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

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

[elpa] externals/embark 81113d559a 3/4: Merge branch 'master' of https:/


From: ELPA Syncer
Subject: [elpa] externals/embark 81113d559a 3/4: Merge branch 'master' of https://github.com/oantolin/embark
Date: Fri, 23 Dec 2022 17:57:38 -0500 (EST)

branch: externals/embark
commit 81113d559a0204f33c344087a21f58c4be76098a
Merge: f14aaa76c6 e7a921060c
Author: Omar Antolín <omar.antolin@gmail.com>
Commit: Omar Antolín <omar.antolin@gmail.com>

    Merge branch 'master' of https://github.com/oantolin/embark
---
 embark-consult.el | 19 ++++++++++++++++---
 embark.el         | 14 ++++++++++++++
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/embark-consult.el b/embark-consult.el
index d5603024a6..b53192425a 100644
--- a/embark-consult.el
+++ b/embark-consult.el
@@ -155,6 +155,8 @@ This function is meant to be added to 
`embark-collect-mode-hook'."
 
 ;;; Support for consult-grep
 
+(defvar grep-mode-line-matches)
+(defvar grep-num-matches-found)
 (defvar wgrep-header/footer-parser)
 (declare-function wgrep-setup "ext:wgrep")
 
@@ -165,12 +167,25 @@ This function is meant to be added to 
`embark-collect-mode-hook'."
 
 (defun embark-consult-export-grep (lines)
   "Create a grep mode buffer listing LINES."
-  (let ((buf (generate-new-buffer "*Embark Export Grep*")))
+  (let ((buf (generate-new-buffer "*Embark Export Grep*"))
+        (count 0)
+        prop)
     (with-current-buffer buf
       (insert (propertize "Exported grep results:\n\n" 'wgrep-header t))
       (dolist (line lines) (insert line "\n"))
       (goto-char (point-min))
+      (while (setq prop (text-property-search-forward
+                         'face 'consult-highlight-match t))
+        (cl-incf count)
+        (put-text-property (prop-match-beginning prop)
+                           (prop-match-end prop)
+                           'font-lock-face
+                           'match))
+      (goto-char (point-min))
       (grep-mode)
+      (when (> count 0)
+        (setq-local grep-num-matches-found count
+                    mode-line-process grep-mode-line-matches))
       ;; Make this buffer current for next/previous-error
       (setq next-error-last-buffer buf)
       ;; Set up keymap before possible wgrep-setup, so that wgrep
@@ -260,8 +275,6 @@ This function is meant to be added to 
`embark-collect-mode-hook'."
 
 ;;; Bindings for consult commands in embark keymaps
 
-(define-key embark-file-map "x" #'consult-file-externally)
-
 (define-key embark-become-file+buffer-map "Cb" #'consult-buffer)
 (define-key embark-become-file+buffer-map "C4b" #'consult-buffer-other-window)
 
diff --git a/embark.el b/embark.el
index 5a2d20dd80..414cf23e33 100644
--- a/embark.el
+++ b/embark.el
@@ -3610,6 +3610,19 @@ with command output.  For replacement behaviour see
                              command
                              (and replace (current-buffer)))))
 
+(defun embark-open-externally (file)
+  "Open FILE using system's default application."
+  (interactive "fOpen: ")
+  (if (and (eq system-type 'windows-nt)
+           (fboundp 'w32-shell-execute))
+      (w32-shell-execute "open" file)
+    (call-process (pcase system-type
+                    ('darwin "open")
+                    ('cygwin "cygstart")
+                    (_ "xdg-open"))
+                  nil 0 nil
+                  (expand-file-name file))))
+
 (defun embark-bury-buffer (buf)
   "Bury buffer BUF."
   (interactive "bBuffer: ")
@@ -4033,6 +4046,7 @@ library, which have an obvious notion of associated 
directory."
   ("\\" embark-recentf-remove)
   ("I" embark-insert-relative-path)
   ("W" embark-save-relative-path)
+  ("x" embark-open-externally)
   ("e" eww-open-file)
   ("l" load-file)
   ("b" byte-compile-file)



reply via email to

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