summaryrefslogtreecommitdiff
path: root/doc/emacs/custom.texi
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-02-13 16:29:26 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2022-02-13 16:29:26 +0100
commit997dd86a9f6a253e4542d65b17dfec6af2f4e8fd (patch)
tree446bf645ed4c341bf4fd237fbdd3812897c20562 /doc/emacs/custom.texi
parent68b32732140606a1eddce82f50733c549a40900a (diff)
downloademacs-997dd86a9f6a253e4542d65b17dfec6af2f4e8fd.tar.gz
emacs-997dd86a9f6a253e4542d65b17dfec6af2f4e8fd.tar.bz2
emacs-997dd86a9f6a253e4542d65b17dfec6af2f4e8fd.zip
Add a new macro `setopt'
* doc/emacs/custom.texi (Examining): Mention it. (Init Syntax): Ditto. * doc/emacs/windows.texi (Window Choice): Adjust example. * doc/lispref/windows.texi (Choosing Window Options): Adjust examples. * doc/lispref/variables.texi (Setting Variables): Document setopt. * doc/misc/eudc.texi (Emacs-only Configuration): Adjust examples. * lisp/cus-edit.el (setopt): New macro.
Diffstat (limited to 'doc/emacs/custom.texi')
-rw-r--r--doc/emacs/custom.texi21
1 files changed, 18 insertions, 3 deletions
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index b2dd5eb6980..c4f112d6683 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -844,6 +844,21 @@ otherwise stated, affects only the current Emacs session. The only
way to alter the variable in future sessions is to put something in
your initialization file (@pxref{Init File}).
+ If you're setting a customizable variable in your initialization
+file, and you don't want to use the Customize interface, you can use
+the @code{setopt} macro. For instance:
+
+@findex setopt
+@example
+(setopt fill-column 75)
+@end example
+
+This works the same as @code{setq}, but if the variable has any
+special setter functions, they will be run automatically when using
+@code{setopt}. You can also use @code{setopt} on other,
+non-customizable variables, but this is less efficient than using
+@code{setq}.
+
@node Hooks
@subsection Hooks
@cindex hook
@@ -2338,8 +2353,8 @@ mode when you set them with Customize, but ordinary @code{setq} won't
do that; to enable the mode in your init file, call the minor mode
command. Finally, a few customizable user options are initialized in
complex ways, and these have to be set either via the customize
-interface (@pxref{Customization}) or by using
-@code{customize-set-variable} (@pxref{Examining}).
+interface (@pxref{Customization}), or by using
+@code{customize-set-variable}/@code{setopt} (@pxref{Examining}).
The second argument to @code{setq} is an expression for the new
value of the variable. This can be a constant, a variable, or a
@@ -2492,7 +2507,7 @@ Change the coding system used when using the clipboard
(@pxref{Communication Coding}).
@example
-(customize-set-variable 'selection-coding-system 'utf-8)
+(setopt selection-coding-system 'utf-8)
@end example
@item