;ELC   
;;; compiled by rms@mole.gnu.ai.mit.edu on Mon Oct 30 13:33:52 1995
;;; from file /home/fsf/rms/e19/lisp/viper-macs.el
;;; emacs version 19.29.1.2.
;;; bytecomp version FSF 2.10
;;; optimization is on.
;;; this file uses opcodes which do not exist in Emacs 18.

(if (and (boundp 'emacs-version)
	 (or (and (boundp 'epoch::version) epoch::version)
	     (string-lessp emacs-version "19.28.90")))
    (error "`viper-macs.el' was compiled for Emacs 19.29 or later"))


(byte-code "!!\f B! B!& B!3 B!@ 	Bć" [require viper-util boundp vip-last-macro-reg nil current-load-list vip-vi-kbd-macro-alist vip-insert-kbd-macro-alist vip-emacs-kbd-macro-alist vip-kbd-macro-parameters] 2)
#@76 Vector of keys representing the name of currently running Viper kbd macro.
(defvar vip-this-kbd-macro nil (#$ . 738))
#@68 Vector of keys representing the name of last Viper keyboard macro.
(defvar vip-last-kbd-macro nil (#$ . 862))
#@187 *Key sequence separated by no more than this many milliseconds is viewed as a macro, if such a macro is defined.
This also controls ESC-keysequences generated by keyboard function keys.
(defconst vip-fast-keyseq-timeout 200 (#$ . -979))
#@360 Prefix key for invocation of vip-repeat-from-history function,
which repeats previous destructive commands from the history of such
commands.
This function can then be invoked as <this-key> 1 or <this-key> 2.
The notation for these keys is borrowed from XEmacs. Basically,
a key is a symbol, e.g., `a', `\1', `f2', etc., or a list, e.g.,
`(meta control f1)'.
(defvar vip-repeat-from-history-key (quote f12) (#$ . 1223))
(defalias 'ex-map #[nil "ǋ!@A\n\fF	\f+ !e !#!\n=  !###!\nc قd #-" ["" nil ins map-args macro-body macro-name mod-char ((byte-code "q! u" [vip-ex-work-buf looking-at "!" t ins mod-char 1] 2)) ex-map-read-args vip-kbd-macro-parameters vip-end-mapping-kbd-macro ignore ex-fixup-history format "map%s %S" vip-display-macro vip-change-state-to-insert start-kbd-macro define-key vip-vi-intercept-map ")" vip-insert-intercept-map vip-emacs-intercept-map message "Mapping %S in %s state. Hit `C-x )' to complete the mapping" "Insert" "Vi"] 7])
(defalias 'ex-unmap #[nil "Ƌ!!!\f!#!\n) ς* \"," ["" nil ins macro-name temp mod-char ((byte-code "q! u" [vip-ex-work-buf looking-at "!" t ins mod-char 1] 2)) ex-unmap-read-args vip-fixup-macro vconcat ex-fixup-history format "unmap%s %S" vip-display-macro vip-unrecord-kbd-macro insert-state vi-state] 6])
(defalias 'ex-map-read-args #[(variant) "	\n͏< ! ;3 ! !! \"!՝ \n\\ !] \"\n؝s \n\nGZ#\n\nGV \n!! #! ! \"! !H \nGU !!! !\f \f! \f! \f! !!\f.	B" [t [] nil args macro-body macro-name message event key temp key-seq cursor-in-echo-area (byte-code "\"P\f!@\fA\"@" [ex-get-inline-cmd-args ".*map[!]*[ 	]?" "\n" " nil nil " args read-from-string temp macro-name macro-body] 4) ((error (byte-code "\"" [signal error ("map: Macro name and body must be a quoted string or a vector")] 3))) vectorp vconcat prin1-to-string ":map%s <Name>" variant sit-for 2 (13 10 (control m) (control j) return linefeed) vector [] (8 127 (quote ^) 32 (quote ^H) (control h) (control \?) backspace delete) subseq 0 format ":map%s %s" vip-display-macro "" vip-read-key vip-mouse-event-p "%s (No mouse---only keyboard keys, please)" vip-event-key error "Can't map an empty macro name" vip-fixup-macro vip-char-array-p vip-char-array-to-macro "map: Invalid syntax in macro definition"] 10])
(defalias 'ex-unmap-read-args #[(variant) "	 \f \fŉ	\n\f!GV 	\"!ٝ \\ !] \"ݝv GZ# ߝ GS#	GV !! #		#	GV !! #		! \n\n! 	\"!ł \n!H GU !՜>!@!." [t variant "!" vip-insert-kbd-macro-alist vip-vi-kbd-macro-alist nil macro-name key-seq key message event vip-emacs-intercept-minor-mode vip-insert-intercept-minor-mode vip-vi-intercept-minor-mode vip-emacs-kbd-minor-mode vip-insert-kbd-minor-mode vip-vi-kbd-minor-mode macro-alist cursor-in-echo-area ex-get-inline-cmd-args ".*unma?p?[!]*[ 	]*" 0 ":unmap%s <Name>" sit-for 2 (13 10 (control m) (control j) return linefeed) vconcat vector [] (8 127 (quote ^) 32 (quote ^H) (control h) (control \?) backspace delete) subseq (tab (control i) 9) format ":unmap%s %s" prin1-to-string vip-display-macro "" vip-do-sequence-completion vip-read-key vip-mouse-event-p "%s (No mouse---only keyboard keys, please)" vip-event-key error "Can't unmap an empty macro name" (91 34) read-from-string] 14])
#@22 Terminate kbd macro.
(defalias 'vip-end-mapping-kbd-macro #[(&optional ignore) "	#\f##% ! % !A@@88Q !! ] ւ^ !#!!$!," [define-key vip-vi-intercept-map ")" nil vip-insert-intercept-map vip-emacs-intercept-map ignore vip-kbd-macro-parameters defining-kbd-macro error "Not mapping a kbd-macro" 2 3 macro-body macro-name ins mod-char end-kbd-macro vip-events-to-macro last-kbd-macro vip-change-state-to-vi vip-record-kbd-macro insert-state vi-state vip-display-macro ex-fixup-history format "map%s %S %S"] 7 (#$ . 4884) nil])
(byte-code "$\"" [ad-add-advice start-kbd-macro (vip-kbd-advice nil t (advice lambda nil "Remove Viper's intercepting bindings for C-x ).\nThis may be needed if the previous `:map' command terminated abnormally." (define-key vip-vi-intercept-map ")" nil) (define-key vip-insert-intercept-map ")" nil) (define-key vip-emacs-intercept-map ")" nil))) after nil ad-activate-on] 5)
#@495 Record a Vi macro. Can be used in `.vip' file to define permanent macros.
MACRO-NAME is a string of characters or a vector of keys. STATE is
either `vi-state' or `insert-state'. It specifies the Viper state in which to
define the macro. MACRO-BODY is a string that represents the keyboard macro.
Optional SCOPE says whether the macro should be global (t), mode-specific
(a major-mode symbol), or buffer-specific (buffer name, a string).
If SCOPE is nil, the user is asked to specify the scope.
(defalias 'vip-record-kbd-macro #[(macro-name state macro-body &optional scope) "= ǂ( >\" \n˂( GUK !!!^ !!!q !=K;K 9K \"! !!\"; 낲 %	 % .\"! !!\";  %	.%.!!\";%	$3!\"!F!!=\"?%3\"!=]BE9pBCBE;BCBEB!\"\nH!!#!@@!!@BA!@ B\"L=A 89B 8\";A@\"M99AABB 8BM;MABA@B.\n" [nil state-name keymap state vi-state "Vi state" vip-vi-kbd-map vip-vi-kbd-macro-alist (insert-state replace-state) "Insert state" vip-insert-kbd-map vip-insert-kbd-macro-alist "Emacs state" vip-emacs-kbd-map vip-emacs-kbd-macro-alist macro-alist-var new-elt old-elt old-sub-elt msg temp lis lis2 macro-name 0 error "Can't map an empty macro name" vip-fixup-macro vip-char-array-p vip-char-array-to-macro macro-body scope t y-or-n-p format "Map this macro for buffer `%s' only? " buffer-name "%S is mapped to %s for %s in `%s'" vip-display-macro vip-abbreviate-string "%S" 14 "" "  ....\"" "  ....]" "Map this macro for the major mode `%S' only? " major-mode "%S is mapped to %s for %s in `%S'" "%S is globally mapped to %s in %s" "Save this macro in %s? " abbreviate-file-name vip-custom-file-name vip-save-string-in-file "\n(vip-record-kbd-macro %S '%S %s '%S)" vectorp message assoc eval define-key vector vip-key-to-emacs-key vip-exec-mapped-kbd-macro vip-array-to-string reverse append 3 2] 10 (#$ . 5886)])
#@361 Delete macro MACRO-NAME from Viper STATE.
MACRO-NAME must be a vector of vip-style keys. This command is used by Viper
internally, but the user can also use it in ~/.vip to delete pre-defined macros
supplied with Viper. The best way to avoid mistakes in macro names to be passed
to this function is to use vip-describe-kbd-macros and copy the name from
there.
(defalias 'vip-unrecord-kbd-macro #[(macro-name state) "= ǂ( >\" \n˂( !!L !!\"GUb !r !	 $ A@\"!8\"8A A A ! #! !	 $\fA A !!#! !	!$\f8A!	#\f!	 $AHAHAH!\"LH!\"H\nH!!#." [nil state-name keymap state vi-state "Vi state" vip-vi-kbd-map vip-vi-kbd-macro-alist (insert-state replace-state) "Insert state" vip-insert-kbd-map vip-insert-kbd-macro-alist "Emacs state" vip-emacs-kbd-map vip-emacs-kbd-macro-alist macro-alist-var buf-mapping mode-mapping global-mapping macro-pair macro-entry vip-fixup-macro macro-name vip-char-array-p vip-char-array-to-macro assoc eval 0 error "Can't unmap an empty macro name" "%S is not mapped to a macro for %s in `%s'" vip-display-macro buffer-name major-mode 2 3 y-or-n-p format "Unmap %S for `%s' only? " message "%S is unmapped for %s in `%s'" "Unmap %S for the major mode `%S' only? " "%S is unmapped for %s in %S" "Global mapping of %S for %s is removed" delq vip-can-release-key define-key vector vip-key-to-emacs-key] 6 (#$ . 8091)])
(defalias 'vip-can-release-key #[(char macro-alist) "$ \f$ @@H= A\n \f+" [macro-alist t nil macro-name can-release lis char 0] 4])
#@21 Dispatch kbd macro.
(defalias 'vip-exec-mapped-kbd-macro #[(count) "=\n \n > \f \n\f\"!\"\"m @A\"  A@\"A 8\"A 8A  @ !#\" @$!) !& #&!!! ! !.\f" [vip-current-state vi-state vip-vi-kbd-macro-alist (insert-state replace-state) vip-insert-kbd-macro-alist vip-emacs-kbd-macro-alist macro-alist "" unmatched-suffix nil vip-vi-kbd-minor-mode vip-insert-kbd-minor-mode vip-emacs-kbd-minor-mode next-best-match keyseq event-seq macro-first-char macro-alist-elt macro-body command last-command-event vip-read-fast-keysequence vip-events-to-macro assoc vip-find-best-matching-macro subseq buffer-name major-mode 2 3 defining-kbd-macro command-history vip-this-kbd-macro execute-kbd-macro vip-macro-to-events count vip-last-kbd-macro vip-set-unread-command-events prefix-arg key-binding read-key-sequence commandp command-execute beep 1] 4 (#$ . 9814) "P"])
#@41 Show currently defined keyboard macros.
(defalias 'vip-describe-kbd-macros #[nil "!\"!\"!	\"" [" *vip-info*" princ "Macros in Vi state:\n===================\n" mapcar vip-describe-one-macro vip-vi-kbd-macro-alist "\n\nMacros in Insert and Replace states:\n====================================\n" vip-insert-kbd-macro-alist "\n\nMacros in Emacs state:\n======================\n" vip-emacs-kbd-macro-alist] 4 (#$ . 10841) nil])
(defalias 'vip-describe-one-macro #[(macro) "\f@!\"!!\fA@ \fA@\"\" !!\f86 \f8\": !!\f8AR \f8A\"!V !!" [princ format "\n  *** Mappings for %S:\n      ------------\n" vip-display-macro macro "   ** Buffer-specific:" mapcar vip-describe-one-macro-elt "  none\n" "\n   ** Mode-specific:" 2 "\n   ** Global:" 3 "\n           %S" "  none" "\n"] 5])
(defalias 'vip-describe-one-macro-elt #[(elt) "@A\n	#!*" [elt defn name princ format "\n       * %S:\n           %S\n"] 5])
(defalias 'vip-keyseq-is-a-possible-macro #[(seq alist) "	!!\"B!)" [vip-events-to-macro seq converted-seq eval or mapcar #[(elt) "	\n\"" [vip-prefix-subseq-p converted-seq elt] 3] vip-this-buffer-macros alist] 6])
(defalias 'vip-prefix-subseq-p #[(seq1 seq2) "G	G\nX 	#*" [seq1 seq2 len2 len1 subseq 0] 6])
(defalias 'vip-common-seq-prefix #[(&rest seqs) "@AGU $ \"\"WJ \n\"B!A \f	!\"T& \f-" [seqs first rest [] pref 0 idx nil len apply min mapcar length eval and #[(s) "	\n	" [first idx s] 3] vconcat vector] 6])
(defalias 'vip-extract-matching-alist-members #[(pref alist) "!\"\"" [delq nil mapcar #[(elt) "	\n\" \n" [vip-prefix-subseq-p pref elt] 3] vip-this-buffer-macros alist] 6])
(defalias 'vip-do-sequence-completion #[(seq alist compl-message) "	\n\"\"	& GU& \n\"!\\ : \n\"!	\\ 	Q \n\"!!\\ 	\\ !*" [vip-extract-matching-alist-members seq alist matches apply vip-common-seq-prefix new-seq 1 message "%s (Sole completion)" compl-message sit-for 2 "%s (No match)" "%s (Complete, but not unique)" vip-display-vector-completions] 3])
(defalias 'vip-display-vector-completions #[(list) "\"\"!" ["*Completions*" display-completion-list mapcar prin1-to-string vip-display-macro list] 7])
(defalias 'vip-find-best-matching-macro #[(alist str) "\nGÉ	\na \na \n@@G		YY \f@\n	#Y  \fA@\"AW \f8\"AW \f8AY \nA\n o \f	u .B" [alist 0 str nil macro-def found unmatched-start-idx match str-len def-len lis subseq assoc buffer-name major-mode 2 3 t] 8])
(defalias 'vip-this-buffer-macros #[(macro-alist) "\f\"	\")" [nil candidates mapcar #[(elt) " \nA@\"A \n8\"A \n8A \n@" [assoc buffer-name elt major-mode 2 3] 4] macro-alist delq] 3])
(defalias 'vip-display-macro #[(macro-name) "	!\f 	#	! 	#	" [vip-char-symbol-sequence-p macro-name mapconcat symbol-name "" vip-char-array-p char-to-string] 4])
(defalias 'vip-events-to-macro #[(event-seq) "\"!" [vconcat mapcar vip-event-key event-seq] 4])
(defalias 'vip-char-array-to-macro #[(array) "	! \f\" \f\"!*" [vconcat array nil macro vec vip-xemacs-p mapcar character-to-event vip-event-key] 4])
(defalias 'vip-fixup-macro #[(macro) "G! <w Ww w ] \fXp \fXp !I \f\\!!Ip <p \f\\!!p \f<i \f!p \f9p T  \f\" ," [macro 0 nil break elt idx len vectorp 9 arrayp intern char-to-string 48 vip-fixup-macro t error "Wrong type macro component, symbol-or-listp, %S"] 7])
(defalias 'vip-char-array-p #[(array) "\f\"B!" [eval and mapcar numberp array] 5])
(defalias 'vip-macro-to-events #[(macro-body) "\"!" [vconcat mapcar vip-key-to-emacs-key macro-body] 4])
(defalias 'vip-char-symbol-sequence-p #[(vec) "	! 	\"B!" [sequencep vec eval and mapcar #[(elt) "9 !GU" [elt symbol-name 1] 2]] 5])
(defalias 'vip-event-vector-p #[(vec) "	! 	\"B!" [vectorp vec eval and mapcar #[(elt) "! 	9 	N! 	:! 	@9! 	@N)& Ç" [elt obj event-symbol-elements t] 3]] 5])
(defalias 'vip-read-fast-keysequence #[(event macro-alist) "	!	 ˥\"# #*B \f\"B  ! \f!\" \f*" [vector event nil next-event lis vip-fast-keyseq-timeout t nodisp val vip-xemacs-p sit-for 1000.0 0 vip-keyseq-is-a-possible-macro macro-alist vip-read-key vip-mouse-event-p vconcat] 4])
(defalias 'vip-set-register-macro #[(reg) "	! ! !	\"" [get-register reg y-or-n-p "Register contains data. Overwrite? " error "Macro not saved in register. Can still be invoked via `C-x e'" set-register last-kbd-macro] 3])
#@54 Keyboard macros in registers - a modified @ command.
(defalias 'vip-register-macro #[(count) " 	X) 	X) 	  	!~ 	!\n\"~ 	U; 	U; 	UM \fC !\f!\n\"~ 	UZ \n!~ 	Ux  	X~ 	X~ 		!~ 	\"!)" [read-char reg 97 122 vip-last-macro-reg defining-kbd-macro end-kbd-macro vip-set-register-macro execute-kbd-macro get-register count 64 10 13 error "No previous kbd macro" 35 start-kbd-macro 33 format "`%c': Unknown register"] 4 (#$ . 15557) "P"])
#@54 Call last keyboad macro for each line in the region.
(defalias 'vip-global-execute #[nil "`!V  y `!W% yy  " [mark t exchange-point-and-mark 0 call-last-kbd-macro 1] 3 (#$ . 16044)])
(provide (quote viper-macs))
