aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2022-05-25 13:57:59 -0400
committerEli Zaretskii2022-05-25 13:57:59 -0400
commit97bb31be9f4e06060f2d192b049c3cdb47aca2f5 (patch)
tree1c7e537561f05e65f43689dc9603056f96962402
parent9661c82920cf2b75300266bbd9da9e45b9471173 (diff)
parent86b49d58652a8f59a3489bf15b367ec224e17ae7 (diff)
downloademacs-97bb31be9f4e06060f2d192b049c3cdb47aca2f5.tar.gz
emacs-97bb31be9f4e06060f2d192b049c3cdb47aca2f5.zip
Merge from origin/emacs-28
86b49d5865 ; * etc/NEWS: Announce changes in 'desktop-kill'. (Bug#55... d5ccf2621a ; Fix last change f1c1fd7184 Improve documentation of mail-user-agent. b05d1e9b98 ; * lisp/desktop.el: Update the commentary. (Bug#55560) 139bfa1a08 More fixes in abbrev.el doc strings d80dea6036 Add note about Tramp completion to completion-styles doc s... 9e7c0cf57d Remove mention of removed nnimap-nov-is-evil variable 90aae0bca2 Improve documentation strings and prompts in abbrev.el dfa3e6f424 Restore the Fselect_window call in gui_consider_frame_title. de35e9728f Advise against settings in the MS-Windows system registry 3ffa3d3403 ; Minor addition to make-tarball.txt 7dc026f9ea Fix kmacro-keymap binding after previous change 4f0fd54bc4 Add glossary entries for "interactively" af1c05a3c4 Fix the name of a kmacro command. # Conflicts: # etc/NEWS # lisp/abbrev.el
-rw-r--r--admin/make-tarball.txt3
-rw-r--r--doc/emacs/cmdargs.texi54
-rw-r--r--doc/emacs/glossary.texi16
-rw-r--r--doc/emacs/sending.texi6
-rw-r--r--doc/misc/gnus.texi7
-rw-r--r--lisp/abbrev.el247
-rw-r--r--lisp/desktop.el9
-rw-r--r--lisp/kmacro.el8
-rw-r--r--lisp/minibuffer.el6
-rw-r--r--lisp/simple.el7
-rw-r--r--src/frame.c7
-rw-r--r--src/frame.h1
-rw-r--r--src/minibuf.c10
-rw-r--r--src/xdisp.c3
14 files changed, 221 insertions, 163 deletions
diff --git a/admin/make-tarball.txt b/admin/make-tarball.txt
index c8ee3349cdb..02b4f318e26 100644
--- a/admin/make-tarball.txt
+++ b/admin/make-tarball.txt
@@ -334,6 +334,9 @@ looks like this:
334 </div> 334 </div>
335 </div> 335 </div>
336 336
337Also, make sure the copyright years at the bottom of emacs.html are
338up-to-date.
339
337The file download.html may need to be updated, for example if the 340The file download.html may need to be updated, for example if the
338MS-Windows binaries will be signed by a different person/key than 341MS-Windows binaries will be signed by a different person/key than
339those mentioned there. 342those mentioned there.
diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi
index 946afb6fc14..0f7acd87978 100644
--- a/doc/emacs/cmdargs.texi
+++ b/doc/emacs/cmdargs.texi
@@ -800,29 +800,45 @@ changing any environment or registry settings.
800@pindex addpm, MS-Windows installation program 800@pindex addpm, MS-Windows installation program
801@cindex registry, setting environment variables (MS-Windows) 801@cindex registry, setting environment variables (MS-Windows)
802 802
803On MS-Windows, the installation program @command{addpm.exe} adds 803On MS-Windows, the environment variables @env{emacs_dir},
804values for @env{emacs_dir}, @env{EMACSLOADPATH}, @env{EMACSDATA}, 804@env{EMACSLOADPATH}, @env{EMACSDATA}, @env{EMACSPATH}, @env{EMACSDOC},
805@env{EMACSPATH}, @env{EMACSDOC}, @env{SHELL} and @env{TERM} to the 805@env{SHELL}, @env{TERM}, @env{HOME}, @env{LANG}, and
806@file{HKEY_LOCAL_MACHINE} section of the system registry, under 806@env{PRELOAD_WINSOCK} can also be set in the @file{HKEY_CURRENT_USER}
807@file{/Software/GNU/Emacs}. It does this because there is no standard 807or the @file{HKEY_LOCAL_MACHINE} section of the system registry, under
808place to set environment variables across different versions of 808the @file{/Software/GNU/Emacs} key. When Emacs starts, as well as
809Windows. Running @command{addpm.exe} is no longer strictly necessary 809checking the environment, it also checks the system registry for those
810in recent versions of Emacs, but if you are upgrading from an older 810variables.
811version, running @command{addpm.exe} ensures that you do not have
812older registry entries from a previous installation, which may not be
813compatible with the latest version of Emacs.
814
815When Emacs starts, as well as checking the environment, it also checks
816the System Registry for those variables and for @env{HOME}, @env{LANG}
817and @env{PRELOAD_WINSOCK}.
818 811
819To determine the value of those variables, Emacs goes through the 812To determine the value of those variables, Emacs goes through the
820following procedure. First, the environment is checked. If the 813following procedure. First, it checks the environment. If the
821variable is not found there, Emacs looks for registry keys by that 814variable is not found there, Emacs looks for a registry key by the
822name under @file{/Software/GNU/Emacs}; first in the 815name of the variable under @file{/Software/GNU/Emacs}; first in the
823@file{HKEY_CURRENT_USER} section of the registry, and if not found 816@file{HKEY_CURRENT_USER} section of the registry, and if not found
824there, in the @file{HKEY_LOCAL_MACHINE} section. Finally, if Emacs 817there, in the @file{HKEY_LOCAL_MACHINE} section. Finally, if Emacs
825still cannot determine the values, compiled-in defaults are used. 818still cannot determine the values, it uses the compiled-in defaults.
819
820Note that the registry settings have global system-wide effect: they
821will affect all Emacs sessions run on the system. Thus, if you run
822different Emacs versions, or use both installed and un-installed Emacs
823executables, or build newer versions of Emacs, the settings in the
824registry will cause all of them to use the same directories, which is
825probably not what you want. For this reason, @emph{we recommend
826against setting these variables in the registry}. If you have such
827settings in the registry, we recommend that you remove them.
828
829If you run the Emacs MS-Windows installation program
830@command{addpm.exe}, it will update any existing registry settings of
831the @env{emacs_dir}, @env{EMACSLOADPATH}, @env{EMACSDATA},
832@env{EMACSPATH}, @env{EMACSDOC}, @env{SHELL}, and @env{TERM} variables
833to have the values suitable for the installed Emacs version with which
834@command{addpm.exe} came. Note that @command{addpm.exe} will
835@emph{not} create any registry setting that didn't exist, it will only
836update existing settings, which are most probably inherited from an
837old Emacs installation, so that they are compatible with the newly
838installed Emacs version. Running @command{addpm.exe} is no longer
839necessary when installing recent versions of Emacs, so we only
840recommend doing that if you are upgrading from an older version, and
841cannot remove these settings from the registry for some reason.
826 842
827In addition to the environment variables above, you can also add 843In addition to the environment variables above, you can also add
828settings to the @file{/Software/GNU/Emacs} registry key to specify X 844settings to the @file{/Software/GNU/Emacs} registry key to specify X
diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi
index 7e0c84d7237..a78a2c9e2d7 100644
--- a/doc/emacs/glossary.texi
+++ b/doc/emacs/glossary.texi
@@ -229,9 +229,11 @@ from a variety of coding systems when reading or writing it.
229@item Command 229@item Command
230A command is a Lisp function specially defined to be able to serve as 230A command is a Lisp function specially defined to be able to serve as
231a key binding in Emacs or to be invoked by its name 231a key binding in Emacs or to be invoked by its name
232(@pxref{Glossary---Command Name}). When you type a key sequence 232(@pxref{Glossary---Command Name}). (Another term for @dfn{command} is
233(q.v.), its binding (q.v.@:) is looked up in the relevant keymaps 233@dfn{interactive function}---they are used interchangeably.) When you
234(q.v.@:) to find the command to run. @xref{Commands}. 234type a key sequence (q.v.), its binding (q.v.@:) is looked up in the
235relevant keymaps (q.v.@:) to find the command to run.
236@xref{Commands}.
235 237
236@item Command History 238@item Command History
237@xref{Glossary---Minibuffer History}. 239@xref{Glossary---Minibuffer History}.
@@ -775,6 +777,14 @@ typing sequences of @acronym{ASCII} characters (q.v.). @xref{Input Methods}.
775Insertion means adding text into the buffer, either from the keyboard 777Insertion means adding text into the buffer, either from the keyboard
776or from some other place in Emacs. 778or from some other place in Emacs.
777 779
780@item Interactive Function
781A different term for @dfn{command} (q.v.).
782
783@item Interactive Invocation
784A function can be called from Lisp code, or called as a user level
785command (via @kbd{M-x}, a key binding or a menu). In the latter case,
786the function is said to be @dfn{called interactively}.
787
778@item Interlocking 788@item Interlocking
779@xref{Glossary---File Locking}. 789@xref{Glossary---File Locking}.
780 790
diff --git a/doc/emacs/sending.texi b/doc/emacs/sending.texi
index ea87e0a77b6..cc54224200a 100644
--- a/doc/emacs/sending.texi
+++ b/doc/emacs/sending.texi
@@ -659,6 +659,7 @@ such as MIME support. Another available mode is MH-E
659(@pxref{Top,,MH-E,mh-e, The Emacs Interface to MH}). 659(@pxref{Top,,MH-E,mh-e, The Emacs Interface to MH}).
660 660
661@vindex mail-user-agent 661@vindex mail-user-agent
662@findex define-mail-user-agent
662 You can choose any of these @dfn{mail user agents} as your preferred 663 You can choose any of these @dfn{mail user agents} as your preferred
663method for editing and sending mail. The commands @kbd{C-x m}, 664method for editing and sending mail. The commands @kbd{C-x m},
664@kbd{C-x 4 m} and @kbd{C-x 5 m} use whichever agent you have 665@kbd{C-x 4 m} and @kbd{C-x 5 m} use whichever agent you have
@@ -667,7 +668,10 @@ the bug reporter (@pxref{Bugs}). To specify a mail user agent,
667customize the variable @code{mail-user-agent}. Currently, legitimate 668customize the variable @code{mail-user-agent}. Currently, legitimate
668values include @code{message-user-agent} (Message mode) 669values include @code{message-user-agent} (Message mode)
669@code{sendmail-user-agent} (Mail mode), @code{gnus-user-agent}, and 670@code{sendmail-user-agent} (Mail mode), @code{gnus-user-agent}, and
670@code{mh-e-user-agent}. 671@code{mh-e-user-agent}. Additional options may be available; check
672in the manual of your mail user agent package for details. You may
673also define another mail user agent using
674@code{define-mail-user-agent}.
671 675
672 If you select a different mail-composition method, the information 676 If you select a different mail-composition method, the information
673in this chapter about the mail buffer and Message mode does not apply; 677in this chapter about the mail buffer and Message mode does not apply;
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index e51ae7d424d..a0be13dac88 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -29685,10 +29685,9 @@ Gnus not to use @acronym{NOV}.
29685 29685
29686As the variables for the other back ends, there are 29686As the variables for the other back ends, there are
29687@code{nndiary-nov-is-evil}, @code{nndir-nov-is-evil}, 29687@code{nndiary-nov-is-evil}, @code{nndir-nov-is-evil},
29688@code{nnfolder-nov-is-evil}, @code{nnimap-nov-is-evil}, 29688@code{nnfolder-nov-is-evil}, @code{nnml-nov-is-evil}, and
29689@code{nnml-nov-is-evil}, and @code{nnspool-nov-is-evil}. Note that a 29689@code{nnspool-nov-is-evil}. Note that a non-@code{nil} value for
29690non-@code{nil} value for @code{gnus-nov-is-evil} overrides all those 29690@code{gnus-nov-is-evil} overrides all those variables.
29691variables.
29692@end table 29691@end table
29693 29692
29694 29693
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 3ee972869bc..e875d77faae 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -42,12 +42,12 @@
42 42
43(defcustom abbrev-file-name 43(defcustom abbrev-file-name
44 (locate-user-emacs-file "abbrev_defs" ".abbrev_defs") 44 (locate-user-emacs-file "abbrev_defs" ".abbrev_defs")
45 "Default name of file from which to read abbrevs." 45 "Default name of file from which to read and where to save abbrevs."
46 :initialize 'custom-initialize-delay 46 :initialize 'custom-initialize-delay
47 :type 'file) 47 :type 'file)
48 48
49(defcustom only-global-abbrevs nil 49(defcustom only-global-abbrevs nil
50 "Non-nil means user plans to use global abbrevs only. 50 "Non-nil means user plans to use only global abbrevs.
51This makes the commands that normally define mode-specific abbrevs 51This makes the commands that normally define mode-specific abbrevs
52define global abbrevs instead." 52define global abbrevs instead."
53 :type 'boolean 53 :type 'boolean
@@ -59,7 +59,8 @@ define global abbrevs instead."
59 59
60In Abbrev mode, inserting an abbreviation causes it to expand and 60In Abbrev mode, inserting an abbreviation causes it to expand and
61be replaced by its expansion." 61be replaced by its expansion."
62 ;; It's defined in C, this stops the d-m-m macro defining it again. 62 ;; It's defined in C, this stops the 'define-minor-mode' macro from
63 ;; defining it again.
63 :variable abbrev-mode) 64 :variable abbrev-mode)
64 65
65(put 'abbrev-mode 'safe-local-variable 'booleanp) 66(put 'abbrev-mode 'safe-local-variable 'booleanp)
@@ -81,7 +82,8 @@ be replaced by its expansion."
81 82
82(defun copy-abbrev-table (table) 83(defun copy-abbrev-table (table)
83 "Make a new abbrev-table with the same abbrevs as TABLE. 84 "Make a new abbrev-table with the same abbrevs as TABLE.
84Does not copy property lists." 85This function does not copy property lists of the abbrevs.
86See `define-abbrev' for the documentation of abbrev properties."
85 (let ((new-table (make-abbrev-table))) 87 (let ((new-table (make-abbrev-table)))
86 (obarray-map 88 (obarray-map
87 (lambda (symbol) 89 (lambda (symbol)
@@ -93,8 +95,8 @@ Does not copy property lists."
93 new-table)) 95 new-table))
94 96
95(defun insert-abbrevs () 97(defun insert-abbrevs ()
96 "Insert after point a description of all defined abbrevs. 98 "Insert the description of all defined abbrevs after point.
97Mark is set after the inserted text." 99Set mark after the inserted text."
98 (interactive) 100 (interactive)
99 (push-mark 101 (push-mark
100 (save-excursion 102 (save-excursion
@@ -103,15 +105,15 @@ Mark is set after the inserted text."
103 (point)))) 105 (point))))
104 106
105(defun list-abbrevs (&optional local) 107(defun list-abbrevs (&optional local)
106 "Display a list of defined abbrevs. 108 "Display a list of the defined abbrevs.
107If LOCAL is non-nil, interactively when invoked with a 109If LOCAL is non-nil (interactively, when invoked with a
108prefix arg, display only local, i.e. mode-specific, abbrevs. 110prefix arg), display only local, i.e. mode-specific, abbrevs.
109Otherwise display all abbrevs." 111Otherwise display all the abbrevs."
110 (interactive "P") 112 (interactive "P")
111 (display-buffer (prepare-abbrev-list-buffer local))) 113 (display-buffer (prepare-abbrev-list-buffer local)))
112 114
113(defun abbrev-table-name (table) 115(defun abbrev-table-name (table)
114 "Value is the name of abbrev table TABLE." 116 "Return the name of the specified abbrev TABLE."
115 (let ((tables abbrev-table-name-list) 117 (let ((tables abbrev-table-name-list)
116 found) 118 found)
117 (while (and (not found) tables) 119 (while (and (not found) tables)
@@ -135,33 +137,33 @@ Otherwise display all abbrevs."
135 (dolist (table (nreverse empty-tables)) 137 (dolist (table (nreverse empty-tables))
136 (insert-abbrev-table-description table t))) 138 (insert-abbrev-table-description table t)))
137 ;; Note: `list-abbrevs' can display only local abbrevs, in 139 ;; Note: `list-abbrevs' can display only local abbrevs, in
138 ;; which case editing could lose abbrevs of other tables. Thus 140 ;; which case editing could lose abbrevs of other tables.
139 ;; enter `edit-abbrevs-mode' only if LOCAL is nil. 141 ;; Thus enter `edit-abbrevs-mode' only if LOCAL is nil.
140 (edit-abbrevs-mode)) 142 (edit-abbrevs-mode))
141 (goto-char (point-min)) 143 (goto-char (point-min))
142 (set-buffer-modified-p nil) 144 (set-buffer-modified-p nil)
143 (current-buffer)))) 145 (current-buffer))))
144 146
145(defun edit-abbrevs () 147(defun edit-abbrevs ()
146 "Alter abbrev definitions by editing a list of them. 148 "Alter abbrev definitions by editing the list of abbrevs.
147Selects a buffer containing a list of abbrev definitions with 149This selects a buffer containing the list of abbrev definitions
148point located in the abbrev table for the current buffer, and 150with point located in the abbrev table for the current buffer, and
149turns on `edit-abbrevs-mode' in that buffer. 151turns on `edit-abbrevs-mode' in the buffer with the list of abbrevs.
150 152
151You can edit them and type \\<edit-abbrevs-mode-map>\\[edit-abbrevs-redefine] \ 153You can edit the abbrevs and type \\<edit-abbrevs-mode-map>\\[edit-abbrevs-redefine] \
152to redefine abbrevs 154to redefine abbrevs
153according to your editing. 155according to your editing.
154 156
155The abbrevs editing buffer contains a header line for each 157The abbrevs editing buffer contains a header line for each
156abbrev table, which is the abbrev table name in parentheses. 158abbrev table, which is the abbrev table name in parentheses.
157 159
158This is followed by one line per abbrev in that table: 160The header line is followed by one line per abbrev in that table:
159 161
160 NAME USECOUNT EXPANSION HOOK 162 NAME USECOUNT EXPANSION HOOK
161 163
162where NAME and EXPANSION are strings with quotes, 164where NAME and EXPANSION are strings with quotes,
163USECOUNT is an integer, and HOOK is any valid function 165USECOUNT is an integer, and HOOK is any valid function
164or may be omitted (it is usually omitted)." 166that may be omitted (it is usually omitted)."
165 (interactive) 167 (interactive)
166 (let ((table-name (abbrev-table-name local-abbrev-table))) 168 (let ((table-name (abbrev-table-name local-abbrev-table)))
167 (switch-to-buffer (prepare-abbrev-list-buffer)) 169 (switch-to-buffer (prepare-abbrev-list-buffer))
@@ -182,8 +184,9 @@ or may be omitted (it is usually omitted)."
182 "Define abbrevs according to current visible buffer contents. 184 "Define abbrevs according to current visible buffer contents.
183See documentation of `edit-abbrevs' for info on the format of the 185See documentation of `edit-abbrevs' for info on the format of the
184text you must have in the buffer. 186text you must have in the buffer.
185With argument, eliminate all abbrev definitions except 187If ARG is non-nil (interactively, when invoked with a prefix
186the ones defined from the buffer now." 188argument), eliminate all abbrev definitions except the ones
189defined by the current buffer contents."
187 (interactive "P") 190 (interactive "P")
188 (if arg (kill-all-abbrevs)) 191 (if arg (kill-all-abbrevs))
189 (save-excursion 192 (save-excursion
@@ -214,7 +217,8 @@ the ones defined from the buffer now."
214 "Read abbrev definitions from file written with `write-abbrev-file'. 217 "Read abbrev definitions from file written with `write-abbrev-file'.
215Optional argument FILE is the name of the file to read; 218Optional argument FILE is the name of the file to read;
216it defaults to the value of `abbrev-file-name'. 219it defaults to the value of `abbrev-file-name'.
217Optional second argument QUIETLY non-nil means don't display a message." 220Optional second argument QUIETLY non-nil means don't display a message
221about loading the abbrevs."
218 (interactive 222 (interactive
219 (list 223 (list
220 (read-file-name (format-prompt "Read abbrev file" abbrev-file-name) 224 (read-file-name (format-prompt "Read abbrev file" abbrev-file-name)
@@ -223,22 +227,22 @@ Optional second argument QUIETLY non-nil means don't display a message."
223 (setq abbrevs-changed nil)) 227 (setq abbrevs-changed nil))
224 228
225(defun quietly-read-abbrev-file (&optional file) 229(defun quietly-read-abbrev-file (&optional file)
226 "Read abbrev definitions from file written with `write-abbrev-file'. 230 "Quietly read abbrev definitions from file written with `write-abbrev-file'.
227Optional argument FILE is the name of the file to read; 231Optional argument FILE is the name of the file to read;
228it defaults to the value of `abbrev-file-name'. 232it defaults to the value of `abbrev-file-name'.
229Does not display any message." 233Do not display any messages about loading the abbrevs."
230 ;(interactive "fRead abbrev file: ") 234 ;(interactive "fRead abbrev file: ")
231 (read-abbrev-file file t)) 235 (read-abbrev-file file t))
232 236
233(defun write-abbrev-file (&optional file verbose) 237(defun write-abbrev-file (&optional file verbose)
234 "Write all user-level abbrev definitions to a file of Lisp code. 238 "Write all user-level abbrev definitions to a file of Lisp code.
235This does not include system abbrevs; it includes only the abbrev tables 239This does not include system abbrevs; it includes only the abbrev tables
236listed in listed in `abbrev-table-name-list'. 240listed in `abbrev-table-name-list'.
237The file written can be loaded in another session to define the same abbrevs. 241The file written can be loaded in another session to define the same abbrevs.
238The argument FILE is the file name to write. If omitted or nil, the file 242The argument FILE is the file name to write. If omitted or nil, it defaults
239specified in `abbrev-file-name' is used. 243to the value of `abbrev-file-name'.
240If VERBOSE is non-nil, display a message indicating where abbrevs 244If VERBOSE is non-nil, display a message indicating the file where the
241have been saved." 245abbrevs have been saved."
242 (interactive 246 (interactive
243 (list 247 (list
244 (read-file-name "Write abbrev file: " 248 (read-file-name "Write abbrev file: "
@@ -251,10 +255,10 @@ have been saved."
251 (dolist (table 255 (dolist (table
252 ;; We sort the table in order to ease the automatic 256 ;; We sort the table in order to ease the automatic
253 ;; merging of different versions of the user's abbrevs 257 ;; merging of different versions of the user's abbrevs
254 ;; file. This is useful, for example, for when the 258 ;; file. This is useful, for example, when the
255 ;; user keeps their home directory in a revision 259 ;; user keeps their home directory in a revision
256 ;; control system, and is therefore keeping multiple 260 ;; control system, and therefore keeps multiple
257 ;; slightly-differing copies loosely synchronized. 261 ;; slightly-differing loosely synchronized copies.
258 (sort (copy-sequence abbrev-table-name-list) 262 (sort (copy-sequence abbrev-table-name-list)
259 (lambda (s1 s2) 263 (lambda (s1 s2)
260 (string< (symbol-name s1) 264 (string< (symbol-name s1)
@@ -268,7 +272,7 @@ have been saved."
268 (write-region nil nil file nil (and (not verbose) 0))))) 272 (write-region nil nil file nil (and (not verbose) 0)))))
269 273
270(defun abbrev-edit-save-to-file (file) 274(defun abbrev-edit-save-to-file (file)
271 "Save all user-level abbrev definitions in current buffer to FILE." 275 "Save to FILE all the user-level abbrev definitions in current buffer."
272 (interactive 276 (interactive
273 (list (read-file-name "Save abbrevs to file: " 277 (list (read-file-name "Save abbrevs to file: "
274 (file-name-directory 278 (file-name-directory
@@ -279,7 +283,7 @@ have been saved."
279 (write-abbrev-file file t)) 283 (write-abbrev-file file t))
280 284
281(defun abbrev-edit-save-buffer () 285(defun abbrev-edit-save-buffer ()
282 "Save all user-level abbrev definitions in current buffer. 286 "Save all the user-level abbrev definitions in current buffer.
283The saved abbrevs are written to the file specified by 287The saved abbrevs are written to the file specified by
284`abbrev-file-name'." 288`abbrev-file-name'."
285 (interactive nil edit-abbrevs-mode) 289 (interactive nil edit-abbrevs-mode)
@@ -287,15 +291,16 @@ The saved abbrevs are written to the file specified by
287 291
288 292
289(defun add-mode-abbrev (arg) 293(defun add-mode-abbrev (arg)
290 "Define mode-specific abbrev for last word(s) before point. 294 "Define a mode-specific abbrev whose expansion is the last word before point.
291Argument is how many words before point form the expansion; 295Prefix argument ARG says how many words before point to use for the expansion;
292or zero means the region is the expansion. 296zero means the entire region is the expansion.
293A negative argument means to undefine the specified abbrev. 297A negative ARG means to undefine the specified abbrev.
294Reads the abbreviation in the minibuffer. 298
299This command reads the abbreviation from the minibuffer.
295 300
296See also `inverse-add-mode-abbrev', which performs the opposite task: 301See also `inverse-add-mode-abbrev', which performs the opposite task:
297if the abbrev text is already in the buffer, use this command to 302if the abbreviation is already in the buffer, use that command to define
298define an abbrev by specifying the expansion in the minibuffer. 303a mode-specific abbrev by specifying its expansion in the minibuffer.
299 304
300Don't use this function in a Lisp program; use `define-abbrev' instead." 305Don't use this function in a Lisp program; use `define-abbrev' instead."
301 (interactive "p") 306 (interactive "p")
@@ -307,15 +312,16 @@ Don't use this function in a Lisp program; use `define-abbrev' instead."
307 "Mode" arg)) 312 "Mode" arg))
308 313
309(defun add-global-abbrev (arg) 314(defun add-global-abbrev (arg)
310 "Define global (all modes) abbrev for last word(s) before point. 315 "Define a global (all modes) abbrev whose expansion is last word before point.
311The prefix argument specifies the number of words before point that form the 316Prefix argument ARG says how many words before point to use for the expansion;
312expansion; or zero means the region is the expansion. 317zero means the entire region is the expansion.
313A negative argument means to undefine the specified abbrev. 318A negative ARG means to undefine the specified abbrev.
314This command uses the minibuffer to read the abbreviation. 319
320This command reads the abbreviation from the minibuffer.
315 321
316See also `inverse-add-global-abbrev', which performs the opposite task: 322See also `inverse-add-global-abbrev', which performs the opposite task:
317if the abbrev text is already in the buffer, use this command to 323if the abbreviation is already in the buffer, use that command to define
318define an abbrev by specifying the expansion in the minibuffer. 324a global abbrev by specifying its expansion in the minibuffer.
319 325
320Don't use this function in a Lisp program; use `define-abbrev' instead." 326Don't use this function in a Lisp program; use `define-abbrev' instead."
321 (interactive "p") 327 (interactive "p")
@@ -329,25 +335,30 @@ Don't use this function in a Lisp program; use `define-abbrev' instead."
329 (save-excursion (forward-word (- arg)) (point)))))) 335 (save-excursion (forward-word (- arg)) (point))))))
330 name) 336 name)
331 (setq name 337 (setq name
332 (read-string (format (if exp "%s abbrev for \"%s\": " 338 (read-string (format (if exp "%s abbrev that expands into \"%s\": "
333 "Undefine %s abbrev: ") 339 "Undefine %s abbrev: ")
334 type exp))) 340 type exp)))
335 (set-text-properties 0 (length name) nil name) 341 (set-text-properties 0 (length name) nil name)
336 (if (or (null exp) 342 (if (or (null exp)
337 (not (abbrev-expansion name table)) 343 (not (abbrev-expansion name table))
338 (y-or-n-p (format "%s expands to \"%s\"; redefine? " 344 (y-or-n-p (format "%s expands into \"%s\"; redefine? "
339 name (abbrev-expansion name table)))) 345 name (abbrev-expansion name table))))
340 (define-abbrev table (downcase name) exp)))) 346 (define-abbrev table (downcase name) exp))))
341 347
342(defun inverse-add-mode-abbrev (n) 348(defun inverse-add-mode-abbrev (n)
343 "Define last word before point as a mode-specific abbrev. 349 "Define the word before point as a mode-specific abbreviation.
344With prefix argument N, defines the Nth word before point. 350With prefix argument N, define the Nth word before point as the
345This command uses the minibuffer to read the expansion. 351abbreviation. Negative N means use the Nth word after point.
346Expands the abbreviation after defining it. 352
353If `only-global-abbrevs' is non-nil, this command defines a
354global (mode-independent) abbrev instead of a mode-specific one.
355
356This command reads the expansion from the minibuffer, defines the
357abbrev, and then expands the abbreviation in the current buffer.
347 358
348See also `add-mode-abbrev', which performs the opposite task: 359See also `add-mode-abbrev', which performs the opposite task:
349if the expansion is already in the buffer, use this command 360if the expansion is already in the buffer, use that command
350to define an abbrev by specifying the abbrev in the minibuffer." 361to define an abbrev by specifying the abbreviation in the minibuffer."
351 (interactive "p") 362 (interactive "p")
352 (inverse-add-abbrev 363 (inverse-add-abbrev
353 (if only-global-abbrevs 364 (if only-global-abbrevs
@@ -357,14 +368,16 @@ to define an abbrev by specifying the abbrev in the minibuffer."
357 "Mode" n)) 368 "Mode" n))
358 369
359(defun inverse-add-global-abbrev (n) 370(defun inverse-add-global-abbrev (n)
360 "Define last word before point as a global (mode-independent) abbrev. 371 "Define the word before point as a global (mode-independent) abbreviation.
361With prefix argument N, defines the Nth word before point. 372With prefix argument N, define the Nth word before point as the
362This command uses the minibuffer to read the expansion. 373abbreviation. Negative N means use the Nth word after point.
363Expands the abbreviation after defining it. 374
375This command reads the expansion from the minibuffer, defines the
376abbrev, and then expands the abbreviation in the current buffer.
364 377
365See also `add-global-abbrev', which performs the opposite task: 378See also `add-global-abbrev', which performs the opposite task:
366if the expansion is already in the buffer, use this command 379if the expansion is already in the buffer, use that command
367to define an abbrev by specifying the abbrev in the minibuffer." 380to define an abbrev by specifying the abbreviation in the minibuffer."
368 (interactive "p") 381 (interactive "p")
369 (inverse-add-abbrev global-abbrev-table "Global" n)) 382 (inverse-add-abbrev global-abbrev-table "Global" n))
370 383
@@ -378,10 +391,10 @@ to define an abbrev by specifying the abbrev in the minibuffer."
378 (setq start (point) 391 (setq start (point)
379 name (buffer-substring-no-properties start end))) 392 name (buffer-substring-no-properties start end)))
380 393
381 (setq exp (read-string (format "%s expansion for \"%s\": " type name) 394 (setq exp (read-string (format "Expansion for %s abbrev \"%s\": " type name)
382 nil nil nil t)) 395 nil nil nil t))
383 (when (or (not (abbrev-expansion name table)) 396 (when (or (not (abbrev-expansion name table))
384 (y-or-n-p (format "%s expands to \"%s\"; redefine? " 397 (y-or-n-p (format "%s expands into \"%s\"; redefine? "
385 name (abbrev-expansion name table)))) 398 name (abbrev-expansion name table))))
386 (define-abbrev table (downcase name) exp) 399 (define-abbrev table (downcase name) exp)
387 (save-excursion 400 (save-excursion
@@ -389,10 +402,11 @@ to define an abbrev by specifying the abbrev in the minibuffer."
389 (expand-abbrev))))) 402 (expand-abbrev)))))
390 403
391(defun abbrev-prefix-mark (&optional arg) 404(defun abbrev-prefix-mark (&optional arg)
392 "Mark current point as the beginning of an abbrev. 405 "Mark point as the beginning of an abbreviation.
393The abbrev to be expanded starts here rather than at beginning of 406The abbrev to be expanded starts at point rather than at the
394word. This way, you can expand an abbrev with a prefix: insert 407beginning of a word. This way, you can expand an abbrev with
395the prefix, use this command, then insert the abbrev. 408a prefix: insert the prefix, use this command, then insert the
409abbrev.
396 410
397This command inserts a hyphen after the prefix, and if the abbrev 411This command inserts a hyphen after the prefix, and if the abbrev
398is subsequently expanded, this hyphen will be removed. 412is subsequently expanded, this hyphen will be removed.
@@ -407,8 +421,8 @@ argument."
407 (insert "-")) 421 (insert "-"))
408 422
409(defun expand-region-abbrevs (start end &optional noquery) 423(defun expand-region-abbrevs (start end &optional noquery)
410 "For abbrev occurrence in the region, offer to expand it. 424 "For each abbrev occurrence in the region, offer to expand it.
411The user is asked to type \\`y' or \\`n' for each occurrence. 425Ask the user to type `y' or `n' for each occurrence.
412A prefix argument means don't query; expand all abbrevs." 426A prefix argument means don't query; expand all abbrevs."
413 (interactive "r\nP") 427 (interactive "r\nP")
414 (save-excursion 428 (save-excursion
@@ -429,18 +443,19 @@ A prefix argument means don't query; expand all abbrevs."
429;;; Abbrev properties. 443;;; Abbrev properties.
430 444
431(defun abbrev-table-get (table prop) 445(defun abbrev-table-get (table prop)
432 "Get the PROP property of abbrev table TABLE." 446 "Get the property PROP of abbrev table TABLE."
433 (let ((sym (obarray-get table ""))) 447 (let ((sym (obarray-get table "")))
434 (if sym (get sym prop)))) 448 (if sym (get sym prop))))
435 449
436(defun abbrev-table-put (table prop val) 450(defun abbrev-table-put (table prop val)
437 "Set the PROP property of abbrev table TABLE to VAL." 451 "Set the property PROP of abbrev table TABLE to VAL."
438 (let ((sym (obarray-put table ""))) 452 (let ((sym (obarray-put table "")))
439 (set sym nil) ; Make sure it won't be confused for an abbrev. 453 (set sym nil) ; Make sure it won't be confused for an abbrev.
440 (put sym prop val))) 454 (put sym prop val)))
441 455
442(defalias 'abbrev-get 'get 456(defalias 'abbrev-get 'get
443 "Get the property PROP of abbrev ABBREV 457 "Get the property PROP of abbrev ABBREV
458See `define-abbrev' for the effect of some special properties.
444 459
445\(fn ABBREV PROP)") 460\(fn ABBREV PROP)")
446 461
@@ -500,7 +515,8 @@ for any particular abbrev defined in both.")
500(defvar abbrev-minor-mode-table-alist nil 515(defvar abbrev-minor-mode-table-alist nil
501 "Alist of abbrev tables to use for minor modes. 516 "Alist of abbrev tables to use for minor modes.
502Each element looks like (VARIABLE . ABBREV-TABLE); 517Each element looks like (VARIABLE . ABBREV-TABLE);
503ABBREV-TABLE is active whenever VARIABLE's value is non-nil. 518ABBREV-TABLE is active whenever VARIABLE's value is non-nil;
519VARIABLE is supposed to be a minor-mode variable.
504ABBREV-TABLE can also be a list of abbrev tables.") 520ABBREV-TABLE can also be a list of abbrev tables.")
505 521
506(defvar fundamental-mode-abbrev-table 522(defvar fundamental-mode-abbrev-table
@@ -511,11 +527,11 @@ ABBREV-TABLE can also be a list of abbrev tables.")
511 "The abbrev table of mode-specific abbrevs for Fundamental Mode.") 527 "The abbrev table of mode-specific abbrevs for Fundamental Mode.")
512 528
513(defvar abbrevs-changed nil 529(defvar abbrevs-changed nil
514 "Set non-nil by defining or altering any word abbrevs. 530 "Non-nil if any word abbrevs were defined or altered.
515This causes `save-some-buffers' to offer to save the abbrevs.") 531This causes `save-some-buffers' to offer to save the abbrevs.")
516 532
517(defcustom abbrev-all-caps nil 533(defcustom abbrev-all-caps nil
518 "Non-nil means expand multi-word abbrevs all caps if abbrev was so." 534 "Non-nil means expand multi-word abbrevs in all caps if the abbrev was so."
519 :type 'boolean 535 :type 'boolean
520 :group 'abbrev-mode) 536 :group 'abbrev-mode)
521 537
@@ -532,17 +548,17 @@ Trying to expand an abbrev in any other buffer clears `abbrev-start-location'.")
532 "The abbrev-symbol of the last abbrev expanded. See `abbrev-symbol'.") 548 "The abbrev-symbol of the last abbrev expanded. See `abbrev-symbol'.")
533 549
534(defvar last-abbrev-text nil 550(defvar last-abbrev-text nil
535 "The exact text of the last abbrev expanded. 551 "The exact text of the last abbrev that was expanded.
536It is nil if the abbrev has already been unexpanded.") 552It is nil if the abbrev has already been unexpanded.")
537 553
538(defvar last-abbrev-location 0 554(defvar last-abbrev-location 0
539 "The location of the start of the last abbrev expanded.") 555 "The location of the start of the last abbrev that was expanded.")
540 556
541;; (defvar-local local-abbrev-table fundamental-mode-abbrev-table 557;; (defvar-local local-abbrev-table fundamental-mode-abbrev-table
542;; "Local (mode-specific) abbrev table of current buffer.") 558;; "Local (mode-specific) abbrev table of current buffer.")
543 559
544(defun clear-abbrev-table (table) 560(defun clear-abbrev-table (table)
545 "Undefine all abbrevs in abbrev table TABLE, leaving it empty." 561 "Undefine all abbrevs in abbrev table TABLE, leaving TABLE empty."
546 (setq abbrevs-changed t) 562 (setq abbrevs-changed t)
547 (let* ((sym (obarray-get table ""))) 563 (let* ((sym (obarray-get table "")))
548 (dotimes (i (length table)) 564 (dotimes (i (length table))
@@ -557,9 +573,9 @@ It is nil if the abbrev has already been unexpanded.")
557 ;; For backward compatibility, always return nil. 573 ;; For backward compatibility, always return nil.
558 nil) 574 nil)
559 575
560(defun define-abbrev (table name expansion &optional hook &rest props) 576(defun define-abbrev (table abbrev expansion &optional hook &rest props)
561 "Define an abbrev in TABLE named NAME, to expand to EXPANSION and call HOOK. 577 "Define ABBREV in TABLE, to expand into EXPANSION and optionally call HOOK.
562NAME must be a string, and should be lower-case. 578ABBREV must be a string, and should be lower-case.
563EXPANSION should usually be a string. 579EXPANSION should usually be a string.
564To undefine an abbrev, define it with EXPANSION = nil. 580To undefine an abbrev, define it with EXPANSION = nil.
565If HOOK is non-nil, it should be a function of no arguments; 581If HOOK is non-nil, it should be a function of no arguments;
@@ -583,8 +599,8 @@ PROPS is a property list. The following properties are special:
583 overwrite a non-system abbreviation of the same name. 599 overwrite a non-system abbreviation of the same name.
584- `:case-fixed': non-nil means that abbreviations are looked up without 600- `:case-fixed': non-nil means that abbreviations are looked up without
585 case-folding, and the expansion is not capitalized/upcased. 601 case-folding, and the expansion is not capitalized/upcased.
586- `:enable-function': a function of no argument which returns non-nil if the 602- `:enable-function': a function of no arguments which returns non-nil
587 abbrev should be used for a particular call of `expand-abbrev'. 603 if the abbrev should be used for a particular call of `expand-abbrev'.
588 604
589An obsolete but still supported calling form is: 605An obsolete but still supported calling form is:
590 606
@@ -599,7 +615,7 @@ An obsolete but still supported calling form is:
599 (setq props (plist-put props :abbrev-table-modiff 615 (setq props (plist-put props :abbrev-table-modiff
600 (abbrev-table-get table :abbrev-table-modiff))) 616 (abbrev-table-get table :abbrev-table-modiff)))
601 (let ((system-flag (plist-get props :system)) 617 (let ((system-flag (plist-get props :system))
602 (sym (obarray-put table name))) 618 (sym (obarray-put table abbrev)))
603 ;; Don't override a prior user-defined abbrev with a system abbrev, 619 ;; Don't override a prior user-defined abbrev with a system abbrev,
604 ;; unless system-flag is `force'. 620 ;; unless system-flag is `force'.
605 (unless (and (not (memq system-flag '(nil force))) 621 (unless (and (not (memq system-flag '(nil force)))
@@ -619,7 +635,7 @@ An obsolete but still supported calling form is:
619 (if (eq 'force system-flag) (plist-put props :system t) props)) 635 (if (eq 'force system-flag) (plist-put props :system t) props))
620 (abbrev-table-put table :abbrev-table-modiff 636 (abbrev-table-put table :abbrev-table-modiff
621 (1+ (abbrev-table-get table :abbrev-table-modiff)))) 637 (1+ (abbrev-table-get table :abbrev-table-modiff))))
622 name)) 638 abbrev))
623 639
624(defun abbrev--check-chars (abbrev global) 640(defun abbrev--check-chars (abbrev global)
625 "Check if the characters in ABBREV have word syntax in either the 641 "Check if the characters in ABBREV have word syntax in either the
@@ -639,7 +655,7 @@ current (if global is nil) or standard syntax table."
639 (if global "in the standard syntax" "in this mode")))))) 655 (if global "in the standard syntax" "in this mode"))))))
640 656
641(defun define-global-abbrev (abbrev expansion) 657(defun define-global-abbrev (abbrev expansion)
642 "Define ABBREV as a global abbreviation for EXPANSION. 658 "Define ABBREV as a global abbreviation that expands into EXPANSION.
643The characters in ABBREV must all be word constituents in the standard 659The characters in ABBREV must all be word constituents in the standard
644syntax table." 660syntax table."
645 (interactive "sDefine global abbrev: \nsExpansion for %s: ") 661 (interactive "sDefine global abbrev: \nsExpansion for %s: ")
@@ -647,7 +663,7 @@ syntax table."
647 (define-abbrev global-abbrev-table (downcase abbrev) expansion)) 663 (define-abbrev global-abbrev-table (downcase abbrev) expansion))
648 664
649(defun define-mode-abbrev (abbrev expansion) 665(defun define-mode-abbrev (abbrev expansion)
650 "Define ABBREV as a mode-specific abbreviation for EXPANSION. 666 "Define ABBREV as a mode-specific abbreviation that expands into EXPANSION.
651The characters in ABBREV must all be word-constituents in the current mode." 667The characters in ABBREV must all be word-constituents in the current mode."
652 (interactive "sDefine mode abbrev: \nsExpansion for %s: ") 668 (interactive "sDefine mode abbrev: \nsExpansion for %s: ")
653 (unless local-abbrev-table 669 (unless local-abbrev-table
@@ -656,8 +672,8 @@ The characters in ABBREV must all be word-constituents in the current mode."
656 (define-abbrev local-abbrev-table (downcase abbrev) expansion)) 672 (define-abbrev local-abbrev-table (downcase abbrev) expansion))
657 673
658(defun abbrev--active-tables (&optional tables) 674(defun abbrev--active-tables (&optional tables)
659 "Return the list of abbrev tables currently active. 675 "Return the list of abbrev tables that are currently active.
660TABLES if non-nil overrides the usual rules. It can hold 676TABLES, if non-nil, overrides the usual rules. It can hold
661either a single abbrev table or a list of abbrev tables." 677either a single abbrev table or a list of abbrev tables."
662 ;; We could just remove the `tables' arg and let callers use 678 ;; We could just remove the `tables' arg and let callers use
663 ;; (or table (abbrev--active-tables)) but then they'd have to be careful 679 ;; (or table (abbrev--active-tables)) but then they'd have to be careful
@@ -683,7 +699,7 @@ either a single abbrev table or a list of abbrev tables."
683 "Return the symbol representing abbrev named ABBREV in TABLE. 699 "Return the symbol representing abbrev named ABBREV in TABLE.
684This symbol's name is ABBREV, but it is not the canonical symbol of that name; 700This symbol's name is ABBREV, but it is not the canonical symbol of that name;
685it is interned in the abbrev-table TABLE rather than the normal obarray. 701it is interned in the abbrev-table TABLE rather than the normal obarray.
686The value is nil if that abbrev is not defined." 702The value is nil if such an abbrev is not defined."
687 (let* ((case-fold (not (abbrev-table-get table :case-fixed))) 703 (let* ((case-fold (not (abbrev-table-get table :case-fixed)))
688 ;; In case the table doesn't set :case-fixed but some of the 704 ;; In case the table doesn't set :case-fixed but some of the
689 ;; abbrevs do, we have to be careful. 705 ;; abbrevs do, we have to be careful.
@@ -700,11 +716,11 @@ The value is nil if that abbrev is not defined."
700 sym))) 716 sym)))
701 717
702(defun abbrev-symbol (abbrev &optional table) 718(defun abbrev-symbol (abbrev &optional table)
703 "Return the symbol representing abbrev named ABBREV. 719 "Return the symbol representing the abbrev named ABBREV in TABLE.
704This symbol's name is ABBREV, but it is not the canonical symbol of that name; 720This symbol's name is ABBREV, but it is not the canonical symbol of that name;
705it is interned in an abbrev-table rather than the normal obarray. 721it is interned in an abbrev-table rather than the normal obarray.
706The value is nil if that abbrev is not defined. 722The value is nil if such an abbrev is not defined.
707Optional second arg TABLE is abbrev table to look it up in. 723Optional second arg TABLE is the abbrev table to look it up in.
708The default is to try buffer's mode-specific abbrev table, then global table." 724The default is to try buffer's mode-specific abbrev table, then global table."
709 (let ((tables (abbrev--active-tables table)) 725 (let ((tables (abbrev--active-tables table))
710 sym) 726 sym)
@@ -717,7 +733,7 @@ The default is to try buffer's mode-specific abbrev table, then global table."
717 733
718(defun abbrev-expansion (abbrev &optional table) 734(defun abbrev-expansion (abbrev &optional table)
719 "Return the string that ABBREV expands into in the current buffer. 735 "Return the string that ABBREV expands into in the current buffer.
720Optionally specify an abbrev table as second arg; 736Optionally specify an abbrev TABLE as second arg;
721then ABBREV is looked up in that table only." 737then ABBREV is looked up in that table only."
722 (symbol-value (abbrev-symbol abbrev table))) 738 (symbol-value (abbrev-symbol abbrev table)))
723 739
@@ -781,9 +797,9 @@ then ABBREV is looked up in that table only."
781(defun abbrev-insert (abbrev &optional name wordstart wordend) 797(defun abbrev-insert (abbrev &optional name wordstart wordend)
782 "Insert abbrev ABBREV at point. 798 "Insert abbrev ABBREV at point.
783If non-nil, NAME is the name by which this abbrev was found. 799If non-nil, NAME is the name by which this abbrev was found.
784If non-nil, WORDSTART is the place where to insert the abbrev. 800If non-nil, WORDSTART is the buffer position where to insert the abbrev.
785If WORDEND is non-nil, the abbrev replaces the previous text between 801If WORDEND is non-nil, it is a buffer position; the abbrev replaces the
786WORDSTART and WORDEND. 802previous text between WORDSTART and WORDEND.
787Return ABBREV if the expansion should be considered as having taken place. 803Return ABBREV if the expansion should be considered as having taken place.
788The return value can be influenced by a `no-self-insert' property; 804The return value can be influenced by a `no-self-insert' property;
789see `define-abbrev' for details." 805see `define-abbrev' for details."
@@ -848,7 +864,8 @@ see `define-abbrev' for details."
848 864
849(defvar abbrev-expand-function #'abbrev--default-expand 865(defvar abbrev-expand-function #'abbrev--default-expand
850 "Function that `expand-abbrev' uses to perform abbrev expansion. 866 "Function that `expand-abbrev' uses to perform abbrev expansion.
851Takes no argument and should return the abbrev symbol if expansion took place.") 867Takes no arguments, and should return the abbrev symbol if expansion
868took place.")
852 869
853(defcustom abbrev-suggest nil 870(defcustom abbrev-suggest nil
854 "Non-nil means suggest using abbrevs to save typing. 871 "Non-nil means suggest using abbrevs to save typing.
@@ -907,15 +924,17 @@ Expansion is a string of one or more words."
907 924
908(defun abbrev--suggest-above-threshold (expansion) 925(defun abbrev--suggest-above-threshold (expansion)
909 "Return non-nil if the abbrev in EXPANSION provides significant savings. 926 "Return non-nil if the abbrev in EXPANSION provides significant savings.
910A significant saving, here, is the difference in length between 927A significant saving, here, means the difference in length between
911the abbrev and the abbrev expansion. EXPANSION is a cons cell 928the abbrev and its expansion is not below the threshold specified
912where the car is the expansion and the cdr is the abbrev." 929by the value of `abbrev-suggest-hint-threshold'.
930EXPANSION is a cons cell where the car is the expansion and the cdr is
931the abbrev."
913 (>= (- (length (car expansion)) 932 (>= (- (length (car expansion))
914 (length (cdr expansion))) 933 (length (cdr expansion)))
915 abbrev-suggest-hint-threshold)) 934 abbrev-suggest-hint-threshold))
916 935
917(defvar abbrev--suggest-saved-recommendations nil 936(defvar abbrev--suggest-saved-recommendations nil
918 "Keeps a list of expansions that have abbrevs defined. 937 "Keeps the list of expansions that have abbrevs defined.
919The user can show this list by calling 938The user can show this list by calling
920`abbrev-suggest-show-report'.") 939`abbrev-suggest-show-report'.")
921 940
@@ -931,7 +950,7 @@ EXPANSION is a cons cell where the `car' is the expansion and the
931 (push expansion abbrev--suggest-saved-recommendations)) 950 (push expansion abbrev--suggest-saved-recommendations))
932 951
933(defun abbrev--suggest-shortest-abbrev (new current) 952(defun abbrev--suggest-shortest-abbrev (new current)
934 "Return the shortest abbrev of NEW and CURRENT. 953 "Return the shortest of the two abbrevs given by NEW and CURRENT.
935NEW and CURRENT are cons cells where the `car' is the expansion 954NEW and CURRENT are cons cells where the `car' is the expansion
936and the `cdr' is the abbrev." 955and the `cdr' is the abbrev."
937 (if (not current) 956 (if (not current)
@@ -960,8 +979,8 @@ informed about the existing abbrev."
960 979
961(defun abbrev--suggest-get-totals () 980(defun abbrev--suggest-get-totals ()
962 "Return a list of all expansions and how many times they were used. 981 "Return a list of all expansions and how many times they were used.
963Each expansion is a cons cell where the `car' is the expansion 982Each expansion in the returned list is a cons cell where the `car' is the
964and the `cdr' is the number of times the expansion has been 983expansion text and the `cdr' is the number of times the expansion has been
965typed." 984typed."
966 (let (total cell) 985 (let (total cell)
967 (dolist (expansion abbrev--suggest-saved-recommendations) 986 (dolist (expansion abbrev--suggest-saved-recommendations)
@@ -1089,11 +1108,11 @@ Presumes that `standard-output' points to `current-buffer'."
1089(defun insert-abbrev-table-description (name &optional readable) 1108(defun insert-abbrev-table-description (name &optional readable)
1090 "Insert before point a full description of abbrev table named NAME. 1109 "Insert before point a full description of abbrev table named NAME.
1091NAME is a symbol whose value is an abbrev table. 1110NAME is a symbol whose value is an abbrev table.
1092If optional 2nd arg READABLE is non-nil, a human-readable description 1111If optional 2nd arg READABLE is non-nil, insert a human-readable
1093is inserted. 1112description.
1094 1113
1095If READABLE is nil, an expression is inserted. The expression is 1114If READABLE is nil, insert an expression. The expression is
1096a call to `define-abbrev-table' that when evaluated will define 1115a call to `define-abbrev-table' that, when evaluated, will define
1097the abbrev table NAME exactly as it is currently defined. 1116the abbrev table NAME exactly as it is currently defined.
1098Abbrevs marked as \"system abbrevs\" are ignored." 1117Abbrevs marked as \"system abbrevs\" are ignored."
1099 (let ((symbols (abbrev--table-symbols name readable))) 1118 (let ((symbols (abbrev--table-symbols name readable)))
@@ -1140,10 +1159,10 @@ Properties with special meaning:
1140 case-folding, and the expansion is not capitalized/upcased. 1159 case-folding, and the expansion is not capitalized/upcased.
1141- `:regexp' is a regular expression that specifies how to extract the 1160- `:regexp' is a regular expression that specifies how to extract the
1142 name of the abbrev before point. The submatch 1 is treated 1161 name of the abbrev before point. The submatch 1 is treated
1143 as the potential name of an abbrev. If :regexp is nil, the default 1162 as the potential name of an abbrev. If `:regexp' is nil, the default
1144 behavior uses `backward-word' and `forward-word' to extract the name 1163 behavior uses `backward-word' and `forward-word' to extract the name
1145 of the abbrev, which can therefore only be a single word. 1164 of the abbrev, which can therefore by default only be a single word.
1146- `:enable-function' can be set to a function of no argument which returns 1165- `:enable-function' can be set to a function of no arguments which returns
1147 non-nil if and only if the abbrevs in this table should be used for this 1166 non-nil if and only if the abbrevs in this table should be used for this
1148 instance of `expand-abbrev'." 1167 instance of `expand-abbrev'."
1149 (declare (doc-string 3) (indent defun)) 1168 (declare (doc-string 3) (indent defun))
@@ -1172,7 +1191,7 @@ Properties with special meaning:
1172 1191
1173(defun abbrev-table-menu (table &optional prompt sortfun) 1192(defun abbrev-table-menu (table &optional prompt sortfun)
1174 "Return a menu that shows all abbrevs in TABLE. 1193 "Return a menu that shows all abbrevs in TABLE.
1175Selecting an entry runs `abbrev-insert'. 1194Selecting an entry runs `abbrev-insert' for that entry's abbrev.
1176PROMPT is the prompt to use for the keymap. 1195PROMPT is the prompt to use for the keymap.
1177SORTFUN is passed to `sort' to change the default ordering." 1196SORTFUN is passed to `sort' to change the default ordering."
1178 (unless sortfun (setq sortfun 'string-lessp)) 1197 (unless sortfun (setq sortfun 'string-lessp))
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 1a4103e2090..947f7cff5cb 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -44,10 +44,11 @@
44;; (info "(emacs)Saving Emacs Sessions") in the GNU Emacs Manual. 44;; (info "(emacs)Saving Emacs Sessions") in the GNU Emacs Manual.
45 45
46;; When the desktop module is loaded, the function `desktop-kill' is 46;; When the desktop module is loaded, the function `desktop-kill' is
47;; added to the `kill-emacs-hook'. This function is responsible for 47;; added to the `kill-emacs-query-functions'. This function is
48;; saving the desktop when Emacs is killed. Furthermore an anonymous 48;; responsible for saving the desktop and deleting the desktop lock
49;; function is added to the `after-init-hook'. This function is 49;; file when Emacs is killed. In addition, an anonymous function is
50;; responsible for loading the desktop when Emacs is started. 50;; added to the `after-init-hook'. This function is responsible for
51;; loading the desktop when Emacs is started.
51 52
52;; Special handling. 53;; Special handling.
53;; ----------------- 54;; -----------------
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 3f1f12fad6f..5746b770a2e 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -172,7 +172,7 @@ macro to be executed before appending to it."
172 (define-key map "\C-k" #'kmacro-end-or-call-macro-repeat) 172 (define-key map "\C-k" #'kmacro-end-or-call-macro-repeat)
173 (define-key map "r" #'apply-macro-to-region-lines) 173 (define-key map "r" #'apply-macro-to-region-lines)
174 (define-key map "q" #'kbd-macro-query) ;; Like C-x q 174 (define-key map "q" #'kbd-macro-query) ;; Like C-x q
175 (define-key map "d" #'kdb-macro-redisplay) 175 (define-key map "d" #'kmacro-redisplay)
176 176
177 ;; macro ring 177 ;; macro ring
178 (define-key map "\C-n" #'kmacro-cycle-ring-next) 178 (define-key map "\C-n" #'kmacro-cycle-ring-next)
@@ -1374,12 +1374,12 @@ To customize possible responses, change the \"bindings\" in
1374 (kmacro-push-ring) 1374 (kmacro-push-ring)
1375 (setq last-kbd-macro kmacro-step-edit-new-macro)))) 1375 (setq last-kbd-macro kmacro-step-edit-new-macro))))
1376 1376
1377(defun kdb-macro-redisplay () 1377(defun kmacro-redisplay ()
1378 "Force redisplay during kbd macro execution." 1378 "Force redisplay during keyboard macro execution."
1379 (interactive) 1379 (interactive)
1380 (or executing-kbd-macro 1380 (or executing-kbd-macro
1381 defining-kbd-macro 1381 defining-kbd-macro
1382 (user-error "Not defining or executing kbd macro")) 1382 (user-error "Not defining or executing keyboard macro"))
1383 (when executing-kbd-macro 1383 (when executing-kbd-macro
1384 (let ((executing-kbd-macro nil)) 1384 (let ((executing-kbd-macro nil))
1385 (redisplay)))) 1385 (redisplay))))
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 8287007d322..6694340e021 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1001,7 +1001,11 @@ and DOC describes the way this style of completion works.")
1001The available styles are listed in `completion-styles-alist'. 1001The available styles are listed in `completion-styles-alist'.
1002 1002
1003Note that `completion-category-overrides' may override these 1003Note that `completion-category-overrides' may override these
1004styles for specific categories, such as files, buffers, etc." 1004styles for specific categories, such as files, buffers, etc.
1005
1006Note that Tramp host name completion (e.g., \"/ssh:ho<TAB>\")
1007currently doesn't work if this list doesn't contain at least one
1008of `basic', `emacs22' or `emacs21'."
1005 :type completion--styles-type 1009 :type completion--styles-type
1006 :version "23.1") 1010 :version "23.1")
1007 1011
diff --git a/lisp/simple.el b/lisp/simple.el
index 4fd6ea009d2..420718869a4 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -9207,9 +9207,10 @@ Valid values include:
9207 paraphernalia if Gnus is running, particularly 9207 paraphernalia if Gnus is running, particularly
9208 the Gcc: header for archiving. 9208 the Gcc: header for archiving.
9209 9209
9210Additional valid symbols may be available; check with the author of 9210Additional valid symbols may be available; check in the manual of
9211your package for details. The function should return non-nil if it 9211your mail user agent package for details. You may also define
9212succeeds. 9212your own symbol to be used as value for this variable using
9213`define-mail-user-agent'.
9213 9214
9214See also `read-mail-command' concerning reading mail." 9215See also `read-mail-command' concerning reading mail."
9215 :type '(radio (function-item :tag "Message package" 9216 :type '(radio (function-item :tag "Message package"
diff --git a/src/frame.c b/src/frame.c
index 795dcb3ca66..252dc591bfa 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1572,6 +1572,13 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor
1572 if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame))) 1572 if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame)))
1573 last_nonminibuf_frame = XFRAME (selected_frame); 1573 last_nonminibuf_frame = XFRAME (selected_frame);
1574 1574
1575 /* If the selected window in the target frame is its mini-window, we move
1576 to a different window, the most recently used one, unless there is a
1577 valid active minibuffer in the mini-window. */
1578 if (EQ (f->selected_window, f->minibuffer_window)
1579 && NILP (Fminibufferp (XWINDOW (f->minibuffer_window)->contents, Qt)))
1580 Fset_frame_selected_window (frame, call1 (Qget_mru_window, frame), Qnil);
1581
1575 Fselect_window (f->selected_window, norecord); 1582 Fselect_window (f->selected_window, norecord);
1576 1583
1577 /* We want to make sure that the next event generates a frame-switch 1584 /* We want to make sure that the next event generates a frame-switch
diff --git a/src/frame.h b/src/frame.h
index 4942e640d27..a164853e09d 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -127,6 +127,7 @@ struct frame
127 /* This frame's selected window. 127 /* This frame's selected window.
128 Each frame has its own window hierarchy 128 Each frame has its own window hierarchy
129 and one of the windows in it is selected within the frame. 129 and one of the windows in it is selected within the frame.
130 This window may be the mini-window of the frame, if any.
130 The selected window of the selected frame is Emacs's selected window. */ 131 The selected window of the selected frame is Emacs's selected window. */
131 Lisp_Object selected_window; 132 Lisp_Object selected_window;
132 133
diff --git a/src/minibuf.c b/src/minibuf.c
index 3f06ce7e0e3..79985b8d2bb 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -201,20 +201,12 @@ move_minibuffers_onto_frame (struct frame *of, bool for_deletion)
201 return; 201 return;
202 if (FRAME_LIVE_P (f) 202 if (FRAME_LIVE_P (f)
203 && !EQ (f->minibuffer_window, of->minibuffer_window) 203 && !EQ (f->minibuffer_window, of->minibuffer_window)
204 && WINDOW_LIVE_P (f->minibuffer_window) /* F not a tootip frame */ 204 && WINDOW_LIVE_P (f->minibuffer_window) /* F not a tooltip frame */
205 && WINDOW_LIVE_P (of->minibuffer_window)) 205 && WINDOW_LIVE_P (of->minibuffer_window))
206 { 206 {
207 zip_minibuffer_stacks (f->minibuffer_window, of->minibuffer_window); 207 zip_minibuffer_stacks (f->minibuffer_window, of->minibuffer_window);
208 if (for_deletion && XFRAME (MB_frame) != of) 208 if (for_deletion && XFRAME (MB_frame) != of)
209 MB_frame = selected_frame; 209 MB_frame = selected_frame;
210 if (!for_deletion
211 && MINI_WINDOW_P (XWINDOW (FRAME_SELECTED_WINDOW (of))))
212 {
213 Lisp_Object old_frame;
214 XSETFRAME (old_frame, of);
215 Fset_frame_selected_window (old_frame,
216 Fframe_first_window (old_frame), Qnil);
217 }
218 } 210 }
219} 211}
220 212
diff --git a/src/xdisp.c b/src/xdisp.c
index bbe64340d15..07324815d90 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13200,8 +13200,9 @@ gui_consider_frame_title (Lisp_Object frame)
13200 mode_line_noprop_buf; then display the title. */ 13200 mode_line_noprop_buf; then display the title. */
13201 record_unwind_protect (unwind_format_mode_line, 13201 record_unwind_protect (unwind_format_mode_line,
13202 format_mode_line_unwind_data 13202 format_mode_line_unwind_data
13203 (NULL, current_buffer, Qnil, false)); 13203 (f, current_buffer, selected_window, false));
13204 13204
13205 Fselect_window (f->selected_window, Qt);
13205 set_buffer_internal_1 13206 set_buffer_internal_1
13206 (XBUFFER (XWINDOW (f->selected_window)->contents)); 13207 (XBUFFER (XWINDOW (f->selected_window)->contents));
13207 fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format; 13208 fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format;