- `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'.
;;; 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
(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)
'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.")
;;; 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