diff options
| author | Glenn Morris | 2020-04-20 07:50:19 -0700 |
|---|---|---|
| committer | Glenn Morris | 2020-04-20 07:50:19 -0700 |
| commit | 477b9eaf45da1ebc4f2117d69df3571f0bf61e47 (patch) | |
| tree | 4600314923713c339c41cd450f50e64c3f16a8aa /doc | |
| parent | 80f04b5d7c817977a365a999693443c4e04e5223 (diff) | |
| parent | 05089a4d65831c5e873956f5f2d92a3d5672d405 (diff) | |
| download | emacs-477b9eaf45da1ebc4f2117d69df3571f0bf61e47.tar.gz emacs-477b9eaf45da1ebc4f2117d69df3571f0bf61e47.zip | |
Merge from origin/emacs-27
05089a4d65 (origin/emacs-27) Tweak wording re constant variables
a1040861f1 Tweak setcar-related wording
751510f865 * lisp/image-mode.el: Add prefix key 's' and reduce depend...
9261a219ec * doc/emacs/windows.texi (Window Convenience): Decribe mor...
e1d42da0d6 Fix mutability glitches reported by Drew Adams
5805df74f5 Improve mutability doc
dca35b31d0 Improve mutability documentation
81e7d7f111 Document that quoting yields constants
5734339f40 * doc/lispref/keymaps.texi (Extended Menu Items, Easy Menu...
14a570afae Remove #' and function quoting from lambda forms in manual
d5ec18c66b * src/regex-emacs.c (re_match_2_internal): Rework comment ...
4df8a61117 Add new node "Image Mode" to Emacs Manual.
d7d5ee6c57 ; Fix a typo in cmdargs.texi (bug#40701)
5e9db48fbe * doc/lispref/display.texi (Customizing Bitmaps): Fix typo.
eebfb72c90 Document constant vs mutable objects better
6c187ed6b0 Improve documentation of 'sort-lines'
52288f4b66 Mention 'spam-stat-process-directory-age' in the documenta...
067b070598 ; Fix some typos and doc issues (bug#40695)
# Conflicts:
# etc/NEWS
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/emacs/cmdargs.texi | 2 | ||||
| -rw-r--r-- | doc/emacs/dired.texi | 3 | ||||
| -rw-r--r-- | doc/emacs/emacs.texi | 3 | ||||
| -rw-r--r-- | doc/emacs/files.texi | 9 | ||||
| -rw-r--r-- | doc/emacs/fixit.texi | 30 | ||||
| -rw-r--r-- | doc/emacs/frames.texi | 5 | ||||
| -rw-r--r-- | doc/emacs/misc.texi | 2 | ||||
| -rw-r--r-- | doc/emacs/windows.texi | 20 | ||||
| -rw-r--r-- | doc/lispintro/emacs-lisp-intro.texi | 32 | ||||
| -rw-r--r-- | doc/lispref/abbrevs.texi | 6 | ||||
| -rw-r--r-- | doc/lispref/backups.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 6 | ||||
| -rw-r--r-- | doc/lispref/edebug.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/elisp.texi | 1 | ||||
| -rw-r--r-- | doc/lispref/eval.texi | 15 | ||||
| -rw-r--r-- | doc/lispref/functions.texi | 4 | ||||
| -rw-r--r-- | doc/lispref/help.texi | 56 | ||||
| -rw-r--r-- | doc/lispref/keymaps.texi | 33 | ||||
| -rw-r--r-- | doc/lispref/lists.texi | 68 | ||||
| -rw-r--r-- | doc/lispref/objects.texi | 48 | ||||
| -rw-r--r-- | doc/lispref/os.texi | 2 | ||||
| -rw-r--r-- | doc/lispref/sequences.texi | 51 | ||||
| -rw-r--r-- | doc/lispref/strings.texi | 18 | ||||
| -rw-r--r-- | doc/lispref/syntax.texi | 6 | ||||
| -rw-r--r-- | doc/lispref/text.texi | 13 | ||||
| -rw-r--r-- | doc/misc/gnus.texi | 7 |
26 files changed, 279 insertions, 165 deletions
diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi index 9303b0b8dd1..2c131165244 100644 --- a/doc/emacs/cmdargs.texi +++ b/doc/emacs/cmdargs.texi | |||
| @@ -340,7 +340,7 @@ initialization file (@pxref{Resources}). | |||
| 340 | @opindex --quick | 340 | @opindex --quick |
| 341 | Start Emacs with minimum customizations. This is similar to using | 341 | Start Emacs with minimum customizations. This is similar to using |
| 342 | @samp{-q}, @samp{--no-site-file}, @samp{--no-site-lisp}, | 342 | @samp{-q}, @samp{--no-site-file}, @samp{--no-site-lisp}, |
| 343 | @samp{--no-x-resources}, and @samp{--no-splash} together.. | 343 | @samp{--no-x-resources}, and @samp{--no-splash} together. |
| 344 | 344 | ||
| 345 | @item -daemon | 345 | @item -daemon |
| 346 | @opindex -daemon | 346 | @opindex -daemon |
diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi index fba4389094f..d5144141803 100644 --- a/doc/emacs/dired.texi +++ b/doc/emacs/dired.texi | |||
| @@ -1416,7 +1416,8 @@ C-c}. | |||
| 1416 | 1416 | ||
| 1417 | Image-Dired is a facility for browsing image files. It provides viewing | 1417 | Image-Dired is a facility for browsing image files. It provides viewing |
| 1418 | the images either as thumbnails or in full size, either inside Emacs | 1418 | the images either as thumbnails or in full size, either inside Emacs |
| 1419 | or through an external viewer. | 1419 | or through an external viewer. This is different from Image mode |
| 1420 | (@pxref{Image Mode}) for visiting an image file in the Emacs buffer. | ||
| 1420 | 1421 | ||
| 1421 | @kindex C-t d @r{(Image-Dired)} | 1422 | @kindex C-t d @r{(Image-Dired)} |
| 1422 | @findex image-dired-display-thumbs | 1423 | @findex image-dired-display-thumbs |
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 6ef4ca63ae7..60f2be9a513 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi | |||
| @@ -455,7 +455,8 @@ File Handling | |||
| 455 | * Remote Files:: Accessing files on other machines. | 455 | * Remote Files:: Accessing files on other machines. |
| 456 | * Quoted File Names:: Quoting special characters in file names. | 456 | * Quoted File Names:: Quoting special characters in file names. |
| 457 | * File Name Cache:: Completion against a list of files you often use. | 457 | * File Name Cache:: Completion against a list of files you often use. |
| 458 | * File Conveniences:: Convenience Features for Finding Files. | 458 | * File Conveniences:: Convenience features for finding files. |
| 459 | * Image Mode:: Viewing image files. | ||
| 459 | * Filesets:: Handling sets of files. | 460 | * Filesets:: Handling sets of files. |
| 460 | 461 | ||
| 461 | Saving Files | 462 | Saving Files |
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index a89b16b3f6d..7d57555ce33 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi | |||
| @@ -38,7 +38,8 @@ on file directories. | |||
| 38 | * Remote Files:: Accessing files on other machines. | 38 | * Remote Files:: Accessing files on other machines. |
| 39 | * Quoted File Names:: Quoting special characters in file names. | 39 | * Quoted File Names:: Quoting special characters in file names. |
| 40 | * File Name Cache:: Completion against a list of files you often use. | 40 | * File Name Cache:: Completion against a list of files you often use. |
| 41 | * File Conveniences:: Convenience Features for Finding Files. | 41 | * File Conveniences:: Convenience features for finding files. |
| 42 | * Image Mode:: Viewing image files. | ||
| 42 | * Filesets:: Handling sets of files. | 43 | * Filesets:: Handling sets of files. |
| 43 | @end menu | 44 | @end menu |
| 44 | 45 | ||
| @@ -2088,8 +2089,7 @@ of the cache with the @code{file-cache-display} command. | |||
| 2088 | @section Convenience Features for Finding Files | 2089 | @section Convenience Features for Finding Files |
| 2089 | 2090 | ||
| 2090 | In this section, we introduce some convenient facilities for finding | 2091 | In this section, we introduce some convenient facilities for finding |
| 2091 | recently-opened files, reading file names from a buffer, and viewing | 2092 | recently-opened files, reading file names from a buffer. |
| 2092 | image files. | ||
| 2093 | 2093 | ||
| 2094 | @findex recentf-mode | 2094 | @findex recentf-mode |
| 2095 | @vindex recentf-mode | 2095 | @vindex recentf-mode |
| @@ -2108,6 +2108,9 @@ point. Partial Completion mode offers other features extending | |||
| 2108 | @code{find-file}, which can be used with @code{ffap}. | 2108 | @code{find-file}, which can be used with @code{ffap}. |
| 2109 | @xref{Completion Options}. | 2109 | @xref{Completion Options}. |
| 2110 | 2110 | ||
| 2111 | @node Image Mode | ||
| 2112 | @section Viewing Image Files | ||
| 2113 | |||
| 2111 | @findex image-mode | 2114 | @findex image-mode |
| 2112 | @findex image-toggle-display | 2115 | @findex image-toggle-display |
| 2113 | @findex image-next-file | 2116 | @findex image-next-file |
diff --git a/doc/emacs/fixit.texi b/doc/emacs/fixit.texi index 2c268f14fb7..5046146dda6 100644 --- a/doc/emacs/fixit.texi +++ b/doc/emacs/fixit.texi | |||
| @@ -204,8 +204,8 @@ sentences and paragraphs, respectively. These commands work like | |||
| 204 | A numeric argument to a transpose command serves as a repeat count: it | 204 | A numeric argument to a transpose command serves as a repeat count: it |
| 205 | tells the transpose command to move the character (or word or | 205 | tells the transpose command to move the character (or word or |
| 206 | expression or line) before or containing point across several other | 206 | expression or line) before or containing point across several other |
| 207 | characters (or words or expressions or lines). For example, @kbd{C-u | 207 | characters (or words or expressions or lines). For example, @w{@kbd{C-u |
| 208 | 3 C-t} moves the character before point forward across three other | 208 | 3 C-t}} moves the character before point forward across three other |
| 209 | characters. It would change @samp{f@point{}oobar} into | 209 | characters. It would change @samp{f@point{}oobar} into |
| 210 | @samp{oobf@point{}ar}. This is equivalent to repeating @kbd{C-t} | 210 | @samp{oobf@point{}ar}. This is equivalent to repeating @kbd{C-t} |
| 211 | three times. @kbd{C-u - 4 M-t} moves the word before point backward | 211 | three times. @kbd{C-u - 4 M-t} moves the word before point backward |
| @@ -307,10 +307,10 @@ region; @pxref{Disabled Transient Mark}.) | |||
| 307 | @cindex spell-checking the active region | 307 | @cindex spell-checking the active region |
| 308 | Similarly, the command @kbd{M-x ispell} performs spell-checking in | 308 | Similarly, the command @kbd{M-x ispell} performs spell-checking in |
| 309 | the region if one is active, or in the entire buffer otherwise. The | 309 | the region if one is active, or in the entire buffer otherwise. The |
| 310 | commands @kbd{M-x ispell-buffer} and @kbd{M-x ispell-region} | 310 | commands @w{@kbd{M-x ispell-buffer}} and @w{@kbd{M-x ispell-region}} |
| 311 | explicitly perform spell-checking on the entire buffer or the region | 311 | explicitly perform spell-checking on the entire buffer or the region |
| 312 | respectively. To check spelling in an email message you are writing, | 312 | respectively. To check spelling in an email message you are writing, |
| 313 | use @kbd{M-x ispell-message}; that command checks the whole buffer, | 313 | use @w{@kbd{M-x ispell-message}}; that command checks the whole buffer, |
| 314 | except for material that is indented or appears to be cited from other | 314 | except for material that is indented or appears to be cited from other |
| 315 | messages. @xref{Sending Mail}. | 315 | messages. @xref{Sending Mail}. |
| 316 | 316 | ||
| @@ -368,8 +368,8 @@ wildcard. | |||
| 368 | @item C-g | 368 | @item C-g |
| 369 | @itemx X | 369 | @itemx X |
| 370 | Quit interactive spell-checking, leaving point at the word that was | 370 | Quit interactive spell-checking, leaving point at the word that was |
| 371 | being checked. You can restart checking again afterward with @kbd{C-u | 371 | being checked. You can restart checking again afterward with @w{@kbd{C-u |
| 372 | M-$}. | 372 | M-$}}. |
| 373 | 373 | ||
| 374 | @item x | 374 | @item x |
| 375 | Quit interactive spell-checking and move point back to where it was | 375 | Quit interactive spell-checking and move point back to where it was |
| @@ -387,8 +387,8 @@ Show the list of options. | |||
| 387 | (@code{ispell-complete-word}) performs in-buffer completion based on | 387 | (@code{ispell-complete-word}) performs in-buffer completion based on |
| 388 | spelling correction. Insert the beginning of a word, and then type | 388 | spelling correction. Insert the beginning of a word, and then type |
| 389 | @kbd{M-@key{TAB}}; this shows a list of completions. (If your | 389 | @kbd{M-@key{TAB}}; this shows a list of completions. (If your |
| 390 | window manager intercepts @kbd{M-@key{TAB}}, type @kbd{@key{ESC} | 390 | window manager intercepts @kbd{M-@key{TAB}}, type @w{@kbd{@key{ESC} |
| 391 | @key{TAB}} or @kbd{C-M-i}.) Each completion is listed with a digit or | 391 | @key{TAB}}} or @kbd{C-M-i}.) Each completion is listed with a digit or |
| 392 | character; type that digit or character to choose it. | 392 | character; type that digit or character to choose it. |
| 393 | 393 | ||
| 394 | @cindex @code{ispell} program | 394 | @cindex @code{ispell} program |
| @@ -396,7 +396,7 @@ character; type that digit or character to choose it. | |||
| 396 | Once started, the spell-checker subprocess continues | 396 | Once started, the spell-checker subprocess continues |
| 397 | to run, waiting for something to do, so that subsequent spell-checking | 397 | to run, waiting for something to do, so that subsequent spell-checking |
| 398 | commands complete more quickly. If you want to get rid of the | 398 | commands complete more quickly. If you want to get rid of the |
| 399 | process, use @kbd{M-x ispell-kill-ispell}. This is not usually | 399 | process, use @w{@kbd{M-x ispell-kill-ispell}}. This is not usually |
| 400 | necessary, since the process uses no processor time except when you do | 400 | necessary, since the process uses no processor time except when you do |
| 401 | spelling correction. | 401 | spelling correction. |
| 402 | 402 | ||
| @@ -409,7 +409,7 @@ the standard dictionary and your personal dictionary. The standard | |||
| 409 | dictionary is specified by the variable @code{ispell-local-dictionary} | 409 | dictionary is specified by the variable @code{ispell-local-dictionary} |
| 410 | or, if that is @code{nil}, by the variable @code{ispell-dictionary}. | 410 | or, if that is @code{nil}, by the variable @code{ispell-dictionary}. |
| 411 | If both are @code{nil}, the spelling program's default dictionary is | 411 | If both are @code{nil}, the spelling program's default dictionary is |
| 412 | used. The command @kbd{M-x ispell-change-dictionary} sets the | 412 | used. The command @w{@kbd{M-x ispell-change-dictionary}} sets the |
| 413 | standard dictionary for the buffer and then restarts the subprocess, | 413 | standard dictionary for the buffer and then restarts the subprocess, |
| 414 | so that it will use a different standard dictionary. Your personal | 414 | so that it will use a different standard dictionary. Your personal |
| 415 | dictionary is specified by the variable | 415 | dictionary is specified by the variable |
| @@ -431,8 +431,8 @@ dictionary. | |||
| 431 | @findex flyspell-mode | 431 | @findex flyspell-mode |
| 432 | Flyspell mode is a minor mode that performs automatic spell-checking | 432 | Flyspell mode is a minor mode that performs automatic spell-checking |
| 433 | of the text you type as you type it. When it finds a word that it | 433 | of the text you type as you type it. When it finds a word that it |
| 434 | does not recognize, it highlights that word. Type @kbd{M-x | 434 | does not recognize, it highlights that word. Type @w{@kbd{M-x |
| 435 | flyspell-mode} to toggle Flyspell mode in the current buffer. To | 435 | flyspell-mode}} to toggle Flyspell mode in the current buffer. To |
| 436 | enable Flyspell mode in all text mode buffers, add | 436 | enable Flyspell mode in all text mode buffers, add |
| 437 | @code{flyspell-mode} to @code{text-mode-hook}. @xref{Hooks}. Note | 437 | @code{flyspell-mode} to @code{text-mode-hook}. @xref{Hooks}. Note |
| 438 | that, as Flyspell mode needs to check each word across which you move, | 438 | that, as Flyspell mode needs to check each word across which you move, |
| @@ -448,14 +448,14 @@ it with @kbd{mouse-2} (@code{flyspell-correct-word}) to display a menu | |||
| 448 | of possible corrections and actions. In addition, @kbd{C-.} or | 448 | of possible corrections and actions. In addition, @kbd{C-.} or |
| 449 | @kbd{@key{ESC}-@key{TAB}} (@code{flyspell-auto-correct-word}) will | 449 | @kbd{@key{ESC}-@key{TAB}} (@code{flyspell-auto-correct-word}) will |
| 450 | propose various successive corrections for the word at point, and | 450 | propose various successive corrections for the word at point, and |
| 451 | @kbd{C-c $} (@code{flyspell-correct-word-before-point}) will pop up a | 451 | @w{@kbd{C-c $}} (@code{flyspell-correct-word-before-point}) will pop up a |
| 452 | menu of possible corrections. Of course, you can always correct the | 452 | menu of possible corrections. Of course, you can always correct the |
| 453 | misspelled word by editing it manually in any way you like. | 453 | misspelled word by editing it manually in any way you like. |
| 454 | 454 | ||
| 455 | @findex flyspell-prog-mode | 455 | @findex flyspell-prog-mode |
| 456 | Flyspell Prog mode works just like ordinary Flyspell mode, except | 456 | Flyspell Prog mode works just like ordinary Flyspell mode, except |
| 457 | that it only checks words in comments and string constants. This | 457 | that it only checks words in comments and string constants. This |
| 458 | feature is useful for editing programs. Type @kbd{M-x | 458 | feature is useful for editing programs. Type @w{@kbd{M-x |
| 459 | flyspell-prog-mode} to enable or disable this mode in the current | 459 | flyspell-prog-mode}} to enable or disable this mode in the current |
| 460 | buffer. To enable this mode in all programming mode buffers, add | 460 | buffer. To enable this mode in all programming mode buffers, add |
| 461 | @code{flyspell-prog-mode} to @code{prog-mode-hook} (@pxref{Hooks}). | 461 | @code{flyspell-prog-mode} to @code{prog-mode-hook} (@pxref{Hooks}). |
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index 7a583b96bbd..94218424d37 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi | |||
| @@ -227,8 +227,9 @@ left. If you'd like to reverse the direction of horizontal scrolling, | |||
| 227 | customize the variable @code{mouse-wheel-flip-direction} to a | 227 | customize the variable @code{mouse-wheel-flip-direction} to a |
| 228 | non-@code{nil} value. | 228 | non-@code{nil} value. |
| 229 | 229 | ||
| 230 | When the mouse pointer is over an image, scrolling the mouse wheel | 230 | When the mouse pointer is over an image in Image mode, @pxref{Image Mode}, |
| 231 | with the @key{Ctrl} modifier scales the image under the mouse pointer. | 231 | scrolling the mouse wheel with the @key{Ctrl} modifier scales the image |
| 232 | under the mouse pointer. | ||
| 232 | 233 | ||
| 233 | 234 | ||
| 234 | @node Word and Line Mouse | 235 | @node Word and Line Mouse |
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 294430aa183..a15aa17a66f 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi | |||
| @@ -2883,7 +2883,7 @@ if there is an active region (@pxref{Mark}), the default URL comes | |||
| 2883 | from the region instead, after removing any whitespace from it. The | 2883 | from the region instead, after removing any whitespace from it. The |
| 2884 | command then creates a new buffer with the embedded browser showing | 2884 | command then creates a new buffer with the embedded browser showing |
| 2885 | the specified URL. The buffer is put in the Xwidget-WebKit mode | 2885 | the specified URL. The buffer is put in the Xwidget-WebKit mode |
| 2886 | (similar to Image mode, @pxref{File Conveniences}), which provides | 2886 | (similar to Image mode, @pxref{Image Mode}), which provides |
| 2887 | one-key commands for scrolling the widget, changing its size, and | 2887 | one-key commands for scrolling the widget, changing its size, and |
| 2888 | reloading it. Type @w{@kbd{C-h b}} in that buffer to see the key | 2888 | reloading it. Type @w{@kbd{C-h b}} in that buffer to see the key |
| 2889 | bindings. | 2889 | bindings. |
diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi index 2e07a98f57d..910ef8fd88d 100644 --- a/doc/emacs/windows.texi +++ b/doc/emacs/windows.texi | |||
| @@ -586,13 +586,25 @@ buffer. @xref{Follow Mode}. | |||
| 586 | @cindex directional window selection | 586 | @cindex directional window selection |
| 587 | @findex windmove-right | 587 | @findex windmove-right |
| 588 | @findex windmove-default-keybindings | 588 | @findex windmove-default-keybindings |
| 589 | @findex windmove-display-default-keybindings | ||
| 590 | @findex windmove-delete-default-keybindings | ||
| 591 | @findex windmove-swap-states-in-direction | ||
| 589 | The Windmove package defines commands for moving directionally | 592 | The Windmove package defines commands for moving directionally |
| 590 | between neighboring windows in a frame. @kbd{M-x windmove-right} | 593 | between neighboring windows in a frame. @kbd{M-x windmove-right} |
| 591 | selects the window immediately to the right of the currently selected | 594 | selects the window immediately to the right of the currently selected |
| 592 | one, and similarly for the left, up, and down | 595 | one, and similarly for the left, up, and down counterparts. |
| 593 | counterparts. @w{@kbd{M-x windmove-default-keybindings}} binds these | 596 | @w{@kbd{M-x windmove-default-keybindings}} binds these commands to |
| 594 | commands to @kbd{S-right} etc.; doing so disables shift selection for | 597 | @kbd{S-right} etc.; doing so disables shift selection for those keys |
| 595 | those keys (@pxref{Shift Selection}). | 598 | (@pxref{Shift Selection}). In the same way as keybindings can be |
| 599 | defined for commands that select windows directionally, you can use | ||
| 600 | @w{@kbd{M-x windmove-display-default-keybindings}} to define | ||
| 601 | keybindings for commands that specify in what direction to display the | ||
| 602 | window for the buffer that the next command is going to display. | ||
| 603 | Also there is @w{@kbd{M-x windmove-delete-default-keybindings}} to | ||
| 604 | define keybindings for commands that delete windows directionally, and | ||
| 605 | @w{@kbd{M-x windmove-swap-states-in-direction}} that define | ||
| 606 | keybindings for commands that swap the window contents of the selected | ||
| 607 | window with the window in the specified direction. | ||
| 596 | 608 | ||
| 597 | The command @kbd{M-x compare-windows} lets you compare the text | 609 | The command @kbd{M-x compare-windows} lets you compare the text |
| 598 | shown in different windows. @xref{Comparing Files}. | 610 | shown in different windows. @xref{Comparing Files}. |
diff --git a/doc/lispintro/emacs-lisp-intro.texi b/doc/lispintro/emacs-lisp-intro.texi index 1726936de10..7484ce57607 100644 --- a/doc/lispintro/emacs-lisp-intro.texi +++ b/doc/lispintro/emacs-lisp-intro.texi | |||
| @@ -2329,7 +2329,7 @@ area. | |||
| 2329 | 2329 | ||
| 2330 | @cindex @samp{bind} defined | 2330 | @cindex @samp{bind} defined |
| 2331 | There are several ways by which a variable can be given a value. One of | 2331 | There are several ways by which a variable can be given a value. One of |
| 2332 | the ways is to use either the function @code{set} or the function | 2332 | the ways is to use either the function @code{set} or the special form |
| 2333 | @code{setq}. Another way is to use @code{let} (@pxref{let}). (The | 2333 | @code{setq}. Another way is to use @code{let} (@pxref{let}). (The |
| 2334 | jargon for this process is to @dfn{bind} a variable to a value.) | 2334 | jargon for this process is to @dfn{bind} a variable to a value.) |
| 2335 | 2335 | ||
| @@ -4517,7 +4517,7 @@ number; it will be printed as the character with that @sc{ascii} code. | |||
| 4517 | 4517 | ||
| 4518 | @item setq | 4518 | @item setq |
| 4519 | @itemx set | 4519 | @itemx set |
| 4520 | The @code{setq} function sets the value of its first argument to the | 4520 | The @code{setq} special form sets the value of its first argument to the |
| 4521 | value of the second argument. The first argument is automatically | 4521 | value of the second argument. The first argument is automatically |
| 4522 | quoted by @code{setq}. It does the same for succeeding pairs of | 4522 | quoted by @code{setq}. It does the same for succeeding pairs of |
| 4523 | arguments. Another function, @code{set}, takes only two arguments and | 4523 | arguments. Another function, @code{set}, takes only two arguments and |
| @@ -7317,11 +7317,21 @@ which leave the original list as it was. One way to find out how this | |||
| 7317 | works is to experiment. We will start with the @code{setcar} function. | 7317 | works is to experiment. We will start with the @code{setcar} function. |
| 7318 | 7318 | ||
| 7319 | @need 1200 | 7319 | @need 1200 |
| 7320 | @cindex constant lists | ||
| 7321 | @cindex mutable lists | ||
| 7320 | First, we can make a list and then set the value of a variable to the | 7322 | First, we can make a list and then set the value of a variable to the |
| 7321 | list, using the @code{setq} function. Here is a list of animals: | 7323 | list, using the @code{setq} special form. Because we intend to use |
| 7324 | @code{setcar} to change the list, this @code{setq} should not use the | ||
| 7325 | quoted form @code{'(antelope giraffe lion tiger)}, as that would yield | ||
| 7326 | a list that is part of the program and bad things could happen if we | ||
| 7327 | tried to change part of the program while running it. Generally | ||
| 7328 | speaking an Emacs Lisp program's components should be constant (or | ||
| 7329 | unchanged) while the program is running. So we instead construct an | ||
| 7330 | animal list that is @dfn{mutable} (or changeable) by using the | ||
| 7331 | @code{list} function, as follows: | ||
| 7322 | 7332 | ||
| 7323 | @smallexample | 7333 | @smallexample |
| 7324 | (setq animals '(antelope giraffe lion tiger)) | 7334 | (setq animals (list 'antelope 'giraffe 'lion 'tiger)) |
| 7325 | @end smallexample | 7335 | @end smallexample |
| 7326 | 7336 | ||
| 7327 | @noindent | 7337 | @noindent |
| @@ -7398,7 +7408,7 @@ To see how this works, set the value of the variable to a list of | |||
| 7398 | domesticated animals by evaluating the following expression: | 7408 | domesticated animals by evaluating the following expression: |
| 7399 | 7409 | ||
| 7400 | @smallexample | 7410 | @smallexample |
| 7401 | (setq domesticated-animals '(horse cow sheep goat)) | 7411 | (setq domesticated-animals (list 'horse 'cow 'sheep 'goat)) |
| 7402 | @end smallexample | 7412 | @end smallexample |
| 7403 | 7413 | ||
| 7404 | @need 1200 | 7414 | @need 1200 |
| @@ -8846,7 +8856,7 @@ and then find the value of @code{trees}: | |||
| 8846 | 8856 | ||
| 8847 | @smallexample | 8857 | @smallexample |
| 8848 | @group | 8858 | @group |
| 8849 | (setq trees '(maple oak pine birch)) | 8859 | (setq trees (list 'maple 'oak 'pine 'birch)) |
| 8850 | @result{} (maple oak pine birch) | 8860 | @result{} (maple oak pine birch) |
| 8851 | @end group | 8861 | @end group |
| 8852 | 8862 | ||
| @@ -9366,7 +9376,7 @@ For example: | |||
| 9366 | 9376 | ||
| 9367 | @smallexample | 9377 | @smallexample |
| 9368 | @group | 9378 | @group |
| 9369 | (setq triple '(1 2 3)) | 9379 | (setq triple (list 1 2 3)) |
| 9370 | 9380 | ||
| 9371 | (setcar triple '37) | 9381 | (setcar triple '37) |
| 9372 | 9382 | ||
| @@ -9547,7 +9557,7 @@ part of which is the address of the next pair. The very last box | |||
| 9547 | points to the symbol @code{nil}, which marks the end of the list. | 9557 | points to the symbol @code{nil}, which marks the end of the list. |
| 9548 | 9558 | ||
| 9549 | @need 1200 | 9559 | @need 1200 |
| 9550 | When a variable is set to a list with a function such as @code{setq}, | 9560 | When a variable is set to a list with an operation such as @code{setq}, |
| 9551 | it stores the address of the first box in the variable. Thus, | 9561 | it stores the address of the first box in the variable. Thus, |
| 9552 | evaluation of the expression | 9562 | evaluation of the expression |
| 9553 | 9563 | ||
| @@ -17092,7 +17102,7 @@ reminders. | |||
| 17092 | 17102 | ||
| 17093 | @cindex Mail aliases | 17103 | @cindex Mail aliases |
| 17094 | @noindent | 17104 | @noindent |
| 17095 | This @code{setq} command sets the value of the variable | 17105 | This @code{setq} sets the value of the variable |
| 17096 | @code{mail-aliases} to @code{t}. Since @code{t} means true, the line | 17106 | @code{mail-aliases} to @code{t}. Since @code{t} means true, the line |
| 17097 | says, in effect, ``Yes, use mail aliases.'' | 17107 | says, in effect, ``Yes, use mail aliases.'' |
| 17098 | 17108 | ||
| @@ -17130,8 +17140,8 @@ The following turns off Indent Tabs mode: | |||
| 17130 | @end smallexample | 17140 | @end smallexample |
| 17131 | 17141 | ||
| 17132 | Note that this line uses @code{setq-default} rather than the | 17142 | Note that this line uses @code{setq-default} rather than the |
| 17133 | @code{setq} command that we have seen before. The @code{setq-default} | 17143 | @code{setq} that we have seen before; @code{setq-default} |
| 17134 | command sets values only in buffers that do not have their own local | 17144 | sets values only in buffers that do not have their own local |
| 17135 | values for the variable. | 17145 | values for the variable. |
| 17136 | 17146 | ||
| 17137 | @ifinfo | 17147 | @ifinfo |
diff --git a/doc/lispref/abbrevs.texi b/doc/lispref/abbrevs.texi index 6689b560c78..575be187d3f 100644 --- a/doc/lispref/abbrevs.texi +++ b/doc/lispref/abbrevs.texi | |||
| @@ -370,9 +370,9 @@ definitions of @code{local-abbrev-table} and @code{text-mode-abbrev-table}. | |||
| 370 | (funcall expand)))) | 370 | (funcall expand)))) |
| 371 | 371 | ||
| 372 | (add-hook 'foo-mode-hook | 372 | (add-hook 'foo-mode-hook |
| 373 | #'(lambda () | 373 | (lambda () |
| 374 | (add-function :around (local 'abbrev-expand-function) | 374 | (add-function :around (local 'abbrev-expand-function) |
| 375 | #'foo-mode-abbrev-expand-function))) | 375 | #'foo-mode-abbrev-expand-function))) |
| 376 | @end smallexample | 376 | @end smallexample |
| 377 | 377 | ||
| 378 | @node Standard Abbrev Tables | 378 | @node Standard Abbrev Tables |
diff --git a/doc/lispref/backups.texi b/doc/lispref/backups.texi index b7318a99b8f..4ed1a10fcf6 100644 --- a/doc/lispref/backups.texi +++ b/doc/lispref/backups.texi | |||
| @@ -807,7 +807,7 @@ If you just want to automatically auto-revert every | |||
| 807 | 807 | ||
| 808 | @example | 808 | @example |
| 809 | (setq-local buffer-stale-function | 809 | (setq-local buffer-stale-function |
| 810 | #'(lambda (&optional noconfirm) 'fast)) | 810 | (lambda (&optional noconfirm) 'fast)) |
| 811 | @end example | 811 | @end example |
| 812 | 812 | ||
| 813 | @noindent | 813 | @noindent |
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 132a3c85354..e01cfedc4b8 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -4358,7 +4358,7 @@ height. | |||
| 4358 | @end defun | 4358 | @end defun |
| 4359 | 4359 | ||
| 4360 | @defun destroy-fringe-bitmap bitmap | 4360 | @defun destroy-fringe-bitmap bitmap |
| 4361 | This function destroy the fringe bitmap identified by @var{bitmap}. | 4361 | This function destroys the fringe bitmap identified by @var{bitmap}. |
| 4362 | If @var{bitmap} identifies a standard fringe bitmap, it actually | 4362 | If @var{bitmap} identifies a standard fringe bitmap, it actually |
| 4363 | restores the standard definition of that bitmap, instead of | 4363 | restores the standard definition of that bitmap, instead of |
| 4364 | eliminating it entirely. | 4364 | eliminating it entirely. |
| @@ -6926,7 +6926,7 @@ end of the buffer continues from the other end. If | |||
| 6926 | is displayed. Any button with a non-@code{nil} @code{skip} property | 6926 | is displayed. Any button with a non-@code{nil} @code{skip} property |
| 6927 | is skipped over. Returns the button found, and signals an error if no | 6927 | is skipped over. Returns the button found, and signals an error if no |
| 6928 | buttons can be found. If @var{no-error} in non-@code{nil}, return nil | 6928 | buttons can be found. If @var{no-error} in non-@code{nil}, return nil |
| 6929 | instead of signalling the error. | 6929 | instead of signaling the error. |
| 6930 | @end deffn | 6930 | @end deffn |
| 6931 | 6931 | ||
| 6932 | @deffn Command backward-button n &optional wrap display-message | 6932 | @deffn Command backward-button n &optional wrap display-message |
| @@ -6938,7 +6938,7 @@ end of the buffer continues from the other end. If | |||
| 6938 | is displayed. Any button with a non-@code{nil} @code{skip} property | 6938 | is displayed. Any button with a non-@code{nil} @code{skip} property |
| 6939 | is skipped over. Returns the button found, and signals an error if no | 6939 | is skipped over. Returns the button found, and signals an error if no |
| 6940 | buttons can be found. If @var{no-error} in non-@code{nil}, return nil | 6940 | buttons can be found. If @var{no-error} in non-@code{nil}, return nil |
| 6941 | instead of signalling the error. | 6941 | instead of signaling the error. |
| 6942 | @end deffn | 6942 | @end deffn |
| 6943 | 6943 | ||
| 6944 | @defun next-button pos &optional count-current | 6944 | @defun next-button pos &optional count-current |
diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi index cfef5c12d1e..5970e7cf801 100644 --- a/doc/lispref/edebug.texi +++ b/doc/lispref/edebug.texi | |||
| @@ -858,7 +858,7 @@ to a non-@code{nil} value. | |||
| 858 | Here is an example of code that creates a circular structure: | 858 | Here is an example of code that creates a circular structure: |
| 859 | 859 | ||
| 860 | @example | 860 | @example |
| 861 | (setq a '(x y)) | 861 | (setq a (list 'x 'y)) |
| 862 | (setcar a a) | 862 | (setcar a a) |
| 863 | @end example | 863 | @end example |
| 864 | 864 | ||
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index cfd96f7aa68..bba1b63115f 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi | |||
| @@ -297,6 +297,7 @@ Lisp Data Types | |||
| 297 | * Circular Objects:: Read syntax for circular structure. | 297 | * Circular Objects:: Read syntax for circular structure. |
| 298 | * Type Predicates:: Tests related to types. | 298 | * Type Predicates:: Tests related to types. |
| 299 | * Equality Predicates:: Tests of equality between any two objects. | 299 | * Equality Predicates:: Tests of equality between any two objects. |
| 300 | * Constants and Mutability:: Whether an object's value can change. | ||
| 300 | 301 | ||
| 301 | Programming Types | 302 | Programming Types |
| 302 | 303 | ||
diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi index f6f36ed3427..021604c5142 100644 --- a/doc/lispref/eval.texi +++ b/doc/lispref/eval.texi | |||
| @@ -158,6 +158,12 @@ contents unchanged. | |||
| 158 | @end group | 158 | @end group |
| 159 | @end example | 159 | @end example |
| 160 | 160 | ||
| 161 | A self-evaluating form yields constant conses, vectors and strings, and you | ||
| 162 | should not attempt to modify their contents via @code{setcar}, @code{aset} or | ||
| 163 | similar operations. The Lisp interpreter might unify the constants | ||
| 164 | yielded by your program's self-evaluating forms, so that these | ||
| 165 | constants might share structure. @xref{Constants and Mutability}. | ||
| 166 | |||
| 161 | It is common to write numbers, characters, strings, and even vectors | 167 | It is common to write numbers, characters, strings, and even vectors |
| 162 | in Lisp code, taking advantage of the fact that they self-evaluate. | 168 | in Lisp code, taking advantage of the fact that they self-evaluate. |
| 163 | However, it is quite unusual to do this for types that lack a read | 169 | However, it is quite unusual to do this for types that lack a read |
| @@ -558,6 +564,8 @@ and vectors.) | |||
| 558 | 564 | ||
| 559 | @defspec quote object | 565 | @defspec quote object |
| 560 | This special form returns @var{object}, without evaluating it. | 566 | This special form returns @var{object}, without evaluating it. |
| 567 | The returned value is a constant, and should not be modified. | ||
| 568 | @xref{Constants and Mutability}. | ||
| 561 | @end defspec | 569 | @end defspec |
| 562 | 570 | ||
| 563 | @cindex @samp{'} for quoting | 571 | @cindex @samp{'} for quoting |
| @@ -612,10 +620,12 @@ only part of a list, while computing and substituting other parts. | |||
| 612 | 620 | ||
| 613 | @dfn{Backquote constructs} allow you to quote a list, but | 621 | @dfn{Backquote constructs} allow you to quote a list, but |
| 614 | selectively evaluate elements of that list. In the simplest case, it | 622 | selectively evaluate elements of that list. In the simplest case, it |
| 615 | is identical to the special form @code{quote} | 623 | is identical to the special form |
| 616 | @iftex | 624 | @iftex |
| 625 | @code{quote}. | ||
| 617 | @end iftex | 626 | @end iftex |
| 618 | @ifnottex | 627 | @ifnottex |
| 628 | @code{quote} | ||
| 619 | (described in the previous section; @pxref{Quoting}). | 629 | (described in the previous section; @pxref{Quoting}). |
| 620 | @end ifnottex | 630 | @end ifnottex |
| 621 | For example, these two forms yield identical results: | 631 | For example, these two forms yield identical results: |
| @@ -693,6 +703,9 @@ Here are some examples: | |||
| 693 | @end group | 703 | @end group |
| 694 | @end example | 704 | @end example |
| 695 | 705 | ||
| 706 | If a subexpression of a backquote construct has no substitutions or | ||
| 707 | splices, it acts like @code{quote} in that it yields constant conses, | ||
| 708 | vectors and strings that should not be modified. | ||
| 696 | 709 | ||
| 697 | @node Eval | 710 | @node Eval |
| 698 | @section Eval | 711 | @section Eval |
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 5cf67ba6473..bc8ec0ef1b0 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi | |||
| @@ -970,7 +970,7 @@ string. | |||
| 970 | @end group | 970 | @end group |
| 971 | 971 | ||
| 972 | @group | 972 | @group |
| 973 | (mapconcat (function (lambda (x) (format "%c" (1+ x)))) | 973 | (mapconcat (lambda (x) (format "%c" (1+ x))) |
| 974 | "HAL-8000" | 974 | "HAL-8000" |
| 975 | "") | 975 | "") |
| 976 | @result{} "IBM.9111" | 976 | @result{} "IBM.9111" |
| @@ -2287,7 +2287,7 @@ function) as a generalized variable. @var{setter} can be a symbol in which | |||
| 2287 | case it will be passed to @code{gv-define-simple-setter}, or it can be of the | 2287 | case it will be passed to @code{gv-define-simple-setter}, or it can be of the |
| 2288 | form @code{(lambda (@var{arg}) @var{body})} in which case that function will | 2288 | form @code{(lambda (@var{arg}) @var{body})} in which case that function will |
| 2289 | additionally have access to the macro (or function)'s arguments and it will | 2289 | additionally have access to the macro (or function)'s arguments and it will |
| 2290 | passed to @code{gv-define-setter}. | 2290 | be passed to @code{gv-define-setter}. |
| 2291 | 2291 | ||
| 2292 | @end table | 2292 | @end table |
| 2293 | 2293 | ||
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi index eea1fd2e8f1..9b3c4fcb23d 100644 --- a/doc/lispref/help.texi +++ b/doc/lispref/help.texi | |||
| @@ -175,49 +175,47 @@ All symbols that have PATTERN in their name are described | |||
| 175 | in the *Help* buffer." | 175 | in the *Help* buffer." |
| 176 | (interactive "sDescribe symbols matching: ") | 176 | (interactive "sDescribe symbols matching: ") |
| 177 | (let ((describe-func | 177 | (let ((describe-func |
| 178 | (function | 178 | (lambda (s) |
| 179 | (lambda (s) | ||
| 180 | @end group | 179 | @end group |
| 181 | @group | 180 | @group |
| 182 | ;; @r{Print description of symbol.} | 181 | ;; @r{Print description of symbol.} |
| 183 | (if (fboundp s) ; @r{It is a function.} | 182 | (if (fboundp s) ; @r{It is a function.} |
| 184 | (princ | 183 | (princ |
| 185 | (format "%s\t%s\n%s\n\n" s | 184 | (format "%s\t%s\n%s\n\n" s |
| 186 | (if (commandp s) | 185 | (if (commandp s) |
| 187 | (let ((keys (where-is-internal s))) | 186 | (let ((keys (where-is-internal s))) |
| 188 | (if keys | 187 | (if keys |
| 189 | (concat | 188 | (concat |
| 190 | "Keys: " | 189 | "Keys: " |
| 191 | (mapconcat 'key-description | 190 | (mapconcat 'key-description |
| 192 | keys " ")) | 191 | keys " ")) |
| 193 | "Keys: none")) | 192 | "Keys: none")) |
| 194 | "Function") | 193 | "Function") |
| 195 | @end group | 194 | @end group |
| 196 | @group | 195 | @group |
| 197 | (or (documentation s) | 196 | (or (documentation s) |
| 198 | "not documented")))) | 197 | "not documented")))) |
| 199 | 198 | ||
| 200 | (if (boundp s) ; @r{It is a variable.} | 199 | (if (boundp s) ; @r{It is a variable.} |
| 201 | @end group | 200 | @end group |
| 202 | @group | 201 | @group |
| 203 | (princ | 202 | (princ |
| 204 | (format "%s\t%s\n%s\n\n" s | 203 | (format "%s\t%s\n%s\n\n" s |
| 205 | (if (custom-variable-p s) | 204 | (if (custom-variable-p s) |
| 206 | "Option " "Variable") | 205 | "Option " "Variable") |
| 207 | @end group | 206 | @end group |
| 208 | @group | 207 | @group |
| 209 | (or (documentation-property | 208 | (or (documentation-property |
| 210 | s 'variable-documentation) | 209 | s 'variable-documentation) |
| 211 | "not documented"))))))) | 210 | "not documented")))))) |
| 212 | sym-list) | 211 | sym-list) |
| 213 | @end group | 212 | @end group |
| 214 | 213 | ||
| 215 | @group | 214 | @group |
| 216 | ;; @r{Build a list of symbols that match pattern.} | 215 | ;; @r{Build a list of symbols that match pattern.} |
| 217 | (mapatoms (function | 216 | (mapatoms (lambda (sym) |
| 218 | (lambda (sym) | 217 | (if (string-match pattern (symbol-name sym)) |
| 219 | (if (string-match pattern (symbol-name sym)) | 218 | (setq sym-list (cons sym sym-list))))) |
| 220 | (setq sym-list (cons sym sym-list)))))) | ||
| 221 | @end group | 219 | @end group |
| 222 | 220 | ||
| 223 | @group | 221 | @group |
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi index 2c90d208c02..130ff0d8671 100644 --- a/doc/lispref/keymaps.texi +++ b/doc/lispref/keymaps.texi | |||
| @@ -1441,10 +1441,10 @@ Here is an example showing a keymap before and after substitution: | |||
| 1441 | 1441 | ||
| 1442 | @smallexample | 1442 | @smallexample |
| 1443 | @group | 1443 | @group |
| 1444 | (setq map '(keymap | 1444 | (setq map (list 'keymap |
| 1445 | (?1 . olddef-1) | 1445 | (cons ?1 olddef-1) |
| 1446 | (?2 . olddef-2) | 1446 | (cons ?2 olddef-2) |
| 1447 | (?3 . olddef-1))) | 1447 | (cons ?3 olddef-1))) |
| 1448 | @result{} (keymap (49 . olddef-1) (50 . olddef-2) (51 . olddef-1)) | 1448 | @result{} (keymap (49 . olddef-1) (50 . olddef-2) (51 . olddef-1)) |
| 1449 | @end group | 1449 | @end group |
| 1450 | 1450 | ||
| @@ -2226,14 +2226,11 @@ right value for selecting that button. Clicking on the button should | |||
| 2226 | set the variable so that the button you clicked on becomes selected. | 2226 | set the variable so that the button you clicked on becomes selected. |
| 2227 | 2227 | ||
| 2228 | @item :key-sequence @var{key-sequence} | 2228 | @item :key-sequence @var{key-sequence} |
| 2229 | This property specifies which key sequence is likely to be bound to the | 2229 | This property specifies which key sequence to display as keyboard equivalent. |
| 2230 | same command invoked by this menu item. If you specify a correct key | 2230 | Before Emacs displays @var{key-sequence} in the menu, it verifies that |
| 2231 | sequence, that sequence will be preferred over others. | 2231 | @var{key-sequence} is really equivalent to this menu item, so it only |
| 2232 | 2232 | has an effect if you specify a correct key sequence. | |
| 2233 | If you specify an incorrect key sequence, it has no effect; before Emacs | 2233 | Specifying @code{nil} for @var{key-sequence} is equivalent to the |
| 2234 | displays @var{key-sequence} in the menu, it verifies that | ||
| 2235 | @var{key-sequence} is really equivalent to this menu item. Specifying | ||
| 2236 | @code{nil} for @var{key-sequence} is equivalent to the | ||
| 2237 | @code{:key-sequence} attribute being absent. | 2234 | @code{:key-sequence} attribute being absent. |
| 2238 | 2235 | ||
| 2239 | @item :keys @var{string} | 2236 | @item :keys @var{string} |
| @@ -2916,17 +2913,17 @@ the following: | |||
| 2916 | 2913 | ||
| 2917 | @table @code | 2914 | @table @code |
| 2918 | @item :keys @var{keys} | 2915 | @item :keys @var{keys} |
| 2919 | @var{keys} is a keyboard equivalent to the menu item (a string). This | 2916 | @var{keys} is a string to display as keyboard equivalent to the menu item. |
| 2920 | is normally not needed, as keyboard equivalents are computed | 2917 | This is normally not needed, as keyboard equivalents are computed |
| 2921 | automatically. @var{keys} is expanded with | 2918 | automatically. @var{keys} is expanded with |
| 2922 | @code{substitute-command-keys} before it is displayed (@pxref{Keys in | 2919 | @code{substitute-command-keys} before it is displayed (@pxref{Keys in |
| 2923 | Documentation}). | 2920 | Documentation}). |
| 2924 | 2921 | ||
| 2925 | @item :key-sequence @var{keys} | 2922 | @item :key-sequence @var{keys} |
| 2926 | @var{keys} is a hint for speeding up Emacs's first display of the | 2923 | @var{keys} is a hint indicating which key sequence to display as |
| 2927 | menu. It should be @code{nil} if you know that the menu item has no keyboard | 2924 | keyboard equivalent, in case the command is bound to several key sequences. |
| 2928 | equivalent; otherwise it should be a string or vector specifying a | 2925 | It has no effect if @var{keys} is not bound to same command as this |
| 2929 | keyboard equivalent for the menu item. | 2926 | menu item. |
| 2930 | 2927 | ||
| 2931 | @item :active @var{enable} | 2928 | @item :active @var{enable} |
| 2932 | @var{enable} is an expression; if it evaluates to @code{nil}, the item | 2929 | @var{enable} is an expression; if it evaluates to @code{nil}, the item |
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index 27fa5385e35..1125af7bec3 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi | |||
| @@ -866,10 +866,15 @@ foo ;; @r{@code{foo} was changed.} | |||
| 866 | @node Modifying Lists | 866 | @node Modifying Lists |
| 867 | @section Modifying Existing List Structure | 867 | @section Modifying Existing List Structure |
| 868 | @cindex destructive list operations | 868 | @cindex destructive list operations |
| 869 | @cindex mutable lists | ||
| 869 | 870 | ||
| 870 | You can modify the @sc{car} and @sc{cdr} contents of a cons cell with the | 871 | You can modify the @sc{car} and @sc{cdr} contents of a cons cell with the |
| 871 | primitives @code{setcar} and @code{setcdr}. These are destructive | 872 | primitives @code{setcar} and @code{setcdr}. These are destructive |
| 872 | operations because they change existing list structure. | 873 | operations because they change existing list structure. |
| 874 | Destructive operations should be applied only to mutable lists, | ||
| 875 | that is, lists constructed via @code{cons}, @code{list} or similar | ||
| 876 | operations. Lists created by quoting are constants and should not be | ||
| 877 | changed by destructive operations. @xref{Constants and Mutability}. | ||
| 873 | 878 | ||
| 874 | @cindex CL note---@code{rplaca} vs @code{setcar} | 879 | @cindex CL note---@code{rplaca} vs @code{setcar} |
| 875 | @quotation | 880 | @quotation |
| @@ -906,7 +911,7 @@ value @var{object}. For example: | |||
| 906 | 911 | ||
| 907 | @example | 912 | @example |
| 908 | @group | 913 | @group |
| 909 | (setq x '(1 2)) | 914 | (setq x (list 1 2)) ; @r{Create a mutable list.} |
| 910 | @result{} (1 2) | 915 | @result{} (1 2) |
| 911 | @end group | 916 | @end group |
| 912 | @group | 917 | @group |
| @@ -926,8 +931,8 @@ these lists. Here is an example: | |||
| 926 | 931 | ||
| 927 | @example | 932 | @example |
| 928 | @group | 933 | @group |
| 929 | ;; @r{Create two lists that are partly shared.} | 934 | ;; @r{Create two mutable lists that are partly shared.} |
| 930 | (setq x1 '(a b c)) | 935 | (setq x1 (list 'a 'b 'c)) |
| 931 | @result{} (a b c) | 936 | @result{} (a b c) |
| 932 | (setq x2 (cons 'z (cdr x1))) | 937 | (setq x2 (cons 'z (cdr x1))) |
| 933 | @result{} (z b c) | 938 | @result{} (z b c) |
| @@ -1017,11 +1022,11 @@ reached via the @sc{cdr}. | |||
| 1017 | 1022 | ||
| 1018 | @example | 1023 | @example |
| 1019 | @group | 1024 | @group |
| 1020 | (setq x '(1 2 3)) | 1025 | (setq x (list 1 2 3)) ; @r{Create a mutable list.} |
| 1021 | @result{} (1 2 3) | 1026 | @result{} (1 2 3) |
| 1022 | @end group | 1027 | @end group |
| 1023 | @group | 1028 | @group |
| 1024 | (setcdr x '(4)) | 1029 | (setcdr x '(4)) ; @r{Modify the list's tail to be a constant list.} |
| 1025 | @result{} (4) | 1030 | @result{} (4) |
| 1026 | @end group | 1031 | @end group |
| 1027 | @group | 1032 | @group |
| @@ -1037,7 +1042,7 @@ the @sc{cdr} of the first cons cell: | |||
| 1037 | 1042 | ||
| 1038 | @example | 1043 | @example |
| 1039 | @group | 1044 | @group |
| 1040 | (setq x1 '(a b c)) | 1045 | (setq x1 (list 'a 'b 'c)) |
| 1041 | @result{} (a b c) | 1046 | @result{} (a b c) |
| 1042 | (setcdr x1 (cdr (cdr x1))) | 1047 | (setcdr x1 (cdr (cdr x1))) |
| 1043 | @result{} (c) | 1048 | @result{} (c) |
| @@ -1069,7 +1074,7 @@ of this list. | |||
| 1069 | 1074 | ||
| 1070 | @example | 1075 | @example |
| 1071 | @group | 1076 | @group |
| 1072 | (setq x1 '(a b c)) | 1077 | (setq x1 (list 'a 'b 'c)) |
| 1073 | @result{} (a b c) | 1078 | @result{} (a b c) |
| 1074 | (setcdr x1 (cons 'd (cdr x1))) | 1079 | (setcdr x1 (cons 'd (cdr x1))) |
| 1075 | @result{} (d b c) | 1080 | @result{} (d b c) |
| @@ -1130,11 +1135,11 @@ Unlike @code{append} (@pxref{Building Lists}), the @var{lists} are | |||
| 1130 | 1135 | ||
| 1131 | @example | 1136 | @example |
| 1132 | @group | 1137 | @group |
| 1133 | (setq x '(1 2 3)) | 1138 | (setq x (list 1 2 3)) ; @r{Create a mutable list.} |
| 1134 | @result{} (1 2 3) | 1139 | @result{} (1 2 3) |
| 1135 | @end group | 1140 | @end group |
| 1136 | @group | 1141 | @group |
| 1137 | (nconc x '(4 5)) | 1142 | (nconc x '(4 5)) ; @r{Modify the list's tail to be a constant list.} |
| 1138 | @result{} (1 2 3 4 5) | 1143 | @result{} (1 2 3 4 5) |
| 1139 | @end group | 1144 | @end group |
| 1140 | @group | 1145 | @group |
| @@ -1150,7 +1155,7 @@ list: | |||
| 1150 | 1155 | ||
| 1151 | @example | 1156 | @example |
| 1152 | @group | 1157 | @group |
| 1153 | (setq x '(1 2 3)) | 1158 | (setq x (list 1 2 3)) |
| 1154 | @result{} (1 2 3) | 1159 | @result{} (1 2 3) |
| 1155 | @end group | 1160 | @end group |
| 1156 | @group | 1161 | @group |
| @@ -1163,11 +1168,13 @@ x | |||
| 1163 | @end group | 1168 | @end group |
| 1164 | @end example | 1169 | @end example |
| 1165 | 1170 | ||
| 1166 | However, the other arguments (all but the last) must be lists. | 1171 | However, the other arguments (all but the last) should be mutable lists. |
| 1167 | 1172 | ||
| 1168 | A common pitfall is to use a quoted constant list as a non-last | 1173 | A common pitfall is to use a constant list as a non-last |
| 1169 | argument to @code{nconc}. If you do this, your program will change | 1174 | argument to @code{nconc}. If you do this, the resulting behavior |
| 1170 | each time you run it! Here is what happens: | 1175 | is undefined. It is possible that your program will change |
| 1176 | each time you run it! Here is what might happen (though this | ||
| 1177 | is not guaranteed to happen): | ||
| 1171 | 1178 | ||
| 1172 | @smallexample | 1179 | @smallexample |
| 1173 | @group | 1180 | @group |
| @@ -1270,7 +1277,7 @@ removing it involves changing the @sc{cdr}s (@pxref{Setcdr}). | |||
| 1270 | 1277 | ||
| 1271 | @example | 1278 | @example |
| 1272 | @group | 1279 | @group |
| 1273 | (setq sample-list '(a b c (4))) | 1280 | (setq sample-list (list 'a 'b 'c '(4))) |
| 1274 | @result{} (a b c (4)) | 1281 | @result{} (a b c (4)) |
| 1275 | @end group | 1282 | @end group |
| 1276 | @group | 1283 | @group |
| @@ -1303,12 +1310,12 @@ into the variable that held the original list: | |||
| 1303 | (setq flowers (delq 'rose flowers)) | 1310 | (setq flowers (delq 'rose flowers)) |
| 1304 | @end example | 1311 | @end example |
| 1305 | 1312 | ||
| 1306 | In the following example, the @code{(4)} that @code{delq} attempts to match | 1313 | In the following example, the @code{(list 4)} that @code{delq} attempts to match |
| 1307 | and the @code{(4)} in the @code{sample-list} are not @code{eq}: | 1314 | and the @code{(4)} in the @code{sample-list} are @code{equal} but not @code{eq}: |
| 1308 | 1315 | ||
| 1309 | @example | 1316 | @example |
| 1310 | @group | 1317 | @group |
| 1311 | (delq '(4) sample-list) | 1318 | (delq (list 4) sample-list) |
| 1312 | @result{} (a c (4)) | 1319 | @result{} (a c (4)) |
| 1313 | @end group | 1320 | @end group |
| 1314 | @end example | 1321 | @end example |
| @@ -1324,7 +1331,7 @@ of @code{list}. | |||
| 1324 | 1331 | ||
| 1325 | @example | 1332 | @example |
| 1326 | @group | 1333 | @group |
| 1327 | (setq sample-list '(a b c a b c)) | 1334 | (setq sample-list (list 'a 'b 'c 'a 'b 'c)) |
| 1328 | @result{} (a b c a b c) | 1335 | @result{} (a b c a b c) |
| 1329 | @end group | 1336 | @end group |
| 1330 | @group | 1337 | @group |
| @@ -1349,12 +1356,12 @@ Compare this with @code{memq}: | |||
| 1349 | 1356 | ||
| 1350 | @example | 1357 | @example |
| 1351 | @group | 1358 | @group |
| 1352 | (memql 1.2 '(1.1 1.2 1.3)) ; @r{@code{1.2} and @code{1.2} are @code{eql}.} | 1359 | (memql 1.2 '(1.1 1.2 1.3)) ; @r{@code{1.2} and @code{1.2} must be @code{eql}.} |
| 1353 | @result{} (1.2 1.3) | 1360 | @result{} (1.2 1.3) |
| 1354 | @end group | 1361 | @end group |
| 1355 | @group | 1362 | @group |
| 1356 | (memq 1.2 '(1.1 1.2 1.3)) ; @r{@code{1.2} and @code{1.2} are not @code{eq}.} | 1363 | (memq 1.2 '(1.1 1.2 1.3)) ; @r{@code{1.2} and @code{1.2} need not be @code{eq}.} |
| 1357 | @result{} nil | 1364 | @result{} nil ; @r{... or it might be @code{(1.2 1.3)}.} |
| 1358 | @end group | 1365 | @end group |
| 1359 | @end example | 1366 | @end example |
| 1360 | @end defun | 1367 | @end defun |
| @@ -1373,11 +1380,11 @@ Compare this with @code{memq}: | |||
| 1373 | 1380 | ||
| 1374 | @example | 1381 | @example |
| 1375 | @group | 1382 | @group |
| 1376 | (member '(2) '((1) (2))) ; @r{@code{(2)} and @code{(2)} are @code{equal}.} | 1383 | (member (list 2) '((1) (2))) ; @r{@code{(list 2)} and @code{(2)} are @code{equal}.} |
| 1377 | @result{} ((2)) | 1384 | @result{} ((2)) |
| 1378 | @end group | 1385 | @end group |
| 1379 | @group | 1386 | @group |
| 1380 | (memq '(2) '((1) (2))) ; @r{@code{(2)} and @code{(2)} are not @code{eq}.} | 1387 | (memq (list 2) '((1) (2))) ; @r{@code{(list 2)} and @code{(2)} are not @code{eq}.} |
| 1381 | @result{} nil | 1388 | @result{} nil |
| 1382 | @end group | 1389 | @end group |
| 1383 | @group | 1390 | @group |
| @@ -1407,7 +1414,7 @@ For example: | |||
| 1407 | 1414 | ||
| 1408 | @example | 1415 | @example |
| 1409 | @group | 1416 | @group |
| 1410 | (setq l '((2) (1) (2))) | 1417 | (setq l (list '(2) '(1) '(2))) |
| 1411 | (delete '(2) l) | 1418 | (delete '(2) l) |
| 1412 | @result{} ((1)) | 1419 | @result{} ((1)) |
| 1413 | l | 1420 | l |
| @@ -1416,7 +1423,7 @@ l | |||
| 1416 | ;; @r{write @code{(setq l (delete '(2) l))}.} | 1423 | ;; @r{write @code{(setq l (delete '(2) l))}.} |
| 1417 | @end group | 1424 | @end group |
| 1418 | @group | 1425 | @group |
| 1419 | (setq l '((2) (1) (2))) | 1426 | (setq l (list '(2) '(1) '(2))) |
| 1420 | (delete '(1) l) | 1427 | (delete '(1) l) |
| 1421 | @result{} ((2) (2)) | 1428 | @result{} ((2) (2)) |
| 1422 | l | 1429 | l |
| @@ -1618,9 +1625,10 @@ keys may not be symbols: | |||
| 1618 | '(("simple leaves" . oak) | 1625 | '(("simple leaves" . oak) |
| 1619 | ("compound leaves" . horsechestnut))) | 1626 | ("compound leaves" . horsechestnut))) |
| 1620 | 1627 | ||
| 1621 | (assq "simple leaves" leaves) | 1628 | ;; @r{The @code{copy-sequence} means the keys are not @code{eq}.} |
| 1629 | (assq (copy-sequence "simple leaves") leaves) | ||
| 1622 | @result{} nil | 1630 | @result{} nil |
| 1623 | (assoc "simple leaves" leaves) | 1631 | (assoc (copy-sequence "simple leaves") leaves) |
| 1624 | @result{} ("simple leaves" . oak) | 1632 | @result{} ("simple leaves" . oak) |
| 1625 | @end smallexample | 1633 | @end smallexample |
| 1626 | @end defun | 1634 | @end defun |
| @@ -1759,7 +1767,7 @@ correct results, use the return value of @code{assq-delete-all} rather | |||
| 1759 | than looking at the saved value of @var{alist}. | 1767 | than looking at the saved value of @var{alist}. |
| 1760 | 1768 | ||
| 1761 | @example | 1769 | @example |
| 1762 | (setq alist '((foo 1) (bar 2) (foo 3) (lose 4))) | 1770 | (setq alist (list '(foo 1) '(bar 2) '(foo 3) '(lose 4))) |
| 1763 | @result{} ((foo 1) (bar 2) (foo 3) (lose 4)) | 1771 | @result{} ((foo 1) (bar 2) (foo 3) (lose 4)) |
| 1764 | (assq-delete-all 'foo alist) | 1772 | (assq-delete-all 'foo alist) |
| 1765 | @result{} ((bar 2) (lose 4)) | 1773 | @result{} ((bar 2) (lose 4)) |
| @@ -1926,7 +1934,7 @@ function returns the modified property list, so you can store that back | |||
| 1926 | in the place where you got @var{plist}. For example, | 1934 | in the place where you got @var{plist}. For example, |
| 1927 | 1935 | ||
| 1928 | @example | 1936 | @example |
| 1929 | (setq my-plist '(bar t foo 4)) | 1937 | (setq my-plist (list 'bar t 'foo 4)) |
| 1930 | @result{} (bar t foo 4) | 1938 | @result{} (bar t foo 4) |
| 1931 | (setq my-plist (plist-put my-plist 'foo 69)) | 1939 | (setq my-plist (plist-put my-plist 'foo 69)) |
| 1932 | @result{} (bar t foo 69) | 1940 | @result{} (bar t foo 69) |
diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index 855dff2130a..3e9f2221020 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi | |||
| @@ -46,6 +46,10 @@ you store in it, type and all. (Actually, a small number of Emacs | |||
| 46 | Lisp variables can only take on values of a certain type. | 46 | Lisp variables can only take on values of a certain type. |
| 47 | @xref{Variables with Restricted Values}.) | 47 | @xref{Variables with Restricted Values}.) |
| 48 | 48 | ||
| 49 | Some Lisp objects are @dfn{constant}: their values never change. | ||
| 50 | Others are @dfn{mutable}: their values can be changed via destructive | ||
| 51 | operations that involve side effects. | ||
| 52 | |||
| 49 | This chapter describes the purpose, printed representation, and read | 53 | This chapter describes the purpose, printed representation, and read |
| 50 | syntax of each of the standard types in GNU Emacs Lisp. Details on how | 54 | syntax of each of the standard types in GNU Emacs Lisp. Details on how |
| 51 | to use these types can be found in later chapters. | 55 | to use these types can be found in later chapters. |
| @@ -59,6 +63,7 @@ to use these types can be found in later chapters. | |||
| 59 | * Circular Objects:: Read syntax for circular structure. | 63 | * Circular Objects:: Read syntax for circular structure. |
| 60 | * Type Predicates:: Tests related to types. | 64 | * Type Predicates:: Tests related to types. |
| 61 | * Equality Predicates:: Tests of equality between any two objects. | 65 | * Equality Predicates:: Tests of equality between any two objects. |
| 66 | * Constants and Mutability:: Whether an object's value can change. | ||
| 62 | @end menu | 67 | @end menu |
| 63 | 68 | ||
| 64 | @node Printed Representation | 69 | @node Printed Representation |
| @@ -2377,3 +2382,46 @@ that for two strings to be equal, they have the same text properties. | |||
| 2377 | @end group | 2382 | @end group |
| 2378 | @end example | 2383 | @end example |
| 2379 | @end defun | 2384 | @end defun |
| 2385 | |||
| 2386 | @node Constants and Mutability | ||
| 2387 | @section Constants and Mutability | ||
| 2388 | @cindex constants | ||
| 2389 | @cindex mutable objects | ||
| 2390 | |||
| 2391 | Some Lisp objects are constant: their values never change. | ||
| 2392 | For example, you can create a new integer by calculating one, but you | ||
| 2393 | cannot modify the value of an existing integer. | ||
| 2394 | |||
| 2395 | Other Lisp objects are mutable: their values can be changed | ||
| 2396 | via destructive operations involving side effects. For example, an | ||
| 2397 | existing marker can be changed by moving the marker to point to | ||
| 2398 | somewhere else. | ||
| 2399 | |||
| 2400 | Although numbers are always constants and markers are always | ||
| 2401 | mutable, some types contain both constant and mutable members. These | ||
| 2402 | types include conses, vectors, strings, and symbols. For example, the string | ||
| 2403 | literal @code{"aaa"} yields a constant string, whereas the function | ||
| 2404 | call @code{(make-string 3 ?a)} yields a mutable string that can be | ||
| 2405 | changed via later calls to @code{aset}. | ||
| 2406 | |||
| 2407 | Trying to modify a constant variable signals an error | ||
| 2408 | (@pxref{Constant Variables}). | ||
| 2409 | A program should not attempt to modify other types of constants because the | ||
| 2410 | resulting behavior is undefined: the Lisp interpreter might or might | ||
| 2411 | not detect the error, and if it does not detect the error the | ||
| 2412 | interpreter can behave unpredictably thereafter. Another way to put | ||
| 2413 | this is that although mutable objects are safe to change and constant | ||
| 2414 | symbols reliably reject attempts to change them, other constants are | ||
| 2415 | not safely mutable: if you try to change one your program might | ||
| 2416 | behave as you expect but it might crash or worse. This problem occurs | ||
| 2417 | with types that have both constant and mutable members, and that have | ||
| 2418 | mutators like @code{setcar} and @code{aset} that are valid on mutable | ||
| 2419 | objects but hazardous on constants. | ||
| 2420 | |||
| 2421 | When the same constant occurs multiple times in a program, the Lisp | ||
| 2422 | interpreter might save time or space by reusing existing constants or | ||
| 2423 | constant components. For example, @code{(eq "abc" "abc")} returns | ||
| 2424 | @code{t} if the interpreter creates only one instance of the string | ||
| 2425 | constant @code{"abc"}, and returns @code{nil} if it creates two | ||
| 2426 | instances. Lisp programs should be written so that they work | ||
| 2427 | regardless of whether this optimization is in use. | ||
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi index e72858bbf1a..5c0b1e2edf0 100644 --- a/doc/lispref/os.texi +++ b/doc/lispref/os.texi | |||
| @@ -2617,7 +2617,7 @@ if it is non-@code{nil}; this can be overridden by binding | |||
| 2617 | This variable is non-@code{nil} when Emacs is running in batch mode. | 2617 | This variable is non-@code{nil} when Emacs is running in batch mode. |
| 2618 | @end defvar | 2618 | @end defvar |
| 2619 | 2619 | ||
| 2620 | If Emacs exits due to signalling an error in batch mode, the exit | 2620 | If Emacs exits due to signaling an error in batch mode, the exit |
| 2621 | status of the Emacs command is non-zero: | 2621 | status of the Emacs command is non-zero: |
| 2622 | 2622 | ||
| 2623 | @example | 2623 | @example |
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi index 1a3a04f680b..1cb0d05cc7b 100644 --- a/doc/lispref/sequences.texi +++ b/doc/lispref/sequences.texi | |||
| @@ -183,11 +183,11 @@ for other ways to copy sequences. | |||
| 183 | 183 | ||
| 184 | @example | 184 | @example |
| 185 | @group | 185 | @group |
| 186 | (setq bar '(1 2)) | 186 | (setq bar (list 1 2)) ; @r{Create a mutable list.} |
| 187 | @result{} (1 2) | 187 | @result{} (1 2) |
| 188 | @end group | 188 | @end group |
| 189 | @group | 189 | @group |
| 190 | (setq x (vector 'foo bar)) | 190 | (setq x (vector 'foo bar)) ; @r{Create a mutable vector.} |
| 191 | @result{} [foo (1 2)] | 191 | @result{} [foo (1 2)] |
| 192 | @end group | 192 | @end group |
| 193 | @group | 193 | @group |
| @@ -278,7 +278,7 @@ Unlike @code{reverse} the original @var{sequence} may be modified. | |||
| 278 | 278 | ||
| 279 | @example | 279 | @example |
| 280 | @group | 280 | @group |
| 281 | (setq x '(a b c)) | 281 | (setq x (list 'a 'b 'c)) ; @r{Create a mutable list.} |
| 282 | @result{} (a b c) | 282 | @result{} (a b c) |
| 283 | @end group | 283 | @end group |
| 284 | @group | 284 | @group |
| @@ -320,7 +320,7 @@ presented graphically: | |||
| 320 | For the vector, it is even simpler because you don't need setq: | 320 | For the vector, it is even simpler because you don't need setq: |
| 321 | 321 | ||
| 322 | @example | 322 | @example |
| 323 | (setq x [1 2 3 4]) | 323 | (setq x (copy-sequence [1 2 3 4])) ; @r{Create a mutable vector.} |
| 324 | @result{} [1 2 3 4] | 324 | @result{} [1 2 3 4] |
| 325 | (nreverse x) | 325 | (nreverse x) |
| 326 | @result{} [4 3 2 1] | 326 | @result{} [4 3 2 1] |
| @@ -330,7 +330,7 @@ x | |||
| 330 | 330 | ||
| 331 | Note that unlike @code{reverse}, this function doesn't work with strings. | 331 | Note that unlike @code{reverse}, this function doesn't work with strings. |
| 332 | Although you can alter string data by using @code{aset}, it is strongly | 332 | Although you can alter string data by using @code{aset}, it is strongly |
| 333 | encouraged to treat strings as immutable. | 333 | encouraged to treat strings as immutable even when they are mutable. |
| 334 | 334 | ||
| 335 | @end defun | 335 | @end defun |
| 336 | 336 | ||
| @@ -374,11 +374,11 @@ appears in a different position in the list due to the change of | |||
| 374 | 374 | ||
| 375 | @example | 375 | @example |
| 376 | @group | 376 | @group |
| 377 | (setq nums '(1 3 2 6 5 4 0)) | 377 | (setq nums (list 1 3 2 6 5 4 0)) ; @r{Create a mutable list.} |
| 378 | @result{} (1 3 2 6 5 4 0) | 378 | @result{} (1 3 2 6 5 4 0) |
| 379 | @end group | 379 | @end group |
| 380 | @group | 380 | @group |
| 381 | (sort nums '<) | 381 | (sort nums #'<) |
| 382 | @result{} (0 1 2 3 4 5 6) | 382 | @result{} (0 1 2 3 4 5 6) |
| 383 | @end group | 383 | @end group |
| 384 | @group | 384 | @group |
| @@ -396,7 +396,7 @@ of @code{sort} and use that. Most often we store the result back into | |||
| 396 | the variable that held the original list: | 396 | the variable that held the original list: |
| 397 | 397 | ||
| 398 | @example | 398 | @example |
| 399 | (setq nums (sort nums '<)) | 399 | (setq nums (sort nums #'<)) |
| 400 | @end example | 400 | @end example |
| 401 | 401 | ||
| 402 | For the better understanding of what stable sort is, consider the following | 402 | For the better understanding of what stable sort is, consider the following |
| @@ -1228,7 +1228,7 @@ This function sets the @var{index}th element of @var{array} to be | |||
| 1228 | 1228 | ||
| 1229 | @example | 1229 | @example |
| 1230 | @group | 1230 | @group |
| 1231 | (setq w [foo bar baz]) | 1231 | (setq w (vector 'foo 'bar 'baz)) ; @r{Create a mutable vector.} |
| 1232 | @result{} [foo bar baz] | 1232 | @result{} [foo bar baz] |
| 1233 | (aset w 0 'fu) | 1233 | (aset w 0 'fu) |
| 1234 | @result{} fu | 1234 | @result{} fu |
| @@ -1237,7 +1237,8 @@ w | |||
| 1237 | @end group | 1237 | @end group |
| 1238 | 1238 | ||
| 1239 | @group | 1239 | @group |
| 1240 | (setq x "asdfasfd") | 1240 | ;; @r{@code{copy-sequence} creates a mutable string.} |
| 1241 | (setq x (copy-sequence "asdfasfd")) | ||
| 1241 | @result{} "asdfasfd" | 1242 | @result{} "asdfasfd" |
| 1242 | (aset x 3 ?Z) | 1243 | (aset x 3 ?Z) |
| 1243 | @result{} 90 | 1244 | @result{} 90 |
| @@ -1246,6 +1247,10 @@ x | |||
| 1246 | @end group | 1247 | @end group |
| 1247 | @end example | 1248 | @end example |
| 1248 | 1249 | ||
| 1250 | The @var{array} should be mutable; that is, it should not be a constant, | ||
| 1251 | such as the constants created via quoting or via self-evaluating forms. | ||
| 1252 | @xref{Constants and Mutability}. | ||
| 1253 | |||
| 1249 | If @var{array} is a string and @var{object} is not a character, a | 1254 | If @var{array} is a string and @var{object} is not a character, a |
| 1250 | @code{wrong-type-argument} error results. The function converts a | 1255 | @code{wrong-type-argument} error results. The function converts a |
| 1251 | unibyte string to multibyte if necessary to insert a character. | 1256 | unibyte string to multibyte if necessary to insert a character. |
| @@ -1257,7 +1262,8 @@ each element of @var{array} is @var{object}. It returns @var{array}. | |||
| 1257 | 1262 | ||
| 1258 | @example | 1263 | @example |
| 1259 | @group | 1264 | @group |
| 1260 | (setq a [a b c d e f g]) | 1265 | ;; @r{Create a mutable vector and then fill it with zeros.} |
| 1266 | (setq a (copy-sequence [a b c d e f g])) | ||
| 1261 | @result{} [a b c d e f g] | 1267 | @result{} [a b c d e f g] |
| 1262 | (fillarray a 0) | 1268 | (fillarray a 0) |
| 1263 | @result{} [0 0 0 0 0 0 0] | 1269 | @result{} [0 0 0 0 0 0 0] |
| @@ -1265,7 +1271,8 @@ a | |||
| 1265 | @result{} [0 0 0 0 0 0 0] | 1271 | @result{} [0 0 0 0 0 0 0] |
| 1266 | @end group | 1272 | @end group |
| 1267 | @group | 1273 | @group |
| 1268 | (setq s "When in the course") | 1274 | ;; @r{Create a mutable string and then fill it with "-".} |
| 1275 | (setq s (copy-sequence "When in the course")) | ||
| 1269 | @result{} "When in the course" | 1276 | @result{} "When in the course" |
| 1270 | (fillarray s ?-) | 1277 | (fillarray s ?-) |
| 1271 | @result{} "------------------" | 1278 | @result{} "------------------" |
| @@ -1302,7 +1309,9 @@ same way in Lisp input. | |||
| 1302 | A vector, like a string or a number, is considered a constant for | 1309 | A vector, like a string or a number, is considered a constant for |
| 1303 | evaluation: the result of evaluating it is the same vector. This does | 1310 | evaluation: the result of evaluating it is the same vector. This does |
| 1304 | not evaluate or even examine the elements of the vector. | 1311 | not evaluate or even examine the elements of the vector. |
| 1305 | @xref{Self-Evaluating Forms}. | 1312 | @xref{Self-Evaluating Forms}. Vectors written with square brackets |
| 1313 | are constants and should not be modified via @code{aset} or other | ||
| 1314 | destructive operations. @xref{Constants and Mutability}. | ||
| 1306 | 1315 | ||
| 1307 | Here are examples illustrating these principles: | 1316 | Here are examples illustrating these principles: |
| 1308 | 1317 | ||
| @@ -1565,14 +1574,14 @@ For example, here is how to examine the elements of the syntax table: | |||
| 1565 | @example | 1574 | @example |
| 1566 | (let (accumulator) | 1575 | (let (accumulator) |
| 1567 | (map-char-table | 1576 | (map-char-table |
| 1568 | #'(lambda (key value) | 1577 | (lambda (key value) |
| 1569 | (setq accumulator | 1578 | (setq accumulator |
| 1570 | (cons (list | 1579 | (cons (list |
| 1571 | (if (consp key) | 1580 | (if (consp key) |
| 1572 | (list (car key) (cdr key)) | 1581 | (list (car key) (cdr key)) |
| 1573 | key) | 1582 | key) |
| 1574 | value) | 1583 | value) |
| 1575 | accumulator))) | 1584 | accumulator))) |
| 1576 | (syntax-table)) | 1585 | (syntax-table)) |
| 1577 | accumulator) | 1586 | accumulator) |
| 1578 | @result{} | 1587 | @result{} |
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi index 14cabc5d79d..a4c9c2549c5 100644 --- a/doc/lispref/strings.texi +++ b/doc/lispref/strings.texi | |||
| @@ -51,10 +51,8 @@ by a distinguished character code. | |||
| 51 | operate on them with the general array and sequence functions documented | 51 | operate on them with the general array and sequence functions documented |
| 52 | in @ref{Sequences Arrays Vectors}. For example, you can access or | 52 | in @ref{Sequences Arrays Vectors}. For example, you can access or |
| 53 | change individual characters in a string using the functions @code{aref} | 53 | change individual characters in a string using the functions @code{aref} |
| 54 | and @code{aset} (@pxref{Array Functions}). However, note that | 54 | and @code{aset} (@pxref{Array Functions}). However, you should not |
| 55 | @code{length} should @emph{not} be used for computing the width of a | 55 | try to change the contents of constant strings (@pxref{Modifying Strings}). |
| 56 | string on display; use @code{string-width} (@pxref{Size of Displayed | ||
| 57 | Text}) instead. | ||
| 58 | 56 | ||
| 59 | There are two text representations for non-@acronym{ASCII} | 57 | There are two text representations for non-@acronym{ASCII} |
| 60 | characters in Emacs strings (and in buffers): unibyte and multibyte. | 58 | characters in Emacs strings (and in buffers): unibyte and multibyte. |
| @@ -89,6 +87,9 @@ copy them into buffers. @xref{Character Type}, and @ref{String Type}, | |||
| 89 | for information about the syntax of characters and strings. | 87 | for information about the syntax of characters and strings. |
| 90 | @xref{Non-ASCII Characters}, for functions to convert between text | 88 | @xref{Non-ASCII Characters}, for functions to convert between text |
| 91 | representations and to encode and decode character codes. | 89 | representations and to encode and decode character codes. |
| 90 | Also, note that @code{length} should @emph{not} be used for computing | ||
| 91 | the width of a string on display; use @code{string-width} (@pxref{Size | ||
| 92 | of Displayed Text}) instead. | ||
| 92 | 93 | ||
| 93 | @node Predicates for Strings | 94 | @node Predicates for Strings |
| 94 | @section Predicates for Strings | 95 | @section Predicates for Strings |
| @@ -380,6 +381,11 @@ usual value is @w{@code{"[ \f\t\n\r\v]+"}}. | |||
| 380 | @cindex modifying strings | 381 | @cindex modifying strings |
| 381 | @cindex string modification | 382 | @cindex string modification |
| 382 | 383 | ||
| 384 | You can alter the contents of a mutable string via operations | ||
| 385 | described in this section. However, you should not try to use these | ||
| 386 | operations to alter the contents of a constant string. | ||
| 387 | @xref{Constants and Mutability}. | ||
| 388 | |||
| 383 | The most basic way to alter the contents of an existing string is with | 389 | The most basic way to alter the contents of an existing string is with |
| 384 | @code{aset} (@pxref{Array Functions}). @code{(aset @var{string} | 390 | @code{aset} (@pxref{Array Functions}). @code{(aset @var{string} |
| 385 | @var{idx} @var{char})} stores @var{char} into @var{string} at index | 391 | @var{idx} @var{char})} stores @var{char} into @var{string} at index |
| @@ -591,7 +597,7 @@ for sorting (@pxref{Sequence Functions}): | |||
| 591 | 597 | ||
| 592 | @example | 598 | @example |
| 593 | @group | 599 | @group |
| 594 | (sort '("11" "12" "1 1" "1 2" "1.1" "1.2") 'string-collate-lessp) | 600 | (sort (list "11" "12" "1 1" "1 2" "1.1" "1.2") 'string-collate-lessp) |
| 595 | @result{} ("11" "1 1" "1.1" "12" "1 2" "1.2") | 601 | @result{} ("11" "1 1" "1.1" "12" "1 2" "1.2") |
| 596 | @end group | 602 | @end group |
| 597 | @end example | 603 | @end example |
| @@ -608,7 +614,7 @@ systems. The @var{locale} value of @code{"POSIX"} or @code{"C"} lets | |||
| 608 | 614 | ||
| 609 | @example | 615 | @example |
| 610 | @group | 616 | @group |
| 611 | (sort '("11" "12" "1 1" "1 2" "1.1" "1.2") | 617 | (sort (list "11" "12" "1 1" "1 2" "1.1" "1.2") |
| 612 | (lambda (s1 s2) (string-collate-lessp s1 s2 "POSIX"))) | 618 | (lambda (s1 s2) (string-collate-lessp s1 s2 "POSIX"))) |
| 613 | @result{} ("1 1" "1 2" "1.1" "1.2" "11" "12") | 619 | @result{} ("1 1" "1 2" "1.1" "1.2" "11" "12") |
| 614 | @end group | 620 | @end group |
diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi index ad45a8edaff..9eb99a0ac92 100644 --- a/doc/lispref/syntax.texi +++ b/doc/lispref/syntax.texi | |||
| @@ -1118,9 +1118,9 @@ bidi-class}). | |||
| 1118 | ;; 'bidi-class' Unicode property is R, AL, or RLO -- | 1118 | ;; 'bidi-class' Unicode property is R, AL, or RLO -- |
| 1119 | ;; these have a right-to-left directionality. | 1119 | ;; these have a right-to-left directionality. |
| 1120 | (map-char-table | 1120 | (map-char-table |
| 1121 | #'(lambda (key val) | 1121 | (lambda (key val) |
| 1122 | (if (memq val '(R AL RLO)) | 1122 | (if (memq val '(R AL RLO)) |
| 1123 | (modify-category-entry key ?R category-table))) | 1123 | (modify-category-entry key ?R category-table))) |
| 1124 | uniprop-table) | 1124 | uniprop-table) |
| 1125 | category-table)) | 1125 | category-table)) |
| 1126 | @end example | 1126 | @end example |
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index ffdf952b081..58424a4231b 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi | |||
| @@ -2073,11 +2073,10 @@ its @code{sort-subr} call looks like this: | |||
| 2073 | @example | 2073 | @example |
| 2074 | @group | 2074 | @group |
| 2075 | (sort-subr reverse | 2075 | (sort-subr reverse |
| 2076 | (function | 2076 | (lambda () |
| 2077 | (lambda () | 2077 | (while (and (not (eobp)) |
| 2078 | (while (and (not (eobp)) | 2078 | (looking-at paragraph-separate)) |
| 2079 | (looking-at paragraph-separate)) | 2079 | (forward-line 1))) |
| 2080 | (forward-line 1)))) | ||
| 2081 | 'forward-paragraph) | 2080 | 'forward-paragraph) |
| 2082 | @end group | 2081 | @end group |
| 2083 | @end example | 2082 | @end example |
| @@ -4679,7 +4678,7 @@ expanded when the header line is computed. To do this, the | |||
| 4679 | above. @var{specification} is an alist that has elements where the | 4678 | above. @var{specification} is an alist that has elements where the |
| 4680 | @code{car} is a character and the @code{cdr} is the substitution. | 4679 | @code{car} is a character and the @code{cdr} is the substitution. |
| 4681 | 4680 | ||
| 4682 | If @code{ONLY-PRESENT} is @code{nil}, errors will be signalled if a | 4681 | If @code{ONLY-PRESENT} is @code{nil}, errors will be signaled if a |
| 4683 | format character has been used that's not present in | 4682 | format character has been used that's not present in |
| 4684 | @var{specification}. If it's non-@code{nil}, that format | 4683 | @var{specification}. If it's non-@code{nil}, that format |
| 4685 | specification is left verbatim in the result. | 4684 | specification is left verbatim in the result. |
| @@ -5725,7 +5724,7 @@ made within the @code{combine-after-change-calls} body. | |||
| 5725 | @code{after-change-functions} within | 5724 | @code{after-change-functions} within |
| 5726 | the body of a @code{combine-after-change-calls} form. | 5725 | the body of a @code{combine-after-change-calls} form. |
| 5727 | 5726 | ||
| 5728 | @strong{Warning:} if the changes you combine occur in widely scattered | 5727 | @strong{Warning:} If the changes you combine occur in widely scattered |
| 5729 | parts of the buffer, this will still work, but it is not advisable, | 5728 | parts of the buffer, this will still work, but it is not advisable, |
| 5730 | because it may lead to inefficient behavior for some change hook | 5729 | because it may lead to inefficient behavior for some change hook |
| 5731 | functions. | 5730 | functions. |
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 424e15bc6d1..718e269fc86 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi | |||
| @@ -25668,6 +25668,13 @@ Create non-spam statistics for every file in this directory. Every | |||
| 25668 | file is treated as one non-spam mail. | 25668 | file is treated as one non-spam mail. |
| 25669 | @end defun | 25669 | @end defun |
| 25670 | 25670 | ||
| 25671 | @defvar spam-stat-process-directory-age | ||
| 25672 | Maximum age of files to be processed, in days. Without this filter, | ||
| 25673 | re-training spam-stat with several thousand messages could take a long | ||
| 25674 | time. The default is 90, but you might want to set this to a bigger | ||
| 25675 | value during the initial training. | ||
| 25676 | @end defvar | ||
| 25677 | |||
| 25671 | Usually you would call @code{spam-stat-process-spam-directory} on a | 25678 | Usually you would call @code{spam-stat-process-spam-directory} on a |
| 25672 | directory such as @file{~/Mail/mail/spam} (this usually corresponds to | 25679 | directory such as @file{~/Mail/mail/spam} (this usually corresponds to |
| 25673 | the group @samp{nnml:mail.spam}), and you would call | 25680 | the group @samp{nnml:mail.spam}), and you would call |