mirror of https://github.com/Chizi123/.emacs.d.git

Chizi123
2018-11-18 8f6f2705a38e2515b6c57fda12c5be29fb9a798f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
;ELC
;;; Compiled
;;; in Emacs version 26.1
;;; with all optimizations.
 
;;; This file uses dynamic docstrings, first added in Emacs 19.29.
 
;;; This file does not contain utf-8 non-ASCII characters,
;;; and so can be loaded in Emacs versions earlier than 23.
 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
(byte-code "\300\301!\210\300\302!\210\300\303!\210\304\305\306\307\310\311\312\313&\210\314\315\306\316\317\320\310\305&\210\314\321\322\323\317\324\310\305&\210\314\325\326\327\317\324\310\305&\210\314\330\331\332\317\333\310\305&\210\314\334\306\335\317\336\310\305&\210\314\337\306\340\317\341\310\305&\210\314\342\343\344\317\345\310\305&\210\314\346\347\350\317\324\310\305&\210\314\351\306\352\317\341\310\305&\210\353\354\355\356\310\305%\210\353\357\360\361\310\305%\210\353\362\363\364\310\305%\207" [require dash popwin s custom-declare-group guide-key nil "Guide key bidings." :group help :prefix "guide-key/" custom-declare-variable guide-key/guide-key-sequence "*Key sequences to guide in `guide-key-mode'.\nThis variable is a list of string representation.\nBoth representations, like \"C-x r\" and \"\\C-xr\",\nare allowed.\n\nIn addition, an element of this list can be a list whose car is\nthe symbol for a certain mode, and whose cdr is a list of key\nsequences to consider only if that mode is active.\n\nSet this variable to `t' to enable for any key sequence." :type (repeat (choice (string :tag "Prefix key sequence") (cons :tag "Mode specific sequence" (symbol :tag "Symbol for mode") (repeat (string :tag "Prefix key sequence"))))) guide-key/polling-time 0.1 "*Polling time to check an input key sequence." float guide-key/idle-delay 1.0 "*Delay in seconds before guide buffer is displayed." guide-key/highlight-prefix-regexp "prefix" "*Regexp for prefix commands." regexp guide-key/highlight-command-regexp "*Regexp for commands to highlight.\nIf a command name matches this regexp, it is highlighted with\n`guide-key/highlight-command-face'.\n\nThis variable can be a list and its element is either a regexp or\na cons cell, its car is a regexp and its cdr is face symbol or\ncolor name string.  If regexp, commands which match the regexp\nare highlighted with `guide-key/highlight-command-face'.  If cons\ncell, commands which match the car regexp are highlighted with\nthe cdr face or color." (choice (regexp :tag "Regexp to highlight") (repeat (choice (regexp :tag "Regexp to highlight") (cons (regexp :tag "Regexp to highlight") (choice (face :tag "Face on command") (string :tag "Color name string")))))) guide-key/align-command-by-space-flag "*If non-nil, align guide buffer by space." boolean guide-key/popup-window-position 'right "*Position where guide buffer is popped up.\nThis variable must be one of `right', `bottom', `left' and `top'." (radio (const right) (const bottom) (const left) (const top)) guide-key/text-scale-amount 0 "*Amount of scaling text in guide buffer.\n\nIf positive number, the text becomes larger.  If negative number,\nthe text becomes smaller.  Scale of the text is detemined by the\nvalue of variable `text-scale-mode-step'." guide-key/recursive-key-sequence-flag "*If non-nil, check an input key sequence recursively.\nFor example, if `guide-key/guide-key-sequence' includes \"C-x\",\nguide buffer is popped up when you input \"C-x r\", \"C-x 4\" and\nany other prefixes following \"C-x\"." custom-declare-face guide-key/prefix-command-face ((((class color) (background dark)) (:foreground "cyan")) (((class color) (background light)) (:foreground "blue"))) "Face for prefix commands to highlight" guide-key/highlight-command-face ((((class color) (background dark)) (:foreground "yellow")) (((class color) (background light)) (:foreground "orange red"))) "Face for commands to highlight" guide-key/key-face ((((class color) (background dark)) (:foreground "red")) (((class color) (background light)) (:foreground "dark green"))) "Face for keys following to a key sequence"] 8)
#@47 Polling timer to check an input key sequence.
(defvar guide-key/polling-timer nil (#$ . 4062))
#@52 Idle timer to wait before popping up guide buffer.
(defvar guide-key/idle-timer nil (#$ . 4163))
#@30 Buffer name of guide buffer.
(defvar guide-key/guide-buffer-name " *guide-key*" (#$ . 4266))
#@51 Key sequence input at the last polling operation.
(defvar guide-key/last-key-sequence-vector nil (#$ . 4365))
#@263 Non-nil if Guide-Key mode is enabled.
See the `guide-key-mode' command
for a description of this minor mode.
Setting this variable directly does not take effect;
either customize it (see the info node `Easy Customization')
or call the function `guide-key-mode'.
(custom-declare-variable 'guide-key-mode nil '(#$ . 4482) :set 'custom-set-minor-mode :initialize 'custom-initialize-default :group 'guide-key :type 'boolean)
#@210 Toggle guide key mode.
 
In guide key mode, Guide following keys to an input key sequence
automatically and dynamically.
With a prefix argument ARG, enable guide key mode if ARG is
positive, otherwise disable.
(defalias 'guide-key-mode #[(&optional arg) "\304 \305\302    \306=\203\307\302!?\202\310    !\311V\"\210\n\203!\312\202\"\313 \210\314\315\307\302!\2030\316\2021\317\"\210\320\321!\203\\\322\302!\210\304 \203I\304 \232\203\\\323\324\325\307\302!\203W\326\202X\327 #\210))\330 \210\307\302!\207" [#1=#:last-message arg guide-key-mode local current-message set-default toggle default-value prefix-numeric-value 0 guide-key/turn-on-timer guide-key/turn-off-timer run-hooks guide-key-mode-hook guide-key-mode-on-hook guide-key-mode-off-hook called-interactively-p any customize-mark-as-set "" message "Guide-Key mode %sabled%s" "en" "dis" force-mode-line-update] 4 (#$ . 4910) (list (or current-prefix-arg 'toggle))])
(defvar guide-key-mode-hook nil)
(byte-code "\301\302N\204\f\303\301\302\304#\210\305\306\307\310\300!\205\311\211%\207" [guide-key-mode-map guide-key-mode-hook variable-documentation put "Hook run after entering or leaving `guide-key-mode'.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it.  (This is true for all hook variables.)" add-minor-mode guide-key-mode " Guide" boundp nil] 6)
#@69 Popup function called after delay of `guide-key/idle-delay' second.
(defalias 'guide-key/popup-function #[(&optional input) "\206\306     p\307r\310!q\210\204\311\203$\312\312\313!\210\314 \210\315 \"\210\316 \n\"\307V\205B\317 \210\320 -\207" [input guide-key/highlight-command-regexp regexp key-seq max-width dsc-buf this-single-command-keys 0 get-buffer-create t nil text-scale-set erase-buffer describe-buffer-bindings guide-key/format-guide-buffer guide-key/close-guide-buffer guide-key/popup-guide-buffer guide-key/guide-buffer-name truncate-lines indent-tabs-mode mode-line-format guide-key/text-scale-amount] 3 (#$ . 6278)])
#@66 Polling function executed every `guide-key/polling-time' second.
(defalias 'guide-key/polling-function #[nil "\302 \303!\203\304!\203\305 \210\202\306 \210\211)\207" [key-seq guide-key/last-key-sequence-vector this-single-command-keys guide-key/popup-guide-buffer-p guide-key/update-guide-buffer-p guide-key/turn-on-idle-timer guide-key/close-guide-buffer] 2 (#$ . 6940)])
#@59 Pop up guide buffer at `guide-key/popup-window-position'.
(defalias 'guide-key/popup-guide-buffer #[nil "\304\305\306\n!\307 \310\311\312 !\203\313\314\315!D\202#\316 !\205#\317\314 D&\210    \211)\207" [popwin:popup-last-config last-config guide-key/guide-buffer-name guide-key/popup-window-position apply popwin:popup-buffer get-buffer :position :noselect t popwin:position-horizontal-p :width guide-key/popup-window-size horizontal popwin:position-vertical-p :height] 10 (#$ . 7330)])
#@209 Return an enough height or width of popup window to display
all key bindings in guide buffer.
 
If HORIZONTAL is omitted or nil, return the height of popup
window.  Otherwise, return the width of popup window
(defalias 'guide-key/popup-window-size #[(&optional horizontal) "r\306!q\210    \203\307\202\310\311\n \"    \203$\312\f\313  \\_!\202.\312\f\314ed\" \\_!+\207" [guide-key/guide-buffer-name horizontal text-scale-mode-step text-scale-mode-amount scale margin get-buffer 5 1 expt ceiling guide-key/buffer-max-width count-lines] 5 (#$ . 7830)])
#@21 Close guide buffer.
(defalias 'guide-key/close-guide-buffer #[nil "\302    !=\203 \303 \210\304 \207" [popwin:popup-buffer guide-key/guide-buffer-name get-buffer popwin:close-popup-window guide-key/turn-off-idle-timer] 3 (#$ . 8389)])
(add-hook 'pre-command-hook 'guide-key/close-guide-buffer)
#@45 Return t if guide buffer should be updated.
(defalias 'guide-key/update-guide-buffer-p #[(key-seq) "    \232?\207" [guide-key/last-key-sequence-vector key-seq] 2 (#$ . 8688)])
#@47 Return t if guide buffer should be popped up.
(defalias 'guide-key/popup-guide-buffer-p #[(key-seq) "G\303V\205    \304=\206\305 \235\206\n\205\306\307!!\207" [key-seq guide-key/guide-key-sequence guide-key/recursive-key-sequence-flag 0 t guide-key/buffer-key-sequences guide-key/popup-guide-buffer-p guide-key/vbutlast] 3 (#$ . 8868)])
#@75 Return a list of key sequences (vector representation) in current buffer.
(defalias 'guide-key/buffer-key-sequences #[nil "\306    \306\211\203 @\211;\203\nB A\211\204\n*\307\310\f    \"\" \306\f\211\203P @\f\311\f!\203I\fJ\203I\307\310\f    \"\" A\211\204/*\312\313\")\207" [lst guide-key/guide-key-sequence ks --dolist-tail-- major-mode minor-mode-list nil append assoc-default boundp mapcar guide-key/convert-key-sequence-to-vector mmode] 5 (#$ . 9219)])
#@63 Return a copy of vector VEC with the last N elements removed.
(defalias 'guide-key/vbutlast #[(vec &optional n) "\302\303\304\305\"    \"!\207" [vec n vconcat butlast append nil] 5 (#$ . 9702)])
#@120 Convert key sequence KEY-SEQ to vector representation.
For example, both "C-x r" and "\C-xr" are converted to [24 114]
(defalias 'guide-key/convert-key-sequence-to-vector #[(key-seq) "\301\302!!\207" [key-seq vconcat read-kbd-macro] 3 (#$ . 9902)])
#@52 Turn on an idle timer for popping up guide buffer.
(defalias 'guide-key/turn-on-idle-timer #[nil "?\205\f\302    \303\304#\211\207" [guide-key/idle-timer guide-key/idle-delay run-with-idle-timer t guide-key/popup-function] 4 (#$ . 10158)])
#@26 Turn off the idle timer.
(defalias 'guide-key/turn-off-idle-timer #[nil "\203\301!\210\302\211\207" [guide-key/idle-timer cancel-timer nil] 2 (#$ . 10404)])
#@26 Turn on a polling timer.
(defalias 'guide-key/turn-on-timer #[nil "?\205\f\302\303    \304#\211\207" [guide-key/polling-timer guide-key/polling-time run-at-time t guide-key/polling-function] 4 (#$ . 10572)])
#@27 Turn off a polling timer.
(defalias 'guide-key/turn-off-timer #[nil "\301!\210\302\211\207" [guide-key/polling-timer cancel-timer nil] 2 (#$ . 10786)])
#@74 Format guide buffer. This function returns the number of following keys.
(defalias 'guide-key/format-guide-buffer #[(key-seq &optional regexp) "\306\211\307\310!\311ed\"\210eb\210\312\313\314\315    !\"\306\316#\203?\317\320!\317\321!\317\322!E\211\f\235\2035\f\210\202;\323\f C\")\202\324 \210\fG\211\307V\203\247\f\306\211\306\211\306:\203\226@\211\211A\242\211A\242@\325$BA\211\202_\237.\326 \327!\"\210eb\210\n,\207" [key-seq key-dsc fkey-list-len fkey-str-list fkey-list #1=#:x nil 0 key-description untabify re-search-forward format "^%s \\([^     ]+\\)\\([     ]+\\)\\(\\(?:[^     \n]+ ?\\)+\\)$" regexp-quote t match-string 1 2 3 append erase-buffer guide-key/fontified-string guide-key/insert-following-key popwin:position-horizontal-p #2=#:--cl-var-- key space command #3=#:--cl-var-- #4=#:--cl-var-- regexp guide-key/popup-window-position] 6 (#$ . 10946)])
#@196 Insert a few following keys per line.
 
If HORIZONTAL is omitted or nil, assume that guide buffer is
popped up at top or bottom. Otherwise, assume that guide buffer
is popped up at left or right.
(defalias 'guide-key/insert-following-key #[(fkey-str-list horizontal) "\306    \" \203*\307\fG\n_\310\311  \203\312\202\313\203#\314\202$\313#\245!\2028\315\316 \317\320\321\322\f\"\"\n_\245!\f\323\314:\203o@\211\324\"\313U\203^\325\202_\326\261\210AT\202C+\327ed\330\314\211\331&*\207" [text-scale-mode-step text-scale-mode-amount scale horizontal fkey-str-list tool-bar-mode expt ceiling - frame-height 2 0 1 floor frame-width apply max mapcar length nil mod "\n" " " align-regexp "\\(\\s-*\\) \\[" t menu-bar-mode columns #1=#:--cl-var-- fkey-str column] 8 (#$ . 11879)])
#@42 Return fontified string of following key
(defalias 'guide-key/fontified-string #[(key space command &optional regexp) "\306    \"\307\310\311\312#\n\203\307 \311\n#\202 \307\313\311\312#\f\203$ \202%\314\n\2031\307\311\n#\2022\260)\207" [command regexp highlight-face key guide-key/align-command-by-space-flag space guide-key/get-highlight-face propertize "[" face guide-key/key-face "]" " "] 8 (#$ . 12697)])
#@191 Return an appropriate face for highlighting STRING according
to `guide-key/highlight-prefix-regexp' and
`guide-key/highlight-command-regexp'. Return nil if an
appropriate face is not found.
(defalias 'guide-key/get-highlight-face #[(string &optional regexp) "\206    \306\n \"\203\307\202\204;\203!\306 \"\205\204\310\202\204<\205\204\311\312\f\311 \f:\203\201\f@\211;\203H\306 \"\205d\310\202d :\205d\306 @ \"\205d A;\203b\313 AD\202d A\211\203u \311\211\f\202v\312)\203\201\fA\211\2021 ,)\207" [regexp guide-key/highlight-command-regexp guide-key/highlight-prefix-regexp string #1=#:--cl-var-- elm string-match guide-key/prefix-command-face guide-key/highlight-command-face nil t :foreground #2=#:--cl-var-- #3=#:--cl-var-- it] 4 (#$ . 13124)])
#@37 Return max width in current buffer.
(defalias 'guide-key/buffer-max-width #[nil "\301ed\"\302\303\304\305\306\307\"\"\")\207" [buf-str buffer-substring-no-properties apply max mapcar length split-string "\n"] 7 (#$ . 13915)])
(defalias 'guide-key/add-local-guide-key-sequence #[(key) "\301\302\303!\"\207" [key add-to-list make-local-variable guide-key/guide-key-sequence] 3])
(defalias 'guide-key/add-local-highlight-command-regexp #[(regexp) "\302\300!\210;\203    D\211\207<\205!    \235\203\207    B\211\207" [guide-key/highlight-command-regexp regexp make-local-variable] 2])
(byte-code "\300\301\302\303\304$\210\300\305\306\303\304$\207" [ad-add-advice this-command-keys (key-chord-hack nil nil (advice lambda nil "Add key chord to the key sequence returned by `this-command-keys'.\n\nOriginal `this-command-keys' returns \"[key-chord]\" when you\ntype any of key chords, so it is difficult to know which key\nchord is pressed.  This advice enables to distinguish pressed key\nchord." (condition-case nil (if (equal ad-return-value [key-chord]) (let ((rkeys (recent-keys))) (setq ad-return-value (vector 'key-chord (aref rkeys (- (length rkeys) 2)) (aref rkeys (- (length rkeys) 1)))))) (error "")))) after nil this-command-keys-vector (key-chord-hack nil nil (advice lambda nil "Add key chord to the key sequence returned by `this-command-keys-vector'.\n\nOriginal `this-command-keys-vector' returns \"[key-chord]\" when you\ntype any of key chords, so it is difficult to know which key\nchord is pressed.  This advice enables to distinguish pressed key\nchord." (condition-case nil (if (equal ad-return-value [key-chord]) (let ((rkeys (recent-keys))) (setq ad-return-value (vector 'key-chord (aref rkeys (- (length rkeys) 2)) (aref rkeys (- (length rkeys) 1)))))) (error []))))] 5)
#@156 Turn on key-chord hack of guide-key.
 
This hack *may be dangerous* because it advices primitive
functions; this-command-keys and this-command-keys-vector.
(defalias 'guide-key/key-chord-hack-on #[nil "\302\303\211\203    @\304\305\306#\210\307!\210    A\211\204*\310\311!\207" [fn --dolist-tail-- (this-command-keys this-command-keys-vector) nil ad-enable-advice after key-chord-hack ad-activate message "Turn on key-chord hack of guide-key"] 5 (#$ . 15720) nil])
#@39 Turn off key-chord hack of guide-key.
(defalias 'guide-key/key-chord-hack-off #[nil "\302\303\211\203    @\304\305\306#\210\307!\210    A\211\204*\310\311!\207" [fn --dolist-tail-- (this-command-keys this-command-keys-vector) nil ad-disable-advice after key-chord-hack ad-activate message "Turn off key-chord hack of guide-key"] 5 (#$ . 16194) nil])
#@2 
(defalias 'guide-key/message-events #[nil "\303\304\305\306 \307 \310     \n&!\207" [last-command-event last-input-event unread-command-events message format "lce:%S tck:%S tckv:%S tsck:%S lie:%S uce:%S" this-command-keys this-command-keys-vector this-single-command-keys] 9 (#$ . 16553)])
(provide 'guide-key)