------------------------------------------------------------
revno: 336
committer: Leo Liu <sdl....@gmail.com>
branch nick: elpa
timestamp: Sun 2013-01-13 01:47:50 +0800
message:
  New command ack-yank-symbol-at-point and bind it to M-Y
  
  Thanks to sco...@irc.freenode.net for request and testing.
  Also update copyright years.
modified:
  packages/ack/README
  packages/ack/ack.el
  packages/ack/pcmpl-ack.el
=== modified file 'packages/ack/README'
--- a/packages/ack/README       2012-10-08 14:12:54 +0000
+++ b/packages/ack/README       2013-01-12 17:47:50 +0000
@@ -15,6 +15,8 @@
 
 - `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'.

=== modified file 'packages/ack/ack.el'
--- a/packages/ack/ack.el       2012-11-18 16:05:46 +0000
+++ b/packages/ack/ack.el       2013-01-12 17:47:50 +0000
@@ -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....@gmail.com>
 ;; Version: 0.8
@@ -308,6 +308,16 @@
     (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 @@
                            '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.")

=== modified file 'packages/ack/pcmpl-ack.el'
--- a/packages/ack/pcmpl-ack.el 2012-10-08 03:54:59 +0000
+++ b/packages/ack/pcmpl-ack.el 2013-01-12 17:47:50 +0000
@@ -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....@gmail.com>
 ;; Keywords: tools, processes, convenience

Reply via email to