* Calling a function interactively with a universal argument
@ 2007-06-13 12:04 spamfilteraccount
2007-06-14 13:21 ` Tim X
2007-06-15 2:14 ` Kevin Rodgers
0 siblings, 2 replies; 3+ messages in thread
From: spamfilteraccount @ 2007-06-13 12:04 UTC (permalink / raw)
To: help-gnu-emacs
Is it possible to call a function from a program with a certain
universal argument?
I'd like to a redefine a standard command, but *without* bothering to
use its actual lisp interface, so I want to call the function from a
program as a user would, supplying only a universal argument or not.
I'd like to override find-tag behavior, so that it does something
after reading the interactive arguments, but before invoking the
original command:
(defun my-find-tag ()
; the result of (interactive-form 'find-tag) should be substituted
here somehow as an interactive specifier, because I want the same
interactive behavior (I can copy it of course manually, but it would
be nicer to copy here the interactive specification of find-tag
programatically)
(if my-find-tags was called with C-u then do something
otherwise do something else)
(call original find-tag with the interactive arugments received))
I've seen call-interactively, but it doesn't allow me to specify the
actual interactive arguments to call the command with.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Calling a function interactively with a universal argument
2007-06-13 12:04 Calling a function interactively with a universal argument spamfilteraccount
@ 2007-06-14 13:21 ` Tim X
2007-06-15 2:14 ` Kevin Rodgers
1 sibling, 0 replies; 3+ messages in thread
From: Tim X @ 2007-06-14 13:21 UTC (permalink / raw)
To: help-gnu-emacs
"spamfilteraccount@gmail.com" <spamfilteraccount@gmail.com> writes:
> Is it possible to call a function from a program with a certain
> universal argument?
>
> I'd like to a redefine a standard command, but *without* bothering to
> use its actual lisp interface, so I want to call the function from a
> program as a user would, supplying only a universal argument or not.
>
>
> I'd like to override find-tag behavior, so that it does something
> after reading the interactive arguments, but before invoking the
> original command:
>
>
> (defun my-find-tag ()
> ; the result of (interactive-form 'find-tag) should be substituted
> here somehow as an interactive specifier, because I want the same
> interactive behavior (I can copy it of course manually, but it would
> be nicer to copy here the interactive specification of find-tag
> programatically)
>
> (if my-find-tags was called with C-u then do something
> otherwise do something else)
>
> (call original find-tag with the interactive arugments received))
>
>
>
> I've seen call-interactively, but it doesn't allow me to specify the
> actual interactive arguments to call the command with.
>
have a look at defadvice in the elisp manual. It should allow you to do what
you want.
tim
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Calling a function interactively with a universal argument
2007-06-13 12:04 Calling a function interactively with a universal argument spamfilteraccount
2007-06-14 13:21 ` Tim X
@ 2007-06-15 2:14 ` Kevin Rodgers
1 sibling, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2007-06-15 2:14 UTC (permalink / raw)
To: help-gnu-emacs
spamfilteraccount@gmail.com wrote:
> Is it possible to call a function from a program with a certain
> universal argument?
>
> I'd like to a redefine a standard command, but *without* bothering to
> use its actual lisp interface, so I want to call the function from a
> program as a user would, supplying only a universal argument or not.
>
>
> I'd like to override find-tag behavior, so that it does something
> after reading the interactive arguments, but before invoking the
> original command:
>
>
> (defun my-find-tag ()
> ; the result of (interactive-form 'find-tag) should be substituted
> here somehow as an interactive specifier, because I want the same
> interactive behavior (I can copy it of course manually, but it would
> be nicer to copy here the interactive specification of find-tag
> programatically)
>
> (if my-find-tags was called with C-u then do something
> otherwise do something else)
>
> (call original find-tag with the interactive arugments received))
(defadvice find-tag (before universal-argument activate)
"If called with \\[universal-argument], do SOMETHING, other do
SOMETHING-ELSE."
(if (consp current-prefix-arg)
(something)
(something-else)))
> I've seen call-interactively, but it doesn't allow me to specify the
> actual interactive arguments to call the command with.
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-06-15 2:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-13 12:04 Calling a function interactively with a universal argument spamfilteraccount
2007-06-14 13:21 ` Tim X
2007-06-15 2:14 ` Kevin Rodgers
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.