[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 382109a 2/8: ack-skel-vc-grep recalls previously inserted
From: |
João Távora |
Subject: |
[elpa] master 382109a 2/8: ack-skel-vc-grep recalls previously inserted symbol, if any |
Date: |
Fri, 15 Mar 2019 18:33:10 -0400 (EDT) |
branch: master
commit 382109adf9ec30cf8287940db78ea35f8e948727
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
ack-skel-vc-grep recalls previously inserted symbol, if any
* ack.el (ack--yanked-symbol): New variable.
(ack-skel-vc-grep): Recall previously inserted symbol. Update
docstring.
(ack-yank-symbol-at-point): Remember inserted symbol.
---
ack.el | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/ack.el b/ack.el
index fa2685a..eae0d23 100644
--- a/ack.el
+++ b/ack.el
@@ -279,6 +279,8 @@ This gets tacked on the end of the generated expressions.")
;; Work around bug http://debbugs.gnu.org/13811
(defvar ack--project-root nil) ; dynamically bound in `ack'
+(defvar ack--yanked-symbol nil) ; buffer-local in the minibuffer
+
(defun ack-skel-vc-grep (&optional interactive)
"Find a vc-controlled dir, insert a template for a vc grep search.
If called interactively, INTERACTIVE is non-nil and calls to this
@@ -286,6 +288,9 @@ function that cannot locate such a directory will produce an
error, whereas in non-interactive calls they will silently exit,
leaving the minibuffer unchanged.
+Additionally, interactive calls preceded by a previous
+`ack-yank-symbol-at-point' call, will recall the symbol inserted.
+
This function is a suitable addition to
`ack-minibuffer-setup-hook'."
(interactive "p")
@@ -317,7 +322,9 @@ This function is a suitable addition to
(setq ack--project-root guessed-root)
(ack-update-minibuffer-prompt))
(delete-minibuffer-contents)
- (skeleton-insert `(nil ,cmd " '" _ "'")))))
+ (skeleton-insert `(nil ,cmd " '" _ "'"))
+ (when (and interactive ack--yanked-symbol)
+ (insert ack--yanked-symbol)))))
(defun ack-yank-symbol-at-point ()
"Yank the symbol from the window before entering the minibuffer."
@@ -326,8 +333,9 @@ This function is a suitable addition to
(with-current-buffer
(window-buffer (minibuffer-selected-window))
(thing-at-point 'symbol)))))
- (if symbol (insert symbol)
- (minibuffer-message "No symbol found"))))
+ (cond (symbol (insert symbol)
+ (set (make-local-variable 'ack--yanked-symbol) symbol))
+ (t (minibuffer-message "No symbol found")))))
(defvar ack-minibuffer-local-map
(let ((map (make-sparse-keymap)))
- [elpa] master updated (dd10f4a -> 5c25a7d), João Távora, 2019/03/15
- [elpa] master 5c25a7d 8/8: Update packages/ack from upstream, João Távora, 2019/03/15
- [elpa] master ac696cd 6/8: Fix search directly from *ack* but in different dir, João Távora, 2019/03/15
- [elpa] master bc671ba 7/8: * ack.el (Version): Bump to 1.6, João Távora, 2019/03/15
- [elpa] master 6c65a62 5/8: * README.rst (Usage): fix rst formatting, João Távora, 2019/03/15
- [elpa] master a8857c1 4/8: * README.rst (Usage): Mention ack-minibuffer-setup-hook., João Távora, 2019/03/15
- [elpa] master 47a417d 3/8: Make myself the maintainer of this project, João Távora, 2019/03/15
- [elpa] master c84b434 1/8: Nicer behaviour from ack-skel-vc-grep when used in setup hook, João Távora, 2019/03/15
- [elpa] master 382109a 2/8: ack-skel-vc-grep recalls previously inserted symbol, if any,
João Távora <=