aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2001-06-14 21:05:55 +0000
committerRichard M. Stallman2001-06-14 21:05:55 +0000
commit01e3636e3546e3a15e6d237dc7c54b60fb7a5d7f (patch)
treebf95805023b6eb5a305084c0784d34cbb8412956
parente4cdc335f37ff8ed88a315508cdf27c7c640e9c6 (diff)
downloademacs-01e3636e3546e3a15e6d237dc7c54b60fb7a5d7f.tar.gz
emacs-01e3636e3546e3a15e6d237dc7c54b60fb7a5d7f.zip
Give advice about how to default position args and region args.
-rw-r--r--lispref/tips.texi40
1 files changed, 38 insertions, 2 deletions
diff --git a/lispref/tips.texi b/lispref/tips.texi
index 031f6b41166..50499e20569 100644
--- a/lispref/tips.texi
+++ b/lispref/tips.texi
@@ -289,11 +289,47 @@ An error message should start with a capital letter but should not end
289with a period. 289with a period.
290 290
291@item 291@item
292In @code{interactive}, if you use a Lisp expression to produce a list
293of arguments, don't try to provide the ``correct'' default values for
294region or position arguments. Instead, provide @code{nil} for those
295arguments if they were not specified, and have the function body
296compute the default value when the argument is @code{nil}. For
297instance, write this:
298
299@example
300(defun foo (pos)
301 (interactive
302 (list (if @var{specified} @var{specified-pos})))
303 (unless pos (setq pos @var{default-pos}))
304 ...)
305@end example
306
307@noindent
308rather than this:
309
310@example
311(defun foo (pos)
312 (interactive
313 (list (if @var{specified} @var{specified-pos}
314 @var{default-pos})))
315 ...)
316@end example
317
318@noindent
319This is so that repetition of the command will recompute
320these defaults based on the current circumstances.
321
322You do not need to take such precautions when you use interactive
323specs @samp{d}, @samp{m} and @samp{r}, because they make special
324arrangements to recompute the argument values on repetition of the
325command.
326
327@item
292Many commands that take a long time to execute display a message that 328Many commands that take a long time to execute display a message that
293says @samp{Operating...} when they start, and change it to 329says something like @samp{Operating...} when they start, and change it to
294@samp{Operating...done} when they finish. Please keep the style of 330@samp{Operating...done} when they finish. Please keep the style of
295these messages uniform: @emph{no} space around the ellipsis, and 331these messages uniform: @emph{no} space around the ellipsis, and
296@emph{no} period at the end. 332@emph{no} period after @samp{done}.
297 333
298@item 334@item
299Try to avoid using recursive edits. Instead, do what the Rmail @kbd{e} 335Try to avoid using recursive edits. Instead, do what the Rmail @kbd{e}