all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tim Visher <tim.visher@gmail.com>
To: emacs <help-gnu-emacs@gnu.org>
Subject: `universal-argument` from isearch minibuffer?
Date: Thu, 30 May 2013 22:25:19 -0400	[thread overview]
Message-ID: <CAHa53uw-V8xs_=4zVzaDygr1-ZXWd1JhZveGTE9ZOuK11+jE9A@mail.gmail.com> (raw)

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



             reply	other threads:[~2013-05-31  2:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-31  2:25 Tim Visher [this message]
2013-05-31  2:31 ` `universal-argument` from isearch minibuffer? Drew Adams
2013-05-31 17:22   ` Tim Visher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHa53uw-V8xs_=4zVzaDygr1-ZXWd1JhZveGTE9ZOuK11+jE9A@mail.gmail.com' \
    --to=tim.visher@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.