diff options
author | Leo Liu <sdl.web@gmail.com> | 2013-01-13 01:47:50 +0800 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2013-01-13 01:47:50 +0800 |
commit | 2d565c6a4db5c7573115930fdb53221b034ee769 (patch) | |
tree | 91fd1d686b2247dd7fd316898e1859905730cfe0 | |
parent | e8c542c2b8d2e835b116b47fe4641c5c96f2068d (diff) | |
download | emacs-2d565c6a4db5c7573115930fdb53221b034ee769.tar.gz |
New command ack-yank-symbol-at-point and bind it to M-Y
Thanks to scottj@irc.freenode.net for request and testing.
Also update copyright years.
-rw-r--r-- | packages/ack/README | 2 | ||||
-rw-r--r-- | packages/ack/ack.el | 13 | ||||
-rw-r--r-- | packages/ack/pcmpl-ack.el | 2 |
3 files changed, 15 insertions, 2 deletions
diff --git a/packages/ack/README b/packages/ack/README index 188562ecf35..8e90f7f3185 100644 --- a/packages/ack/README +++ b/packages/ack/README @@ -15,6 +15,8 @@ key bindings may be useful: - `M-I' inserts a template for case-insensitive file name search - `M-G' inserts a template for `git grep', `hg grep' or `bzr grep' +- `M-Y' inserts the symbol at point from the window before entering + the minibuffer - `TAB' completes ack options This package does not require `--nogroup' nor `--noheading'. diff --git a/packages/ack/ack.el b/packages/ack/ack.el index d58a7ff1e8a..6b1655ddcac 100644 --- a/packages/ack/ack.el +++ b/packages/ack/ack.el @@ -1,6 +1,6 @@ ;;; ack.el --- Emacs interface to ack -;; Copyright (C) 2012 Free Software Foundation, Inc. +;; Copyright (C) 2012, 2013 Free Software Foundation, Inc. ;; Author: Leo Liu <sdl.web@gmail.com> ;; Version: 0.8 @@ -308,6 +308,16 @@ This gets tacked on the end of the generated expressions.") (delete-minibuffer-contents) (skeleton-insert '(nil cmd " '" _ "'")))) +(defun ack-yank-symbol-at-point () + "Yank the symbol from the window before entering the minibuffer." + (interactive) + (let ((symbol (and (minibuffer-selected-window) + (with-current-buffer + (window-buffer (minibuffer-selected-window)) + (thing-at-point 'symbol))))) + (if symbol (insert symbol) + (minibuffer-message "No symbol found")))) + (defvar ack-minibuffer-local-map (let ((map (make-sparse-keymap))) (set-keymap-parent map minibuffer-local-map) @@ -316,6 +326,7 @@ This gets tacked on the end of the generated expressions.") 'pcomplete)) (define-key map "\M-I" 'ack-skel-file) (define-key map "\M-G" 'ack-skel-vc-grep) + (define-key map "\M-Y" 'ack-yank-symbol-at-point) (define-key map "'" 'skeleton-pair-insert-maybe) map) "Keymap used for reading `ack' command and args in minibuffer.") diff --git a/packages/ack/pcmpl-ack.el b/packages/ack/pcmpl-ack.el index ea504a89add..766168a8047 100644 --- a/packages/ack/pcmpl-ack.el +++ b/packages/ack/pcmpl-ack.el @@ -1,6 +1,6 @@ ;;; pcmpl-ack.el --- completion for ack tool -;; Copyright (C) 2012 Free Software Foundation, Inc. +;; Copyright (C) 2012, 2013 Free Software Foundation, Inc. ;; Author: Leo Liu <sdl.web@gmail.com> ;; Keywords: tools, processes, convenience |