;ELC ;;; compiled by kwzh@hal.gnu.ai.mit.edu on Thu Jun 8 20:41:40 1995 ;;; from file /gd/gnu/emacs/19.0/lisp/viper-macs.el ;;; emacs version 19.28.93.6. ;;; 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 (#$ . 740)) #@68 Vector of keys representing the name of last Viper keyboard macro. (defvar vip-last-kbd-macro nil (#$ . 864)) #@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 (#$ . -981)) #@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 1 or 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 f1) (#$ . 1225)) (defalias 'ex-map #[nil "Nj!@ 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!@\fA\"@" [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 " 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-event 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 \n \f !GV \"!ٝ\\!]\"ݝvGZ#ߝGS# GV!!#  # GV!!#  ! \n\n! \"!ł\n!HGU!՜> !@!. " [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 " 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-event 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@@88 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 (#$ . 4889) 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!=<;<9< \"!!!\";낲% % .\"!!!\";% .%.!!\";% $3!\"!7! %3\"!=NBEq9aBCBEq;qBCBEB!\"\nH!!#!@@!!@BA!B\"L=@89A8\";A@\"<9(AABA8B<;<ABA@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)" 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 (#$ . 5891)]) #@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\"8AAA! #!! $\fAA!!#!! !$\f8A! #\f! $AHAHAH!\"LH!\"H\nH!!#." [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 (#$ . 8070)]) (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@\"A8\"A8A@ !#\" @$!)!&#&!!!!!.\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 (#$ . 9793) "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 (#$ . 10820) 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) "@AGU$\"\"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‰!