mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-29 19:48:19 +00:00
Merge from origin/emacs-27
05089a4d65
(origin/emacs-27) Tweak wording re constant variablesa1040861f1
Tweak setcar-related wording751510f865
* 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 Adams5805df74f5
Improve mutability docdca35b31d0
Improve mutability documentation81e7d7f111
Document that quoting yields constants5734339f40
* doc/lispref/keymaps.texi (Extended Menu Items, Easy Menu...14a570afae
Remove #' and function quoting from lambda forms in manuald5ec18c66b
* 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 better6c187ed6b0
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
This commit is contained in:
commit
477b9eaf45
16
ChangeLog.3
16
ChangeLog.3
@ -11660,7 +11660,7 @@
|
|||||||
Mention the Emacs exit code in batch mode
|
Mention the Emacs exit code in batch mode
|
||||||
|
|
||||||
* doc/lispref/os.texi (Batch Mode): Mention what the exit code is
|
* doc/lispref/os.texi (Batch Mode): Mention what the exit code is
|
||||||
if an error is signalled (bug#31552).
|
if an error is signaled (bug#31552).
|
||||||
|
|
||||||
2019-10-12 Kaushal Modi <kaushal.modi@gmail.com>
|
2019-10-12 Kaushal Modi <kaushal.modi@gmail.com>
|
||||||
|
|
||||||
@ -15059,7 +15059,7 @@
|
|||||||
|
|
||||||
* lisp/image/exif.el (exif-parse-buffer): New function.
|
* lisp/image/exif.el (exif-parse-buffer): New function.
|
||||||
(exif-orientation): Ditto.
|
(exif-orientation): Ditto.
|
||||||
(exif-error): New error symbol, and adjust all error signalling to
|
(exif-error): New error symbol, and adjust all error signaling to
|
||||||
only use that signal.
|
only use that signal.
|
||||||
|
|
||||||
2019-09-22 Andreas Schwab <schwab@linux-m68k.org>
|
2019-09-22 Andreas Schwab <schwab@linux-m68k.org>
|
||||||
@ -25100,7 +25100,7 @@
|
|||||||
|
|
||||||
* lisp/json.el (json-read): Try to clarify what's returned (bug#34242).
|
* lisp/json.el (json-read): Try to clarify what's returned (bug#34242).
|
||||||
(json-encode): Refer to `json-read' about what the input is and
|
(json-encode): Refer to `json-read' about what the input is and
|
||||||
say what error is signalled.
|
say what error is signaled.
|
||||||
|
|
||||||
2019-07-09 Lars Ingebrigtsen <larsi@gnus.org>
|
2019-07-09 Lars Ingebrigtsen <larsi@gnus.org>
|
||||||
|
|
||||||
@ -26971,7 +26971,7 @@
|
|||||||
help-C-file-name shouldn't error out if we can't find the name
|
help-C-file-name shouldn't error out if we can't find the name
|
||||||
|
|
||||||
* lisp/help-fns.el (help-C-file-name): Make help-C-file-name
|
* lisp/help-fns.el (help-C-file-name): Make help-C-file-name
|
||||||
return nil instead of signalling an error if we can't find the
|
return nil instead of signaling an error if we can't find the
|
||||||
file name (bug#17250).
|
file name (bug#17250).
|
||||||
|
|
||||||
2019-06-26 Stefan Monnier <monnier@iro.umontreal.ca>
|
2019-06-26 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||||
@ -34107,7 +34107,7 @@
|
|||||||
Remove unused internal function completion-pcm--optimize-pattern
|
Remove unused internal function completion-pcm--optimize-pattern
|
||||||
|
|
||||||
* lisp/minibuffer.el (completion-pcm--optimize-pattern): Remove
|
* lisp/minibuffer.el (completion-pcm--optimize-pattern): Remove
|
||||||
unused internal function (that signalled a compilation warning).
|
unused internal function (that signaled a compilation warning).
|
||||||
|
|
||||||
2019-05-16 Stefan Monnier <monnier@iro.umontreal.ca>
|
2019-05-16 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||||
|
|
||||||
@ -40134,10 +40134,10 @@
|
|||||||
|
|
||||||
2019-03-30 Mattias Engdegård <mattiase@acm.org>
|
2019-03-30 Mattias Engdegård <mattiase@acm.org>
|
||||||
|
|
||||||
Release regexp before signalling overflow error
|
Release regexp before signaling overflow error
|
||||||
|
|
||||||
* src/search.c (looking_at_1, search_buffer_re): Unfreeze the regexp
|
* src/search.c (looking_at_1, search_buffer_re): Unfreeze the regexp
|
||||||
buffer before signalling a matcher overflow, since the error
|
buffer before signaling a matcher overflow, since the error
|
||||||
processing may require quite some regexp use as well (Bug#34910).
|
processing may require quite some regexp use as well (Bug#34910).
|
||||||
|
|
||||||
2019-03-30 Mattias Engdegård <mattiase@acm.org>
|
2019-03-30 Mattias Engdegård <mattiase@acm.org>
|
||||||
@ -88604,7 +88604,7 @@
|
|||||||
Tweak Fdocumentation's error for an undefined function
|
Tweak Fdocumentation's error for an undefined function
|
||||||
|
|
||||||
* src/doc.c (Fdocumentation): Restore the pre-25 behavior
|
* src/doc.c (Fdocumentation): Restore the pre-25 behavior
|
||||||
of signalling a void-function error for an undefined function.
|
of signaling a void-function error for an undefined function.
|
||||||
This seems cleaner than Emacs 25's "invalid-function: nil" error,
|
This seems cleaner than Emacs 25's "invalid-function: nil" error,
|
||||||
which was (probably) an unintended consequence of changes to
|
which was (probably) an unintended consequence of changes to
|
||||||
Findirect_function.
|
Findirect_function.
|
||||||
|
@ -81,7 +81,7 @@ the ones that are not reproducible on the current release.
|
|||||||
* New bug triage process
|
* New bug triage process
|
||||||
|
|
||||||
The goal of the new bug triage process is similar to the backlog triage process,
|
The goal of the new bug triage process is similar to the backlog triage process,
|
||||||
except that the focus is on prioritizing the bug, and making sure it is has
|
except that the focus is on prioritizing the bug, and making sure it has
|
||||||
necessary information for others to act on.
|
necessary information for others to act on.
|
||||||
|
|
||||||
For each new bug, ask the following questions:
|
For each new bug, ask the following questions:
|
||||||
|
@ -340,7 +340,7 @@ initialization file (@pxref{Resources}).
|
|||||||
@opindex --quick
|
@opindex --quick
|
||||||
Start Emacs with minimum customizations. This is similar to using
|
Start Emacs with minimum customizations. This is similar to using
|
||||||
@samp{-q}, @samp{--no-site-file}, @samp{--no-site-lisp},
|
@samp{-q}, @samp{--no-site-file}, @samp{--no-site-lisp},
|
||||||
@samp{--no-x-resources}, and @samp{--no-splash} together..
|
@samp{--no-x-resources}, and @samp{--no-splash} together.
|
||||||
|
|
||||||
@item -daemon
|
@item -daemon
|
||||||
@opindex -daemon
|
@opindex -daemon
|
||||||
|
@ -1416,7 +1416,8 @@ C-c}.
|
|||||||
|
|
||||||
Image-Dired is a facility for browsing image files. It provides viewing
|
Image-Dired is a facility for browsing image files. It provides viewing
|
||||||
the images either as thumbnails or in full size, either inside Emacs
|
the images either as thumbnails or in full size, either inside Emacs
|
||||||
or through an external viewer.
|
or through an external viewer. This is different from Image mode
|
||||||
|
(@pxref{Image Mode}) for visiting an image file in the Emacs buffer.
|
||||||
|
|
||||||
@kindex C-t d @r{(Image-Dired)}
|
@kindex C-t d @r{(Image-Dired)}
|
||||||
@findex image-dired-display-thumbs
|
@findex image-dired-display-thumbs
|
||||||
|
@ -455,7 +455,8 @@ File Handling
|
|||||||
* Remote Files:: Accessing files on other machines.
|
* Remote Files:: Accessing files on other machines.
|
||||||
* Quoted File Names:: Quoting special characters in file names.
|
* Quoted File Names:: Quoting special characters in file names.
|
||||||
* File Name Cache:: Completion against a list of files you often use.
|
* File Name Cache:: Completion against a list of files you often use.
|
||||||
* File Conveniences:: Convenience Features for Finding Files.
|
* File Conveniences:: Convenience features for finding files.
|
||||||
|
* Image Mode:: Viewing image files.
|
||||||
* Filesets:: Handling sets of files.
|
* Filesets:: Handling sets of files.
|
||||||
|
|
||||||
Saving Files
|
Saving Files
|
||||||
|
@ -38,7 +38,8 @@ on file directories.
|
|||||||
* Remote Files:: Accessing files on other machines.
|
* Remote Files:: Accessing files on other machines.
|
||||||
* Quoted File Names:: Quoting special characters in file names.
|
* Quoted File Names:: Quoting special characters in file names.
|
||||||
* File Name Cache:: Completion against a list of files you often use.
|
* File Name Cache:: Completion against a list of files you often use.
|
||||||
* File Conveniences:: Convenience Features for Finding Files.
|
* File Conveniences:: Convenience features for finding files.
|
||||||
|
* Image Mode:: Viewing image files.
|
||||||
* Filesets:: Handling sets of files.
|
* Filesets:: Handling sets of files.
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@ -2088,8 +2089,7 @@ of the cache with the @code{file-cache-display} command.
|
|||||||
@section Convenience Features for Finding Files
|
@section Convenience Features for Finding Files
|
||||||
|
|
||||||
In this section, we introduce some convenient facilities for finding
|
In this section, we introduce some convenient facilities for finding
|
||||||
recently-opened files, reading file names from a buffer, and viewing
|
recently-opened files, reading file names from a buffer.
|
||||||
image files.
|
|
||||||
|
|
||||||
@findex recentf-mode
|
@findex recentf-mode
|
||||||
@vindex recentf-mode
|
@vindex recentf-mode
|
||||||
@ -2108,6 +2108,9 @@ point. Partial Completion mode offers other features extending
|
|||||||
@code{find-file}, which can be used with @code{ffap}.
|
@code{find-file}, which can be used with @code{ffap}.
|
||||||
@xref{Completion Options}.
|
@xref{Completion Options}.
|
||||||
|
|
||||||
|
@node Image Mode
|
||||||
|
@section Viewing Image Files
|
||||||
|
|
||||||
@findex image-mode
|
@findex image-mode
|
||||||
@findex image-toggle-display
|
@findex image-toggle-display
|
||||||
@findex image-next-file
|
@findex image-next-file
|
||||||
|
@ -204,8 +204,8 @@ sentences and paragraphs, respectively. These commands work like
|
|||||||
A numeric argument to a transpose command serves as a repeat count: it
|
A numeric argument to a transpose command serves as a repeat count: it
|
||||||
tells the transpose command to move the character (or word or
|
tells the transpose command to move the character (or word or
|
||||||
expression or line) before or containing point across several other
|
expression or line) before or containing point across several other
|
||||||
characters (or words or expressions or lines). For example, @kbd{C-u
|
characters (or words or expressions or lines). For example, @w{@kbd{C-u
|
||||||
3 C-t} moves the character before point forward across three other
|
3 C-t}} moves the character before point forward across three other
|
||||||
characters. It would change @samp{f@point{}oobar} into
|
characters. It would change @samp{f@point{}oobar} into
|
||||||
@samp{oobf@point{}ar}. This is equivalent to repeating @kbd{C-t}
|
@samp{oobf@point{}ar}. This is equivalent to repeating @kbd{C-t}
|
||||||
three times. @kbd{C-u - 4 M-t} moves the word before point backward
|
three times. @kbd{C-u - 4 M-t} moves the word before point backward
|
||||||
@ -307,10 +307,10 @@ region; @pxref{Disabled Transient Mark}.)
|
|||||||
@cindex spell-checking the active region
|
@cindex spell-checking the active region
|
||||||
Similarly, the command @kbd{M-x ispell} performs spell-checking in
|
Similarly, the command @kbd{M-x ispell} performs spell-checking in
|
||||||
the region if one is active, or in the entire buffer otherwise. The
|
the region if one is active, or in the entire buffer otherwise. The
|
||||||
commands @kbd{M-x ispell-buffer} and @kbd{M-x ispell-region}
|
commands @w{@kbd{M-x ispell-buffer}} and @w{@kbd{M-x ispell-region}}
|
||||||
explicitly perform spell-checking on the entire buffer or the region
|
explicitly perform spell-checking on the entire buffer or the region
|
||||||
respectively. To check spelling in an email message you are writing,
|
respectively. To check spelling in an email message you are writing,
|
||||||
use @kbd{M-x ispell-message}; that command checks the whole buffer,
|
use @w{@kbd{M-x ispell-message}}; that command checks the whole buffer,
|
||||||
except for material that is indented or appears to be cited from other
|
except for material that is indented or appears to be cited from other
|
||||||
messages. @xref{Sending Mail}.
|
messages. @xref{Sending Mail}.
|
||||||
|
|
||||||
@ -368,8 +368,8 @@ wildcard.
|
|||||||
@item C-g
|
@item C-g
|
||||||
@itemx X
|
@itemx X
|
||||||
Quit interactive spell-checking, leaving point at the word that was
|
Quit interactive spell-checking, leaving point at the word that was
|
||||||
being checked. You can restart checking again afterward with @kbd{C-u
|
being checked. You can restart checking again afterward with @w{@kbd{C-u
|
||||||
M-$}.
|
M-$}}.
|
||||||
|
|
||||||
@item x
|
@item x
|
||||||
Quit interactive spell-checking and move point back to where it was
|
Quit interactive spell-checking and move point back to where it was
|
||||||
@ -387,8 +387,8 @@ Show the list of options.
|
|||||||
(@code{ispell-complete-word}) performs in-buffer completion based on
|
(@code{ispell-complete-word}) performs in-buffer completion based on
|
||||||
spelling correction. Insert the beginning of a word, and then type
|
spelling correction. Insert the beginning of a word, and then type
|
||||||
@kbd{M-@key{TAB}}; this shows a list of completions. (If your
|
@kbd{M-@key{TAB}}; this shows a list of completions. (If your
|
||||||
window manager intercepts @kbd{M-@key{TAB}}, type @kbd{@key{ESC}
|
window manager intercepts @kbd{M-@key{TAB}}, type @w{@kbd{@key{ESC}
|
||||||
@key{TAB}} or @kbd{C-M-i}.) Each completion is listed with a digit or
|
@key{TAB}}} or @kbd{C-M-i}.) Each completion is listed with a digit or
|
||||||
character; type that digit or character to choose it.
|
character; type that digit or character to choose it.
|
||||||
|
|
||||||
@cindex @code{ispell} program
|
@cindex @code{ispell} program
|
||||||
@ -396,7 +396,7 @@ character; type that digit or character to choose it.
|
|||||||
Once started, the spell-checker subprocess continues
|
Once started, the spell-checker subprocess continues
|
||||||
to run, waiting for something to do, so that subsequent spell-checking
|
to run, waiting for something to do, so that subsequent spell-checking
|
||||||
commands complete more quickly. If you want to get rid of the
|
commands complete more quickly. If you want to get rid of the
|
||||||
process, use @kbd{M-x ispell-kill-ispell}. This is not usually
|
process, use @w{@kbd{M-x ispell-kill-ispell}}. This is not usually
|
||||||
necessary, since the process uses no processor time except when you do
|
necessary, since the process uses no processor time except when you do
|
||||||
spelling correction.
|
spelling correction.
|
||||||
|
|
||||||
@ -409,7 +409,7 @@ the standard dictionary and your personal dictionary. The standard
|
|||||||
dictionary is specified by the variable @code{ispell-local-dictionary}
|
dictionary is specified by the variable @code{ispell-local-dictionary}
|
||||||
or, if that is @code{nil}, by the variable @code{ispell-dictionary}.
|
or, if that is @code{nil}, by the variable @code{ispell-dictionary}.
|
||||||
If both are @code{nil}, the spelling program's default dictionary is
|
If both are @code{nil}, the spelling program's default dictionary is
|
||||||
used. The command @kbd{M-x ispell-change-dictionary} sets the
|
used. The command @w{@kbd{M-x ispell-change-dictionary}} sets the
|
||||||
standard dictionary for the buffer and then restarts the subprocess,
|
standard dictionary for the buffer and then restarts the subprocess,
|
||||||
so that it will use a different standard dictionary. Your personal
|
so that it will use a different standard dictionary. Your personal
|
||||||
dictionary is specified by the variable
|
dictionary is specified by the variable
|
||||||
@ -431,8 +431,8 @@ dictionary.
|
|||||||
@findex flyspell-mode
|
@findex flyspell-mode
|
||||||
Flyspell mode is a minor mode that performs automatic spell-checking
|
Flyspell mode is a minor mode that performs automatic spell-checking
|
||||||
of the text you type as you type it. When it finds a word that it
|
of the text you type as you type it. When it finds a word that it
|
||||||
does not recognize, it highlights that word. Type @kbd{M-x
|
does not recognize, it highlights that word. Type @w{@kbd{M-x
|
||||||
flyspell-mode} to toggle Flyspell mode in the current buffer. To
|
flyspell-mode}} to toggle Flyspell mode in the current buffer. To
|
||||||
enable Flyspell mode in all text mode buffers, add
|
enable Flyspell mode in all text mode buffers, add
|
||||||
@code{flyspell-mode} to @code{text-mode-hook}. @xref{Hooks}. Note
|
@code{flyspell-mode} to @code{text-mode-hook}. @xref{Hooks}. Note
|
||||||
that, as Flyspell mode needs to check each word across which you move,
|
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
|
|||||||
of possible corrections and actions. In addition, @kbd{C-.} or
|
of possible corrections and actions. In addition, @kbd{C-.} or
|
||||||
@kbd{@key{ESC}-@key{TAB}} (@code{flyspell-auto-correct-word}) will
|
@kbd{@key{ESC}-@key{TAB}} (@code{flyspell-auto-correct-word}) will
|
||||||
propose various successive corrections for the word at point, and
|
propose various successive corrections for the word at point, and
|
||||||
@kbd{C-c $} (@code{flyspell-correct-word-before-point}) will pop up a
|
@w{@kbd{C-c $}} (@code{flyspell-correct-word-before-point}) will pop up a
|
||||||
menu of possible corrections. Of course, you can always correct the
|
menu of possible corrections. Of course, you can always correct the
|
||||||
misspelled word by editing it manually in any way you like.
|
misspelled word by editing it manually in any way you like.
|
||||||
|
|
||||||
@findex flyspell-prog-mode
|
@findex flyspell-prog-mode
|
||||||
Flyspell Prog mode works just like ordinary Flyspell mode, except
|
Flyspell Prog mode works just like ordinary Flyspell mode, except
|
||||||
that it only checks words in comments and string constants. This
|
that it only checks words in comments and string constants. This
|
||||||
feature is useful for editing programs. Type @kbd{M-x
|
feature is useful for editing programs. Type @w{@kbd{M-x
|
||||||
flyspell-prog-mode} to enable or disable this mode in the current
|
flyspell-prog-mode}} to enable or disable this mode in the current
|
||||||
buffer. To enable this mode in all programming mode buffers, add
|
buffer. To enable this mode in all programming mode buffers, add
|
||||||
@code{flyspell-prog-mode} to @code{prog-mode-hook} (@pxref{Hooks}).
|
@code{flyspell-prog-mode} to @code{prog-mode-hook} (@pxref{Hooks}).
|
||||||
|
@ -227,8 +227,9 @@ left. If you'd like to reverse the direction of horizontal scrolling,
|
|||||||
customize the variable @code{mouse-wheel-flip-direction} to a
|
customize the variable @code{mouse-wheel-flip-direction} to a
|
||||||
non-@code{nil} value.
|
non-@code{nil} value.
|
||||||
|
|
||||||
When the mouse pointer is over an image, scrolling the mouse wheel
|
When the mouse pointer is over an image in Image mode, @pxref{Image Mode},
|
||||||
with the @key{Ctrl} modifier scales the image under the mouse pointer.
|
scrolling the mouse wheel with the @key{Ctrl} modifier scales the image
|
||||||
|
under the mouse pointer.
|
||||||
|
|
||||||
|
|
||||||
@node Word and Line Mouse
|
@node Word and Line Mouse
|
||||||
|
@ -2883,7 +2883,7 @@ if there is an active region (@pxref{Mark}), the default URL comes
|
|||||||
from the region instead, after removing any whitespace from it. The
|
from the region instead, after removing any whitespace from it. The
|
||||||
command then creates a new buffer with the embedded browser showing
|
command then creates a new buffer with the embedded browser showing
|
||||||
the specified URL. The buffer is put in the Xwidget-WebKit mode
|
the specified URL. The buffer is put in the Xwidget-WebKit mode
|
||||||
(similar to Image mode, @pxref{File Conveniences}), which provides
|
(similar to Image mode, @pxref{Image Mode}), which provides
|
||||||
one-key commands for scrolling the widget, changing its size, and
|
one-key commands for scrolling the widget, changing its size, and
|
||||||
reloading it. Type @w{@kbd{C-h b}} in that buffer to see the key
|
reloading it. Type @w{@kbd{C-h b}} in that buffer to see the key
|
||||||
bindings.
|
bindings.
|
||||||
|
@ -586,13 +586,25 @@ buffer. @xref{Follow Mode}.
|
|||||||
@cindex directional window selection
|
@cindex directional window selection
|
||||||
@findex windmove-right
|
@findex windmove-right
|
||||||
@findex windmove-default-keybindings
|
@findex windmove-default-keybindings
|
||||||
|
@findex windmove-display-default-keybindings
|
||||||
|
@findex windmove-delete-default-keybindings
|
||||||
|
@findex windmove-swap-states-in-direction
|
||||||
The Windmove package defines commands for moving directionally
|
The Windmove package defines commands for moving directionally
|
||||||
between neighboring windows in a frame. @kbd{M-x windmove-right}
|
between neighboring windows in a frame. @kbd{M-x windmove-right}
|
||||||
selects the window immediately to the right of the currently selected
|
selects the window immediately to the right of the currently selected
|
||||||
one, and similarly for the left, up, and down
|
one, and similarly for the left, up, and down counterparts.
|
||||||
counterparts. @w{@kbd{M-x windmove-default-keybindings}} binds these
|
@w{@kbd{M-x windmove-default-keybindings}} binds these commands to
|
||||||
commands to @kbd{S-right} etc.; doing so disables shift selection for
|
@kbd{S-right} etc.; doing so disables shift selection for those keys
|
||||||
those keys (@pxref{Shift Selection}).
|
(@pxref{Shift Selection}). In the same way as keybindings can be
|
||||||
|
defined for commands that select windows directionally, you can use
|
||||||
|
@w{@kbd{M-x windmove-display-default-keybindings}} to define
|
||||||
|
keybindings for commands that specify in what direction to display the
|
||||||
|
window for the buffer that the next command is going to display.
|
||||||
|
Also there is @w{@kbd{M-x windmove-delete-default-keybindings}} to
|
||||||
|
define keybindings for commands that delete windows directionally, and
|
||||||
|
@w{@kbd{M-x windmove-swap-states-in-direction}} that define
|
||||||
|
keybindings for commands that swap the window contents of the selected
|
||||||
|
window with the window in the specified direction.
|
||||||
|
|
||||||
The command @kbd{M-x compare-windows} lets you compare the text
|
The command @kbd{M-x compare-windows} lets you compare the text
|
||||||
shown in different windows. @xref{Comparing Files}.
|
shown in different windows. @xref{Comparing Files}.
|
||||||
|
@ -2329,7 +2329,7 @@ area.
|
|||||||
|
|
||||||
@cindex @samp{bind} defined
|
@cindex @samp{bind} defined
|
||||||
There are several ways by which a variable can be given a value. One of
|
There are several ways by which a variable can be given a value. One of
|
||||||
the ways is to use either the function @code{set} or the function
|
the ways is to use either the function @code{set} or the special form
|
||||||
@code{setq}. Another way is to use @code{let} (@pxref{let}). (The
|
@code{setq}. Another way is to use @code{let} (@pxref{let}). (The
|
||||||
jargon for this process is to @dfn{bind} a variable to a value.)
|
jargon for this process is to @dfn{bind} a variable to a value.)
|
||||||
|
|
||||||
@ -4517,7 +4517,7 @@ number; it will be printed as the character with that @sc{ascii} code.
|
|||||||
|
|
||||||
@item setq
|
@item setq
|
||||||
@itemx set
|
@itemx set
|
||||||
The @code{setq} function sets the value of its first argument to the
|
The @code{setq} special form sets the value of its first argument to the
|
||||||
value of the second argument. The first argument is automatically
|
value of the second argument. The first argument is automatically
|
||||||
quoted by @code{setq}. It does the same for succeeding pairs of
|
quoted by @code{setq}. It does the same for succeeding pairs of
|
||||||
arguments. Another function, @code{set}, takes only two arguments and
|
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
|
|||||||
works is to experiment. We will start with the @code{setcar} function.
|
works is to experiment. We will start with the @code{setcar} function.
|
||||||
|
|
||||||
@need 1200
|
@need 1200
|
||||||
|
@cindex constant lists
|
||||||
|
@cindex mutable lists
|
||||||
First, we can make a list and then set the value of a variable to the
|
First, we can make a list and then set the value of a variable to the
|
||||||
list, using the @code{setq} function. Here is a list of animals:
|
list, using the @code{setq} special form. Because we intend to use
|
||||||
|
@code{setcar} to change the list, this @code{setq} should not use the
|
||||||
|
quoted form @code{'(antelope giraffe lion tiger)}, as that would yield
|
||||||
|
a list that is part of the program and bad things could happen if we
|
||||||
|
tried to change part of the program while running it. Generally
|
||||||
|
speaking an Emacs Lisp program's components should be constant (or
|
||||||
|
unchanged) while the program is running. So we instead construct an
|
||||||
|
animal list that is @dfn{mutable} (or changeable) by using the
|
||||||
|
@code{list} function, as follows:
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
(setq animals '(antelope giraffe lion tiger))
|
(setq animals (list 'antelope 'giraffe 'lion 'tiger))
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
@ -7398,7 +7408,7 @@ To see how this works, set the value of the variable to a list of
|
|||||||
domesticated animals by evaluating the following expression:
|
domesticated animals by evaluating the following expression:
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
(setq domesticated-animals '(horse cow sheep goat))
|
(setq domesticated-animals (list 'horse 'cow 'sheep 'goat))
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
@need 1200
|
@need 1200
|
||||||
@ -8846,7 +8856,7 @@ and then find the value of @code{trees}:
|
|||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
@group
|
@group
|
||||||
(setq trees '(maple oak pine birch))
|
(setq trees (list 'maple 'oak 'pine 'birch))
|
||||||
@result{} (maple oak pine birch)
|
@result{} (maple oak pine birch)
|
||||||
@end group
|
@end group
|
||||||
|
|
||||||
@ -9366,7 +9376,7 @@ For example:
|
|||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
@group
|
@group
|
||||||
(setq triple '(1 2 3))
|
(setq triple (list 1 2 3))
|
||||||
|
|
||||||
(setcar triple '37)
|
(setcar triple '37)
|
||||||
|
|
||||||
@ -9547,7 +9557,7 @@ part of which is the address of the next pair. The very last box
|
|||||||
points to the symbol @code{nil}, which marks the end of the list.
|
points to the symbol @code{nil}, which marks the end of the list.
|
||||||
|
|
||||||
@need 1200
|
@need 1200
|
||||||
When a variable is set to a list with a function such as @code{setq},
|
When a variable is set to a list with an operation such as @code{setq},
|
||||||
it stores the address of the first box in the variable. Thus,
|
it stores the address of the first box in the variable. Thus,
|
||||||
evaluation of the expression
|
evaluation of the expression
|
||||||
|
|
||||||
@ -17092,7 +17102,7 @@ reminders.
|
|||||||
|
|
||||||
@cindex Mail aliases
|
@cindex Mail aliases
|
||||||
@noindent
|
@noindent
|
||||||
This @code{setq} command sets the value of the variable
|
This @code{setq} sets the value of the variable
|
||||||
@code{mail-aliases} to @code{t}. Since @code{t} means true, the line
|
@code{mail-aliases} to @code{t}. Since @code{t} means true, the line
|
||||||
says, in effect, ``Yes, use mail aliases.''
|
says, in effect, ``Yes, use mail aliases.''
|
||||||
|
|
||||||
@ -17130,8 +17140,8 @@ The following turns off Indent Tabs mode:
|
|||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
Note that this line uses @code{setq-default} rather than the
|
Note that this line uses @code{setq-default} rather than the
|
||||||
@code{setq} command that we have seen before. The @code{setq-default}
|
@code{setq} that we have seen before; @code{setq-default}
|
||||||
command sets values only in buffers that do not have their own local
|
sets values only in buffers that do not have their own local
|
||||||
values for the variable.
|
values for the variable.
|
||||||
|
|
||||||
@ifinfo
|
@ifinfo
|
||||||
|
@ -370,9 +370,9 @@ definitions of @code{local-abbrev-table} and @code{text-mode-abbrev-table}.
|
|||||||
(funcall expand))))
|
(funcall expand))))
|
||||||
|
|
||||||
(add-hook 'foo-mode-hook
|
(add-hook 'foo-mode-hook
|
||||||
#'(lambda ()
|
(lambda ()
|
||||||
(add-function :around (local 'abbrev-expand-function)
|
(add-function :around (local 'abbrev-expand-function)
|
||||||
#'foo-mode-abbrev-expand-function)))
|
#'foo-mode-abbrev-expand-function)))
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
@node Standard Abbrev Tables
|
@node Standard Abbrev Tables
|
||||||
|
@ -807,7 +807,7 @@ If you just want to automatically auto-revert every
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
(setq-local buffer-stale-function
|
(setq-local buffer-stale-function
|
||||||
#'(lambda (&optional noconfirm) 'fast))
|
(lambda (&optional noconfirm) 'fast))
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
|
@ -4358,7 +4358,7 @@ height.
|
|||||||
@end defun
|
@end defun
|
||||||
|
|
||||||
@defun destroy-fringe-bitmap bitmap
|
@defun destroy-fringe-bitmap bitmap
|
||||||
This function destroy the fringe bitmap identified by @var{bitmap}.
|
This function destroys the fringe bitmap identified by @var{bitmap}.
|
||||||
If @var{bitmap} identifies a standard fringe bitmap, it actually
|
If @var{bitmap} identifies a standard fringe bitmap, it actually
|
||||||
restores the standard definition of that bitmap, instead of
|
restores the standard definition of that bitmap, instead of
|
||||||
eliminating it entirely.
|
eliminating it entirely.
|
||||||
@ -6926,7 +6926,7 @@ end of the buffer continues from the other end. If
|
|||||||
is displayed. Any button with a non-@code{nil} @code{skip} property
|
is displayed. Any button with a non-@code{nil} @code{skip} property
|
||||||
is skipped over. Returns the button found, and signals an error if no
|
is skipped over. Returns the button found, and signals an error if no
|
||||||
buttons can be found. If @var{no-error} in non-@code{nil}, return nil
|
buttons can be found. If @var{no-error} in non-@code{nil}, return nil
|
||||||
instead of signalling the error.
|
instead of signaling the error.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn Command backward-button n &optional wrap display-message
|
@deffn Command backward-button n &optional wrap display-message
|
||||||
@ -6938,7 +6938,7 @@ end of the buffer continues from the other end. If
|
|||||||
is displayed. Any button with a non-@code{nil} @code{skip} property
|
is displayed. Any button with a non-@code{nil} @code{skip} property
|
||||||
is skipped over. Returns the button found, and signals an error if no
|
is skipped over. Returns the button found, and signals an error if no
|
||||||
buttons can be found. If @var{no-error} in non-@code{nil}, return nil
|
buttons can be found. If @var{no-error} in non-@code{nil}, return nil
|
||||||
instead of signalling the error.
|
instead of signaling the error.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@defun next-button pos &optional count-current
|
@defun next-button pos &optional count-current
|
||||||
|
@ -858,7 +858,7 @@ to a non-@code{nil} value.
|
|||||||
Here is an example of code that creates a circular structure:
|
Here is an example of code that creates a circular structure:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
(setq a '(x y))
|
(setq a (list 'x 'y))
|
||||||
(setcar a a)
|
(setcar a a)
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
@ -297,6 +297,7 @@ Lisp Data Types
|
|||||||
* Circular Objects:: Read syntax for circular structure.
|
* Circular Objects:: Read syntax for circular structure.
|
||||||
* Type Predicates:: Tests related to types.
|
* Type Predicates:: Tests related to types.
|
||||||
* Equality Predicates:: Tests of equality between any two objects.
|
* Equality Predicates:: Tests of equality between any two objects.
|
||||||
|
* Constants and Mutability:: Whether an object's value can change.
|
||||||
|
|
||||||
Programming Types
|
Programming Types
|
||||||
|
|
||||||
|
@ -158,6 +158,12 @@ contents unchanged.
|
|||||||
@end group
|
@end group
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
A self-evaluating form yields constant conses, vectors and strings, and you
|
||||||
|
should not attempt to modify their contents via @code{setcar}, @code{aset} or
|
||||||
|
similar operations. The Lisp interpreter might unify the constants
|
||||||
|
yielded by your program's self-evaluating forms, so that these
|
||||||
|
constants might share structure. @xref{Constants and Mutability}.
|
||||||
|
|
||||||
It is common to write numbers, characters, strings, and even vectors
|
It is common to write numbers, characters, strings, and even vectors
|
||||||
in Lisp code, taking advantage of the fact that they self-evaluate.
|
in Lisp code, taking advantage of the fact that they self-evaluate.
|
||||||
However, it is quite unusual to do this for types that lack a read
|
However, it is quite unusual to do this for types that lack a read
|
||||||
@ -558,6 +564,8 @@ and vectors.)
|
|||||||
|
|
||||||
@defspec quote object
|
@defspec quote object
|
||||||
This special form returns @var{object}, without evaluating it.
|
This special form returns @var{object}, without evaluating it.
|
||||||
|
The returned value is a constant, and should not be modified.
|
||||||
|
@xref{Constants and Mutability}.
|
||||||
@end defspec
|
@end defspec
|
||||||
|
|
||||||
@cindex @samp{'} for quoting
|
@cindex @samp{'} for quoting
|
||||||
@ -612,10 +620,12 @@ only part of a list, while computing and substituting other parts.
|
|||||||
|
|
||||||
@dfn{Backquote constructs} allow you to quote a list, but
|
@dfn{Backquote constructs} allow you to quote a list, but
|
||||||
selectively evaluate elements of that list. In the simplest case, it
|
selectively evaluate elements of that list. In the simplest case, it
|
||||||
is identical to the special form @code{quote}
|
is identical to the special form
|
||||||
@iftex
|
@iftex
|
||||||
|
@code{quote}.
|
||||||
@end iftex
|
@end iftex
|
||||||
@ifnottex
|
@ifnottex
|
||||||
|
@code{quote}
|
||||||
(described in the previous section; @pxref{Quoting}).
|
(described in the previous section; @pxref{Quoting}).
|
||||||
@end ifnottex
|
@end ifnottex
|
||||||
For example, these two forms yield identical results:
|
For example, these two forms yield identical results:
|
||||||
@ -693,6 +703,9 @@ Here are some examples:
|
|||||||
@end group
|
@end group
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
If a subexpression of a backquote construct has no substitutions or
|
||||||
|
splices, it acts like @code{quote} in that it yields constant conses,
|
||||||
|
vectors and strings that should not be modified.
|
||||||
|
|
||||||
@node Eval
|
@node Eval
|
||||||
@section Eval
|
@section Eval
|
||||||
|
@ -970,7 +970,7 @@ string.
|
|||||||
@end group
|
@end group
|
||||||
|
|
||||||
@group
|
@group
|
||||||
(mapconcat (function (lambda (x) (format "%c" (1+ x))))
|
(mapconcat (lambda (x) (format "%c" (1+ x)))
|
||||||
"HAL-8000"
|
"HAL-8000"
|
||||||
"")
|
"")
|
||||||
@result{} "IBM.9111"
|
@result{} "IBM.9111"
|
||||||
@ -2287,7 +2287,7 @@ function) as a generalized variable. @var{setter} can be a symbol in which
|
|||||||
case it will be passed to @code{gv-define-simple-setter}, or it can be of the
|
case it will be passed to @code{gv-define-simple-setter}, or it can be of the
|
||||||
form @code{(lambda (@var{arg}) @var{body})} in which case that function will
|
form @code{(lambda (@var{arg}) @var{body})} in which case that function will
|
||||||
additionally have access to the macro (or function)'s arguments and it will
|
additionally have access to the macro (or function)'s arguments and it will
|
||||||
passed to @code{gv-define-setter}.
|
be passed to @code{gv-define-setter}.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
|
@ -175,49 +175,47 @@ All symbols that have PATTERN in their name are described
|
|||||||
in the *Help* buffer."
|
in the *Help* buffer."
|
||||||
(interactive "sDescribe symbols matching: ")
|
(interactive "sDescribe symbols matching: ")
|
||||||
(let ((describe-func
|
(let ((describe-func
|
||||||
(function
|
(lambda (s)
|
||||||
(lambda (s)
|
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
;; @r{Print description of symbol.}
|
;; @r{Print description of symbol.}
|
||||||
(if (fboundp s) ; @r{It is a function.}
|
(if (fboundp s) ; @r{It is a function.}
|
||||||
(princ
|
(princ
|
||||||
(format "%s\t%s\n%s\n\n" s
|
(format "%s\t%s\n%s\n\n" s
|
||||||
(if (commandp s)
|
(if (commandp s)
|
||||||
(let ((keys (where-is-internal s)))
|
(let ((keys (where-is-internal s)))
|
||||||
(if keys
|
(if keys
|
||||||
(concat
|
(concat
|
||||||
"Keys: "
|
"Keys: "
|
||||||
(mapconcat 'key-description
|
(mapconcat 'key-description
|
||||||
keys " "))
|
keys " "))
|
||||||
"Keys: none"))
|
"Keys: none"))
|
||||||
"Function")
|
"Function")
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
(or (documentation s)
|
(or (documentation s)
|
||||||
"not documented"))))
|
"not documented"))))
|
||||||
|
|
||||||
(if (boundp s) ; @r{It is a variable.}
|
(if (boundp s) ; @r{It is a variable.}
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
(princ
|
(princ
|
||||||
(format "%s\t%s\n%s\n\n" s
|
(format "%s\t%s\n%s\n\n" s
|
||||||
(if (custom-variable-p s)
|
(if (custom-variable-p s)
|
||||||
"Option " "Variable")
|
"Option " "Variable")
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
(or (documentation-property
|
(or (documentation-property
|
||||||
s 'variable-documentation)
|
s 'variable-documentation)
|
||||||
"not documented")))))))
|
"not documented"))))))
|
||||||
sym-list)
|
sym-list)
|
||||||
@end group
|
@end group
|
||||||
|
|
||||||
@group
|
@group
|
||||||
;; @r{Build a list of symbols that match pattern.}
|
;; @r{Build a list of symbols that match pattern.}
|
||||||
(mapatoms (function
|
(mapatoms (lambda (sym)
|
||||||
(lambda (sym)
|
(if (string-match pattern (symbol-name sym))
|
||||||
(if (string-match pattern (symbol-name sym))
|
(setq sym-list (cons sym sym-list)))))
|
||||||
(setq sym-list (cons sym sym-list))))))
|
|
||||||
@end group
|
@end group
|
||||||
|
|
||||||
@group
|
@group
|
||||||
|
@ -1441,10 +1441,10 @@ Here is an example showing a keymap before and after substitution:
|
|||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
@group
|
@group
|
||||||
(setq map '(keymap
|
(setq map (list 'keymap
|
||||||
(?1 . olddef-1)
|
(cons ?1 olddef-1)
|
||||||
(?2 . olddef-2)
|
(cons ?2 olddef-2)
|
||||||
(?3 . olddef-1)))
|
(cons ?3 olddef-1)))
|
||||||
@result{} (keymap (49 . olddef-1) (50 . olddef-2) (51 . olddef-1))
|
@result{} (keymap (49 . olddef-1) (50 . olddef-2) (51 . olddef-1))
|
||||||
@end group
|
@end group
|
||||||
|
|
||||||
@ -2226,14 +2226,11 @@ right value for selecting that button. Clicking on the button should
|
|||||||
set the variable so that the button you clicked on becomes selected.
|
set the variable so that the button you clicked on becomes selected.
|
||||||
|
|
||||||
@item :key-sequence @var{key-sequence}
|
@item :key-sequence @var{key-sequence}
|
||||||
This property specifies which key sequence is likely to be bound to the
|
This property specifies which key sequence to display as keyboard equivalent.
|
||||||
same command invoked by this menu item. If you specify a correct key
|
Before Emacs displays @var{key-sequence} in the menu, it verifies that
|
||||||
sequence, that sequence will be preferred over others.
|
@var{key-sequence} is really equivalent to this menu item, so it only
|
||||||
|
has an effect if you specify a correct key sequence.
|
||||||
If you specify an incorrect key sequence, it has no effect; before Emacs
|
Specifying @code{nil} for @var{key-sequence} is equivalent to the
|
||||||
displays @var{key-sequence} in the menu, it verifies that
|
|
||||||
@var{key-sequence} is really equivalent to this menu item. Specifying
|
|
||||||
@code{nil} for @var{key-sequence} is equivalent to the
|
|
||||||
@code{:key-sequence} attribute being absent.
|
@code{:key-sequence} attribute being absent.
|
||||||
|
|
||||||
@item :keys @var{string}
|
@item :keys @var{string}
|
||||||
@ -2916,17 +2913,17 @@ the following:
|
|||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@item :keys @var{keys}
|
@item :keys @var{keys}
|
||||||
@var{keys} is a keyboard equivalent to the menu item (a string). This
|
@var{keys} is a string to display as keyboard equivalent to the menu item.
|
||||||
is normally not needed, as keyboard equivalents are computed
|
This is normally not needed, as keyboard equivalents are computed
|
||||||
automatically. @var{keys} is expanded with
|
automatically. @var{keys} is expanded with
|
||||||
@code{substitute-command-keys} before it is displayed (@pxref{Keys in
|
@code{substitute-command-keys} before it is displayed (@pxref{Keys in
|
||||||
Documentation}).
|
Documentation}).
|
||||||
|
|
||||||
@item :key-sequence @var{keys}
|
@item :key-sequence @var{keys}
|
||||||
@var{keys} is a hint for speeding up Emacs's first display of the
|
@var{keys} is a hint indicating which key sequence to display as
|
||||||
menu. It should be @code{nil} if you know that the menu item has no keyboard
|
keyboard equivalent, in case the command is bound to several key sequences.
|
||||||
equivalent; otherwise it should be a string or vector specifying a
|
It has no effect if @var{keys} is not bound to same command as this
|
||||||
keyboard equivalent for the menu item.
|
menu item.
|
||||||
|
|
||||||
@item :active @var{enable}
|
@item :active @var{enable}
|
||||||
@var{enable} is an expression; if it evaluates to @code{nil}, the item
|
@var{enable} is an expression; if it evaluates to @code{nil}, the item
|
||||||
|
@ -866,10 +866,15 @@ foo ;; @r{@code{foo} was changed.}
|
|||||||
@node Modifying Lists
|
@node Modifying Lists
|
||||||
@section Modifying Existing List Structure
|
@section Modifying Existing List Structure
|
||||||
@cindex destructive list operations
|
@cindex destructive list operations
|
||||||
|
@cindex mutable lists
|
||||||
|
|
||||||
You can modify the @sc{car} and @sc{cdr} contents of a cons cell with the
|
You can modify the @sc{car} and @sc{cdr} contents of a cons cell with the
|
||||||
primitives @code{setcar} and @code{setcdr}. These are destructive
|
primitives @code{setcar} and @code{setcdr}. These are destructive
|
||||||
operations because they change existing list structure.
|
operations because they change existing list structure.
|
||||||
|
Destructive operations should be applied only to mutable lists,
|
||||||
|
that is, lists constructed via @code{cons}, @code{list} or similar
|
||||||
|
operations. Lists created by quoting are constants and should not be
|
||||||
|
changed by destructive operations. @xref{Constants and Mutability}.
|
||||||
|
|
||||||
@cindex CL note---@code{rplaca} vs @code{setcar}
|
@cindex CL note---@code{rplaca} vs @code{setcar}
|
||||||
@quotation
|
@quotation
|
||||||
@ -906,7 +911,7 @@ value @var{object}. For example:
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(setq x '(1 2))
|
(setq x (list 1 2)) ; @r{Create a mutable list.}
|
||||||
@result{} (1 2)
|
@result{} (1 2)
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
@ -926,8 +931,8 @@ these lists. Here is an example:
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
;; @r{Create two lists that are partly shared.}
|
;; @r{Create two mutable lists that are partly shared.}
|
||||||
(setq x1 '(a b c))
|
(setq x1 (list 'a 'b 'c))
|
||||||
@result{} (a b c)
|
@result{} (a b c)
|
||||||
(setq x2 (cons 'z (cdr x1)))
|
(setq x2 (cons 'z (cdr x1)))
|
||||||
@result{} (z b c)
|
@result{} (z b c)
|
||||||
@ -1017,11 +1022,11 @@ reached via the @sc{cdr}.
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(setq x '(1 2 3))
|
(setq x (list 1 2 3)) ; @r{Create a mutable list.}
|
||||||
@result{} (1 2 3)
|
@result{} (1 2 3)
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
(setcdr x '(4))
|
(setcdr x '(4)) ; @r{Modify the list's tail to be a constant list.}
|
||||||
@result{} (4)
|
@result{} (4)
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
@ -1037,7 +1042,7 @@ the @sc{cdr} of the first cons cell:
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(setq x1 '(a b c))
|
(setq x1 (list 'a 'b 'c))
|
||||||
@result{} (a b c)
|
@result{} (a b c)
|
||||||
(setcdr x1 (cdr (cdr x1)))
|
(setcdr x1 (cdr (cdr x1)))
|
||||||
@result{} (c)
|
@result{} (c)
|
||||||
@ -1069,7 +1074,7 @@ of this list.
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(setq x1 '(a b c))
|
(setq x1 (list 'a 'b 'c))
|
||||||
@result{} (a b c)
|
@result{} (a b c)
|
||||||
(setcdr x1 (cons 'd (cdr x1)))
|
(setcdr x1 (cons 'd (cdr x1)))
|
||||||
@result{} (d b c)
|
@result{} (d b c)
|
||||||
@ -1130,11 +1135,11 @@ Unlike @code{append} (@pxref{Building Lists}), the @var{lists} are
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(setq x '(1 2 3))
|
(setq x (list 1 2 3)) ; @r{Create a mutable list.}
|
||||||
@result{} (1 2 3)
|
@result{} (1 2 3)
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
(nconc x '(4 5))
|
(nconc x '(4 5)) ; @r{Modify the list's tail to be a constant list.}
|
||||||
@result{} (1 2 3 4 5)
|
@result{} (1 2 3 4 5)
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
@ -1150,7 +1155,7 @@ list:
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(setq x '(1 2 3))
|
(setq x (list 1 2 3))
|
||||||
@result{} (1 2 3)
|
@result{} (1 2 3)
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
@ -1163,11 +1168,13 @@ x
|
|||||||
@end group
|
@end group
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
However, the other arguments (all but the last) must be lists.
|
However, the other arguments (all but the last) should be mutable lists.
|
||||||
|
|
||||||
A common pitfall is to use a quoted constant list as a non-last
|
A common pitfall is to use a constant list as a non-last
|
||||||
argument to @code{nconc}. If you do this, your program will change
|
argument to @code{nconc}. If you do this, the resulting behavior
|
||||||
each time you run it! Here is what happens:
|
is undefined. It is possible that your program will change
|
||||||
|
each time you run it! Here is what might happen (though this
|
||||||
|
is not guaranteed to happen):
|
||||||
|
|
||||||
@smallexample
|
@smallexample
|
||||||
@group
|
@group
|
||||||
@ -1270,7 +1277,7 @@ removing it involves changing the @sc{cdr}s (@pxref{Setcdr}).
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(setq sample-list '(a b c (4)))
|
(setq sample-list (list 'a 'b 'c '(4)))
|
||||||
@result{} (a b c (4))
|
@result{} (a b c (4))
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
@ -1303,12 +1310,12 @@ into the variable that held the original list:
|
|||||||
(setq flowers (delq 'rose flowers))
|
(setq flowers (delq 'rose flowers))
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
In the following example, the @code{(4)} that @code{delq} attempts to match
|
In the following example, the @code{(list 4)} that @code{delq} attempts to match
|
||||||
and the @code{(4)} in the @code{sample-list} are not @code{eq}:
|
and the @code{(4)} in the @code{sample-list} are @code{equal} but not @code{eq}:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(delq '(4) sample-list)
|
(delq (list 4) sample-list)
|
||||||
@result{} (a c (4))
|
@result{} (a c (4))
|
||||||
@end group
|
@end group
|
||||||
@end example
|
@end example
|
||||||
@ -1324,7 +1331,7 @@ of @code{list}.
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(setq sample-list '(a b c a b c))
|
(setq sample-list (list 'a 'b 'c 'a 'b 'c))
|
||||||
@result{} (a b c a b c)
|
@result{} (a b c a b c)
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
@ -1349,12 +1356,12 @@ Compare this with @code{memq}:
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(memql 1.2 '(1.1 1.2 1.3)) ; @r{@code{1.2} and @code{1.2} are @code{eql}.}
|
(memql 1.2 '(1.1 1.2 1.3)) ; @r{@code{1.2} and @code{1.2} must be @code{eql}.}
|
||||||
@result{} (1.2 1.3)
|
@result{} (1.2 1.3)
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
(memq 1.2 '(1.1 1.2 1.3)) ; @r{@code{1.2} and @code{1.2} are not @code{eq}.}
|
(memq 1.2 '(1.1 1.2 1.3)) ; @r{@code{1.2} and @code{1.2} need not be @code{eq}.}
|
||||||
@result{} nil
|
@result{} nil ; @r{... or it might be @code{(1.2 1.3)}.}
|
||||||
@end group
|
@end group
|
||||||
@end example
|
@end example
|
||||||
@end defun
|
@end defun
|
||||||
@ -1373,11 +1380,11 @@ Compare this with @code{memq}:
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(member '(2) '((1) (2))) ; @r{@code{(2)} and @code{(2)} are @code{equal}.}
|
(member (list 2) '((1) (2))) ; @r{@code{(list 2)} and @code{(2)} are @code{equal}.}
|
||||||
@result{} ((2))
|
@result{} ((2))
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
(memq '(2) '((1) (2))) ; @r{@code{(2)} and @code{(2)} are not @code{eq}.}
|
(memq (list 2) '((1) (2))) ; @r{@code{(list 2)} and @code{(2)} are not @code{eq}.}
|
||||||
@result{} nil
|
@result{} nil
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
@ -1407,7 +1414,7 @@ For example:
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(setq l '((2) (1) (2)))
|
(setq l (list '(2) '(1) '(2)))
|
||||||
(delete '(2) l)
|
(delete '(2) l)
|
||||||
@result{} ((1))
|
@result{} ((1))
|
||||||
l
|
l
|
||||||
@ -1416,7 +1423,7 @@ l
|
|||||||
;; @r{write @code{(setq l (delete '(2) l))}.}
|
;; @r{write @code{(setq l (delete '(2) l))}.}
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
(setq l '((2) (1) (2)))
|
(setq l (list '(2) '(1) '(2)))
|
||||||
(delete '(1) l)
|
(delete '(1) l)
|
||||||
@result{} ((2) (2))
|
@result{} ((2) (2))
|
||||||
l
|
l
|
||||||
@ -1618,9 +1625,10 @@ keys may not be symbols:
|
|||||||
'(("simple leaves" . oak)
|
'(("simple leaves" . oak)
|
||||||
("compound leaves" . horsechestnut)))
|
("compound leaves" . horsechestnut)))
|
||||||
|
|
||||||
(assq "simple leaves" leaves)
|
;; @r{The @code{copy-sequence} means the keys are not @code{eq}.}
|
||||||
|
(assq (copy-sequence "simple leaves") leaves)
|
||||||
@result{} nil
|
@result{} nil
|
||||||
(assoc "simple leaves" leaves)
|
(assoc (copy-sequence "simple leaves") leaves)
|
||||||
@result{} ("simple leaves" . oak)
|
@result{} ("simple leaves" . oak)
|
||||||
@end smallexample
|
@end smallexample
|
||||||
@end defun
|
@end defun
|
||||||
@ -1759,7 +1767,7 @@ correct results, use the return value of @code{assq-delete-all} rather
|
|||||||
than looking at the saved value of @var{alist}.
|
than looking at the saved value of @var{alist}.
|
||||||
|
|
||||||
@example
|
@example
|
||||||
(setq alist '((foo 1) (bar 2) (foo 3) (lose 4)))
|
(setq alist (list '(foo 1) '(bar 2) '(foo 3) '(lose 4)))
|
||||||
@result{} ((foo 1) (bar 2) (foo 3) (lose 4))
|
@result{} ((foo 1) (bar 2) (foo 3) (lose 4))
|
||||||
(assq-delete-all 'foo alist)
|
(assq-delete-all 'foo alist)
|
||||||
@result{} ((bar 2) (lose 4))
|
@result{} ((bar 2) (lose 4))
|
||||||
@ -1926,7 +1934,7 @@ function returns the modified property list, so you can store that back
|
|||||||
in the place where you got @var{plist}. For example,
|
in the place where you got @var{plist}. For example,
|
||||||
|
|
||||||
@example
|
@example
|
||||||
(setq my-plist '(bar t foo 4))
|
(setq my-plist (list 'bar t 'foo 4))
|
||||||
@result{} (bar t foo 4)
|
@result{} (bar t foo 4)
|
||||||
(setq my-plist (plist-put my-plist 'foo 69))
|
(setq my-plist (plist-put my-plist 'foo 69))
|
||||||
@result{} (bar t foo 69)
|
@result{} (bar t foo 69)
|
||||||
|
@ -46,6 +46,10 @@ you store in it, type and all. (Actually, a small number of Emacs
|
|||||||
Lisp variables can only take on values of a certain type.
|
Lisp variables can only take on values of a certain type.
|
||||||
@xref{Variables with Restricted Values}.)
|
@xref{Variables with Restricted Values}.)
|
||||||
|
|
||||||
|
Some Lisp objects are @dfn{constant}: their values never change.
|
||||||
|
Others are @dfn{mutable}: their values can be changed via destructive
|
||||||
|
operations that involve side effects.
|
||||||
|
|
||||||
This chapter describes the purpose, printed representation, and read
|
This chapter describes the purpose, printed representation, and read
|
||||||
syntax of each of the standard types in GNU Emacs Lisp. Details on how
|
syntax of each of the standard types in GNU Emacs Lisp. Details on how
|
||||||
to use these types can be found in later chapters.
|
to use these types can be found in later chapters.
|
||||||
@ -59,6 +63,7 @@ to use these types can be found in later chapters.
|
|||||||
* Circular Objects:: Read syntax for circular structure.
|
* Circular Objects:: Read syntax for circular structure.
|
||||||
* Type Predicates:: Tests related to types.
|
* Type Predicates:: Tests related to types.
|
||||||
* Equality Predicates:: Tests of equality between any two objects.
|
* Equality Predicates:: Tests of equality between any two objects.
|
||||||
|
* Constants and Mutability:: Whether an object's value can change.
|
||||||
@end menu
|
@end menu
|
||||||
|
|
||||||
@node Printed Representation
|
@node Printed Representation
|
||||||
@ -2377,3 +2382,46 @@ that for two strings to be equal, they have the same text properties.
|
|||||||
@end group
|
@end group
|
||||||
@end example
|
@end example
|
||||||
@end defun
|
@end defun
|
||||||
|
|
||||||
|
@node Constants and Mutability
|
||||||
|
@section Constants and Mutability
|
||||||
|
@cindex constants
|
||||||
|
@cindex mutable objects
|
||||||
|
|
||||||
|
Some Lisp objects are constant: their values never change.
|
||||||
|
For example, you can create a new integer by calculating one, but you
|
||||||
|
cannot modify the value of an existing integer.
|
||||||
|
|
||||||
|
Other Lisp objects are mutable: their values can be changed
|
||||||
|
via destructive operations involving side effects. For example, an
|
||||||
|
existing marker can be changed by moving the marker to point to
|
||||||
|
somewhere else.
|
||||||
|
|
||||||
|
Although numbers are always constants and markers are always
|
||||||
|
mutable, some types contain both constant and mutable members. These
|
||||||
|
types include conses, vectors, strings, and symbols. For example, the string
|
||||||
|
literal @code{"aaa"} yields a constant string, whereas the function
|
||||||
|
call @code{(make-string 3 ?a)} yields a mutable string that can be
|
||||||
|
changed via later calls to @code{aset}.
|
||||||
|
|
||||||
|
Trying to modify a constant variable signals an error
|
||||||
|
(@pxref{Constant Variables}).
|
||||||
|
A program should not attempt to modify other types of constants because the
|
||||||
|
resulting behavior is undefined: the Lisp interpreter might or might
|
||||||
|
not detect the error, and if it does not detect the error the
|
||||||
|
interpreter can behave unpredictably thereafter. Another way to put
|
||||||
|
this is that although mutable objects are safe to change and constant
|
||||||
|
symbols reliably reject attempts to change them, other constants are
|
||||||
|
not safely mutable: if you try to change one your program might
|
||||||
|
behave as you expect but it might crash or worse. This problem occurs
|
||||||
|
with types that have both constant and mutable members, and that have
|
||||||
|
mutators like @code{setcar} and @code{aset} that are valid on mutable
|
||||||
|
objects but hazardous on constants.
|
||||||
|
|
||||||
|
When the same constant occurs multiple times in a program, the Lisp
|
||||||
|
interpreter might save time or space by reusing existing constants or
|
||||||
|
constant components. For example, @code{(eq "abc" "abc")} returns
|
||||||
|
@code{t} if the interpreter creates only one instance of the string
|
||||||
|
constant @code{"abc"}, and returns @code{nil} if it creates two
|
||||||
|
instances. Lisp programs should be written so that they work
|
||||||
|
regardless of whether this optimization is in use.
|
||||||
|
@ -2617,7 +2617,7 @@ if it is non-@code{nil}; this can be overridden by binding
|
|||||||
This variable is non-@code{nil} when Emacs is running in batch mode.
|
This variable is non-@code{nil} when Emacs is running in batch mode.
|
||||||
@end defvar
|
@end defvar
|
||||||
|
|
||||||
If Emacs exits due to signalling an error in batch mode, the exit
|
If Emacs exits due to signaling an error in batch mode, the exit
|
||||||
status of the Emacs command is non-zero:
|
status of the Emacs command is non-zero:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
|
@ -183,11 +183,11 @@ for other ways to copy sequences.
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(setq bar '(1 2))
|
(setq bar (list 1 2)) ; @r{Create a mutable list.}
|
||||||
@result{} (1 2)
|
@result{} (1 2)
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
(setq x (vector 'foo bar))
|
(setq x (vector 'foo bar)) ; @r{Create a mutable vector.}
|
||||||
@result{} [foo (1 2)]
|
@result{} [foo (1 2)]
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
@ -278,7 +278,7 @@ Unlike @code{reverse} the original @var{sequence} may be modified.
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(setq x '(a b c))
|
(setq x (list 'a 'b 'c)) ; @r{Create a mutable list.}
|
||||||
@result{} (a b c)
|
@result{} (a b c)
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
@ -320,7 +320,7 @@ presented graphically:
|
|||||||
For the vector, it is even simpler because you don't need setq:
|
For the vector, it is even simpler because you don't need setq:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
(setq x [1 2 3 4])
|
(setq x (copy-sequence [1 2 3 4])) ; @r{Create a mutable vector.}
|
||||||
@result{} [1 2 3 4]
|
@result{} [1 2 3 4]
|
||||||
(nreverse x)
|
(nreverse x)
|
||||||
@result{} [4 3 2 1]
|
@result{} [4 3 2 1]
|
||||||
@ -330,7 +330,7 @@ x
|
|||||||
|
|
||||||
Note that unlike @code{reverse}, this function doesn't work with strings.
|
Note that unlike @code{reverse}, this function doesn't work with strings.
|
||||||
Although you can alter string data by using @code{aset}, it is strongly
|
Although you can alter string data by using @code{aset}, it is strongly
|
||||||
encouraged to treat strings as immutable.
|
encouraged to treat strings as immutable even when they are mutable.
|
||||||
|
|
||||||
@end defun
|
@end defun
|
||||||
|
|
||||||
@ -374,11 +374,11 @@ appears in a different position in the list due to the change of
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(setq nums '(1 3 2 6 5 4 0))
|
(setq nums (list 1 3 2 6 5 4 0)) ; @r{Create a mutable list.}
|
||||||
@result{} (1 3 2 6 5 4 0)
|
@result{} (1 3 2 6 5 4 0)
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
(sort nums '<)
|
(sort nums #'<)
|
||||||
@result{} (0 1 2 3 4 5 6)
|
@result{} (0 1 2 3 4 5 6)
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
@ -396,7 +396,7 @@ of @code{sort} and use that. Most often we store the result back into
|
|||||||
the variable that held the original list:
|
the variable that held the original list:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
(setq nums (sort nums '<))
|
(setq nums (sort nums #'<))
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
For the better understanding of what stable sort is, consider the following
|
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
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(setq w [foo bar baz])
|
(setq w (vector 'foo 'bar 'baz)) ; @r{Create a mutable vector.}
|
||||||
@result{} [foo bar baz]
|
@result{} [foo bar baz]
|
||||||
(aset w 0 'fu)
|
(aset w 0 'fu)
|
||||||
@result{} fu
|
@result{} fu
|
||||||
@ -1237,7 +1237,8 @@ w
|
|||||||
@end group
|
@end group
|
||||||
|
|
||||||
@group
|
@group
|
||||||
(setq x "asdfasfd")
|
;; @r{@code{copy-sequence} creates a mutable string.}
|
||||||
|
(setq x (copy-sequence "asdfasfd"))
|
||||||
@result{} "asdfasfd"
|
@result{} "asdfasfd"
|
||||||
(aset x 3 ?Z)
|
(aset x 3 ?Z)
|
||||||
@result{} 90
|
@result{} 90
|
||||||
@ -1246,6 +1247,10 @@ x
|
|||||||
@end group
|
@end group
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
The @var{array} should be mutable; that is, it should not be a constant,
|
||||||
|
such as the constants created via quoting or via self-evaluating forms.
|
||||||
|
@xref{Constants and Mutability}.
|
||||||
|
|
||||||
If @var{array} is a string and @var{object} is not a character, a
|
If @var{array} is a string and @var{object} is not a character, a
|
||||||
@code{wrong-type-argument} error results. The function converts a
|
@code{wrong-type-argument} error results. The function converts a
|
||||||
unibyte string to multibyte if necessary to insert a character.
|
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}.
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(setq a [a b c d e f g])
|
;; @r{Create a mutable vector and then fill it with zeros.}
|
||||||
|
(setq a (copy-sequence [a b c d e f g]))
|
||||||
@result{} [a b c d e f g]
|
@result{} [a b c d e f g]
|
||||||
(fillarray a 0)
|
(fillarray a 0)
|
||||||
@result{} [0 0 0 0 0 0 0]
|
@result{} [0 0 0 0 0 0 0]
|
||||||
@ -1265,7 +1271,8 @@ a
|
|||||||
@result{} [0 0 0 0 0 0 0]
|
@result{} [0 0 0 0 0 0 0]
|
||||||
@end group
|
@end group
|
||||||
@group
|
@group
|
||||||
(setq s "When in the course")
|
;; @r{Create a mutable string and then fill it with "-".}
|
||||||
|
(setq s (copy-sequence "When in the course"))
|
||||||
@result{} "When in the course"
|
@result{} "When in the course"
|
||||||
(fillarray s ?-)
|
(fillarray s ?-)
|
||||||
@result{} "------------------"
|
@result{} "------------------"
|
||||||
@ -1302,7 +1309,9 @@ same way in Lisp input.
|
|||||||
A vector, like a string or a number, is considered a constant for
|
A vector, like a string or a number, is considered a constant for
|
||||||
evaluation: the result of evaluating it is the same vector. This does
|
evaluation: the result of evaluating it is the same vector. This does
|
||||||
not evaluate or even examine the elements of the vector.
|
not evaluate or even examine the elements of the vector.
|
||||||
@xref{Self-Evaluating Forms}.
|
@xref{Self-Evaluating Forms}. Vectors written with square brackets
|
||||||
|
are constants and should not be modified via @code{aset} or other
|
||||||
|
destructive operations. @xref{Constants and Mutability}.
|
||||||
|
|
||||||
Here are examples illustrating these principles:
|
Here are examples illustrating these principles:
|
||||||
|
|
||||||
@ -1565,14 +1574,14 @@ For example, here is how to examine the elements of the syntax table:
|
|||||||
@example
|
@example
|
||||||
(let (accumulator)
|
(let (accumulator)
|
||||||
(map-char-table
|
(map-char-table
|
||||||
#'(lambda (key value)
|
(lambda (key value)
|
||||||
(setq accumulator
|
(setq accumulator
|
||||||
(cons (list
|
(cons (list
|
||||||
(if (consp key)
|
(if (consp key)
|
||||||
(list (car key) (cdr key))
|
(list (car key) (cdr key))
|
||||||
key)
|
key)
|
||||||
value)
|
value)
|
||||||
accumulator)))
|
accumulator)))
|
||||||
(syntax-table))
|
(syntax-table))
|
||||||
accumulator)
|
accumulator)
|
||||||
@result{}
|
@result{}
|
||||||
|
@ -51,10 +51,8 @@ by a distinguished character code.
|
|||||||
operate on them with the general array and sequence functions documented
|
operate on them with the general array and sequence functions documented
|
||||||
in @ref{Sequences Arrays Vectors}. For example, you can access or
|
in @ref{Sequences Arrays Vectors}. For example, you can access or
|
||||||
change individual characters in a string using the functions @code{aref}
|
change individual characters in a string using the functions @code{aref}
|
||||||
and @code{aset} (@pxref{Array Functions}). However, note that
|
and @code{aset} (@pxref{Array Functions}). However, you should not
|
||||||
@code{length} should @emph{not} be used for computing the width of a
|
try to change the contents of constant strings (@pxref{Modifying Strings}).
|
||||||
string on display; use @code{string-width} (@pxref{Size of Displayed
|
|
||||||
Text}) instead.
|
|
||||||
|
|
||||||
There are two text representations for non-@acronym{ASCII}
|
There are two text representations for non-@acronym{ASCII}
|
||||||
characters in Emacs strings (and in buffers): unibyte and multibyte.
|
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},
|
|||||||
for information about the syntax of characters and strings.
|
for information about the syntax of characters and strings.
|
||||||
@xref{Non-ASCII Characters}, for functions to convert between text
|
@xref{Non-ASCII Characters}, for functions to convert between text
|
||||||
representations and to encode and decode character codes.
|
representations and to encode and decode character codes.
|
||||||
|
Also, note that @code{length} should @emph{not} be used for computing
|
||||||
|
the width of a string on display; use @code{string-width} (@pxref{Size
|
||||||
|
of Displayed Text}) instead.
|
||||||
|
|
||||||
@node Predicates for Strings
|
@node Predicates for Strings
|
||||||
@section Predicates for Strings
|
@section Predicates for Strings
|
||||||
@ -380,6 +381,11 @@ usual value is @w{@code{"[ \f\t\n\r\v]+"}}.
|
|||||||
@cindex modifying strings
|
@cindex modifying strings
|
||||||
@cindex string modification
|
@cindex string modification
|
||||||
|
|
||||||
|
You can alter the contents of a mutable string via operations
|
||||||
|
described in this section. However, you should not try to use these
|
||||||
|
operations to alter the contents of a constant string.
|
||||||
|
@xref{Constants and Mutability}.
|
||||||
|
|
||||||
The most basic way to alter the contents of an existing string is with
|
The most basic way to alter the contents of an existing string is with
|
||||||
@code{aset} (@pxref{Array Functions}). @code{(aset @var{string}
|
@code{aset} (@pxref{Array Functions}). @code{(aset @var{string}
|
||||||
@var{idx} @var{char})} stores @var{char} into @var{string} at index
|
@var{idx} @var{char})} stores @var{char} into @var{string} at index
|
||||||
@ -591,7 +597,7 @@ for sorting (@pxref{Sequence Functions}):
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(sort '("11" "12" "1 1" "1 2" "1.1" "1.2") 'string-collate-lessp)
|
(sort (list "11" "12" "1 1" "1 2" "1.1" "1.2") 'string-collate-lessp)
|
||||||
@result{} ("11" "1 1" "1.1" "12" "1 2" "1.2")
|
@result{} ("11" "1 1" "1.1" "12" "1 2" "1.2")
|
||||||
@end group
|
@end group
|
||||||
@end example
|
@end example
|
||||||
@ -608,7 +614,7 @@ systems. The @var{locale} value of @code{"POSIX"} or @code{"C"} lets
|
|||||||
|
|
||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(sort '("11" "12" "1 1" "1 2" "1.1" "1.2")
|
(sort (list "11" "12" "1 1" "1 2" "1.1" "1.2")
|
||||||
(lambda (s1 s2) (string-collate-lessp s1 s2 "POSIX")))
|
(lambda (s1 s2) (string-collate-lessp s1 s2 "POSIX")))
|
||||||
@result{} ("1 1" "1 2" "1.1" "1.2" "11" "12")
|
@result{} ("1 1" "1 2" "1.1" "1.2" "11" "12")
|
||||||
@end group
|
@end group
|
||||||
|
@ -1118,9 +1118,9 @@ bidi-class}).
|
|||||||
;; 'bidi-class' Unicode property is R, AL, or RLO --
|
;; 'bidi-class' Unicode property is R, AL, or RLO --
|
||||||
;; these have a right-to-left directionality.
|
;; these have a right-to-left directionality.
|
||||||
(map-char-table
|
(map-char-table
|
||||||
#'(lambda (key val)
|
(lambda (key val)
|
||||||
(if (memq val '(R AL RLO))
|
(if (memq val '(R AL RLO))
|
||||||
(modify-category-entry key ?R category-table)))
|
(modify-category-entry key ?R category-table)))
|
||||||
uniprop-table)
|
uniprop-table)
|
||||||
category-table))
|
category-table))
|
||||||
@end example
|
@end example
|
||||||
|
@ -2073,11 +2073,10 @@ its @code{sort-subr} call looks like this:
|
|||||||
@example
|
@example
|
||||||
@group
|
@group
|
||||||
(sort-subr reverse
|
(sort-subr reverse
|
||||||
(function
|
(lambda ()
|
||||||
(lambda ()
|
(while (and (not (eobp))
|
||||||
(while (and (not (eobp))
|
(looking-at paragraph-separate))
|
||||||
(looking-at paragraph-separate))
|
(forward-line 1)))
|
||||||
(forward-line 1))))
|
|
||||||
'forward-paragraph)
|
'forward-paragraph)
|
||||||
@end group
|
@end group
|
||||||
@end example
|
@end example
|
||||||
@ -4679,7 +4678,7 @@ expanded when the header line is computed. To do this, the
|
|||||||
above. @var{specification} is an alist that has elements where the
|
above. @var{specification} is an alist that has elements where the
|
||||||
@code{car} is a character and the @code{cdr} is the substitution.
|
@code{car} is a character and the @code{cdr} is the substitution.
|
||||||
|
|
||||||
If @code{ONLY-PRESENT} is @code{nil}, errors will be signalled if a
|
If @code{ONLY-PRESENT} is @code{nil}, errors will be signaled if a
|
||||||
format character has been used that's not present in
|
format character has been used that's not present in
|
||||||
@var{specification}. If it's non-@code{nil}, that format
|
@var{specification}. If it's non-@code{nil}, that format
|
||||||
specification is left verbatim in the result.
|
specification is left verbatim in the result.
|
||||||
@ -5725,7 +5724,7 @@ made within the @code{combine-after-change-calls} body.
|
|||||||
@code{after-change-functions} within
|
@code{after-change-functions} within
|
||||||
the body of a @code{combine-after-change-calls} form.
|
the body of a @code{combine-after-change-calls} form.
|
||||||
|
|
||||||
@strong{Warning:} if the changes you combine occur in widely scattered
|
@strong{Warning:} If the changes you combine occur in widely scattered
|
||||||
parts of the buffer, this will still work, but it is not advisable,
|
parts of the buffer, this will still work, but it is not advisable,
|
||||||
because it may lead to inefficient behavior for some change hook
|
because it may lead to inefficient behavior for some change hook
|
||||||
functions.
|
functions.
|
||||||
|
@ -25668,6 +25668,13 @@ Create non-spam statistics for every file in this directory. Every
|
|||||||
file is treated as one non-spam mail.
|
file is treated as one non-spam mail.
|
||||||
@end defun
|
@end defun
|
||||||
|
|
||||||
|
@defvar spam-stat-process-directory-age
|
||||||
|
Maximum age of files to be processed, in days. Without this filter,
|
||||||
|
re-training spam-stat with several thousand messages could take a long
|
||||||
|
time. The default is 90, but you might want to set this to a bigger
|
||||||
|
value during the initial training.
|
||||||
|
@end defvar
|
||||||
|
|
||||||
Usually you would call @code{spam-stat-process-spam-directory} on a
|
Usually you would call @code{spam-stat-process-spam-directory} on a
|
||||||
directory such as @file{~/Mail/mail/spam} (this usually corresponds to
|
directory such as @file{~/Mail/mail/spam} (this usually corresponds to
|
||||||
the group @samp{nnml:mail.spam}), and you would call
|
the group @samp{nnml:mail.spam}), and you would call
|
||||||
|
66
etc/NEWS.27
66
etc/NEWS.27
@ -934,7 +934,7 @@ back, customize 'follow-hide-ghost-cursors' to nil.
|
|||||||
*** 'windmove-create-window' when non-nil makes a new window.
|
*** 'windmove-create-window' when non-nil makes a new window.
|
||||||
This happens upon moving off the edge of the frame.
|
This happens upon moving off the edge of the frame.
|
||||||
|
|
||||||
---
|
+++
|
||||||
*** Windmove supports directional window display and selection.
|
*** Windmove supports directional window display and selection.
|
||||||
The new command 'windmove-display-default-keybindings' binds default
|
The new command 'windmove-display-default-keybindings' binds default
|
||||||
keys with provided modifiers (by default, Shift-Meta) to the commands
|
keys with provided modifiers (by default, Shift-Meta) to the commands
|
||||||
@ -948,7 +948,7 @@ display the buffer in the same window, for example, 'S-M-0 C-h e'
|
|||||||
displays the "*Messages*" buffer in the same window. 'S-M-t C-h C-n'
|
displays the "*Messages*" buffer in the same window. 'S-M-t C-h C-n'
|
||||||
displays NEWS in a new tab.
|
displays NEWS in a new tab.
|
||||||
|
|
||||||
---
|
+++
|
||||||
*** Windmove also supports directional window deletion.
|
*** Windmove also supports directional window deletion.
|
||||||
The new command 'windmove-delete-default-keybindings' binds default
|
The new command 'windmove-delete-default-keybindings' binds default
|
||||||
keys with provided prefix (by default, 'C-x') and modifiers (by default,
|
keys with provided prefix (by default, 'C-x') and modifiers (by default,
|
||||||
@ -958,7 +958,7 @@ With a prefix arg 'C-u', also kills the buffer in that window.
|
|||||||
With 'M-0', deletes the selected window and selects the window
|
With 'M-0', deletes the selected window and selects the window
|
||||||
that was in the specified direction.
|
that was in the specified direction.
|
||||||
|
|
||||||
---
|
+++
|
||||||
*** New command 'windmove-swap-states-in-direction' binds default keys
|
*** New command 'windmove-swap-states-in-direction' binds default keys
|
||||||
to the commands that swap the states of the selected window with the
|
to the commands that swap the states of the selected window with the
|
||||||
window in the specified direction.
|
window in the specified direction.
|
||||||
@ -1011,10 +1011,6 @@ remapped to these, respectively.
|
|||||||
|
|
||||||
** Dired
|
** Dired
|
||||||
|
|
||||||
---
|
|
||||||
*** On systems that support suid/guid files, Dired now fontifies the
|
|
||||||
permissions of such files with a special face 'dired-set-id'.
|
|
||||||
|
|
||||||
+++
|
+++
|
||||||
*** New command 'dired-create-empty-file'.
|
*** New command 'dired-create-empty-file'.
|
||||||
|
|
||||||
@ -1026,10 +1022,6 @@ It is by default bound to '* N'.
|
|||||||
*** The marking commands now report how many files were marked by the
|
*** The marking commands now report how many files were marked by the
|
||||||
command itself, not how many files are marked in total.
|
command itself, not how many files are marked in total.
|
||||||
|
|
||||||
---
|
|
||||||
*** A new face, 'dired-special', is used to highlight sockets, named
|
|
||||||
pipes, block devices and character devices.
|
|
||||||
|
|
||||||
+++
|
+++
|
||||||
*** The new user option 'dired-create-destination-dirs' controls whether
|
*** The new user option 'dired-create-destination-dirs' controls whether
|
||||||
'dired-do-copy' and 'dired-rename-file' should create non-existent
|
'dired-do-copy' and 'dired-rename-file' should create non-existent
|
||||||
@ -1047,6 +1039,14 @@ Dired performs file renaming using underlying version control system.
|
|||||||
*** Zstandard compression is now supported for 'dired-do-compress' and
|
*** Zstandard compression is now supported for 'dired-do-compress' and
|
||||||
'dired-do-compress-to'.
|
'dired-do-compress-to'.
|
||||||
|
|
||||||
|
---
|
||||||
|
*** On systems that support suid/guid files, Dired now fontifies the
|
||||||
|
permissions of such files with a special face 'dired-set-id'.
|
||||||
|
|
||||||
|
---
|
||||||
|
*** A new face, 'dired-special', is used to highlight sockets, named
|
||||||
|
pipes, block devices and character devices.
|
||||||
|
|
||||||
** Find-Dired
|
** Find-Dired
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -1068,12 +1068,6 @@ script. The default is nil.
|
|||||||
*** New command 'log-edit-generate-changelog-from-diff', bound to 'C-c C-w'.
|
*** New command 'log-edit-generate-changelog-from-diff', bound to 'C-c C-w'.
|
||||||
This generates ChangeLog entries from the VC fileset diff.
|
This generates ChangeLog entries from the VC fileset diff.
|
||||||
|
|
||||||
---
|
|
||||||
*** 'vc-dir' now shows a button allowing you to hide the stash list.
|
|
||||||
Controlled by user option 'vc-git-show-stash'. Default t means show
|
|
||||||
the entire list as before. An integer value limits the list length
|
|
||||||
(but still allows you to show the entire list via the button).
|
|
||||||
|
|
||||||
+++
|
+++
|
||||||
*** Recording ChangeLog entries doesn't require an actual file.
|
*** Recording ChangeLog entries doesn't require an actual file.
|
||||||
If a ChangeLog file doesn't exist, and if the new user option
|
If a ChangeLog file doesn't exist, and if the new user option
|
||||||
@ -1084,9 +1078,11 @@ still be used if it exists.) Set the user option to nil to get the
|
|||||||
previous behavior of always creating a buffer that visits a ChangeLog
|
previous behavior of always creating a buffer that visits a ChangeLog
|
||||||
file.
|
file.
|
||||||
|
|
||||||
---
|
+++
|
||||||
*** New user option 'vc-find-revision-no-save'.
|
*** The new 'd' command ('vc-dir-clean-files') in 'vc-dir-mode'
|
||||||
With non-nil, 'vc-find-revision' doesn't write the created buffer to file.
|
buffers will delete the marked files (or if no files are marked, the
|
||||||
|
file under point). This command does not notify the VC backend, and
|
||||||
|
is mostly useful for unregistered files.
|
||||||
|
|
||||||
---
|
---
|
||||||
*** 'vc-dir-ignore' now takes a prefix argument to ignore all marked files.
|
*** 'vc-dir-ignore' now takes a prefix argument to ignore all marked files.
|
||||||
@ -1101,6 +1097,12 @@ This new user option allows customizing the default arguments passed to
|
|||||||
When some files are marked, only those are stashed.
|
When some files are marked, only those are stashed.
|
||||||
When no files are marked, all modified files are stashed, as before.
|
When no files are marked, all modified files are stashed, as before.
|
||||||
|
|
||||||
|
---
|
||||||
|
*** 'vc-dir' now shows a button allowing you to hide the stash list.
|
||||||
|
Controlled by user option 'vc-git-show-stash'. Default t means show
|
||||||
|
the entire list as before. An integer value limits the list length
|
||||||
|
(but still allows you to show the entire list via the button).
|
||||||
|
|
||||||
---
|
---
|
||||||
*** 'vc-git-stash' is now bound to 'C' in the stash headers.
|
*** 'vc-git-stash' is now bound to 'C' in the stash headers.
|
||||||
|
|
||||||
@ -1133,25 +1135,19 @@ you invoke 'C-x v m' ('vc-merge').
|
|||||||
instead of revision numbers as completion candidates when it prompts
|
instead of revision numbers as completion candidates when it prompts
|
||||||
for a revision.
|
for a revision.
|
||||||
|
|
||||||
|
---
|
||||||
|
*** New user option 'vc-hg-revert-switches'.
|
||||||
|
It specifies switches to pass to Hg's 'revert' command.
|
||||||
|
|
||||||
+++
|
+++
|
||||||
*** 'C-u C-x v D' ('vc-root-version-diff') prompts for two revisions
|
*** 'C-u C-x v D' ('vc-root-version-diff') prompts for two revisions
|
||||||
and compares their entire trees.
|
and compares their entire trees.
|
||||||
|
|
||||||
---
|
|
||||||
*** New user option 'vc-hg-revert-switches'.
|
|
||||||
It specifies switches to pass to Hg's 'revert' command.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
*** 'C-x v M D' ('vc-diff-mergebase') and 'C-x v M L' ('vc-log-mergebase')
|
*** 'C-x v M D' ('vc-diff-mergebase') and 'C-x v M L' ('vc-log-mergebase')
|
||||||
print diffs and logs between the merge base (common ancestor) of two
|
print diffs and logs between the merge base (common ancestor) of two
|
||||||
given revisions.
|
given revisions.
|
||||||
|
|
||||||
+++
|
|
||||||
*** The new 'd' command ('vc-dir-clean-files') in 'vc-dir-mode'
|
|
||||||
buffers will delete the marked files (or if no files are marked, the
|
|
||||||
file under point). This command does not notify the VC backend, and
|
|
||||||
is mostly useful for unregistered files.
|
|
||||||
|
|
||||||
+++
|
+++
|
||||||
*** New command 'vc-log-search' asks for a pattern, searches it
|
*** New command 'vc-log-search' asks for a pattern, searches it
|
||||||
in the revision log, and displays matched log entries in the
|
in the revision log, and displays matched log entries in the
|
||||||
@ -1169,6 +1165,10 @@ ID, and shows its log entry together with the diffs introduced by the
|
|||||||
revision's commit. (For some less capable VCSes, only the log entry
|
revision's commit. (For some less capable VCSes, only the log entry
|
||||||
is shown.)
|
is shown.)
|
||||||
|
|
||||||
|
---
|
||||||
|
*** New user option 'vc-find-revision-no-save'.
|
||||||
|
With non-nil, 'vc-find-revision' doesn't write the created buffer to file.
|
||||||
|
|
||||||
---
|
---
|
||||||
*** 'C-x v =' can now mimic Magit's diff format.
|
*** 'C-x v =' can now mimic Magit's diff format.
|
||||||
Set the new user option 'diff-font-lock-prettify' to t for that, see
|
Set the new user option 'diff-font-lock-prettify' to t for that, see
|
||||||
@ -3515,6 +3515,10 @@ functions.
|
|||||||
*** 'image-mode' now uses this library to automatically rotate images
|
*** 'image-mode' now uses this library to automatically rotate images
|
||||||
according to the orientation in the Exif data, if any.
|
according to the orientation in the Exif data, if any.
|
||||||
|
|
||||||
|
*** In 'image-mode' the image is resized automatically to fit in window.
|
||||||
|
The image will resize upon first display and whenever the window's
|
||||||
|
dimensions change.
|
||||||
|
|
||||||
---
|
---
|
||||||
*** New library image-converter.
|
*** New library image-converter.
|
||||||
If you need to view exotic image formats for which Emacs doesn't have
|
If you need to view exotic image formats for which Emacs doesn't have
|
||||||
@ -3552,6 +3556,8 @@ name to the kill ring.
|
|||||||
With a prefix argument, 'image-rotate' now rotates the image at point
|
With a prefix argument, 'image-rotate' now rotates the image at point
|
||||||
90 degrees counter-clockwise, instead of the default clockwise.
|
90 degrees counter-clockwise, instead of the default clockwise.
|
||||||
|
|
||||||
|
*** 'image-mode' has a new key prefix 's' for transformation commands.
|
||||||
|
|
||||||
** Modules
|
** Modules
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -67,7 +67,7 @@ union ieee754_float
|
|||||||
#endif /* Little endian. */
|
#endif /* Little endian. */
|
||||||
} ieee;
|
} ieee;
|
||||||
|
|
||||||
/* This format makes it easier to see if a NaN is a signalling NaN. */
|
/* This format makes it easier to see if a NaN is a signaling NaN. */
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||||
@ -118,7 +118,7 @@ union ieee754_double
|
|||||||
#endif /* Little endian. */
|
#endif /* Little endian. */
|
||||||
} ieee;
|
} ieee;
|
||||||
|
|
||||||
/* This format makes it easier to see if a NaN is a signalling NaN. */
|
/* This format makes it easier to see if a NaN is a signaling NaN. */
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
#if __BYTE_ORDER == __BIG_ENDIAN
|
#if __BYTE_ORDER == __BIG_ENDIAN
|
||||||
|
@ -677,7 +677,7 @@ Each element is (INDEX . VALUE)")
|
|||||||
(byte-defop 112 1 byte-current-buffer)
|
(byte-defop 112 1 byte-current-buffer)
|
||||||
(byte-defop 113 0 byte-set-buffer)
|
(byte-defop 113 0 byte-set-buffer)
|
||||||
(byte-defop 114 0 byte-save-current-buffer
|
(byte-defop 114 0 byte-save-current-buffer
|
||||||
"To make a binding to record the current buffer")
|
"to make a binding to record the current buffer")
|
||||||
(byte-defop 115 0 byte-set-mark-OBSOLETE)
|
(byte-defop 115 0 byte-set-mark-OBSOLETE)
|
||||||
(byte-defop 116 1 byte-interactive-p-OBSOLETE)
|
(byte-defop 116 1 byte-interactive-p-OBSOLETE)
|
||||||
|
|
||||||
|
@ -2134,7 +2134,7 @@ buffer, otherwise stop after the first error."
|
|||||||
(checkdoc-ispell-init)
|
(checkdoc-ispell-init)
|
||||||
(unless checkdoc-spellcheck-documentation-flag
|
(unless checkdoc-spellcheck-documentation-flag
|
||||||
;; this happens when (checkdoc-ispell-init) can't start `ispell-program-name'
|
;; this happens when (checkdoc-ispell-init) can't start `ispell-program-name'
|
||||||
(user-error "No spellchecker installed: check the variable `ispell-program-name'."))
|
(user-error "No spellchecker installed: check the variable `ispell-program-name'"))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(skip-chars-forward "^a-zA-Z")
|
(skip-chars-forward "^a-zA-Z")
|
||||||
(let (word sym case-fold-search err word-beginning word-end)
|
(let (word sym case-fold-search err word-beginning word-end)
|
||||||
|
@ -767,7 +767,7 @@ The result of the body appears to the compiler as a quoted constant."
|
|||||||
"Eval EXPR and choose among clauses on that value.
|
"Eval EXPR and choose among clauses on that value.
|
||||||
Each clause looks like (KEYLIST BODY...). EXPR is evaluated and
|
Each clause looks like (KEYLIST BODY...). EXPR is evaluated and
|
||||||
compared against each key in each KEYLIST; the corresponding BODY
|
compared against each key in each KEYLIST; the corresponding BODY
|
||||||
is evaluated. If no clause succeeds, cl-case returns nil. A
|
is evaluated. If no clause succeeds, this macro returns nil. A
|
||||||
single non-nil atom may be used in place of a KEYLIST of one
|
single non-nil atom may be used in place of a KEYLIST of one
|
||||||
atom. A KEYLIST of t or `otherwise' is allowed only in the final
|
atom. A KEYLIST of t or `otherwise' is allowed only in the final
|
||||||
clause, and matches if no other keys match. Key values are
|
clause, and matches if no other keys match. Key values are
|
||||||
@ -806,10 +806,10 @@ compared by `eql'.
|
|||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defmacro cl-typecase (expr &rest clauses)
|
(defmacro cl-typecase (expr &rest clauses)
|
||||||
"Evals EXPR, chooses among clauses on that value.
|
"Eval EXPR and choose among clauses on that value.
|
||||||
Each clause looks like (TYPE BODY...). EXPR is evaluated and, if it
|
Each clause looks like (TYPE BODY...). EXPR is evaluated and, if it
|
||||||
satisfies TYPE, the corresponding BODY is evaluated. If no clause succeeds,
|
satisfies TYPE, the corresponding BODY is evaluated. If no clause succeeds,
|
||||||
cl-typecase returns nil. A TYPE of t or `otherwise' is allowed only in the
|
this macro returns nil. A TYPE of t or `otherwise' is allowed only in the
|
||||||
final clause, and matches if no other keys match.
|
final clause, and matches if no other keys match.
|
||||||
\n(fn EXPR (TYPE BODY...)...)"
|
\n(fn EXPR (TYPE BODY...)...)"
|
||||||
(declare (indent 1)
|
(declare (indent 1)
|
||||||
@ -2701,7 +2701,7 @@ pairs for that slot.
|
|||||||
Supported keywords for slots are:
|
Supported keywords for slots are:
|
||||||
- `:read-only': If this has a non-nil value, that slot cannot be set via `setf'.
|
- `:read-only': If this has a non-nil value, that slot cannot be set via `setf'.
|
||||||
- `:documentation': this is a docstring describing the slot.
|
- `:documentation': this is a docstring describing the slot.
|
||||||
- `:type': the type of the field; currently unused.
|
- `:type': the type of the field; currently only used for documentation.
|
||||||
|
|
||||||
\(fn NAME &optional DOCSTRING &rest SLOTS)"
|
\(fn NAME &optional DOCSTRING &rest SLOTS)"
|
||||||
(declare (doc-string 2) (indent 1)
|
(declare (doc-string 2) (indent 1)
|
||||||
|
@ -238,7 +238,7 @@ FUNSYM must be a symbol of a defined function."
|
|||||||
;; The info vector data structure is a 2 element vector. The 0th
|
;; The info vector data structure is a 2 element vector. The 0th
|
||||||
;; element is the call-count, i.e. the total number of times this
|
;; element is the call-count, i.e. the total number of times this
|
||||||
;; function has been entered. This value is bumped up on entry to
|
;; function has been entered. This value is bumped up on entry to
|
||||||
;; the function so that non-local exists are still recorded. TBD:
|
;; the function so that non-local exits are still recorded. TBD:
|
||||||
;; I haven't tested non-local exits at all, so no guarantees.
|
;; I haven't tested non-local exits at all, so no guarantees.
|
||||||
;;
|
;;
|
||||||
;; The 1st element is the total amount of time in seconds that has
|
;; The 1st element is the total amount of time in seconds that has
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
;; This raw form of iteration is general, but a bit awkward to use, so
|
;; This raw form of iteration is general, but a bit awkward to use, so
|
||||||
;; this library also provides some convenience functions:
|
;; this library also provides some convenience functions:
|
||||||
;;
|
;;
|
||||||
;; `iter-do' is like `cl-do', except that instead of walking a list,
|
;; `iter-do' is like `dolist', except that instead of walking a list,
|
||||||
;; it walks an iterator. `cl-loop' is also extended with a new
|
;; it walks an iterator. `cl-loop' is also extended with a new
|
||||||
;; keyword, `iter-by', that iterates over an iterator.
|
;; keyword, `iter-by', that iterates over an iterator.
|
||||||
;;
|
;;
|
||||||
@ -67,7 +67,7 @@
|
|||||||
;;; Implementation:
|
;;; Implementation:
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;; The internal cps transformation code uses the cps- namespace.
|
;; The internal CPS transformation code uses the cps- namespace.
|
||||||
;; Iteration functions use the `iter-' namespace. Generator functions
|
;; Iteration functions use the `iter-' namespace. Generator functions
|
||||||
;; are somewhat less efficient than conventional elisp routines,
|
;; are somewhat less efficient than conventional elisp routines,
|
||||||
;; although we try to avoid CPS transformation on forms that do not
|
;; although we try to avoid CPS transformation on forms that do not
|
||||||
@ -89,13 +89,13 @@
|
|||||||
`(gensym (format ,fmt ,@args)))
|
`(gensym (format ,fmt ,@args)))
|
||||||
|
|
||||||
(defvar cps--dynamic-wrappers '(identity)
|
(defvar cps--dynamic-wrappers '(identity)
|
||||||
"List of transformer functions to apply to atomic forms we
|
"List of functions to apply to atomic forms.
|
||||||
evaluate in CPS context.")
|
These are transformer functions applied to atomic forms evaluated
|
||||||
|
in CPS context.")
|
||||||
|
|
||||||
(defconst cps-standard-special-forms
|
(defconst cps-standard-special-forms
|
||||||
'(setq setq-default throw interactive)
|
'(setq setq-default throw interactive)
|
||||||
"List of special forms that we treat just like ordinary
|
"List of special forms treated just like ordinary function applications." )
|
||||||
function applications." )
|
|
||||||
|
|
||||||
(defun cps--trace-funcall (func &rest args)
|
(defun cps--trace-funcall (func &rest args)
|
||||||
(message "%S: args=%S" func args)
|
(message "%S: args=%S" func args)
|
||||||
@ -118,17 +118,15 @@ evaluate in CPS context.")
|
|||||||
(error "%s not supported in generators" ,function)))
|
(error "%s not supported in generators" ,function)))
|
||||||
|
|
||||||
(defmacro cps--with-value-wrapper (wrapper &rest body)
|
(defmacro cps--with-value-wrapper (wrapper &rest body)
|
||||||
"Continue generating CPS code with an atomic-form wrapper
|
"Evaluate BODY with WRAPPER added to the stack of atomic-form wrappers.
|
||||||
to the current stack of such wrappers. WRAPPER is a function that
|
WRAPPER is a function that takes an atomic form and returns a wrapped form.
|
||||||
takes a form and returns a wrapped form.
|
|
||||||
|
|
||||||
Whenever we generate an atomic form (i.e., a form that can't
|
Whenever we generate an atomic form (i.e., a form that can't
|
||||||
`iter-yield'), we first (before actually inserting that form in our
|
`iter-yield'), we first (before actually inserting that form in our
|
||||||
generated code) pass that form through all the transformer
|
generated code) pass that form through all the transformer
|
||||||
functions. We use this facility to wrap forms that can transfer
|
functions. We use this facility to wrap forms that can transfer
|
||||||
control flow non-locally in goo that diverts this control flow to
|
control flow non-locally in goo that diverts this control flow to
|
||||||
the CPS state machinery.
|
the CPS state machinery."
|
||||||
"
|
|
||||||
(declare (indent 1))
|
(declare (indent 1))
|
||||||
`(let ((cps--dynamic-wrappers
|
`(let ((cps--dynamic-wrappers
|
||||||
(cons
|
(cons
|
||||||
@ -153,7 +151,7 @@ DYNAMIC-VAR bound to STATIC-VAR."
|
|||||||
,@body))
|
,@body))
|
||||||
|
|
||||||
(defun cps--add-state (kind body)
|
(defun cps--add-state (kind body)
|
||||||
"Create a new CPS state with body BODY and return the state's name."
|
"Create a new CPS state of KIND with BODY and return the state's name."
|
||||||
(declare (indent 1))
|
(declare (indent 1))
|
||||||
(let ((state (cps--gensym "cps-state-%s-" kind)))
|
(let ((state (cps--gensym "cps-state-%s-" kind)))
|
||||||
(push (list state body cps--cleanup-function) cps--states)
|
(push (list state body cps--cleanup-function) cps--states)
|
||||||
@ -170,14 +168,12 @@ DYNAMIC-VAR bound to STATIC-VAR."
|
|||||||
(and (fboundp handler) handler)))
|
(and (fboundp handler) handler)))
|
||||||
|
|
||||||
(defvar cps-inhibit-atomic-optimization nil
|
(defvar cps-inhibit-atomic-optimization nil
|
||||||
"When non-nil, always rewrite forms into cps even when they
|
"When non-nil, always rewrite forms into CPS even when they don't yield.")
|
||||||
don't yield.")
|
|
||||||
|
|
||||||
(defvar cps--yield-seen)
|
(defvar cps--yield-seen)
|
||||||
|
|
||||||
(defun cps--atomic-p (form)
|
(defun cps--atomic-p (form)
|
||||||
"Return whether the given form never yields."
|
"Return nil if FORM can yield, non-nil otherwise."
|
||||||
|
|
||||||
(and (not cps-inhibit-atomic-optimization)
|
(and (not cps-inhibit-atomic-optimization)
|
||||||
(let* ((cps--yield-seen))
|
(let* ((cps--yield-seen))
|
||||||
(ignore (macroexpand-all
|
(ignore (macroexpand-all
|
||||||
@ -649,8 +645,8 @@ modified copy."
|
|||||||
(defun iter-yield (value)
|
(defun iter-yield (value)
|
||||||
"When used inside a generator, yield control to caller.
|
"When used inside a generator, yield control to caller.
|
||||||
The caller of `iter-next' receives VALUE, and the next call to
|
The caller of `iter-next' receives VALUE, and the next call to
|
||||||
`iter-next' resumes execution at the previous
|
`iter-next' resumes execution with the form immediately following this
|
||||||
`iter-yield' point."
|
`iter-yield' call."
|
||||||
(identity value)
|
(identity value)
|
||||||
(error "`iter-yield' used outside a generator"))
|
(error "`iter-yield' used outside a generator"))
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
;;
|
;;
|
||||||
;; Instead, we use here a higher-order approach: instead
|
;; Instead, we use here a higher-order approach: instead
|
||||||
;; of a 5-tuple, a place-expander returns a function.
|
;; of a 5-tuple, a place-expander returns a function.
|
||||||
;; If you think about types, the old approach return things of type
|
;; If you think about types, the old approach returns things of type
|
||||||
;; {vars: List Var, values: List Exp,
|
;; {vars: List Var, values: List Exp,
|
||||||
;; stores: List Var, getter: Exp, setter: Exp}
|
;; stores: List Var, getter: Exp, setter: Exp}
|
||||||
;; whereas the new approach returns a function of type
|
;; whereas the new approach returns a function of type
|
||||||
|
@ -535,7 +535,7 @@ This will generate compile-time constants from BINDINGS."
|
|||||||
|
|
||||||
;; Support backtrace mode.
|
;; Support backtrace mode.
|
||||||
(defconst lisp-el-font-lock-keywords-for-backtraces lisp-el-font-lock-keywords
|
(defconst lisp-el-font-lock-keywords-for-backtraces lisp-el-font-lock-keywords
|
||||||
"Default highlighting from Emacs Lisp mod used in Backtrace mode.")
|
"Default highlighting from Emacs Lisp mode used in Backtrace mode.")
|
||||||
(defconst lisp-el-font-lock-keywords-for-backtraces-1 lisp-el-font-lock-keywords-1
|
(defconst lisp-el-font-lock-keywords-for-backtraces-1 lisp-el-font-lock-keywords-1
|
||||||
"Subdued highlighting from Emacs Lisp mode used in Backtrace mode.")
|
"Subdued highlighting from Emacs Lisp mode used in Backtrace mode.")
|
||||||
(defconst lisp-el-font-lock-keywords-for-backtraces-2
|
(defconst lisp-el-font-lock-keywords-for-backtraces-2
|
||||||
|
@ -418,24 +418,40 @@ call."
|
|||||||
|
|
||||||
(defvar image-mode-map
|
(defvar image-mode-map
|
||||||
(let ((map (make-sparse-keymap)))
|
(let ((map (make-sparse-keymap)))
|
||||||
|
|
||||||
|
;; Toggling keys
|
||||||
(define-key map "\C-c\C-c" 'image-toggle-display)
|
(define-key map "\C-c\C-c" 'image-toggle-display)
|
||||||
(define-key map "\C-c\C-x" 'image-toggle-hex-display)
|
(define-key map "\C-c\C-x" 'image-toggle-hex-display)
|
||||||
(define-key map (kbd "SPC") 'image-scroll-up)
|
|
||||||
(define-key map (kbd "S-SPC") 'image-scroll-down)
|
;; Transformation keys
|
||||||
(define-key map (kbd "DEL") 'image-scroll-down)
|
(define-key map "sf" 'image-mode-fit-frame)
|
||||||
(define-key map (kbd "RET") 'image-toggle-animation)
|
(define-key map "sh" 'image-transform-fit-to-height)
|
||||||
|
(define-key map "sw" 'image-transform-fit-to-width)
|
||||||
|
(define-key map "sr" 'image-transform-set-rotation)
|
||||||
|
(define-key map "s0" 'image-transform-reset)
|
||||||
|
(define-key map "ss" 'image-transform-set-scale)
|
||||||
|
|
||||||
|
;; Multi-frame keys
|
||||||
|
(define-key map (kbd "RET") 'image-toggle-animation)
|
||||||
(define-key map "F" 'image-goto-frame)
|
(define-key map "F" 'image-goto-frame)
|
||||||
(define-key map "f" 'image-next-frame)
|
(define-key map "f" 'image-next-frame)
|
||||||
(define-key map "b" 'image-previous-frame)
|
(define-key map "b" 'image-previous-frame)
|
||||||
(define-key map "n" 'image-next-file)
|
|
||||||
(define-key map "p" 'image-previous-file)
|
|
||||||
(define-key map "a+" 'image-increase-speed)
|
(define-key map "a+" 'image-increase-speed)
|
||||||
(define-key map "a-" 'image-decrease-speed)
|
(define-key map "a-" 'image-decrease-speed)
|
||||||
(define-key map "a0" 'image-reset-speed)
|
(define-key map "a0" 'image-reset-speed)
|
||||||
(define-key map "ar" 'image-reverse-speed)
|
(define-key map "ar" 'image-reverse-speed)
|
||||||
|
|
||||||
|
;; File keys
|
||||||
|
(define-key map "n" 'image-next-file)
|
||||||
|
(define-key map "p" 'image-previous-file)
|
||||||
(define-key map "w" 'image-mode-copy-file-name-as-kill)
|
(define-key map "w" 'image-mode-copy-file-name-as-kill)
|
||||||
(define-key map "m" 'image-mode-mark-file)
|
(define-key map "m" 'image-mode-mark-file)
|
||||||
(define-key map "u" 'image-mode-unmark-file)
|
(define-key map "u" 'image-mode-unmark-file)
|
||||||
|
|
||||||
|
;; Scrolling keys
|
||||||
|
(define-key map (kbd "SPC") 'image-scroll-up)
|
||||||
|
(define-key map (kbd "S-SPC") 'image-scroll-down)
|
||||||
|
(define-key map (kbd "DEL") 'image-scroll-down)
|
||||||
(define-key map [remap forward-char] 'image-forward-hscroll)
|
(define-key map [remap forward-char] 'image-forward-hscroll)
|
||||||
(define-key map [remap backward-char] 'image-backward-hscroll)
|
(define-key map [remap backward-char] 'image-backward-hscroll)
|
||||||
(define-key map [remap right-char] 'image-forward-hscroll)
|
(define-key map [remap right-char] 'image-forward-hscroll)
|
||||||
@ -452,6 +468,7 @@ call."
|
|||||||
(define-key map [remap move-end-of-line] 'image-eol)
|
(define-key map [remap move-end-of-line] 'image-eol)
|
||||||
(define-key map [remap beginning-of-buffer] 'image-bob)
|
(define-key map [remap beginning-of-buffer] 'image-bob)
|
||||||
(define-key map [remap end-of-buffer] 'image-eob)
|
(define-key map [remap end-of-buffer] 'image-eob)
|
||||||
|
|
||||||
(easy-menu-define image-mode-menu map "Menu for Image mode."
|
(easy-menu-define image-mode-menu map "Menu for Image mode."
|
||||||
'("Image"
|
'("Image"
|
||||||
["Show as Text" image-toggle-display :active t
|
["Show as Text" image-toggle-display :active t
|
||||||
@ -459,17 +476,15 @@ call."
|
|||||||
["Show as Hex" image-toggle-hex-display :active t
|
["Show as Hex" image-toggle-hex-display :active t
|
||||||
:help "Show image as hex"]
|
:help "Show image as hex"]
|
||||||
"--"
|
"--"
|
||||||
|
["Fit Frame to Image" image-mode-fit-frame :active t
|
||||||
|
:help "Resize frame to match image"]
|
||||||
["Fit to Window Height" image-transform-fit-to-height
|
["Fit to Window Height" image-transform-fit-to-height
|
||||||
:visible (eq image-type 'imagemagick)
|
|
||||||
:help "Resize image to match the window height"]
|
:help "Resize image to match the window height"]
|
||||||
["Fit to Window Width" image-transform-fit-to-width
|
["Fit to Window Width" image-transform-fit-to-width
|
||||||
:visible (eq image-type 'imagemagick)
|
|
||||||
:help "Resize image to match the window width"]
|
:help "Resize image to match the window width"]
|
||||||
["Rotate Image..." image-transform-set-rotation
|
["Rotate Image..." image-transform-set-rotation
|
||||||
:visible (eq image-type 'imagemagick)
|
|
||||||
:help "Rotate the image"]
|
:help "Rotate the image"]
|
||||||
["Reset Transformations" image-transform-reset
|
["Reset Transformations" image-transform-reset
|
||||||
:visible (eq image-type 'imagemagick)
|
|
||||||
:help "Reset all image transformations"]
|
:help "Reset all image transformations"]
|
||||||
"--"
|
"--"
|
||||||
["Show Thumbnails"
|
["Show Thumbnails"
|
||||||
@ -486,9 +501,6 @@ call."
|
|||||||
:active buffer-file-name
|
:active buffer-file-name
|
||||||
:help "Copy the current file name to the kill ring"]
|
:help "Copy the current file name to the kill ring"]
|
||||||
"--"
|
"--"
|
||||||
["Fit Frame to Image" image-mode-fit-frame :active t
|
|
||||||
:help "Resize frame to match image"]
|
|
||||||
"--"
|
|
||||||
["Animate Image" image-toggle-animation :style toggle
|
["Animate Image" image-toggle-animation :style toggle
|
||||||
:selected (let ((image (image-get-display-property)))
|
:selected (let ((image (image-get-display-property)))
|
||||||
(and image (image-animate-timer image)))
|
(and image (image-animate-timer image)))
|
||||||
@ -767,11 +779,12 @@ was inserted."
|
|||||||
props image)
|
props image)
|
||||||
|
|
||||||
;; Get the rotation data from the file, if any.
|
;; Get the rotation data from the file, if any.
|
||||||
(setq image-transform-rotation
|
(when (zerop image-transform-rotation) ; don't reset modified value
|
||||||
(or (exif-orientation
|
(setq image-transform-rotation
|
||||||
(ignore-error exif-error
|
(or (exif-orientation
|
||||||
(exif-parse-buffer)))
|
(ignore-error exif-error
|
||||||
0.0))
|
(exif-parse-buffer)))
|
||||||
|
0.0)))
|
||||||
|
|
||||||
;; :scale 1: If we do not set this, create-image will apply
|
;; :scale 1: If we do not set this, create-image will apply
|
||||||
;; default scaling based on font size.
|
;; default scaling based on font size.
|
||||||
@ -1250,8 +1263,7 @@ Do this for an image of type `imagemagick' to make sure that the
|
|||||||
elisp code matches the way ImageMagick computes the bounding box
|
elisp code matches the way ImageMagick computes the bounding box
|
||||||
of a rotated image."
|
of a rotated image."
|
||||||
(when (and (not (numberp image-transform-resize))
|
(when (and (not (numberp image-transform-resize))
|
||||||
(boundp 'image-type)
|
(boundp 'image-type))
|
||||||
(eq image-type 'imagemagick))
|
|
||||||
(let ((size (image-display-size (image-get-display-property) t)))
|
(let ((size (image-display-size (image-get-display-property) t)))
|
||||||
(cond ((eq image-transform-resize 'fit-width)
|
(cond ((eq image-transform-resize 'fit-width)
|
||||||
(cl-assert (= (car size)
|
(cl-assert (= (car size)
|
||||||
@ -1268,10 +1280,7 @@ of a rotated image."
|
|||||||
"Return rescaling/rotation properties for image SPEC.
|
"Return rescaling/rotation properties for image SPEC.
|
||||||
These properties are determined by the Image mode variables
|
These properties are determined by the Image mode variables
|
||||||
`image-transform-resize' and `image-transform-rotation'. The
|
`image-transform-resize' and `image-transform-rotation'. The
|
||||||
return value is suitable for appending to an image spec.
|
return value is suitable for appending to an image spec."
|
||||||
|
|
||||||
Rescaling and rotation properties only take effect if Emacs is
|
|
||||||
compiled with ImageMagick support."
|
|
||||||
(setq image-transform-scale 1.0)
|
(setq image-transform-scale 1.0)
|
||||||
(when (or image-transform-resize
|
(when (or image-transform-resize
|
||||||
(/= image-transform-rotation 0.0))
|
(/= image-transform-rotation 0.0))
|
||||||
@ -1302,41 +1311,32 @@ compiled with ImageMagick support."
|
|||||||
(list :rotation image-transform-rotation))))))
|
(list :rotation image-transform-rotation))))))
|
||||||
|
|
||||||
(defun image-transform-set-scale (scale)
|
(defun image-transform-set-scale (scale)
|
||||||
"Prompt for a number, and resize the current image by that amount.
|
"Prompt for a number, and resize the current image by that amount."
|
||||||
This command has no effect unless Emacs is compiled with
|
|
||||||
ImageMagick support."
|
|
||||||
(interactive "nScale: ")
|
(interactive "nScale: ")
|
||||||
(setq image-transform-resize scale)
|
(setq image-transform-resize scale)
|
||||||
(image-toggle-display-image))
|
(image-toggle-display-image))
|
||||||
|
|
||||||
(defun image-transform-fit-to-height ()
|
(defun image-transform-fit-to-height ()
|
||||||
"Fit the current image to the height of the current window.
|
"Fit the current image to the height of the current window."
|
||||||
This command has no effect unless Emacs is compiled with
|
|
||||||
ImageMagick support."
|
|
||||||
(interactive)
|
(interactive)
|
||||||
(setq image-transform-resize 'fit-height)
|
(setq image-transform-resize 'fit-height)
|
||||||
(image-toggle-display-image))
|
(image-toggle-display-image))
|
||||||
|
|
||||||
(defun image-transform-fit-to-width ()
|
(defun image-transform-fit-to-width ()
|
||||||
"Fit the current image to the width of the current window.
|
"Fit the current image to the width of the current window."
|
||||||
This command has no effect unless Emacs is compiled with
|
|
||||||
ImageMagick support."
|
|
||||||
(interactive)
|
(interactive)
|
||||||
(setq image-transform-resize 'fit-width)
|
(setq image-transform-resize 'fit-width)
|
||||||
(image-toggle-display-image))
|
(image-toggle-display-image))
|
||||||
|
|
||||||
(defun image-transform-set-rotation (rotation)
|
(defun image-transform-set-rotation (rotation)
|
||||||
"Prompt for an angle ROTATION, and rotate the image by that amount.
|
"Prompt for an angle ROTATION, and rotate the image by that amount.
|
||||||
ROTATION should be in degrees. This command has no effect unless
|
ROTATION should be in degrees."
|
||||||
Emacs is compiled with ImageMagick support."
|
|
||||||
(interactive "nRotation angle (in degrees): ")
|
(interactive "nRotation angle (in degrees): ")
|
||||||
(setq image-transform-rotation (float (mod rotation 360)))
|
(setq image-transform-rotation (float (mod rotation 360)))
|
||||||
(image-toggle-display-image))
|
(image-toggle-display-image))
|
||||||
|
|
||||||
(defun image-transform-reset ()
|
(defun image-transform-reset ()
|
||||||
"Display the current image with the default size and rotation.
|
"Display the current image with the default size and rotation."
|
||||||
This command has no effect unless Emacs is compiled with
|
|
||||||
ImageMagick support."
|
|
||||||
(interactive)
|
(interactive)
|
||||||
(setq image-transform-resize nil
|
(setq image-transform-resize nil
|
||||||
image-transform-rotation 0.0
|
image-transform-rotation 0.0
|
||||||
|
@ -95,7 +95,7 @@ mirrored or not.")
|
|||||||
"Parse FILE (a JPEG file) and return the Exif data, if any.
|
"Parse FILE (a JPEG file) and return the Exif data, if any.
|
||||||
The return value is a list of Exif items.
|
The return value is a list of Exif items.
|
||||||
|
|
||||||
If the data is invalid, an `exif-error' is signalled."
|
If the data is invalid, an `exif-error' is signaled."
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(set-buffer-multibyte nil)
|
(set-buffer-multibyte nil)
|
||||||
(insert-file-contents-literally file)
|
(insert-file-contents-literally file)
|
||||||
@ -105,7 +105,7 @@ If the data is invalid, an `exif-error' is signalled."
|
|||||||
"Parse BUFFER (which should be a JPEG file) and return the Exif data, if any.
|
"Parse BUFFER (which should be a JPEG file) and return the Exif data, if any.
|
||||||
The return value is a list of Exif items.
|
The return value is a list of Exif items.
|
||||||
|
|
||||||
If the data is invalid, an `exif-error' is signalled."
|
If the data is invalid, an `exif-error' is signaled."
|
||||||
(setq buffer (or buffer (current-buffer)))
|
(setq buffer (or buffer (current-buffer)))
|
||||||
(with-current-buffer buffer
|
(with-current-buffer buffer
|
||||||
(if enable-multibyte-characters
|
(if enable-multibyte-characters
|
||||||
|
@ -75,7 +75,7 @@ unless the display width of STR is equal to or less than the display
|
|||||||
width of ELLIPSIS. If it is non-nil and not a string, then ELLIPSIS
|
width of ELLIPSIS. If it is non-nil and not a string, then ELLIPSIS
|
||||||
defaults to `truncate-string-ellipsis'.
|
defaults to `truncate-string-ellipsis'.
|
||||||
|
|
||||||
If ELLIPSIS-TEXT-PROPERTY in non-nil, a too-long string will not
|
If ELLIPSIS-TEXT-PROPERTY is non-nil, a too-long string will not
|
||||||
be truncated, but instead the elided parts will be covered by a
|
be truncated, but instead the elided parts will be covered by a
|
||||||
`display' text property showing the ellipsis."
|
`display' text property showing the ellipsis."
|
||||||
(or start-column
|
(or start-column
|
||||||
|
@ -736,7 +736,7 @@ you will get the following structure returned:
|
|||||||
|
|
||||||
OBJECT should have a structure like one returned by `json-read'.
|
OBJECT should have a structure like one returned by `json-read'.
|
||||||
If an error is detected during encoding, an error based on
|
If an error is detected during encoding, an error based on
|
||||||
`json-error' is signalled."
|
`json-error' is signaled."
|
||||||
(cond ((memq object (list t json-null json-false))
|
(cond ((memq object (list t json-null json-false))
|
||||||
(json-encode-keyword object))
|
(json-encode-keyword object))
|
||||||
((stringp object) (json-encode-string object))
|
((stringp object) (json-encode-string object))
|
||||||
|
@ -163,8 +163,8 @@ perform completion, no matter what ACTION is.
|
|||||||
|
|
||||||
If ACTION is `metadata' or a list where the first element is
|
If ACTION is `metadata' or a list where the first element is
|
||||||
`boundaries', return nil. If ACTION is nil, this function works
|
`boundaries', return nil. If ACTION is nil, this function works
|
||||||
like `try-completion'; if it's t, this function works like
|
like `try-completion'; if it is t, this function works like
|
||||||
`all-completion'; and any other values makes it work like
|
`all-completion'; and any other value makes it work like
|
||||||
`test-completion'."
|
`test-completion'."
|
||||||
(cond
|
(cond
|
||||||
((functionp collection) (funcall collection string predicate action))
|
((functionp collection) (funcall collection string predicate action))
|
||||||
|
@ -509,7 +509,7 @@ This method shows how to handle `setf's to places of the form
|
|||||||
ARGLIST, as if NAME were going to be expanded as a macro, then
|
ARGLIST, as if NAME were going to be expanded as a macro, then
|
||||||
the BODY forms are executed and must return a list of five elements:
|
the BODY forms are executed and must return a list of five elements:
|
||||||
a temporary-variables list, a value-forms list, a store-variables list
|
a temporary-variables list, a value-forms list, a store-variables list
|
||||||
\(of length one), a store-form, and an access- form.
|
\(of length one), a store-form, and an access-form.
|
||||||
|
|
||||||
See `gv-define-expander', and `gv-define-setter' for better and
|
See `gv-define-expander', and `gv-define-setter' for better and
|
||||||
simpler ways to define setf-methods."
|
simpler ways to define setf-methods."
|
||||||
|
@ -198,7 +198,8 @@ as start and end positions), and with `string<' otherwise."
|
|||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun sort-lines (reverse beg end)
|
(defun sort-lines (reverse beg end)
|
||||||
"Sort lines in region alphabetically; argument means descending order.
|
"Sort lines in region alphabetically; REVERSE non-nil means descending order.
|
||||||
|
Interactively, REVERSE is the prefix argument, and BEG and END are the region.
|
||||||
Called from a program, there are three arguments:
|
Called from a program, there are three arguments:
|
||||||
REVERSE (non-nil means reverse order), BEG and END (region to sort).
|
REVERSE (non-nil means reverse order), BEG and END (region to sort).
|
||||||
The variable `sort-fold-case' determines whether alphabetic case affects
|
The variable `sort-fold-case' determines whether alphabetic case affects
|
||||||
|
@ -352,11 +352,11 @@ Setting `init-file-user' does not prevent Emacs from loading
|
|||||||
|
|
||||||
(defcustom site-run-file (purecopy "site-start")
|
(defcustom site-run-file (purecopy "site-start")
|
||||||
"File containing site-wide run-time initializations.
|
"File containing site-wide run-time initializations.
|
||||||
This file is loaded at run-time before `~/.emacs'. It contains inits
|
This file is loaded at run-time before `user-init-file'. It contains
|
||||||
that need to be in place for the entire site, but which, due to their
|
inits that need to be in place for the entire site, but which, due to
|
||||||
higher incidence of change, don't make sense to put into Emacs's
|
their higher incidence of change, don't make sense to put into Emacs's
|
||||||
dump file. Thus, the run-time load order is: 1. file described in
|
dump file. Thus, the run-time load order is: 1. file described in
|
||||||
this variable, if non-nil; 2. `~/.emacs'; 3. `default.el'.
|
this variable, if non-nil; 2. `user-init-file'; 3. `default.el'.
|
||||||
|
|
||||||
Don't use the `site-start.el' file for things some users may not like.
|
Don't use the `site-start.el' file for things some users may not like.
|
||||||
Put them in `default.el' instead, so that users can more easily
|
Put them in `default.el' instead, so that users can more easily
|
||||||
|
@ -385,7 +385,7 @@ entry to the debugger, even when `debug-on-error' is non-nil.
|
|||||||
This can be overridden by `debug-ignored-errors'.
|
This can be overridden by `debug-ignored-errors'.
|
||||||
|
|
||||||
To signal with MESSAGE without interpreting format characters
|
To signal with MESSAGE without interpreting format characters
|
||||||
like `%', `\\=`' and `\\='', use (error \"%s\" MESSAGE).
|
like `%', `\\=`' and `\\='', use (user-error \"%s\" MESSAGE).
|
||||||
In Emacs, the convention is that error messages start with a capital
|
In Emacs, the convention is that error messages start with a capital
|
||||||
letter but *do not* end with a period. Please follow this convention
|
letter but *do not* end with a period. Please follow this convention
|
||||||
for the sake of consistency."
|
for the sake of consistency."
|
||||||
@ -3314,7 +3314,7 @@ alternatives."
|
|||||||
|
|
||||||
(defun function-get (f prop &optional autoload)
|
(defun function-get (f prop &optional autoload)
|
||||||
"Return the value of property PROP of function F.
|
"Return the value of property PROP of function F.
|
||||||
If AUTOLOAD is non-nil and F is autoloaded, try to autoload it
|
If AUTOLOAD is non-nil and F is autoloaded, try to load it
|
||||||
in the hope that it will set PROP. If AUTOLOAD is `macro', do it only
|
in the hope that it will set PROP. If AUTOLOAD is `macro', do it only
|
||||||
if it's an autoloaded macro."
|
if it's an autoloaded macro."
|
||||||
(let ((val nil))
|
(let ((val nil))
|
||||||
@ -5021,7 +5021,7 @@ The properties used on SYMBOL are `composefunc', `sendfunc',
|
|||||||
(defun backtrace-frames (&optional base)
|
(defun backtrace-frames (&optional base)
|
||||||
"Collect all frames of current backtrace into a list.
|
"Collect all frames of current backtrace into a list.
|
||||||
If non-nil, BASE should be a function, and frames before its
|
If non-nil, BASE should be a function, and frames before its
|
||||||
nearest activation frames are discarded."
|
nearest activation frame are discarded."
|
||||||
(let ((frames nil))
|
(let ((frames nil))
|
||||||
(mapbacktrace (lambda (&rest frame) (push frame frames))
|
(mapbacktrace (lambda (&rest frame) (push frame frames))
|
||||||
(or base 'backtrace-frames))
|
(or base 'backtrace-frames))
|
||||||
|
@ -800,8 +800,8 @@ Otherwise returns the library directory name, if that is defined."
|
|||||||
|
|
||||||
(defun ispell-create-debug-buffer (&optional append)
|
(defun ispell-create-debug-buffer (&optional append)
|
||||||
"Create an ispell debug buffer for debugging output.
|
"Create an ispell debug buffer for debugging output.
|
||||||
If APPEND is non-nil, append the info to previous buffer if exists,
|
If APPEND is non-nil, add output to the old buffer if it exists,
|
||||||
otherwise is reset. Returns name of ispell debug buffer.
|
otherwise the buffer is erased first. Returns the debug buffer.
|
||||||
See `ispell-buffer-with-debug' for an example of use."
|
See `ispell-buffer-with-debug' for an example of use."
|
||||||
(let ((ispell-debug-buffer (get-buffer-create "*ispell-debug*")))
|
(let ((ispell-debug-buffer (get-buffer-create "*ispell-debug*")))
|
||||||
(with-current-buffer ispell-debug-buffer
|
(with-current-buffer ispell-debug-buffer
|
||||||
@ -812,7 +812,7 @@ See `ispell-buffer-with-debug' for an example of use."
|
|||||||
ispell-debug-buffer))
|
ispell-debug-buffer))
|
||||||
|
|
||||||
(defsubst ispell-print-if-debug (format &rest args)
|
(defsubst ispell-print-if-debug (format &rest args)
|
||||||
"Print message using FORMAT and ARGS to `ispell-debug-buffer' buffer if enabled."
|
"Print message using FORMAT and ARGS to `ispell-debug-buffer' if enabled."
|
||||||
(if (boundp 'ispell-debug-buffer)
|
(if (boundp 'ispell-debug-buffer)
|
||||||
(with-current-buffer ispell-debug-buffer
|
(with-current-buffer ispell-debug-buffer
|
||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
@ -3618,8 +3618,8 @@ Returns the sum SHIFT due to changes in word replacements."
|
|||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun ispell-buffer-with-debug (&optional append)
|
(defun ispell-buffer-with-debug (&optional append)
|
||||||
"`ispell-buffer' with some output sent to `ispell-debug-buffer' buffer.
|
"`ispell-buffer' with some output sent to `ispell-debug-buffer'.
|
||||||
If APPEND is non-n il, append the info to previous buffer if exists."
|
If APPEND is non-nil, don't erase previous debugging output."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((ispell-debug-buffer (ispell-create-debug-buffer append)))
|
(let ((ispell-debug-buffer (ispell-create-debug-buffer append)))
|
||||||
(ispell-buffer)))
|
(ispell-buffer)))
|
||||||
|
@ -1229,7 +1229,7 @@ The car of a handler may be a list of condition names instead of a
|
|||||||
single condition name; then it handles all of them. If the special
|
single condition name; then it handles all of them. If the special
|
||||||
condition name `debug' is present in this list, it allows another
|
condition name `debug' is present in this list, it allows another
|
||||||
condition in the list to run the debugger if `debug-on-error' and the
|
condition in the list to run the debugger if `debug-on-error' and the
|
||||||
other usual mechanisms says it should (otherwise, `condition-case'
|
other usual mechanisms say it should (otherwise, `condition-case'
|
||||||
suppresses the debugger).
|
suppresses the debugger).
|
||||||
|
|
||||||
When a handler handles an error, control returns to the `condition-case'
|
When a handler handles an error, control returns to the `condition-case'
|
||||||
|
@ -4881,7 +4881,7 @@ features required. Each entry has the form `(provide . FEATURE)',
|
|||||||
`(defface . SYMBOL)', `(define-type . SYMBOL)',
|
`(defface . SYMBOL)', `(define-type . SYMBOL)',
|
||||||
`(cl-defmethod METHOD SPECIALIZERS)', or `(t . SYMBOL)'.
|
`(cl-defmethod METHOD SPECIALIZERS)', or `(t . SYMBOL)'.
|
||||||
Entries like `(t . SYMBOL)' may precede a `(defun . FUNCTION)' entry,
|
Entries like `(t . SYMBOL)' may precede a `(defun . FUNCTION)' entry,
|
||||||
and means that SYMBOL was an autoload before this file redefined it
|
and mean that SYMBOL was an autoload before this file redefined it
|
||||||
as a function. In addition, entries may also be single symbols,
|
as a function. In addition, entries may also be single symbols,
|
||||||
which means that symbol was defined by `defvar' or `defconst'.
|
which means that symbol was defined by `defvar' or `defconst'.
|
||||||
|
|
||||||
|
@ -3954,9 +3954,11 @@ re_match_2_internal (struct re_pattern_buffer *bufp,
|
|||||||
|
|
||||||
/* Prevent shrinking and relocation of buffer text if GC happens
|
/* Prevent shrinking and relocation of buffer text if GC happens
|
||||||
while we are inside this function. The calls to
|
while we are inside this function. The calls to
|
||||||
UPDATE_SYNTAX_TABLE_* macros can trigger GC if they call Lisp,
|
UPDATE_SYNTAX_TABLE_* macros can call Lisp (via
|
||||||
and we have C pointers to buffer text that must not become
|
`internal--syntax-propertize`); these calls are careful to defend against
|
||||||
invalid as result of GC. */
|
buffer modifications, but even with no modifications, the buffer text may
|
||||||
|
be relocated during GC by `compact_buffer` which would invalidate
|
||||||
|
our C pointers to buffer text. */
|
||||||
if (!current_buffer->text->inhibit_shrinking)
|
if (!current_buffer->text->inhibit_shrinking)
|
||||||
{
|
{
|
||||||
record_unwind_protect_ptr (unwind_re_match, current_buffer);
|
record_unwind_protect_ptr (unwind_re_match, current_buffer);
|
||||||
|
@ -480,10 +480,10 @@ parse_sexp_propertize (ptrdiff_t charpos)
|
|||||||
safe_call1 (Qinternal__syntax_propertize,
|
safe_call1 (Qinternal__syntax_propertize,
|
||||||
make_fixnum (min (zv, 1 + charpos)));
|
make_fixnum (min (zv, 1 + charpos)));
|
||||||
if (modiffs != CHARS_MODIFF)
|
if (modiffs != CHARS_MODIFF)
|
||||||
error ("parse-sexp-propertize-function modified the buffer!");
|
error ("internal--syntax-propertize modified the buffer!");
|
||||||
if (syntax_propertize__done <= charpos
|
if (syntax_propertize__done <= charpos
|
||||||
&& syntax_propertize__done < zv)
|
&& syntax_propertize__done < zv)
|
||||||
error ("parse-sexp-propertize-function did not move"
|
error ("internal--syntax-propertize did not move"
|
||||||
" syntax-propertize--done");
|
" syntax-propertize--done");
|
||||||
SETUP_SYNTAX_TABLE (charpos, 1);
|
SETUP_SYNTAX_TABLE (charpos, 1);
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@
|
|||||||
(condition-case err
|
(condition-case err
|
||||||
(progn
|
(progn
|
||||||
(jsonrpc-request conn 'delete-directory "~/tmp")
|
(jsonrpc-request conn 'delete-directory "~/tmp")
|
||||||
(ert-fail "A `jsonrpc-error' should have been signalled!"))
|
(ert-fail "A `jsonrpc-error' should have been signaled!"))
|
||||||
(jsonrpc-error
|
(jsonrpc-error
|
||||||
(should (= -32601 (cdr (assoc 'jsonrpc-error-code (cdr err)))))))))
|
(should (= -32601 (cdr (assoc 'jsonrpc-error-code (cdr err)))))))))
|
||||||
|
|
||||||
@ -124,7 +124,7 @@
|
|||||||
(condition-case err
|
(condition-case err
|
||||||
(progn
|
(progn
|
||||||
(jsonrpc-request conn '+ ["a" 2])
|
(jsonrpc-request conn '+ ["a" 2])
|
||||||
(ert-fail "A `jsonrpc-error' should have been signalled!"))
|
(ert-fail "A `jsonrpc-error' should have been signaled!"))
|
||||||
(jsonrpc-error
|
(jsonrpc-error
|
||||||
(should (= -32603 (cdr (assoc 'jsonrpc-error-code (cdr err)))))))))
|
(should (= -32603 (cdr (assoc 'jsonrpc-error-code (cdr err)))))))))
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@
|
|||||||
(should-error (thread-join (current-thread))))
|
(should-error (thread-join (current-thread))))
|
||||||
|
|
||||||
(ert-deftest threads-join-error ()
|
(ert-deftest threads-join-error ()
|
||||||
"Test of error signalling from `thread-join'."
|
"Test of error signaling from `thread-join'."
|
||||||
:tags '(:unstable)
|
:tags '(:unstable)
|
||||||
(skip-unless (featurep 'threads))
|
(skip-unless (featurep 'threads))
|
||||||
(let ((thread (make-thread #'threads-call-error)))
|
(let ((thread (make-thread #'threads-call-error)))
|
||||||
|
Loading…
Reference in New Issue
Block a user