aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref
diff options
context:
space:
mode:
Diffstat (limited to 'doc/lispref')
-rw-r--r--doc/lispref/customize.texi13
-rw-r--r--doc/lispref/elisp.texi1
-rw-r--r--doc/lispref/files.texi3
-rw-r--r--doc/lispref/frames.texi16
-rw-r--r--doc/lispref/help.texi9
-rw-r--r--doc/lispref/tips.texi84
6 files changed, 117 insertions, 9 deletions
diff --git a/doc/lispref/customize.texi b/doc/lispref/customize.texi
index 364edf63031..705af15e4e2 100644
--- a/doc/lispref/customize.texi
+++ b/doc/lispref/customize.texi
@@ -372,12 +372,15 @@ added by calls to @code{custom-add-frequent-value} (see below).
372@item :set @var{setfunction} 372@item :set @var{setfunction}
373Specify @var{setfunction} as the way to change the value of this 373Specify @var{setfunction} as the way to change the value of this
374option when using the Customize interface. The function 374option when using the Customize interface. The function
375@var{setfunction} should take two arguments, a symbol (the option 375@var{setfunction} should take two or three arguments, a symbol (the option
376name) and the new value, and should do whatever is necessary to update 376name), the new value, and an optional @var{buffer-local} indicator.
377@var{setfunction} should do whatever is necessary to update
377the value properly for this option (which may not mean simply setting 378the value properly for this option (which may not mean simply setting
378the option as a Lisp variable); preferably, though, it should not 379the option as a Lisp variable); preferably, though, it should not
379modify its value argument destructively. The default for 380modify its value argument destructively. If optional @var{buffer-local}
380@var{setfunction} is @code{set-default-toplevel-value}. 381is non-nil, the new value should be set buffer locally and not affect its
382global or default values. The default for @var{setfunction} is
383@code{set-default-toplevel-value}.
381 384
382If defined, @var{setfunction} will also be called when evaluating a 385If defined, @var{setfunction} will also be called when evaluating a
383@code{defcustom} form with @kbd{C-M-x} in Emacs Lisp mode and when the 386@code{defcustom} form with @kbd{C-M-x} in Emacs Lisp mode and when the
@@ -387,7 +390,7 @@ If defined, @var{setfunction} will also be called when evaluating a
387If you specify this keyword, the variable's documentation string 390If you specify this keyword, the variable's documentation string
388should describe how to do the same job in hand-written Lisp code, 391should describe how to do the same job in hand-written Lisp code,
389either by invoking @var{setfunction} directly or by using 392either by invoking @var{setfunction} directly or by using
390@code{setopt}. 393@code{setopt} or @code{setopt-local}.
391 394
392@kindex get@r{, @code{defcustom} keyword} 395@kindex get@r{, @code{defcustom} keyword}
393@item :get @var{getfunction} 396@item :get @var{getfunction}
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index 656a422cf6e..9115b3a4691 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -1661,6 +1661,7 @@ Tips and Conventions
1661* Compilation Tips:: Making compiled code run fast. 1661* Compilation Tips:: Making compiled code run fast.
1662* Warning Tips:: Turning off compiler warnings. 1662* Warning Tips:: Turning off compiler warnings.
1663* Documentation Tips:: Writing readable documentation strings. 1663* Documentation Tips:: Writing readable documentation strings.
1664* Documentation Group Tips:: Writing useful documentation groups.
1664* Comment Tips:: Conventions for writing comments. 1665* Comment Tips:: Conventions for writing comments.
1665* Library Headers:: Standard headers for library packages. 1666* Library Headers:: Standard headers for library packages.
1666 1667
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 049e8ac3e84..f86a18fd896 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -2777,6 +2777,9 @@ the end of the file name.
2777 2777
2778If @var{text} is a string, @code{make-temp-file} inserts it in the file. 2778If @var{text} is a string, @code{make-temp-file} inserts it in the file.
2779 2779
2780On Posix systems, Emacs creates the file with permissions that limit its
2781access to the current user.
2782
2780To prevent conflicts among different libraries running in the same 2783To prevent conflicts among different libraries running in the same
2781Emacs, each Lisp program that uses @code{make-temp-file} should have its 2784Emacs, each Lisp program that uses @code{make-temp-file} should have its
2782own @var{prefix}. The number added to the end of @var{prefix} 2785own @var{prefix}. The number added to the end of @var{prefix}
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index d57d643e922..c50619a2de0 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -89,6 +89,20 @@ displayed on that terminal; the list of possible values is the same as
89for @code{framep} above. 89for @code{framep} above.
90@end defun 90@end defun
91 91
92@defun frame-initial-p &optional frame
93This predicate returns non-@code{nil} if @var{frame} is or holds the
94initial text frame that is used internally during daemon mode
95(@pxref{Initial Options, daemon,, emacs, The GNU Emacs Manual}), batch
96mode (@pxref{Batch Mode}), and the early stages of startup
97(@pxref{Startup Summary}). Interactive and graphical programs, for
98instance, can use this predicate to avoid operating on the initial
99frame, which is never displayed.
100
101If @var{frame} is a terminal, this function returns non-@code{nil} if
102@var{frame} holds the initial frame. If @var{frame} is omitted or
103@code{nil}, it defaults to the selected one.
104@end defun
105
92@cindex top-level frame 106@cindex top-level frame
93On a graphical terminal we distinguish two types of frames: A normal 107On a graphical terminal we distinguish two types of frames: A normal
94@dfn{top-level frame} is a frame whose window-system window is a child 108@dfn{top-level frame} is a frame whose window-system window is a child
@@ -3029,7 +3043,7 @@ direction.
3029 See also @code{next-window} and @code{previous-window}, in @ref{Cyclic 3043 See also @code{next-window} and @code{previous-window}, in @ref{Cyclic
3030Window Ordering}. 3044Window Ordering}.
3031 3045
3032 Some Lisp programs need to find one or more frames that satisfy a 3046 Some Lisp programs need to find one or more frames that satisfy
3033given criteria. The function @code{filtered-frame-list} is provided for 3047given criteria. The function @code{filtered-frame-list} is provided for
3034this purpose. 3048this purpose.
3035 3049
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi
index 3261cf838f7..a9bc9221912 100644
--- a/doc/lispref/help.texi
+++ b/doc/lispref/help.texi
@@ -828,14 +828,16 @@ if the user types the help character again.
828@cindex documentation groups 828@cindex documentation groups
829@cindex groups of functions 829@cindex groups of functions
830@cindex function groups 830@cindex function groups
831@cindex shortdoc groups
831 832
832Emacs can list functions based on various groupings. For instance, 833Emacs can list functions based on various groupings. For instance,
833@code{string-trim} and @code{mapconcat} are ``string'' functions, so 834@code{string-trim} and @code{mapconcat} are ``string'' functions, so
834@kbd{M-x shortdoc RET string RET} will give an overview 835@kbd{M-x shortdoc RET string RET} will give an overview of these and
835of functions that operate on strings. 836other functions that operate on strings.
836 837
837The documentation groups are created with the 838The documentation groups are created with the
838@code{define-short-documentation-group} macro. 839@code{define-short-documentation-group} macro. @xref{Documentation
840Group Tips}, for how to write good documentation groups.
839 841
840@defmac define-short-documentation-group group &rest functions 842@defmac define-short-documentation-group group &rest functions
841Define @var{group} as a group of functions, and provide short 843Define @var{group} as a group of functions, and provide short
@@ -846,6 +848,7 @@ summaries of using those functions. The optional argument
846(@var{func} [@var{keyword} @var{val}]@dots{}) 848(@var{func} [@var{keyword} @var{val}]@dots{})
847@end lisp 849@end lisp
848 850
851@cindex documentation group keywords
849The following keywords are recognized: 852The following keywords are recognized:
850 853
851@table @code 854@table @code
diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi
index 7f22dc06ef2..2fbac9508d6 100644
--- a/doc/lispref/tips.texi
+++ b/doc/lispref/tips.texi
@@ -35,6 +35,7 @@ in batch mode, e.g., with a command run by @kbd{@w{M-x compile
35* Compilation Tips:: Making compiled code run fast. 35* Compilation Tips:: Making compiled code run fast.
36* Warning Tips:: Turning off compiler warnings. 36* Warning Tips:: Turning off compiler warnings.
37* Documentation Tips:: Writing readable documentation strings. 37* Documentation Tips:: Writing readable documentation strings.
38* Documentation Group Tips:: Writing useful documentation groups.
38* Comment Tips:: Conventions for writing comments. 39* Comment Tips:: Conventions for writing comments.
39* Library Headers:: Standard headers for library packages. 40* Library Headers:: Standard headers for library packages.
40@end menu 41@end menu
@@ -934,6 +935,89 @@ If you do not anticipate anyone editing your code with older Emacs
934versions, there is no need for this work-around. 935versions, there is no need for this work-around.
935@end itemize 936@end itemize
936 937
938@node Documentation Group Tips
939@section Tips for Documentation Groups
940@cindex documentation groups, tips
941@cindex tips for documentation groups
942
943@cindex documentation groups, compatibility
944 Documentation groups, available since Emacs 28, are useful to document
945functions of Lisp packages based on various groupings
946(@pxref{Documentation Groups}). This section gives some tips on how you
947can define documentation groups in your Lisp package in a way such that
948users of different Emacs versions can equally well use these groups.
949
950@itemize @bullet
951@item
952To define documentation groups for your own Lisp package across
953different Emacs versions, you can use a boilerplate template along the
954lines of the following to make your package compile and load without
955errors:
956
957@smallexample
958@group
959;;; well-doc.el --- a well-documented package -*- lexical-binding: t; -*-
960
961@dots{} package header and contents @dots{}
962@end group
963
964@group
965;; Explicitly require shortdoc for Emacs 28, which does not have an
966;; autoload for macro `define-short-documentation-group'. And for
967;; Emacs 30, so that we can redefine `shortdoc--check' later.
968(require 'shortdoc nil t)
969
970(eval-when-compile
971
972 ;; Default macro `define-short-documentation-group' for Emacs 27
973 ;; and older, which do not have the shortdoc feature at all.
974 (unless (fboundp 'define-short-documentation-group)
975 (defmacro define-short-documentation-group (&rest _)))
976
977 ;; Disable too rigid shortdoc checks for Emacs 30, which let it
978 ;; error out on newer shortdoc keywords.
979 (when (eq emacs-major-version 30)
980 (fset 'shortdoc--check #'ignore)))
981@end group
982
983@group
984(define-short-documentation-group well-doc
985 @dots{})
986
987;;; well-doc.el ends here
988@end group
989@end smallexample
990
991@findex define-short-documentation-group
992If you do not intend to support some of the Emacs versions mentioned
993above, you can safely omit the corresponding forms from the template.
994If you intend to support only Emacs 31 and newer, you do not need any
995of the above and can just use @code{define-short-documentation-group}.
996
997@item
998@cindex documentation group keywords, compatibility
999Newer Emacs versions might introduce newer documentation group features
1000and keywords. However, these features or keywords will never break the
1001display of a documentation group in older Emacs versions. Suppose you
1002use a hypothetical group keyword @code{:super-pretty-print}, available
1003in some future Emacs version, like this in your Lisp package
1004@file{well-doc.el}:
1005
1006@smallexample
1007@group
1008(define-short-documentation-group well-doc
1009 (well-doc-foo
1010 :eval (well-doc-foo)
1011 :super-pretty-print t))
1012@end group
1013@end smallexample
1014
1015That future Emacs version will then supposedly super-pretty-print the
1016example for function @code{well-doc-foo}. Older Emacs versions will
1017silently ignore keyword @code{:super-pretty-print} and show the example
1018according to their regular display rules.
1019@end itemize
1020
937@node Comment Tips 1021@node Comment Tips
938@section Tips on Writing Comments 1022@section Tips on Writing Comments
939@cindex comments, Lisp convention for 1023@cindex comments, Lisp convention for