emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/urgrep 496647e748 019/115: Add our own toolbar so we ge


From: ELPA Syncer
Subject: [elpa] externals/urgrep 496647e748 019/115: Add our own toolbar so we get better tooltips
Date: Wed, 10 May 2023 03:00:39 -0400 (EDT)

branch: externals/urgrep
commit 496647e74872a6eea86312a9ab739c60ab0328f6
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Jim Porter <jporterbugs@gmail.com>

    Add our own toolbar so we get better tooltips
---
 urgrep.el | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/urgrep.el b/urgrep.el
index a149fa8907..418429589e 100644
--- a/urgrep.el
+++ b/urgrep.el
@@ -236,6 +236,32 @@ for MS shells."
     ["Stop search" kill-compilation
      :help "Kill the currently running search process"]))
 
+(defvar urgrep-mode-tool-bar-map
+  ;; When bootstrapping, tool-bar-map is not properly initialized yet,
+  ;; so don't do anything.
+  (when (keymapp tool-bar-map)
+    (let ((map (copy-keymap tool-bar-map)))
+      (define-key map [undo] nil)
+      (define-key map [separator-2] nil)
+      (define-key-after map [separator-urgrep] menu-bar-separator)
+      (tool-bar-local-item
+       "left-arrow" 'previous-error-no-select 'previous-error-no-select map
+       :rtl "right-arrow"
+       :help "Goto previous match")
+      (tool-bar-local-item
+       "right-arrow" 'next-error-no-select 'next-error-no-select map
+       :rtl "left-arrow"
+       :help "Goto next match")
+      (tool-bar-local-item
+       "cancel" 'kill-compilation 'kill-compilation map
+       :enable '(let ((buffer (compilation-find-buffer)))
+                 (get-buffer-process buffer))
+       :help "Stop search")
+      (tool-bar-local-item
+       "refresh" 'recompile 'recompile map
+       :help "Restart search")
+      map)))
+
 (defconst urgrep-mode-line-matches
   `(" [" (:propertize (:eval (int-to-string urgrep-num-matches-found))
                       face urgrep-match-count
@@ -385,7 +411,8 @@ This function is called from `compilation-filter-hook'."
 
 (define-compilation-mode urgrep-mode "Urgrep"
   "A compilation mode for various grep-like tools."
-  (setq-local compilation-process-setup-function 'urgrep-process-setup
+  (setq-local tool-bar-map urgrep-mode-tool-bar-map
+              compilation-process-setup-function 'urgrep-process-setup
               compilation-error-face 'urgrep-hit
               compilation-error-regexp-alist urgrep-regexp-alist
               compilation-mode-line-errors urgrep-mode-line-matches



reply via email to

[Prev in Thread] Current Thread [Next in Thread]