diff options
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/emacs/custom.texi | 53 | ||||
| -rw-r--r-- | doc/emacs/maintaining.texi | 16 | ||||
| -rw-r--r-- | doc/lispintro/emacs-lisp-intro.texi | 29 | ||||
| -rw-r--r-- | doc/lispref/customize.texi | 13 | ||||
| -rw-r--r-- | doc/lispref/elisp.texi | 1 | ||||
| -rw-r--r-- | doc/lispref/files.texi | 3 | ||||
| -rw-r--r-- | doc/lispref/frames.texi | 16 | ||||
| -rw-r--r-- | doc/lispref/help.texi | 9 | ||||
| -rw-r--r-- | doc/lispref/tips.texi | 84 | ||||
| -rw-r--r-- | doc/misc/tramp.texi | 39 |
10 files changed, 228 insertions, 35 deletions
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index bf137ef946b..77fff25b7b2 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi | |||
| @@ -868,13 +868,20 @@ otherwise stated, affects only the current Emacs session. The only | |||
| 868 | way to alter the variable in future sessions is to put something in | 868 | way to alter the variable in future sessions is to put something in |
| 869 | your initialization file (@pxref{Init File}). | 869 | your initialization file (@pxref{Init File}). |
| 870 | 870 | ||
| 871 | If you're setting a customizable variable in your initialization | ||
| 872 | file, and you don't want to use the Customize interface, you can use | ||
| 873 | the @code{setopt} macro. For instance: | ||
| 874 | |||
| 875 | @findex setopt | 871 | @findex setopt |
| 872 | If you're setting a customizable variable, and you don't want to use | ||
| 873 | the Customize interface, you can use the @code{setopt} macro. For | ||
| 874 | instance: | ||
| 875 | |||
| 876 | @example | 876 | @example |
| 877 | (setopt fill-column 75) | 877 | M-: (setopt fill-column 75) @key{RET} |
| 878 | @end example | ||
| 879 | |||
| 880 | @noindent | ||
| 881 | Or, if you want to do this in your initialization file: | ||
| 882 | |||
| 883 | @example | ||
| 884 | (setopt fill-column 75) | ||
| 878 | @end example | 885 | @end example |
| 879 | 886 | ||
| 880 | This works the same as @code{setq}, but if the variable has any | 887 | This works the same as @code{setq}, but if the variable has any |
| @@ -883,6 +890,34 @@ special setter functions, they will be run automatically when using | |||
| 883 | non-customizable variables, but this is less efficient than using | 890 | non-customizable variables, but this is less efficient than using |
| 884 | @code{setq}. | 891 | @code{setq}. |
| 885 | 892 | ||
| 893 | @findex setopt-local | ||
| 894 | There is also a buffer-local version of @code{setopt}, called | ||
| 895 | @code{setopt-local}, that you can use to set buffer specific values for | ||
| 896 | customizable options, for example, in mode hooks (@pxref{Hooks}). | ||
| 897 | |||
| 898 | This works the same as @code{setq-local}, but if the variable has any | ||
| 899 | special setter functions, they will be run automatically when using | ||
| 900 | @code{setopt-local}. You can also use @code{setopt-local} on other, | ||
| 901 | non-customizable variables, but this is less efficient than using | ||
| 902 | @code{setq-local}. | ||
| 903 | |||
| 904 | If you want to change the value of a customizable variable only in | ||
| 905 | your current buffer, you can use the @code{setopt-local} macro. For | ||
| 906 | instance: | ||
| 907 | |||
| 908 | @example | ||
| 909 | M-: (setopt-local fill-column 75) @key{RET} | ||
| 910 | @end example | ||
| 911 | |||
| 912 | @noindent | ||
| 913 | Or, if you want to do this in your initialization file, use the | ||
| 914 | following inside a mode hook so this variable will be automatically | ||
| 915 | customized in buffers of that mode (@pxref{Hooks}): | ||
| 916 | |||
| 917 | @example | ||
| 918 | (setopt-local fill-column 75) | ||
| 919 | @end example | ||
| 920 | |||
| 886 | @node Hooks | 921 | @node Hooks |
| 887 | @subsection Hooks | 922 | @subsection Hooks |
| 888 | @cindex hook | 923 | @cindex hook |
| @@ -3262,7 +3297,7 @@ acquainted with conventions from other programs. | |||
| 3262 | The functionality enabled by the @code{newcomers-presets} theme will | 3297 | The functionality enabled by the @code{newcomers-presets} theme will |
| 3263 | change between releases of Emacs. We may add new functionality, and | 3298 | change between releases of Emacs. We may add new functionality, and |
| 3264 | also remove old functionality that we think has been superseded. | 3299 | also remove old functionality that we think has been superseded. |
| 3265 | Therefore, if you get used to the newcomers' presets, consider copying | 3300 | Therefore, if you get used to the newcomers' presets, you should copy |
| 3266 | them into your own configuration and then disabling the theme again. | 3301 | them into your own configuration and then disable the theme again. You |
| 3267 | You can use the command @code{copy-theme-options} (@pxref{Custom | 3302 | can use the command @code{copy-theme-options} (@pxref{Custom Themes}) to |
| 3268 | Themes}) to do this. | 3303 | do this. |
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index 4aee5e1045d..697a13dbe7b 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi | |||
| @@ -2764,10 +2764,10 @@ Table}.) | |||
| 2764 | @node Xref Commands | 2764 | @node Xref Commands |
| 2765 | @subsubsection Commands Available in the @file{*xref*} Buffer | 2765 | @subsubsection Commands Available in the @file{*xref*} Buffer |
| 2766 | @cindex commands in @file{*xref*} buffers | 2766 | @cindex commands in @file{*xref*} buffers |
| 2767 | @cindex XREF mode | 2767 | @cindex Xref mode |
| 2768 | 2768 | ||
| 2769 | The following commands are provided in the @file{*xref*} buffer by | 2769 | The following commands are provided in the @file{*xref*} buffer by |
| 2770 | the special XREF mode: | 2770 | the special Xref mode: |
| 2771 | 2771 | ||
| 2772 | @table @kbd | 2772 | @table @kbd |
| 2773 | @item @key{RET} | 2773 | @item @key{RET} |
| @@ -2880,7 +2880,7 @@ prompt always, customize the value of the variable | |||
| 2880 | to prompt only if there's no usable identifier at point.) The command | 2880 | to prompt only if there's no usable identifier at point.) The command |
| 2881 | then presents the @file{*xref*} buffer with all the references to the | 2881 | then presents the @file{*xref*} buffer with all the references to the |
| 2882 | identifier, showing the file name and the line where the identifier is | 2882 | identifier, showing the file name and the line where the identifier is |
| 2883 | referenced. The XREF mode commands are available in this buffer, see | 2883 | referenced. The Xref mode commands are available in this buffer, see |
| 2884 | @ref{Xref Commands}. | 2884 | @ref{Xref Commands}. |
| 2885 | 2885 | ||
| 2886 | When invoked in a buffer whose major mode uses the @code{etags} backend, | 2886 | When invoked in a buffer whose major mode uses the @code{etags} backend, |
| @@ -2926,6 +2926,16 @@ matches of that regexp in the names of the identifiers with | |||
| 2926 | @code{xref-query-replace-in-results}, but is more convenient when you | 2926 | @code{xref-query-replace-in-results}, but is more convenient when you |
| 2927 | want to rename a single identifier specified by its name @var{from}. | 2927 | want to rename a single identifier specified by its name @var{from}. |
| 2928 | 2928 | ||
| 2929 | @findex xref-change-to-xref-edit-mode | ||
| 2930 | @cindex Xref Edit mode | ||
| 2931 | @cindex mode, Xref Edit | ||
| 2932 | Typing @kbd{e} in the @file{*xref*} buffer makes the buffer writable | ||
| 2933 | and enters the Xref Edit mode. Similar to Occur Edit mode (@pxref{Other | ||
| 2934 | Repeating Search}), you can edit the matching lines reported by | ||
| 2935 | Xref backend and have those changes reflected in the buffer visiting the | ||
| 2936 | originating file. Type @kbd{C-c C-c} to leave the Xref Edit mode and | ||
| 2937 | return to the Xref mode. | ||
| 2938 | |||
| 2929 | @findex tags-search | 2939 | @findex tags-search |
| 2930 | @kbd{M-x tags-search} reads a regexp using the minibuffer, then | 2940 | @kbd{M-x tags-search} reads a regexp using the minibuffer, then |
| 2931 | searches for matches in all the files in the selected tags table, one | 2941 | searches for matches in all the files in the selected tags table, one |
diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 1497a9906bd..a712b3a1b46 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi | |||
| @@ -14660,9 +14660,9 @@ beginning of the file. The function definition looks like this: | |||
| 14660 | @smallexample | 14660 | @smallexample |
| 14661 | @group | 14661 | @group |
| 14662 | (defun lengths-list-file (filename) | 14662 | (defun lengths-list-file (filename) |
| 14663 | "Return list of definitions' lengths within FILE. | 14663 | "Return list of definitions' lengths within the file named FILENAME. |
| 14664 | The returned list is a list of numbers. | 14664 | The returned list is a list of numbers. |
| 14665 | Each number is the number of words or | 14665 | Each number in the list is the number of words or |
| 14666 | symbols in one function definition." | 14666 | symbols in one function definition." |
| 14667 | @end group | 14667 | @end group |
| 14668 | @group | 14668 | @group |
| @@ -14683,10 +14683,10 @@ symbols in one function definition." | |||
| 14683 | @end smallexample | 14683 | @end smallexample |
| 14684 | 14684 | ||
| 14685 | @noindent | 14685 | @noindent |
| 14686 | The function is passed one argument, the name of the file on which it | 14686 | The function is passed one argument @var{filename}, the name of the file |
| 14687 | will work. It has four lines of documentation, but no interactive | 14687 | on which it will work. It has four lines of documentation, but no |
| 14688 | specification. Since people worry that a computer is broken if they | 14688 | interactive specification. Since people worry that a computer is broken |
| 14689 | don't see anything going on, the first line of the body is a | 14689 | if they don't see anything going on, the first line of the body is a |
| 14690 | message. | 14690 | message. |
| 14691 | 14691 | ||
| 14692 | The next line contains a @code{save-excursion} that returns Emacs's | 14692 | The next line contains a @code{save-excursion} that returns Emacs's |
| @@ -14730,8 +14730,8 @@ definition and constructs a lengths' list containing the information. | |||
| 14730 | Emacs kills the buffer after working through it. This is to save | 14730 | Emacs kills the buffer after working through it. This is to save |
| 14731 | space inside of Emacs. My version of GNU Emacs 19 contained over 300 | 14731 | space inside of Emacs. My version of GNU Emacs 19 contained over 300 |
| 14732 | source files of interest; GNU Emacs 22 contains over a thousand source | 14732 | source files of interest; GNU Emacs 22 contains over a thousand source |
| 14733 | files. Another function will apply @code{lengths-list-file} to each | 14733 | files, and Emacs 30.2 more than 1600. Another function will apply |
| 14734 | of the files. | 14734 | @code{lengths-list-file} to each of the files. |
| 14735 | 14735 | ||
| 14736 | Finally, the last expression within the @code{let} expression is the | 14736 | Finally, the last expression within the @code{let} expression is the |
| 14737 | @code{lengths-list} variable; its value is returned as the value of | 14737 | @code{lengths-list} variable; its value is returned as the value of |
| @@ -14744,13 +14744,13 @@ C-e} (@code{eval-last-sexp}). | |||
| 14744 | @c !!! 22.1.1 lisp sources location here | 14744 | @c !!! 22.1.1 lisp sources location here |
| 14745 | @smallexample | 14745 | @smallexample |
| 14746 | (lengths-list-file | 14746 | (lengths-list-file |
| 14747 | "/usr/local/share/emacs/22.1/lisp/emacs-lisp/debug.el") | 14747 | "/usr/local/share/emacs/30.2/lisp/emacs-lisp/debug.el") |
| 14748 | @end smallexample | 14748 | @end smallexample |
| 14749 | 14749 | ||
| 14750 | @noindent | 14750 | @noindent |
| 14751 | You may need to change the pathname of the file; the one here is for | 14751 | You may need to change the name of the file; the one here is for default |
| 14752 | GNU Emacs version 22.1. To change the expression, copy it to | 14752 | installation tree of GNU Emacs version 30.2. To change the expression, |
| 14753 | the @file{*scratch*} buffer and edit it. | 14753 | copy it to the @file{*scratch*} buffer and edit it. |
| 14754 | 14754 | ||
| 14755 | @need 1200 | 14755 | @need 1200 |
| 14756 | @noindent | 14756 | @noindent |
| @@ -14768,10 +14768,11 @@ Then evaluate the @code{lengths-list-file} expression.) | |||
| 14768 | 14768 | ||
| 14769 | @need 1200 | 14769 | @need 1200 |
| 14770 | The lengths' list for @file{debug.el} takes less than a second to | 14770 | The lengths' list for @file{debug.el} takes less than a second to |
| 14771 | produce and looks like this in GNU Emacs 22: | 14771 | produce and looks like this in GNU Emacs 30.2: |
| 14772 | 14772 | ||
| 14773 | @smallexample | 14773 | @smallexample |
| 14774 | (83 113 105 144 289 22 30 97 48 89 25 52 52 88 28 29 77 49 43 290 232 587) | 14774 | (79 26 140 34 17 112 81 24 155 54 43 102 21 36 36 117 28 29 102 49 43 |
| 14775 | 208 101 28 22 728 15 27) | ||
| 14775 | @end smallexample | 14776 | @end smallexample |
| 14776 | 14777 | ||
| 14777 | @need 1500 | 14778 | @need 1500 |
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} |
| 373 | Specify @var{setfunction} as the way to change the value of this | 373 | Specify @var{setfunction} as the way to change the value of this |
| 374 | option when using the Customize interface. The function | 374 | option 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 |
| 376 | name) and the new value, and should do whatever is necessary to update | 376 | name), the new value, and an optional @var{buffer-local} indicator. |
| 377 | @var{setfunction} should do whatever is necessary to update | ||
| 377 | the value properly for this option (which may not mean simply setting | 378 | the value properly for this option (which may not mean simply setting |
| 378 | the option as a Lisp variable); preferably, though, it should not | 379 | the option as a Lisp variable); preferably, though, it should not |
| 379 | modify its value argument destructively. The default for | 380 | modify its value argument destructively. If optional @var{buffer-local} |
| 380 | @var{setfunction} is @code{set-default-toplevel-value}. | 381 | is non-nil, the new value should be set buffer locally and not affect its |
| 382 | global or default values. The default for @var{setfunction} is | ||
| 383 | @code{set-default-toplevel-value}. | ||
| 381 | 384 | ||
| 382 | If defined, @var{setfunction} will also be called when evaluating a | 385 | If 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 | |||
| 387 | If you specify this keyword, the variable's documentation string | 390 | If you specify this keyword, the variable's documentation string |
| 388 | should describe how to do the same job in hand-written Lisp code, | 391 | should describe how to do the same job in hand-written Lisp code, |
| 389 | either by invoking @var{setfunction} directly or by using | 392 | either 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 | ||
| 2778 | If @var{text} is a string, @code{make-temp-file} inserts it in the file. | 2778 | If @var{text} is a string, @code{make-temp-file} inserts it in the file. |
| 2779 | 2779 | ||
| 2780 | On Posix systems, Emacs creates the file with permissions that limit its | ||
| 2781 | access to the current user. | ||
| 2782 | |||
| 2780 | To prevent conflicts among different libraries running in the same | 2783 | To prevent conflicts among different libraries running in the same |
| 2781 | Emacs, each Lisp program that uses @code{make-temp-file} should have its | 2784 | Emacs, each Lisp program that uses @code{make-temp-file} should have its |
| 2782 | own @var{prefix}. The number added to the end of @var{prefix} | 2785 | own @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 | |||
| 89 | for @code{framep} above. | 89 | for @code{framep} above. |
| 90 | @end defun | 90 | @end defun |
| 91 | 91 | ||
| 92 | @defun frame-initial-p &optional frame | ||
| 93 | This predicate returns non-@code{nil} if @var{frame} is or holds the | ||
| 94 | initial text frame that is used internally during daemon mode | ||
| 95 | (@pxref{Initial Options, daemon,, emacs, The GNU Emacs Manual}), batch | ||
| 96 | mode (@pxref{Batch Mode}), and the early stages of startup | ||
| 97 | (@pxref{Startup Summary}). Interactive and graphical programs, for | ||
| 98 | instance, can use this predicate to avoid operating on the initial | ||
| 99 | frame, which is never displayed. | ||
| 100 | |||
| 101 | If @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 |
| 93 | On a graphical terminal we distinguish two types of frames: A normal | 107 | On 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 |
| 3030 | Window Ordering}. | 3044 | Window 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 |
| 3033 | given criteria. The function @code{filtered-frame-list} is provided for | 3047 | given criteria. The function @code{filtered-frame-list} is provided for |
| 3034 | this purpose. | 3048 | this 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 | ||
| 832 | Emacs can list functions based on various groupings. For instance, | 833 | Emacs 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 |
| 835 | of functions that operate on strings. | 836 | other functions that operate on strings. |
| 836 | 837 | ||
| 837 | The documentation groups are created with the | 838 | The documentation groups are created with the |
| 838 | @code{define-short-documentation-group} macro. | 839 | @code{define-short-documentation-group} macro. @xref{Documentation |
| 840 | Group 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 |
| 841 | Define @var{group} as a group of functions, and provide short | 843 | Define @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 | ||
| 849 | The following keywords are recognized: | 852 | The 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 | |||
| 934 | versions, there is no need for this work-around. | 935 | versions, 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 | ||
| 945 | functions of Lisp packages based on various groupings | ||
| 946 | (@pxref{Documentation Groups}). This section gives some tips on how you | ||
| 947 | can define documentation groups in your Lisp package in a way such that | ||
| 948 | users of different Emacs versions can equally well use these groups. | ||
| 949 | |||
| 950 | @itemize @bullet | ||
| 951 | @item | ||
| 952 | To define documentation groups for your own Lisp package across | ||
| 953 | different Emacs versions, you can use a boilerplate template along the | ||
| 954 | lines of the following to make your package compile and load without | ||
| 955 | errors: | ||
| 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 | ||
| 992 | If you do not intend to support some of the Emacs versions mentioned | ||
| 993 | above, you can safely omit the corresponding forms from the template. | ||
| 994 | If you intend to support only Emacs 31 and newer, you do not need any | ||
| 995 | of the above and can just use @code{define-short-documentation-group}. | ||
| 996 | |||
| 997 | @item | ||
| 998 | @cindex documentation group keywords, compatibility | ||
| 999 | Newer Emacs versions might introduce newer documentation group features | ||
| 1000 | and keywords. However, these features or keywords will never break the | ||
| 1001 | display of a documentation group in older Emacs versions. Suppose you | ||
| 1002 | use a hypothetical group keyword @code{:super-pretty-print}, available | ||
| 1003 | in 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 | |||
| 1015 | That future Emacs version will then supposedly super-pretty-print the | ||
| 1016 | example for function @code{well-doc-foo}. Older Emacs versions will | ||
| 1017 | silently ignore keyword @code{:super-pretty-print} and show the example | ||
| 1018 | according 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 |
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index b75a037f78b..23b6dce2ec6 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi | |||
| @@ -6728,6 +6728,45 @@ See the docstring of variable @code{tramp-methods} for possible | |||
| 6728 | @code{foo-tramp-executable} in this example would be a Lisp constant, | 6728 | @code{foo-tramp-executable} in this example would be a Lisp constant, |
| 6729 | which is the program name of @command{foo}. | 6729 | which is the program name of @command{foo}. |
| 6730 | 6730 | ||
| 6731 | If a parameter doesn't have a static value but must be computed at | ||
| 6732 | runtime, a format specifier can be used, like @t{"%h"} in the example | ||
| 6733 | above. See the docstring of @code{tramp-methods}, which patterns are | ||
| 6734 | expanded in which parameter. Furthermore, other format specifiers can | ||
| 6735 | be added via the variable @code{tramp-extra-expand-args}. | ||
| 6736 | |||
| 6737 | The following parameters expand format specifiers for the | ||
| 6738 | @code{tramp-sh} backend: @code{tramp-copy-args}, | ||
| 6739 | @code{tramp-copy-env}, @code{tramp-copy-file-name}, | ||
| 6740 | @code{tramp-login-args}, @code{tramp-login-program}, | ||
| 6741 | @code{tramp-remote-copy-args}. | ||
| 6742 | |||
| 6743 | The example above could use | ||
| 6744 | |||
| 6745 | @lisp | ||
| 6746 | (tramp-login-program "%1") | ||
| 6747 | @end lisp | ||
| 6748 | |||
| 6749 | And you could set @code{tramp-extra-expand-args} as connection-local value: | ||
| 6750 | |||
| 6751 | @lisp | ||
| 6752 | @group | ||
| 6753 | (defun foo-tramp-get-login-program (vec) | ||
| 6754 | "Return connection-local value of `tramp-login-program'." | ||
| 6755 | @dots{}) | ||
| 6756 | @end group | ||
| 6757 | |||
| 6758 | @group | ||
| 6759 | (connection-local-set-profile-variables | ||
| 6760 | 'foo-tramp-connection-local-default-profile | ||
| 6761 | '((tramp-extra-expand-args | ||
| 6762 | ?1 (foo-tramp-get-login-program (car tramp-current-connection))))) | ||
| 6763 | |||
| 6764 | (connection-local-set-profiles | ||
| 6765 | '(:application tramp :protocol "foo") | ||
| 6766 | foo-tramp-connection-local-default-profile) | ||
| 6767 | @end group | ||
| 6768 | @end lisp | ||
| 6769 | |||
| 6731 | Another initialization could tell @value{tramp} which are the default | 6770 | Another initialization could tell @value{tramp} which are the default |
| 6732 | user and host name for method @option{foo}. This is done by calling | 6771 | user and host name for method @option{foo}. This is done by calling |
| 6733 | @code{tramp-set-completion-function}: | 6772 | @code{tramp-set-completion-function}: |