help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting last-command with arguments


From: Nicolas Richard
Subject: Re: Getting last-command with arguments
Date: Fri, 13 Sep 2013 15:58:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Suvayu Ali <address@hidden> writes:

> Hi Nicolas,
>
> On Fri, Sep 13, 2013 at 01:34:04PM +0200, Nicolas Richard wrote:
>> Suvayu Ali <address@hidden> writes:
>> > I am conditionally repeating the last command from inside an elisp
>> > function.  So I look at `last-command' and decide.  But now I want to
>> > see the original arguments: say the command was, M-2 M-x my-command RET,
>> > then I want to know 2 was passed to `my-command'.  I am not sure how I
>> > can do that.
>> 
>> The variable current-prefix-arg has that information.
>
> Thanks a lot.  But did you mean last-prefix-arg instead?

No, but I had misread last-command for this-command. Sorry about that.
last-prefix-arg sounds like a good candidate from its docstring, but I
don't understand how it works:

(defun yf/foo (arg)
  (interactive "i")
  (message "Last: %s : %s\nThis: %s : %s"
           last-command last-prefix-arg 
           this-command current-prefix-arg))
(local-set-key (kbd "<f5>") #'yf/foo)

Hitting RET RET C-u <f5> in a buffer shows me:
Last: newline : (4)
This: yf/foo : (4)

I expected

Last: newline : nil
This: yf/foo : (4)

would someone have an explanation ?

-- 
Nico.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]