all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* default value with interactive
@ 2017-11-19 19:08 Emanuel Berg
  2017-11-19 21:49 ` Michael Heerdegen
  0 siblings, 1 reply; 9+ messages in thread
From: Emanuel Berg @ 2017-11-19 19:08 UTC (permalink / raw)
  To: help-gnu-emacs

I'm preparing one of my packs for MELPA so I go
thru the list of formal style
suggestions [1] ...

One I don't know how to do is when there is
a default value. The info node that is
referenced in the suggestion list, namely

    (info "(elisp) Programming Tips")

says the prompt string should look like this

    Enter the answer (default 42):

However then it says it should be implemented
like this

    (defun foo (pos)
      (interactive
        (list (if SPECIFIED SPECIFIED-POS)))
      (unless pos (setq pos DEFAULT-POS))
      ...)

Note that DEFAULT-POS in this example does not
appear in the `interactive' form! So how does
it appear in the prompt string at all?

And even if it did, how do you then get around
it without having to compute/fetch DEFAULT-POS
two times? One time for the prompt string, and
then again to set pos (in the abstract example
above)?

Is there a real-code example somewhere when
this is done the right way?

[1] https://github.com/melpa/melpa/blob/master/CONTRIBUTING.md

-- 
underground experts united
http://user.it.uu.se/~embe8573




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

end of thread, other threads:[~2017-11-21  2:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-19 19:08 default value with interactive Emanuel Berg
2017-11-19 21:49 ` Michael Heerdegen
2017-11-19 22:54   ` Emanuel Berg
2017-11-20  0:05     ` Michael Heerdegen
2017-11-20  1:10       ` Emanuel Berg
2017-11-20  2:18         ` Michael Heerdegen
2017-11-20  3:10           ` Emanuel Berg
2017-11-21  0:31             ` Robert Thorpe
2017-11-21  2:00               ` Emanuel Berg

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.