aboutsummaryrefslogtreecommitdiffstats
path: root/lispref
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>2001-06-14 21:05:55 +0000
committerRichard M. Stallman <[email protected]>2001-06-14 21:05:55 +0000
commit01e3636e3546e3a15e6d237dc7c54b60fb7a5d7f (patch)
treebf95805023b6eb5a305084c0784d34cbb8412956 /lispref
parente4cdc335f37ff8ed88a315508cdf27c7c640e9c6 (diff)
Give advice about how to default position args and region args.
Diffstat (limited to 'lispref')
-rw-r--r--lispref/tips.texi40
1 files changed, 38 insertions, 2 deletions
diff --git a/lispref/tips.texi b/lispref/tips.texi
index 031f6b4116..50499e2056 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
with a period.
@item
+In @code{interactive}, if you use a Lisp expression to produce a list
+of arguments, don't try to provide the ``correct'' default values for
+region or position arguments. Instead, provide @code{nil} for those
+arguments if they were not specified, and have the function body
+compute the default value when the argument is @code{nil}. For
+instance, write this:
+
+@example
+(defun foo (pos)
+ (interactive
+ (list (if @var{specified} @var{specified-pos})))
+ (unless pos (setq pos @var{default-pos}))
+ ...)
+@end example
+
+@noindent
+rather than this:
+
+@example
+(defun foo (pos)
+ (interactive
+ (list (if @var{specified} @var{specified-pos}
+ @var{default-pos})))
+ ...)
+@end example
+
+@noindent
+This is so that repetition of the command will recompute
+these defaults based on the current circumstances.
+
+You do not need to take such precautions when you use interactive
+specs @samp{d}, @samp{m} and @samp{r}, because they make special
+arrangements to recompute the argument values on repetition of the
+command.
+
+@item
Many commands that take a long time to execute display a message that
-says @samp{Operating...} when they start, and change it to
+says something like @samp{Operating...} when they start, and change it to
@samp{Operating...done} when they finish. Please keep the style of
these messages uniform: @emph{no} space around the ellipsis, and
-@emph{no} period at the end.
+@emph{no} period after @samp{done}.
@item
Try to avoid using recursive edits. Instead, do what the Rmail @kbd{e}