[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 11/14: Fix #58: Search history can be manipulated with C-k and C-
From: |
Leo Liu |
Subject: |
[elpa] 11/14: Fix #58: Search history can be manipulated with C-k and C-y |
Date: |
Sun, 22 Jun 2014 09:41:43 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit b42bf956931c1625b9acd54050549877409484aa
Author: Leo Liu <address@hidden>
Date: Sun Jun 15 12:17:04 2014 +0800
Fix #58: Search history can be manipulated with C-k and C-y
---
README.rst | 1 +
ggtags.el | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/README.rst b/README.rst
index 8e1d352..671b27e 100644
--- a/README.rst
+++ b/README.rst
@@ -306,6 +306,7 @@ NEWS
``ggtags-view-search-history``.
#. The output buffer from ``ggtags-view-search-history`` looks
cleaner.
+#. Search history items can be re-arranged with ``C-k`` and ``C-y``.
[2014-05-06 Tue] 0.8.4
++++++++++++++++++++++
diff --git a/ggtags.el b/ggtags.el
index c3c80a5..dbc9a81 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -1073,6 +1073,9 @@ Global and Emacs."
(define-key m "\M-p" 'ggtags-view-search-history-prev)
(define-key m "n" 'ggtags-view-search-history-next)
(define-key m "\M-n" 'ggtags-view-search-history-next)
+ (define-key m "\C-k" 'ggtags-view-search-history-kill)
+ (define-key m [remap yank] (lambda (&optional arg) (interactive "P") (yank
arg)))
+ (define-key m "\C-c\C-c" 'ggtags-view-search-history-update)
(define-key m "r" 'ggtags-save-to-register)
(define-key m "\r" 'ggtags-view-search-history-action)
(define-key m "q" 'kill-buffer-and-window)
@@ -1093,6 +1096,41 @@ Global and Emacs."
(interactive "p")
(ggtags-view-search-history-next (- (or arg 1))))
+(defun ggtags-view-search-history-kill (&optional append)
+ (interactive "P")
+ (let* ((node (or (ewoc-locate ggtags-global-search-ewoc)
+ (user-error "No node at point")))
+ (next (ewoc-next ggtags-global-search-ewoc node))
+ (text (filter-buffer-substring (ewoc-location node)
+ (if next (ewoc-location next)
+ (point-max)))))
+ (put-text-property
+ 0 (length text) 'yank-handler
+ (list (lambda (arg)
+ (if (not ggtags-global-search-ewoc)
+ (insert (car arg))
+ (let* ((inhibit-read-only t)
+ (node (unless (looking-at-p "[ \t\n]*\\'")
+ (ewoc-locate ggtags-global-search-ewoc))))
+ (if node
+ (ewoc-enter-before ggtags-global-search-ewoc
+ node (cadr arg))
+ (ewoc-enter-last ggtags-global-search-ewoc (cadr arg))))))
+ (list text (ewoc-data node)))
+ text)
+ (if append (kill-append text nil)
+ (kill-new text))
+ (let ((inhibit-read-only t))
+ (ewoc-delete ggtags-global-search-ewoc node))))
+
+(defun ggtags-view-search-history-update (&optional noconfirm)
+ "Update `ggtags-global-search-history' to current buffer."
+ (interactive "P")
+ (when (or noconfirm
+ (yes-or-no-p "Modify `ggtags-global-search-history'?"))
+ (setq ggtags-global-search-history
+ (ewoc-collect ggtags-global-search-ewoc #'identity))))
+
(defun ggtags-view-search-history-action ()
(interactive)
(let ((data (ewoc-data (or (ewoc-locate ggtags-global-search-ewoc)
- [elpa] branch master updated (76cd6eb -> 4e171a5), Leo Liu, 2014/06/22
- [elpa] 01/14: Fix #54: New command ggtags-find-tag-mouse, Leo Liu, 2014/06/22
- [elpa] 02/14: Update doc strings and comments, Leo Liu, 2014/06/22
- [elpa] 03/14: Fix #56: Restore variable ggtags-completing-read-function, Leo Liu, 2014/06/22
- [elpa] 05/14: Fix #59: detect missing tag files and remove project cache, Leo Liu, 2014/06/22
- [elpa] 04/14: New command ggtags-find-definition for #57, Leo Liu, 2014/06/22
- [elpa] 06/14: Make ggtags-create-tags invalidate ggtags-project-root, Leo Liu, 2014/06/22
- [elpa] 07/14: Fix #65: Clear ggtags-project-root based on default-directory, Leo Liu, 2014/06/22
- [elpa] 11/14: Fix #58: Search history can be manipulated with C-k and C-y,
Leo Liu <=
- [elpa] 08/14: Fix #64: Bind M-s s to ggtags-navigation-isearch-forward, Leo Liu, 2014/06/22
- [elpa] 09/14: Fix #60: Declutter command and highlight tag in search history, Leo Liu, 2014/06/22
- [elpa] 10/14: Refactoring: Use a major mode for viewing search history, Leo Liu, 2014/06/22
- [elpa] 14/14: Merge branch 'master' of github.com:leoliu/ggtags, Leo Liu, 2014/06/22
- [elpa] 13/14: Fix ggtags-global-handle-exit to conditionally pop up window, Leo Liu, 2014/06/22
- [elpa] 12/14: Replace kill-buffer-and-window with ggtags-kill-window, Leo Liu, 2014/06/22