[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/frog-menu e2307a0 19/43: Add actions face
From: |
Clemens Radermacher |
Subject: |
[elpa] externals/frog-menu e2307a0 19/43: Add actions face |
Date: |
Sun, 24 Mar 2019 05:14:46 -0400 (EDT) |
branch: externals/frog-menu
commit e2307a02740e8316fcb9333420aebf6a6a497575
Author: Clemens Radermacher <address@hidden>
Commit: Clemens Radermacher <address@hidden>
Add actions face
---
frog-menu.el | 54 +++++++++++++++++++++++++++++++++---------------------
1 file changed, 33 insertions(+), 21 deletions(-)
diff --git a/frog-menu.el b/frog-menu.el
index 1539abb..caf732e 100644
--- a/frog-menu.el
+++ b/frog-menu.el
@@ -86,6 +86,12 @@ and optionally to
`frog-menu-cleanup-handler-alist'."
:type 'symbol)
+(defcustom frog-menu-after-init-hook '()
+ "Frog menu init hook.
+
+Runs after menu buffer is initialized by its init handler. The
+menu buffer is set current when this hook runs."
+ :type '(repeat function))
(defcustom frog-menu-init-handler-alist
'((avy-posframe . frog-menu-init-avy-posframe))
@@ -133,21 +139,14 @@ exits through an error."
:type '(alist :key-type symbol
:value-type function))
-(defcustom frog-menu-after-init-hook '()
- "Frog menu init hook.
-
-Runs after menu buffer is initialized by its init handler. The
-menu buffer is set current when this hook runs."
- :type '(repeat function))
+(defcustom frog-menu-format-actions-function #'frog-menu-action-format
+ "Function used to format the actions passed to `frog-menu-read'."
+ :type 'function)
(defcustom frog-menu-format-strings-function #'frog-menu-grid-format
"Function used to format the strings passed to `frog-menu-read'."
:type 'function)
-(defcustom frog-menu-format-actions-function #'frog-menu-action-format
- "Function used to format the actions passed to `frog-menu-read'."
- :type 'function)
-
(defcustom frog-menu-grid-width-function
(lambda () (/ (frame-width) 2))
"Returns the width that should be used for menu grid.
@@ -182,12 +181,16 @@ be drawn by single characters."
(defface frog-menu-border '((((background dark)) . (:background "white"))
(((background light)) . (:background "black")))
- "The border color for the posframe.")
+ "The face defining the border for the posframe.")
-(defface frog-menu-candidate-face
+(defface frog-menu-candidates-face
'((t (:inherit default)))
"Face used for menu candidates.")
+(defface frog-menu-actions-face
+ '((t (:inherit default)))
+ "Face used for menu actions.")
+
(defvar frog-menu--buffer " *frog-menu-menu*"
"Buffer used for the frog menu.")
@@ -253,10 +256,16 @@ ACTIONS."
(with-temp-buffer
(let ((header-pos (point)))
(dolist (action actions)
- (insert (car action)
- "_"
- (replace-regexp-in-string " " "_" (cadr action))
- " "))
+ (add-text-properties
+ (point)
+ (progn
+ (insert (car action)
+ "_"
+ (replace-regexp-in-string " " "_"
+ (cadr action))
+ " ")
+ (point))
+ '(face frog-menu-actions-face)))
(insert "\n")
(let ((fill-column (1+ (funcall frog-menu-grid-width-function))))
(fill-region header-pos (point))
@@ -300,19 +309,18 @@ Returns the buffer containing the formatted grid."
(add-text-properties (point)
(progn (insert str)
(point))
- '(face frog-menu-candidate-face))
+ '(face frog-menu-candidates-face))
(setq column (+ column
(* colwidth (ceiling length colwidth)))))))
(buffer-string))))
-
;; * Display
(defun frog-menu-display-posframe (buf)
"Display posframe showing buffer BUF.
-Returns candidates to be handled by query handler."
+Returns window of displayed buffer."
(posframe-show buf
:poshandler #'posframe-poshandler-point-bottom-left-corner
:internal-border-width 1)
@@ -322,6 +330,7 @@ Returns candidates to be handled by query handler."
(frame-selected-window
(buffer-local-value 'posframe--frame buf)))
+
(defun frog-menu--get-avy-candidates (&optional b w start end)
"Return candidates to be passed to `avy--process'.
@@ -341,14 +350,17 @@ buffer positions containing the candidates and default to
(narrow-to-region start end)
(goto-char (point-min))
(when (eq (get-char-property (point) 'face)
- 'frog-menu-candidate-face)
+ 'frog-menu-candidates-face)
(push (cons (point) w) candidates))
(goto-char
(or (next-single-property-change
(point) 'face)
(point-max)))
(while (< (point) (point-max))
- (unless (looking-at "[[:blank:]\r\n]\\|\\'")
+ (unless (or (looking-at "[[:blank:]\r\n]\\|\\'")
+ (not (eq (get-char-property (point) 'face)
+ 'frog-menu-candidates-face)))
+
(push (cons (point) w)
candidates))
(goto-char
- [elpa] externals/frog-menu 6596627 20/43: Add prompt face, (continued)
- [elpa] externals/frog-menu 6596627 20/43: Add prompt face, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 0d4d9f2 25/43: Update description for new frog-menu-type avy-side-window, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 6bf85da 32/43: Rephrase description, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 0ba3279 36/43: add face for posframe menu action keybindings, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu f45005d 42/43: Merge branch 'master' of github.com:clemera/frog-menu, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 9c382dc 08/43: Improve description, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu fbe8f88 10/43: Fix adding padding for avy char, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu b73b59a 11/43: Mention avy-menu, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 7f403de 12/43: Link to ace-popup-menu, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 60ed0a5 15/43: Support passing only actions, too, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu e2307a0 19/43: Add actions face,
Clemens Radermacher <=
- [elpa] externals/frog-menu 8b7213d 27/43: Merge branch 'master' of github.com:clemera/frog-menu, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 2a29f34 29/43: Add usage description for flyspell-correct, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 37ad44b 21/43: Refactor and add new menu type for non graphical displays, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 6abd002 34/43: Use own avy style function and allow padding, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 3d84ba3 38/43: allow flexible way to customize posframe parameters, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 6373133 37/43: Merge pull request #2 from waymondo/master, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 173aea7 41/43: Add more padding to the right of menu, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 75f5243 39/43: Merge pull request #3 from waymondo/posframe-parameters, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu cd5dd46 43/43: Checkdoc fixes, Clemens Radermacher, 2019/03/24
- [elpa] externals/frog-menu 7c3262c 30/43: Add terminal screenshot, Clemens Radermacher, 2019/03/24