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

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

Re: Problems with keybindings for functions with arguments


From: Thorsten Jolitz
Subject: Re: Problems with keybindings for functions with arguments
Date: Fri, 08 Mar 2013 17:04:45 +0100
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.2 (gnu/linux)

"Drew Adams" <drew.adams@oracle.com> writes:

>> #### question 1 ####

> There is no canonical way.  What you did is fine and typical.  If you want the
> key/binding list to say what the command is then you need to give the command 
> a
> name.  E.g., instead of:
>
> (lambda () (interactive) (navi-show-headers 4))
>
> Use:
>
> (defun show-headers-4 () (interactive) (navi-show-headers 4))

Ok, then I already knew the existing possibilities and did not miss the
somehow better solution I suspected to exist.

>> #### question 2 ####

> Not sure what the question is.  But if you want to use a numeric prefix arg 
> for
> LEVEL, then do so:
>
> (defun navi-show-headers (level)
>   "Act conditional on LEVEL"
>   (interactive "p")
>   (do-stuff level))

I think I will use this now

,--------------------------------------------------------------
| (defun show-headers-4 () (interactive) (navi-show-headers 4))
`--------------------------------------------------------------

so that question 2 becomes more or less obsolete like you describe, just
standard usage of 'interactive'.

Thanks for the answer. 

-- 
cheers,
Thorsten




reply via email to

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