all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* `universal-argument` from isearch minibuffer?
@ 2013-05-31  2:25 Tim Visher
  2013-05-31  2:31 ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Visher @ 2013-05-31  2:25 UTC (permalink / raw)
  To: emacs

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: `universal-argument` from isearch minibuffer?
  2013-05-31  2:25 `universal-argument` from isearch minibuffer? Tim Visher
@ 2013-05-31  2:31 ` Drew Adams
  2013-05-31 17:22   ` Tim Visher
  0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2013-05-31  2:31 UTC (permalink / raw)
  To: Tim Visher, emacs

> My question is whether or not it's possible to affect the
> current-prefix-arg when you're already in the isearch minibuffer.

Yes, but it's almost a secret.   Set `isearch-allow-scroll' to non-nil.

Odd name, but that's the open sesame.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: `universal-argument` from isearch minibuffer?
  2013-05-31  2:31 ` Drew Adams
@ 2013-05-31 17:22   ` Tim Visher
  0 siblings, 0 replies; 3+ messages in thread
From: Tim Visher @ 2013-05-31 17:22 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs

On Thu, May 30, 2013 at 10:31 PM, Drew Adams <drew.adams@oracle.com> wrote:
>> My question is whether or not it's possible to affect the
>> current-prefix-arg when you're already in the isearch minibuffer.
>
> Yes, but it's almost a secret.   Set `isearch-allow-scroll' to non-nil.
>
> Odd name, but that's the open sesame.

Wow. How would I have ever guessed that!

Oh emacs, you so crazy!

Thanks!

--

In Christ,

Timmy V.

http://blog.twonegatives.com/
http://five.sentenc.es/ -- Spend less time on mail



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-31 17:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-31  2:25 `universal-argument` from isearch minibuffer? Tim Visher
2013-05-31  2:31 ` Drew Adams
2013-05-31 17:22   ` Tim Visher

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.