[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
`universal-argument` from isearch minibuffer?
From: |
Tim Visher |
Subject: |
`universal-argument` from isearch minibuffer? |
Date: |
Thu, 30 May 2013 22:25:19 -0400 |
Hi All,
I'm hacking up a way to get my current isearch term into the ack
prompt: https://gist.github.com/timvisher/5682600
My question is whether or not it's possible to affect the
current-prefix-arg when you're already in the isearch minibuffer.
`ack` behaves differently when the prefix arg is set differently so my
hope was to be able to press
C-s search-term [C-u]* C-c r g
and get my prompt.
Unfortunately, `C-u` promptly exits isearch.
I've included the code below that is available in the gist for easy reference.
Thanks in advance!
(defun timvisher/ack-from-root (arg regexp)
(interactive "P")
(let ((current-prefix-arg (cond ((not arg) 4)
((= 4 (car arg)) 16)
((<= 16 (car arg)) nil))))
(call-interactively 'ack)))
(defun timvisher/isearch-ack-from-root (arg regexp)
(interactive
(list current-prefix-arg
(cond
((functionp isearch-word)
(funcall isearch-word isearch-string))
(isearch-word (word-search-regexp isearch-string))
(isearch-regexp isearch-string)
(t (regexp-quote isearch-string)))))
(let ((ack-command (concat "ag " regexp))
(current-prefix-arg 4))
(isearch-done nil)
(isearch-clean-overlays)
(call-interactively 'ack)))
(define-key isearch-mode-map (kbd "C-c r g") 'timvisher/isearch-ack-from-root)
--
In Christ,
Timmy V.
http://blog.twonegatives.com/
http://five.sentenc.es/ -- Spend less time on mail
- `universal-argument` from isearch minibuffer?,
Tim Visher <=