;ELC ;;; Compiled ;;; in Emacs version 26.3 ;;; with all optimizations. ;;; This file contains utf-8 non-ASCII characters, ;;; and so cannot be loaded into Emacs 22 or earlier. (and (boundp 'emacs-version) (< (aref emacs-version (1- (length emacs-version))) ?A) (string-lessp emacs-version "23") (error "`%s' was compiled for Emacs 23 or later" #$)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301!\210\300\302!\210\303\304\305\306\307\310\311\312&\207" [require avy posframe custom-declare-group frog-menu nil "Quickly pick items from ad hoc menus." :group convenience :prefix "frog-menu-"] 8) #@353 Type of menu to use. By default types `avy-posframe' and `avy-side-window' are possible. When using a new menu type, handlers need to be added for `frog-menu-init-handler-alist' `frog-menu-display-handler-alist' `frog-menu-display-option-alist' `frog-menu-query-handler-alist' and optionally to `frog-menu-cleanup-handler-alist'. (defvar frog-menu-type nil (#$ . 628)) (byte-code "\300\301\302\303\304DD\305\306\303%\210\300\307\302\303\310DD\311\306\312%\210\300\313\302\303\314DD\315\306\316%\210\300\317\302\303\320DD\321\306\322%\210\300\323\302\303\324DD\325\306\326%\210\300\327\302\303\330DD\331\306\332%\210\300\333\302\303\334DD\335\306\336%\210\300\337\302\303\340DD\341\306\342%\210\300\343\302\303\344DD\345\306\346%\210\300\347\302\303\350DD\351\306\352%\210\300\353\302\303\354DD\355\306\303%\210\300\356\302\303\357DD\360\306\303%\210\300\361\302\303\362DD\363\306\346%\210\300\364\302\303\365DD\366\306\303%\210\300\367\302\303\370DD\371\306\303%\210\300\372\302\303\373DD\374\306\375%\207" [custom-declare-variable frog-menu-type-function funcall function #[0 "\300\207" [frog-menu-type] 1] "Function which should return the variable `frog-menu-type' to be used.\n\nSee variable `frog-menu-type'" :type frog-menu-after-init-hook #[0 "\300\207" [nil] 1] "Frog menu init hook.\n\nRuns after menu buffer is initialized by its init handler. The\nmenu buffer is set current when this hook runs." (repeat function) frog-menu-init-handler-alist #[0 "\300\207" [((avy-posframe . frog-menu-init-display-buffer) (avy-side-window . frog-menu-init-display-buffer))] 1] "Maps variable `frog-menu-type' to an init handler.\n\nThe init handler is called with the prompt, strings formatted by\n`frog-menu-format-strings-function' actions formatted by\n`frog-menu-format-actions-function'. It should initialize the\ndisplay buffer (which is current when called). After init the\nhook `frog-menu-after-init-hook' gets executed." (alist :key-type symbol :value-type function) frog-menu-display-handler-alist #[0 "\300\207" [((avy-posframe . frog-menu-display-posframe) (avy-side-window . frog-menu-display-side-window))] 1] "Maps variable `frog-menu-type' to a display handler.\n\nThe display handler receives the buffer to display as an argument\nand should return the window of the displayed buffer." (alist :key-type symbol :value-type function) frog-menu-display-option-alist #[0 "\300\207" [((avy-posframe . posframe-poshandler-point-bottom-left-corner) (avy-side-window display-buffer-in-side-window (side . bottom)))] 1] "Maps variable `frog-menu-type' to a display option.\n\nThe display option is passed to the display handler as second argument." (alist :key-type symbol :value-type function) frog-menu-query-handler-alist #[0 "\300\207" [((avy-posframe . frog-menu-query-with-avy) (avy-side-window . frog-menu-query-with-avy))] 1] "Maps variable `frog-menu-type' to a query handler.\n\nThe query handler receives four arguments.\n\nThe first is the displayed buffer. The second the window where\nthe buffer is displayed. The last one is the actions argument\npassed to `frog-menu-read'.\n\nThis function should return the chosen string or action return\nvalue. If the user exited the query return nil." (alist :key-type symbol :value-type function) frog-menu-cleanup-handler-alist #[0 "\300\207" [((avy-posframe . frog-menu-posframe-hide) (avy-side-window . frog-menu-side-window-hide))] 1] "Maps variable `frog-menu-type' to a cleanup handler.\n\nThe cleanup handler receives the displayed buffer and the window\nas arguments and is called after the query handler returns or\nexits through an error." (alist :key-type symbol :value-type function) frog-menu-avy-padding #[0 "\300\207" [nil] 1] "If non-nil use padding between avy hints and candidates." boolean frog-menu-posframe-border-width #[0 "\300\207" [1] 1] "Border width to use for the posframe `frog-menu' creates." integer frog-menu-posframe-parameters #[0 "\300\207" [nil] 1] "Explicit frame parameters to be used by the posframe `frog-menu' creates." list frog-menu-format-actions-function #[0 "\300\207" [frog-menu-action-format] 1] "Function used to format the actions passed to `frog-menu-read'." frog-menu-format-strings-function #[0 "\300\207" [frog-menu-grid-format] 1] "Function used to format the strings passed to `frog-menu-read'." frog-menu-min-col-padding #[0 "\300\207" [2] 1] "Minimal padding between columns of grid." frog-menu-grid-width-function #[0 "\300\207" [#[0 " \301=\203\f\302 \303\245\207 \304=\203\302 \305\245\303_\207\302 \207" [frog-menu-type-function avy-posframe frame-width 2 avy-side-window 3] 2]] 1] "Returns the width that should be used for menu grid.\n\nUsed by `frog-menu-grid-format'." frog-menu-grid-column-function #[0 "\300\207" [#[0 " \301\245\207" [frog-menu-grid-width-function 8] 2]] 1] "Returns the number of columns for the menu grid.\n\nLess columns are used automatically if the grid width is not big\nenough to contain that many columns.\n\nUsed by `frog-menu-grid-format' and `frog-menu-action-format'." frog-menu-avy-keys #[0 "\300\301\300\302\"\262\303\300\302\"\262\304\300\302\"\262\301\226\300\302\"\262\303\226\300\302\"\262\304\226\300\302\"\262\305\306\307\"&\207" [append "asdflkjgh" nil "qwerpoiuty" "zxcvmnb" number-sequence 44 64] 10] "Frog menu keys used for `avy-keys'.\n\nBy default uses a large collection of keys, so that the hints can\nbe drawn by single characters." (repeat character)] 6) #@277 A function to sort displayed strings for `frog-menu-read'. If this variable is bound to a function `frog-menu-read' will pass the strings to be displayed and the function to `sort': (let ((frog-menu-sort-function #'string<)) (frog-menu-read "Example" '("z" "a"))) (defvar frog-menu-sort-function nil (#$ . 6108)) #@272 Defines in which order strings for `frog-menu-read' are displayed. If the value is `vertical', strings are ordered vertically. If the value is `horizontal', strings are ordered horizontally. This variable does not define sorting, see `frog-menu-sort-function' for this. (defvar frog-menu-format completions-format (#$ . 6440)) (byte-code "\300\301\302\303#\210\300\304\305\306#\210\300\307\310\311#\210\300\312\313\314#\210\300\315\316\317#\210\300\320\321\322#\207" [custom-declare-face frog-menu-border ((((background dark)) :background "white") (((background light)) :background "black")) "The face defining the border for the posframe." frog-menu-prompt-face ((t (:inherit default))) "Face used for menu promp" frog-menu-candidates-face ((t (:inherit default))) "Face used for menu candidates." frog-menu-actions-face ((t (:inherit default))) "Face used for menu actions." frog-menu-action-keybinding-face ((t (:inherit default))) "Face used for menu action keybindings." frog-menu-posframe-background-face ((t :background "old lace")) "Face used for the background color of the posframe."] 4) #@32 Buffer used for the frog menu. (defvar frog-menu--buffer " *frog-menu-menu*" (#$ . 7545)) #@42 Return variable `frog-menu-type' to use. (defalias 'frog-menu-type #[0 "\300 \203\301\207\302\207" [display-graphic-p avy-posframe avy-side-window] 1 (#$ . 7641)]) #@144 Initialize the menu BUFFER and return it. PROMPT, STRINGS and ACTIONS are the args from `frog-menu-read'. (fn BUFFER PROMPT STRINGS ACTIONS) (defalias 'frog-menu--init-buffer #[1028 "rq\210\304 \210\205!\205 !\n \236A#\210\305\306!\210\266\202)\207" [frog-menu-format-strings-function frog-menu-format-actions-function frog-menu-type frog-menu-init-handler-alist erase-buffer run-hooks frog-menu-after-init-hook] 10 (#$ . 7814)]) #@48 Hide the posframe buffer BUF. (fn BUF WINDOW) (defalias 'frog-menu-posframe-hide #[514 "\300!\207" [posframe-hide] 4 (#$ . 8266)]) #@51 Hide the BUF side window WINDOW. (fn BUF WINDOW) (defalias 'frog-menu-side-window-hide #[514 "\300!\207" [delete-window] 4 (#$ . 8405)]) #@249 Init handler for avy-posframe. PROMPT, FORMATTED-STRINGS and FORMATTED-ACTIONS are the args from `frog-menu-read'. Fills the buffer with a grid of FORMATTED-STRINGS followed by PROMPT and ACTIONS. (fn PROMPT FORMATTED-STRINGS FORMATTED-ACTIONS) (defalias 'frog-menu-init-display-buffer #[771 "\203c\210\211\300\230\262\204#\203\301c\210\302`c\210`\303#\210\304c\210\211\203:\2037\211\300\230\262\2037\301c\210\211c\210eb\207" ["" "\n\n" add-text-properties (face frog-menu-prompt-face) "\n"] 7 (#$ . 8551)]) #@41 Format STRINGS to a grid. (fn STRINGS) (defalias 'frog-menu-grid-format #[257 "\302\303\304\" #\207" [frog-menu-grid-column-function frog-menu-grid-width-function frog-menu--grid-format mapcar #[257 "\302\303\304\305 \306=\203\307\310\311\312#\202\307\313!D# \203 \314\202!\315Q\207" [frog-menu-type-function frog-menu-avy-padding propertize "_" face :foreground avy-posframe face-background frog-menu-posframe-background-face nil t default " " ""] 9 "\n\n(fn STR)"]] 5 (#$ . 9085)]) #@48 Format ACTIONS for menu display. (fn ACTIONS) (defalias 'frog-menu-action-format #[257 "\211\205p\302\303!r\211q\210\304\305\306\307\310!\311\"\312$\216`\211\203C\211@\313`@c\210`\314#\210\313`\315\316\317\315A@#\317\261\210`\320#\210A\266\202\202\210\321c\210 T\322`\"\210\323`\324\325\211\326&\210\327\315\330#\203i\331\317!\210\202Z)\210\332 *\262\207" [frog-menu-grid-width-function fill-column generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205 \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 add-text-properties (face frog-menu-action-keybinding-face) "_" replace-regexp-in-string " " (face frog-menu-actions-face) "\n" fill-region align-regexp "\\(\\s-*\\) " 1 nil re-search-backward t replace-match buffer-string] 12 (#$ . 9588)]) #@282 Return grid string built with STRINGS. The grid will be segmented into columns. COLS is the maximum number of columns to use. The columns have WIDTH space in horizontal direction which default to frame width. Returns the formatted grid string. (fn STRINGS COLS &optional WIDTH) (defalias 'frog-menu--grid-format #[770 "\302\303!r\211q\210\304\305\306\307\310!\311\"\312$\216\313\314\315\316\"\"\206!\317 \320\\\245^]\245\305\321 G\245\305 \211\203\211@\316! \322=\203\257V\203[\323Zy\210\305\262\\\262\305V\203\217\324\210iV\203m\203v\325c\210\202e\320y\210\324\210\202e\326c\210\327`S`\330\331\332\fED#\210\333`c\210`\334#\210\305V\203\245\324y\210\202\250\325c\210T\262\202\204\353 ]\\W\204\306\211\305U\203\333\325\305U\203\321\325\202\322\335\261\210\305\262\202\353\326c\210\327`S`\330\331\332\fED#\210\211\305U\262\333`c\210`\336#\210\337 \"_\\\262\210A\266\202\2027\210\340 \266\210*\207" [frog-menu-min-col-padding frog-menu-format generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205 \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 apply max mapcar string-width frame-width 1 t vertical -1 nil "\n" " " set-text-properties display space :align-to add-text-properties (face frog-menu-candidates-face) "" (face frog-menu-candidates-face) ceiling buffer-string] 22 (#$ . 10377)]) #@181 Display posframe showing buffer BUF. If given, DISPLAY-OPTION is passed as :poshandler to `posframe-show'. Returns window of displayed buffer. (fn BUF &optional DISPLAY-OPTION) (defalias 'frog-menu-display-posframe #[513 "\302\303\206\304\305\306\307\310\311\"\312 & \210\313\314\315\316\"\317\320$\210\321\315\316\"!\207" [frog-menu-posframe-border-width frog-menu-posframe-parameters posframe-show :poshandler posframe-poshandler-point-bottom-left-corner :internal-border-width :background-color face-attribute frog-menu-posframe-background-face :background :override-parameters set-face-attribute internal-border buffer-local-value posframe--frame :inherit frog-menu-border frame-selected-window] 12 (#$ . 11772)]) #@185 Display posframe showing buffer BUF. If given DISPLAY-OPTION is passed as action argument to `display-buffer'. Returns window of displayed buffer. (fn BUF &optional DISPLAY-OPTION) (defalias 'frog-menu-display-side-window #[513 "\306\206\307\"\211\310!r\311\312\313\314\315!\316\"\317$\216\320@\321\"\210rq\210\322\312\"\210\323\324\"\210\325\326\324#\210\324\327\211\327\211\324\327\330\327\211\331#\210*eb\210+\210\207" [window-size-fixed cursor-type display-line-numbers show-trailing-whitespace mode-line-format window-resize-pixelwise display-buffer (display-buffer-in-side-window (side . bottom)) internal--before-with-selected-window make-byte-code 0 "\301\300!\207" vconcat vector [internal--after-with-selected-window] 2 select-window norecord set-window-hscroll set-window-dedicated-p t set-window-parameter no-other-window nil fit-window-to-buffer 1] 12 (#$ . 12507)]) #@360 Return candidates to be passed to `avy--process'. B is the buffer of the candidates and defaults to the current one. W is the window where the candidates can be found and defaults to the currently selected one. START and END are the buffer positions containing the candidates and default to ‘point-min’ and ‘point-max’. (fn &optional B W START END) (defalias 'frog-menu--get-avy-candidates #[1024 "\206\300 \206 p\301rq\210\206e\206d\212\214}\210eb\210\302`\303\"\304=\2033`BB\262\305`\303\"\206;db\210`dW\203f\306\307!\204Y\302`\303\"\304=\203Y`BB\262\305`\303\"\206adb\210\202=*\266)\211\237\207" [selected-window nil get-char-property face frog-menu-candidates-face next-single-property-change looking-at "[[:blank:] \n]\\|\\'"] 12 (#$ . 13415)]) #@57 Internal keymap saving the actions for the avy handler. (defvar frog-menu--avy-action-map nil (#$ . 14209)) #@42 Execute menu action for CHAR. (fn CHAR) (defalias 'frog-menu--posframe-ace-handler #[257 "\211\301>\203 \302\303\304\"\207\305!\203\306\307\310D\"\207\311\312\313!!!\314\"\315!\2031\302\303C\"\2029\316\317!\210\302\303\320\"\207" [frog-menu--avy-action-map (27 7) throw done exit mouse-event-p signal user-error "Mouse event not handled" kbd key-description vector lookup-key functionp message "No such candidate, hit `C-g' to quit." restart] 6 (#$ . 14323)]) #@175 Initialize `frog-menu--action-map'. Each action of ACTIONS is bound to a command which returns the action result. ACTIONS is the argument of `frog-menu-read'. (fn ACTIONS) (defalias 'frog-menu--init-avy-action-map #[257 "\301 \211\211\203%\211@\302\303@!\304\305\306\307\310!\311\"\312$#\210A\266\202\202\210\302\313\314#\207" [frog-menu--avy-action-map make-sparse-keymap define-key kbd make-byte-code 0 "\300AA@\207" vconcat vector [] 1 " " frog-menu--complete] 12 (#$ . 14803)]) #@172 Query handler for avy-posframe. Uses `avy' to query for candidates in BUFFER showing in WINDOW. ACTIONS is the argument of `frog-menu-read'. (fn BUFFER WINDOW ACTIONS) (defalias 'frog-menu-query-with-avy #[771 "\306\"\307!\210\211\203v?\310\311\312\313%\314&\315!r\316\317\320\321\322!\323\"\324$\216\325@\326\"\210\327\330%!\"*\262\331!\203]rq\210\211\332\333\"\206Pd\334\335\336{#\266\202)\202o\211\337=\203g\211\202o\340!\205o\211 .\262\202\224\312\211\204\220\341'\322\342 !\"\211\262\204w\343\344!\210\202w\211 \262\207" [frog-menu-avy-keys avy-keys avy-single-candidate-jump avy-handler-function avy-pre-action avy-all-windows frog-menu--get-avy-candidates frog-menu--init-avy-action-map frog-menu--posframe-ace-handler ignore nil at-full identity internal--before-with-selected-window make-byte-code 0 "\301\300!\207" vconcat vector [internal--after-with-selected-window] 2 select-window norecord avy--process avy--style-fn number-or-marker-p next-single-property-change face replace-regexp-in-string "\\`_ *" "" frog-menu--complete functionp lookup-key read-char message "No such action, hit C-g to quit." avy-style avy-action frog-menu--avy-action-map] 12 (#$ . 15304)]) #@189 PROMPT for `completing-read' COLLECTION. Remaining ARGS are passed to `completing-read'. PROMPT and COLLECTION are the arguments from `frog-menu-read'. (fn PROMPT COLLECTION &rest ARGS) (defalias 'frog-menu--complete #[642 "\300\301\211\302\230\262\203\303\202\304\305\303#$\207" [apply completing-read "" ": " replace-regexp-in-string "\\(: ?\\)?\\'"] 9 (#$ . 16534)]) #@169 Can be used as `completing-read-function'. PROMPT, COLLECTION and PREDICATE are of format as specified by `completing-read'. (fn PROMPT COLLECTION PREDICATE &rest _) (defalias 'frog-menu-completing-read-function #[899 "\300\"\301\"\207" [frog-menu--collection-to-strings frog-menu-read] 8 (#$ . 16923)]) #@215 Read a command from CMDS and execute it. CMDS is of format as specified by `completing-read' collections. If PROMPT is given it should be a string with prompt information for the user. (fn CMDS &optional PROMPT) (defalias 'frog-menu-call #[513 "\300\301\206\302\303!\"!\304!\207" [intern-soft frog-menu-read "" frog-menu--collection-to-strings command-execute] 7 (#$ . 17240)]) #@169 Return list of strings representing COLLECTION. COLLECTION and PREDICATE should have the format as specified by `completing-read'. (fn COLLECTION &optional PREDICATE) (defalias 'frog-menu--collection-to-strings #[513 "\300!\203\301\302#\211\242;\203\303!\202\304\305\"\207<\203V\306\211\203Q\211@\2033!\204J\211\242\2069\211\2119\203D\305!\202E\211B\262\210A\266\202\202#\237\262\207\307!\203u\306C\310\311\312\313\314\315\"\316\"\317\320%\"\210\211\242\237\207\321!\205\224\306C\322\311\323\324\314\315\"\325\"\326\327%!\210\211\242\237\262\207" [functionp "" t copy-sequence mapcar symbol-name nil hash-table-p maphash make-byte-code 514 "\300\205\300\"?\205\3019\203\302!\202\301\242B\240\207" vconcat vector [symbol-name] 5 "\n\n(fn KEY VAL)" vectorp mapatoms 257 "\300\205\300!?\205\301\302!\301\242B\240\207" [symbol-name] 4 "\n\n(fn EL)"] 11 (#$ . 17632)]) #@852 Read from a menu of variable `frog-menu-type'. PROMPT is a string with prompt information for the user. COLLECTION is a list from which the user can choose an item. It can be a list of strings or an alist mapping strings to return values. Users can switch to `completing-read' from COLLECTION using the TAB key. For sorting the displayed strings see `frog-menu-sort-function'. ACTIONS is an additional list of actions that can be given to let the user choose an action instead an item from COLLECTION. Each ACTION is a list of the form: (KEY DESCRIPTION RETURN) Where KEY is a string to be interpreted as spelled-out keystrokes, using the same format as for `kbd'. DESCRIPTION is a string to be displayed along with KEY to describe the action. RETURN will be the returned value if KEY is pressed. (fn PROMPT COLLECTION &optional ACTIONS) (defalias 'frog-menu-read #[770 " \205@:\205\306\211\203\307\"\202\n\203%\310\n\"\202&\211\311\312 !$ \f\236A \236A\" \236A \236A\313\314\315\316\317\320  #\321\"\322$\216 #\262)\211\323=\203p\323  \"\262 \306=\203\200\324 \"A\202\201\211)\207" [frog-menu-type-function frog-menu-type frog-menu-sort-function frog-menu--buffer frog-menu-display-handler-alist frog-menu-display-option-alist car mapcar sort frog-menu--init-buffer get-buffer-create nil make-byte-code 0 "\302\205\302\300\301\"\207" vconcat vector [] 3 frog-menu--complete assoc frog-menu-query-handler-alist frog-menu-cleanup-handler-alist] 21 (#$ . 18567)]) (provide 'frog-menu)