diff options
| author | Eli Zaretskii | 2022-05-21 10:20:41 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2022-05-21 10:20:41 +0300 |
| commit | 90aae0bca2a4d082ec6e452ca8399b75c6c1d633 (patch) | |
| tree | cb7dd91cf327f08595ce76555a912b93dc79a37c | |
| parent | dfa3e6f424b20fe27d9041b2ce7d69811df5d8cd (diff) | |
| download | emacs-90aae0bca2a4d082ec6e452ca8399b75c6c1d633.tar.gz emacs-90aae0bca2a4d082ec6e452ca8399b75c6c1d633.zip | |
Improve documentation strings and prompts in abbrev.el
* lisp/abbrev.el (abbrev-file-name, only-global-abbrevs)
(copy-abbrev-table, insert-abbrevs, list-abbrevs)
(abbrev-table-name, edit-abbrevs, define-abbrevs)
(read-abbrev-file, quietly-read-abbrev-file, write-abbrev-file)
(abbrev-edit-save-to-file, abbrev-edit-save-buffer)
(add-mode-abbrev, add-global-abbrev, inverse-add-mode-abbrev)
(inverse-add-global-abbrev, abbrev-prefix-mark)
(expand-region-abbrevs, abbrev-table-get, abbrev-table-put)
(abbrev-get, abbrev-minor-mode-table-alist, abbrevs-changed)
(abbrev-all-caps, last-abbrev-text, last-abbrev-location)
(clear-abbrev-table, define-abbrev, define-global-abbrev)
(define-mode-abbrev, abbrev--active-tables, abbrev--symbol)
(abbrev-symbol, abbrev-expansion, abbrev-insert)
(abbrev-expand-function, abbrev--suggest-above-threshold)
(abbrev--suggest-saved-recommendations)
(abbrev--suggest-shortest-abbrev, abbrev--suggest-get-totals)
(insert-abbrev-table-description, define-abbrev-table)
(abbrev-table-menu): Fix doc strings: wording, punctuation,
clarity.
(add-abbrev, inverse-add-abbrev): Improve the prompt text.
(Bug#55527)
| -rw-r--r-- | lisp/abbrev.el | 249 |
1 files changed, 134 insertions, 115 deletions
diff --git a/lisp/abbrev.el b/lisp/abbrev.el index de971eb2bd5..fd8cb754d17 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. |
| 51 | This makes the commands that normally define mode-specific abbrevs | 51 | This makes the commands that normally define mode-specific abbrevs |
| 52 | define global abbrevs instead." | 52 | define global abbrevs instead." |
| 53 | :type 'boolean | 53 | :type 'boolean |
| @@ -59,7 +59,8 @@ define global abbrevs instead." | |||
| 59 | 59 | ||
| 60 | In Abbrev mode, inserting an abbreviation causes it to expand and | 60 | In Abbrev mode, inserting an abbreviation causes it to expand and |
| 61 | be replaced by its expansion." | 61 | be 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) |
| @@ -83,7 +84,8 @@ be replaced by its expansion." | |||
| 83 | 84 | ||
| 84 | (defun copy-abbrev-table (table) | 85 | (defun copy-abbrev-table (table) |
| 85 | "Make a new abbrev-table with the same abbrevs as TABLE. | 86 | "Make a new abbrev-table with the same abbrevs as TABLE. |
| 86 | Does not copy property lists." | 87 | This function does not copy property lists of the abbrevs. |
| 88 | See `define-abbrev' for the documentation of abbrev properties." | ||
| 87 | (let ((new-table (make-abbrev-table))) | 89 | (let ((new-table (make-abbrev-table))) |
| 88 | (obarray-map | 90 | (obarray-map |
| 89 | (lambda (symbol) | 91 | (lambda (symbol) |
| @@ -95,8 +97,8 @@ Does not copy property lists." | |||
| 95 | new-table)) | 97 | new-table)) |
| 96 | 98 | ||
| 97 | (defun insert-abbrevs () | 99 | (defun insert-abbrevs () |
| 98 | "Insert after point a description of all defined abbrevs. | 100 | "Insert the description of all defined abbrevs after point. |
| 99 | Mark is set after the inserted text." | 101 | Set mark after the inserted text." |
| 100 | (interactive) | 102 | (interactive) |
| 101 | (push-mark | 103 | (push-mark |
| 102 | (save-excursion | 104 | (save-excursion |
| @@ -105,15 +107,15 @@ Mark is set after the inserted text." | |||
| 105 | (point)))) | 107 | (point)))) |
| 106 | 108 | ||
| 107 | (defun list-abbrevs (&optional local) | 109 | (defun list-abbrevs (&optional local) |
| 108 | "Display a list of defined abbrevs. | 110 | "Display a list of the defined abbrevs. |
| 109 | If LOCAL is non-nil, interactively when invoked with a | 111 | If LOCAL is non-nil (interactively, when invoked with a |
| 110 | prefix arg, display only local, i.e. mode-specific, abbrevs. | 112 | prefix arg), display only local, i.e. mode-specific, abbrevs. |
| 111 | Otherwise display all abbrevs." | 113 | Otherwise display all the abbrevs." |
| 112 | (interactive "P") | 114 | (interactive "P") |
| 113 | (display-buffer (prepare-abbrev-list-buffer local))) | 115 | (display-buffer (prepare-abbrev-list-buffer local))) |
| 114 | 116 | ||
| 115 | (defun abbrev-table-name (table) | 117 | (defun abbrev-table-name (table) |
| 116 | "Value is the name of abbrev table TABLE." | 118 | "Return the name of the specified abbrev TABLE." |
| 117 | (let ((tables abbrev-table-name-list) | 119 | (let ((tables abbrev-table-name-list) |
| 118 | found) | 120 | found) |
| 119 | (while (and (not found) tables) | 121 | (while (and (not found) tables) |
| @@ -137,33 +139,33 @@ Otherwise display all abbrevs." | |||
| 137 | (dolist (table (nreverse empty-tables)) | 139 | (dolist (table (nreverse empty-tables)) |
| 138 | (insert-abbrev-table-description table t))) | 140 | (insert-abbrev-table-description table t))) |
| 139 | ;; Note: `list-abbrevs' can display only local abbrevs, in | 141 | ;; Note: `list-abbrevs' can display only local abbrevs, in |
| 140 | ;; which case editing could lose abbrevs of other tables. Thus | 142 | ;; which case editing could lose abbrevs of other tables. |
| 141 | ;; enter `edit-abbrevs-mode' only if LOCAL is nil. | 143 | ;; Thus enter `edit-abbrevs-mode' only if LOCAL is nil. |
| 142 | (edit-abbrevs-mode)) | 144 | (edit-abbrevs-mode)) |
| 143 | (goto-char (point-min)) | 145 | (goto-char (point-min)) |
| 144 | (set-buffer-modified-p nil) | 146 | (set-buffer-modified-p nil) |
| 145 | (current-buffer)))) | 147 | (current-buffer)))) |
| 146 | 148 | ||
| 147 | (defun edit-abbrevs () | 149 | (defun edit-abbrevs () |
| 148 | "Alter abbrev definitions by editing a list of them. | 150 | "Alter abbrev definitions by editing the list of abbrevs. |
| 149 | Selects a buffer containing a list of abbrev definitions with | 151 | This selects a buffer containing the list of abbrev definitions |
| 150 | point located in the abbrev table for the current buffer, and | 152 | with point located in the abbrev table for the current buffer, and |
| 151 | turns on `edit-abbrevs-mode' in that buffer. | 153 | turns on `edit-abbrevs-mode' in the buffer with the list of abbrevs. |
| 152 | 154 | ||
| 153 | You can edit them and type \\<edit-abbrevs-mode-map>\\[edit-abbrevs-redefine] \ | 155 | You can edit the abbrevs and type \\<edit-abbrevs-mode-map>\\[edit-abbrevs-redefine] \ |
| 154 | to redefine abbrevs | 156 | to redefine abbrevs |
| 155 | according to your editing. | 157 | according to your editing. |
| 156 | 158 | ||
| 157 | The abbrevs editing buffer contains a header line for each | 159 | The abbrevs editing buffer contains a header line for each |
| 158 | abbrev table, which is the abbrev table name in parentheses. | 160 | abbrev table, which is the abbrev table name in parentheses. |
| 159 | 161 | ||
| 160 | This is followed by one line per abbrev in that table: | 162 | The header line is followed by one line per abbrev in that table: |
| 161 | 163 | ||
| 162 | NAME USECOUNT EXPANSION HOOK | 164 | NAME USECOUNT EXPANSION HOOK |
| 163 | 165 | ||
| 164 | where NAME and EXPANSION are strings with quotes, | 166 | where NAME and EXPANSION are strings with quotes, |
| 165 | USECOUNT is an integer, and HOOK is any valid function | 167 | USECOUNT is an integer, and HOOK is any valid function |
| 166 | or may be omitted (it is usually omitted)." | 168 | that may be omitted (it is usually omitted)." |
| 167 | (interactive) | 169 | (interactive) |
| 168 | (let ((table-name (abbrev-table-name local-abbrev-table))) | 170 | (let ((table-name (abbrev-table-name local-abbrev-table))) |
| 169 | (switch-to-buffer (prepare-abbrev-list-buffer)) | 171 | (switch-to-buffer (prepare-abbrev-list-buffer)) |
| @@ -184,8 +186,9 @@ or may be omitted (it is usually omitted)." | |||
| 184 | "Define abbrevs according to current visible buffer contents. | 186 | "Define abbrevs according to current visible buffer contents. |
| 185 | See documentation of `edit-abbrevs' for info on the format of the | 187 | See documentation of `edit-abbrevs' for info on the format of the |
| 186 | text you must have in the buffer. | 188 | text you must have in the buffer. |
| 187 | With argument, eliminate all abbrev definitions except | 189 | If ARG is non-nil (interactively, when invoked with a prefix |
| 188 | the ones defined from the buffer now." | 190 | argument), eliminate all abbrev definitions except the ones |
| 191 | defined by the current buffer contents." | ||
| 189 | (interactive "P") | 192 | (interactive "P") |
| 190 | (if arg (kill-all-abbrevs)) | 193 | (if arg (kill-all-abbrevs)) |
| 191 | (save-excursion | 194 | (save-excursion |
| @@ -216,7 +219,8 @@ the ones defined from the buffer now." | |||
| 216 | "Read abbrev definitions from file written with `write-abbrev-file'. | 219 | "Read abbrev definitions from file written with `write-abbrev-file'. |
| 217 | Optional argument FILE is the name of the file to read; | 220 | Optional argument FILE is the name of the file to read; |
| 218 | it defaults to the value of `abbrev-file-name'. | 221 | it defaults to the value of `abbrev-file-name'. |
| 219 | Optional second argument QUIETLY non-nil means don't display a message." | 222 | Optional second argument QUIETLY non-nil means don't display a message |
| 223 | about loading the abbrevs." | ||
| 220 | (interactive | 224 | (interactive |
| 221 | (list | 225 | (list |
| 222 | (read-file-name (format-prompt "Read abbrev file" abbrev-file-name) | 226 | (read-file-name (format-prompt "Read abbrev file" abbrev-file-name) |
| @@ -225,22 +229,22 @@ Optional second argument QUIETLY non-nil means don't display a message." | |||
| 225 | (setq abbrevs-changed nil)) | 229 | (setq abbrevs-changed nil)) |
| 226 | 230 | ||
| 227 | (defun quietly-read-abbrev-file (&optional file) | 231 | (defun quietly-read-abbrev-file (&optional file) |
| 228 | "Read abbrev definitions from file written with `write-abbrev-file'. | 232 | "Quietly read abbrev definitions from file written with `write-abbrev-file'. |
| 229 | Optional argument FILE is the name of the file to read; | 233 | Optional argument FILE is the name of the file to read; |
| 230 | it defaults to the value of `abbrev-file-name'. | 234 | it defaults to the value of `abbrev-file-name'. |
| 231 | Does not display any message." | 235 | Do not display any messages about loading the abbrevs." |
| 232 | ;(interactive "fRead abbrev file: ") | 236 | ;(interactive "fRead abbrev file: ") |
| 233 | (read-abbrev-file file t)) | 237 | (read-abbrev-file file t)) |
| 234 | 238 | ||
| 235 | (defun write-abbrev-file (&optional file verbose) | 239 | (defun write-abbrev-file (&optional file verbose) |
| 236 | "Write all user-level abbrev definitions to a file of Lisp code. | 240 | "Write all user-level abbrev definitions to a file of Lisp code. |
| 237 | This does not include system abbrevs; it includes only the abbrev tables | 241 | This does not include system abbrevs; it includes only the abbrev tables |
| 238 | listed in listed in `abbrev-table-name-list'. | 242 | listed in `abbrev-table-name-list'. |
| 239 | The file written can be loaded in another session to define the same abbrevs. | 243 | The file written can be loaded in another session to define the same abbrevs. |
| 240 | The argument FILE is the file name to write. If omitted or nil, the file | 244 | The argument FILE is the file name to write. If omitted or nil, it defaults |
| 241 | specified in `abbrev-file-name' is used. | 245 | to the value of `abbrev-file-name'. |
| 242 | If VERBOSE is non-nil, display a message indicating where abbrevs | 246 | If VERBOSE is non-nil, display a message indicating the file where the |
| 243 | have been saved." | 247 | abbrevs have been saved." |
| 244 | (interactive | 248 | (interactive |
| 245 | (list | 249 | (list |
| 246 | (read-file-name "Write abbrev file: " | 250 | (read-file-name "Write abbrev file: " |
| @@ -253,10 +257,10 @@ have been saved." | |||
| 253 | (dolist (table | 257 | (dolist (table |
| 254 | ;; We sort the table in order to ease the automatic | 258 | ;; We sort the table in order to ease the automatic |
| 255 | ;; merging of different versions of the user's abbrevs | 259 | ;; merging of different versions of the user's abbrevs |
| 256 | ;; file. This is useful, for example, for when the | 260 | ;; file. This is useful, for example, when the |
| 257 | ;; user keeps their home directory in a revision | 261 | ;; user keeps their home directory in a revision |
| 258 | ;; control system, and is therefore keeping multiple | 262 | ;; control system, and therefore keeps multiple |
| 259 | ;; slightly-differing copies loosely synchronized. | 263 | ;; slightly-differing loosely synchronized copies. |
| 260 | (sort (copy-sequence abbrev-table-name-list) | 264 | (sort (copy-sequence abbrev-table-name-list) |
| 261 | (lambda (s1 s2) | 265 | (lambda (s1 s2) |
| 262 | (string< (symbol-name s1) | 266 | (string< (symbol-name s1) |
| @@ -270,7 +274,7 @@ have been saved." | |||
| 270 | (write-region nil nil file nil (and (not verbose) 0))))) | 274 | (write-region nil nil file nil (and (not verbose) 0))))) |
| 271 | 275 | ||
| 272 | (defun abbrev-edit-save-to-file (file) | 276 | (defun abbrev-edit-save-to-file (file) |
| 273 | "Save all user-level abbrev definitions in current buffer to FILE." | 277 | "Save to FILE all the user-level abbrev definitions in current buffer." |
| 274 | (interactive | 278 | (interactive |
| 275 | (list (read-file-name "Save abbrevs to file: " | 279 | (list (read-file-name "Save abbrevs to file: " |
| 276 | (file-name-directory | 280 | (file-name-directory |
| @@ -280,7 +284,7 @@ have been saved." | |||
| 280 | (write-abbrev-file file t)) | 284 | (write-abbrev-file file t)) |
| 281 | 285 | ||
| 282 | (defun abbrev-edit-save-buffer () | 286 | (defun abbrev-edit-save-buffer () |
| 283 | "Save all user-level abbrev definitions in current buffer. | 287 | "Save all the user-level abbrev definitions in current buffer. |
| 284 | The saved abbrevs are written to the file specified by | 288 | The saved abbrevs are written to the file specified by |
| 285 | `abbrev-file-name'." | 289 | `abbrev-file-name'." |
| 286 | (interactive) | 290 | (interactive) |
| @@ -288,15 +292,16 @@ The saved abbrevs are written to the file specified by | |||
| 288 | 292 | ||
| 289 | 293 | ||
| 290 | (defun add-mode-abbrev (arg) | 294 | (defun add-mode-abbrev (arg) |
| 291 | "Define mode-specific abbrev for last word(s) before point. | 295 | "Define a mode-specific abbrev whose expansion is the last word before point. |
| 292 | Argument is how many words before point form the expansion; | 296 | Prefix argument ARG says how many words before point to use for the expansion; |
| 293 | or zero means the region is the expansion. | 297 | zero means the entire region is the expansion. |
| 294 | A negative argument means to undefine the specified abbrev. | 298 | A negative ARG means to undefine the specified abbrev. |
| 295 | Reads the abbreviation in the minibuffer. | 299 | |
| 300 | This command reads the abbreviation from the minibuffer. | ||
| 296 | 301 | ||
| 297 | See also `inverse-add-mode-abbrev', which performs the opposite task: | 302 | See also `inverse-add-mode-abbrev', which performs the opposite task: |
| 298 | if the abbrev text is already in the buffer, use this command to | 303 | if the abbreviation is already in the buffer, use that command to define |
| 299 | define an abbrev by specifying the expansion in the minibuffer. | 304 | a mode-specific abbrev by specifying its expansion in the minibuffer. |
| 300 | 305 | ||
| 301 | Don't use this function in a Lisp program; use `define-abbrev' instead." | 306 | Don't use this function in a Lisp program; use `define-abbrev' instead." |
| 302 | (interactive "p") | 307 | (interactive "p") |
| @@ -308,15 +313,16 @@ Don't use this function in a Lisp program; use `define-abbrev' instead." | |||
| 308 | "Mode" arg)) | 313 | "Mode" arg)) |
| 309 | 314 | ||
| 310 | (defun add-global-abbrev (arg) | 315 | (defun add-global-abbrev (arg) |
| 311 | "Define global (all modes) abbrev for last word(s) before point. | 316 | "Define a global (all modes) abbrev whose expansion is last word before point. |
| 312 | The prefix argument specifies the number of words before point that form the | 317 | Prefix argument ARG says how many words before point to use for the expansion; |
| 313 | expansion; or zero means the region is the expansion. | 318 | zero means the entire region is the expansion. |
| 314 | A negative argument means to undefine the specified abbrev. | 319 | A negative ARG means to undefine the specified abbrev. |
| 315 | This command uses the minibuffer to read the abbreviation. | 320 | |
| 321 | This command reads the abbreviation from the minibuffer. | ||
| 316 | 322 | ||
| 317 | See also `inverse-add-global-abbrev', which performs the opposite task: | 323 | See also `inverse-add-global-abbrev', which performs the opposite task: |
| 318 | if the abbrev text is already in the buffer, use this command to | 324 | if the abbreviation is already in the buffer, use that command to define |
| 319 | define an abbrev by specifying the expansion in the minibuffer. | 325 | a global abbrev by specifying its expansion in the minibuffer. |
| 320 | 326 | ||
| 321 | Don't use this function in a Lisp program; use `define-abbrev' instead." | 327 | Don't use this function in a Lisp program; use `define-abbrev' instead." |
| 322 | (interactive "p") | 328 | (interactive "p") |
| @@ -330,25 +336,30 @@ Don't use this function in a Lisp program; use `define-abbrev' instead." | |||
| 330 | (save-excursion (forward-word (- arg)) (point)))))) | 336 | (save-excursion (forward-word (- arg)) (point)))))) |
| 331 | name) | 337 | name) |
| 332 | (setq name | 338 | (setq name |
| 333 | (read-string (format (if exp "%s abbrev for \"%s\": " | 339 | (read-string (format (if exp "%s abbrev that expands into \"%s\": " |
| 334 | "Undefine %s abbrev: ") | 340 | "Undefine %s abbrev: ") |
| 335 | type exp))) | 341 | type exp))) |
| 336 | (set-text-properties 0 (length name) nil name) | 342 | (set-text-properties 0 (length name) nil name) |
| 337 | (if (or (null exp) | 343 | (if (or (null exp) |
| 338 | (not (abbrev-expansion name table)) | 344 | (not (abbrev-expansion name table)) |
| 339 | (y-or-n-p (format "%s expands to \"%s\"; redefine? " | 345 | (y-or-n-p (format "%s expands into \"%s\"; redefine? " |
| 340 | name (abbrev-expansion name table)))) | 346 | name (abbrev-expansion name table)))) |
| 341 | (define-abbrev table (downcase name) exp)))) | 347 | (define-abbrev table (downcase name) exp)))) |
| 342 | 348 | ||
| 343 | (defun inverse-add-mode-abbrev (n) | 349 | (defun inverse-add-mode-abbrev (n) |
| 344 | "Define last word before point as a mode-specific abbrev. | 350 | "Define the word before point as a mode-specific abbreviation. |
| 345 | With prefix argument N, defines the Nth word before point. | 351 | With prefix argument N, define the Nth word before point as the |
| 346 | This command uses the minibuffer to read the expansion. | 352 | abbreviation. |
| 347 | Expands the abbreviation after defining it. | 353 | |
| 354 | If `only-global-abbrevs' is non-nil, this command defines a | ||
| 355 | global (mode-independent) abbrev instead of a mode-specific one. | ||
| 356 | |||
| 357 | This command reads the expansion from the minibuffer, defines the | ||
| 358 | abbrev, and then expands the abbreviation in the current buffer. | ||
| 348 | 359 | ||
| 349 | See also `add-mode-abbrev', which performs the opposite task: | 360 | See also `add-mode-abbrev', which performs the opposite task: |
| 350 | if the expansion is already in the buffer, use this command | 361 | if the expansion is already in the buffer, use that command |
| 351 | to define an abbrev by specifying the abbrev in the minibuffer." | 362 | to define an abbrev by specifying the abbreviation in the minibuffer." |
| 352 | (interactive "p") | 363 | (interactive "p") |
| 353 | (inverse-add-abbrev | 364 | (inverse-add-abbrev |
| 354 | (if only-global-abbrevs | 365 | (if only-global-abbrevs |
| @@ -358,14 +369,16 @@ to define an abbrev by specifying the abbrev in the minibuffer." | |||
| 358 | "Mode" n)) | 369 | "Mode" n)) |
| 359 | 370 | ||
| 360 | (defun inverse-add-global-abbrev (n) | 371 | (defun inverse-add-global-abbrev (n) |
| 361 | "Define last word before point as a global (mode-independent) abbrev. | 372 | "Define the word before point as a global (mode-independent) abbreviation. |
| 362 | With prefix argument N, defines the Nth word before point. | 373 | With prefix argument N, define the Nth word before point as the |
| 363 | This command uses the minibuffer to read the expansion. | 374 | abbreviation. |
| 364 | Expands the abbreviation after defining it. | 375 | |
| 376 | This command reads the expansion from the minibuffer, defines the | ||
| 377 | abbrev, and then expands the abbreviation in the current buffer. | ||
| 365 | 378 | ||
| 366 | See also `add-global-abbrev', which performs the opposite task: | 379 | See also `add-global-abbrev', which performs the opposite task: |
| 367 | if the expansion is already in the buffer, use this command | 380 | if the expansion is already in the buffer, use that command |
| 368 | to define an abbrev by specifying the abbrev in the minibuffer." | 381 | to define an abbrev by specifying the abbreviation in the minibuffer." |
| 369 | (interactive "p") | 382 | (interactive "p") |
| 370 | (inverse-add-abbrev global-abbrev-table "Global" n)) | 383 | (inverse-add-abbrev global-abbrev-table "Global" n)) |
| 371 | 384 | ||
| @@ -379,10 +392,10 @@ to define an abbrev by specifying the abbrev in the minibuffer." | |||
| 379 | (setq start (point) | 392 | (setq start (point) |
| 380 | name (buffer-substring-no-properties start end))) | 393 | name (buffer-substring-no-properties start end))) |
| 381 | 394 | ||
| 382 | (setq exp (read-string (format "%s expansion for \"%s\": " type name) | 395 | (setq exp (read-string (format "Expansion for %s abbrev \"%s\": " type name) |
| 383 | nil nil nil t)) | 396 | nil nil nil t)) |
| 384 | (when (or (not (abbrev-expansion name table)) | 397 | (when (or (not (abbrev-expansion name table)) |
| 385 | (y-or-n-p (format "%s expands to \"%s\"; redefine? " | 398 | (y-or-n-p (format "%s expands into \"%s\"; redefine? " |
| 386 | name (abbrev-expansion name table)))) | 399 | name (abbrev-expansion name table)))) |
| 387 | (define-abbrev table (downcase name) exp) | 400 | (define-abbrev table (downcase name) exp) |
| 388 | (save-excursion | 401 | (save-excursion |
| @@ -390,10 +403,11 @@ to define an abbrev by specifying the abbrev in the minibuffer." | |||
| 390 | (expand-abbrev))))) | 403 | (expand-abbrev))))) |
| 391 | 404 | ||
| 392 | (defun abbrev-prefix-mark (&optional arg) | 405 | (defun abbrev-prefix-mark (&optional arg) |
| 393 | "Mark current point as the beginning of an abbrev. | 406 | "Mark point as the beginning of an abbreviation. |
| 394 | The abbrev to be expanded starts here rather than at beginning of | 407 | The abbrev to be expanded starts at point rather than at the |
| 395 | word. This way, you can expand an abbrev with a prefix: insert | 408 | beginning of a word. This way, you can expand an abbrev with |
| 396 | the prefix, use this command, then insert the abbrev. | 409 | a prefix: insert the prefix, use this command, then insert the |
| 410 | abbrev. | ||
| 397 | 411 | ||
| 398 | This command inserts a hyphen after the prefix, and if the abbrev | 412 | This command inserts a hyphen after the prefix, and if the abbrev |
| 399 | is subsequently expanded, this hyphen will be removed. | 413 | is subsequently expanded, this hyphen will be removed. |
| @@ -408,8 +422,8 @@ argument." | |||
| 408 | (insert "-")) | 422 | (insert "-")) |
| 409 | 423 | ||
| 410 | (defun expand-region-abbrevs (start end &optional noquery) | 424 | (defun expand-region-abbrevs (start end &optional noquery) |
| 411 | "For abbrev occurrence in the region, offer to expand it. | 425 | "For each abbrev occurrence in the region, offer to expand it. |
| 412 | The user is asked to type `y' or `n' for each occurrence. | 426 | Ask the user to type `y' or `n' for each occurrence. |
| 413 | A prefix argument means don't query; expand all abbrevs." | 427 | A prefix argument means don't query; expand all abbrevs." |
| 414 | (interactive "r\nP") | 428 | (interactive "r\nP") |
| 415 | (save-excursion | 429 | (save-excursion |
| @@ -430,18 +444,19 @@ A prefix argument means don't query; expand all abbrevs." | |||
| 430 | ;;; Abbrev properties. | 444 | ;;; Abbrev properties. |
| 431 | 445 | ||
| 432 | (defun abbrev-table-get (table prop) | 446 | (defun abbrev-table-get (table prop) |
| 433 | "Get the PROP property of abbrev table TABLE." | 447 | "Get the property PROP of abbrev table TABLE." |
| 434 | (let ((sym (obarray-get table ""))) | 448 | (let ((sym (obarray-get table ""))) |
| 435 | (if sym (get sym prop)))) | 449 | (if sym (get sym prop)))) |
| 436 | 450 | ||
| 437 | (defun abbrev-table-put (table prop val) | 451 | (defun abbrev-table-put (table prop val) |
| 438 | "Set the PROP property of abbrev table TABLE to VAL." | 452 | "Set the property PROP of abbrev table TABLE to VAL." |
| 439 | (let ((sym (obarray-put table ""))) | 453 | (let ((sym (obarray-put table ""))) |
| 440 | (set sym nil) ; Make sure it won't be confused for an abbrev. | 454 | (set sym nil) ; Make sure it won't be confused for an abbrev. |
| 441 | (put sym prop val))) | 455 | (put sym prop val))) |
| 442 | 456 | ||
| 443 | (defalias 'abbrev-get 'get | 457 | (defalias 'abbrev-get 'get |
| 444 | "Get the property PROP of abbrev ABBREV | 458 | "Get the property PROP of abbrev ABBREV |
| 459 | See `define-abbrev' for the effect of some special properties. | ||
| 445 | 460 | ||
| 446 | \(fn ABBREV PROP)") | 461 | \(fn ABBREV PROP)") |
| 447 | 462 | ||
| @@ -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. |
| 502 | Each element looks like (VARIABLE . ABBREV-TABLE); | 517 | Each element looks like (VARIABLE . ABBREV-TABLE); |
| 503 | ABBREV-TABLE is active whenever VARIABLE's value is non-nil. | 518 | ABBREV-TABLE is active whenever VARIABLE's value is non-nil; |
| 519 | VARIABLE is supposed to be a minor-mode variable. | ||
| 504 | ABBREV-TABLE can also be a list of abbrev tables.") | 520 | ABBREV-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. |
| 515 | This causes `save-some-buffers' to offer to save the abbrevs.") | 531 | This 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. |
| 536 | It is nil if the abbrev has already been unexpanded.") | 552 | It 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. |
| 562 | NAME must be a string, and should be lower-case. | 578 | ABBREV must be a string, and should be lower-case. |
| 563 | EXPANSION should usually be a string. | 579 | EXPANSION should usually be a string. |
| 564 | To undefine an abbrev, define it with EXPANSION = nil. | 580 | To undefine an abbrev, define it with EXPANSION = nil. |
| 565 | If HOOK is non-nil, it should be a function of no arguments; | 581 | If HOOK is non-nil, it should be a function of no arguments; |
| @@ -583,12 +599,12 @@ 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 | ||
| 589 | An obsolete but still supported calling form is: | 605 | An obsolete but still supported calling form is: |
| 590 | 606 | ||
| 591 | \(define-abbrev TABLE NAME EXPANSION &optional HOOK COUNT SYSTEM)." | 607 | \(define-abbrev TABLE ABBREV EXPANSION &optional HOOK COUNT SYSTEM)." |
| 592 | (when (and (consp props) (or (null (car props)) (numberp (car props)))) | 608 | (when (and (consp props) (or (null (car props)) (numberp (car props)))) |
| 593 | ;; Old-style calling convention. | 609 | ;; Old-style calling convention. |
| 594 | (setq props `(:count ,(car props) | 610 | (setq props `(:count ,(car props) |
| @@ -598,7 +614,7 @@ An obsolete but still supported calling form is: | |||
| 598 | (setq props (plist-put props :abbrev-table-modiff | 614 | (setq props (plist-put props :abbrev-table-modiff |
| 599 | (abbrev-table-get table :abbrev-table-modiff))) | 615 | (abbrev-table-get table :abbrev-table-modiff))) |
| 600 | (let ((system-flag (plist-get props :system)) | 616 | (let ((system-flag (plist-get props :system)) |
| 601 | (sym (obarray-put table name))) | 617 | (sym (obarray-put table abbrev))) |
| 602 | ;; Don't override a prior user-defined abbrev with a system abbrev, | 618 | ;; Don't override a prior user-defined abbrev with a system abbrev, |
| 603 | ;; unless system-flag is `force'. | 619 | ;; unless system-flag is `force'. |
| 604 | (unless (and (not (memq system-flag '(nil force))) | 620 | (unless (and (not (memq system-flag '(nil force))) |
| @@ -618,7 +634,7 @@ An obsolete but still supported calling form is: | |||
| 618 | (if (eq 'force system-flag) (plist-put props :system t) props)) | 634 | (if (eq 'force system-flag) (plist-put props :system t) props)) |
| 619 | (abbrev-table-put table :abbrev-table-modiff | 635 | (abbrev-table-put table :abbrev-table-modiff |
| 620 | (1+ (abbrev-table-get table :abbrev-table-modiff)))) | 636 | (1+ (abbrev-table-get table :abbrev-table-modiff)))) |
| 621 | name)) | 637 | abbrev)) |
| 622 | 638 | ||
| 623 | (defun abbrev--check-chars (abbrev global) | 639 | (defun abbrev--check-chars (abbrev global) |
| 624 | "Check if the characters in ABBREV have word syntax in either the | 640 | "Check if the characters in ABBREV have word syntax in either the |
| @@ -638,7 +654,7 @@ current (if global is nil) or standard syntax table." | |||
| 638 | (if global "in the standard syntax" "in this mode")))))) | 654 | (if global "in the standard syntax" "in this mode")))))) |
| 639 | 655 | ||
| 640 | (defun define-global-abbrev (abbrev expansion) | 656 | (defun define-global-abbrev (abbrev expansion) |
| 641 | "Define ABBREV as a global abbreviation for EXPANSION. | 657 | "Define ABBREV as a global abbreviation that expands into EXPANSION. |
| 642 | The characters in ABBREV must all be word constituents in the standard | 658 | The characters in ABBREV must all be word constituents in the standard |
| 643 | syntax table." | 659 | syntax table." |
| 644 | (interactive "sDefine global abbrev: \nsExpansion for %s: ") | 660 | (interactive "sDefine global abbrev: \nsExpansion for %s: ") |
| @@ -646,7 +662,7 @@ syntax table." | |||
| 646 | (define-abbrev global-abbrev-table (downcase abbrev) expansion)) | 662 | (define-abbrev global-abbrev-table (downcase abbrev) expansion)) |
| 647 | 663 | ||
| 648 | (defun define-mode-abbrev (abbrev expansion) | 664 | (defun define-mode-abbrev (abbrev expansion) |
| 649 | "Define ABBREV as a mode-specific abbreviation for EXPANSION. | 665 | "Define ABBREV as a mode-specific abbreviation that expands into EXPANSION. |
| 650 | The characters in ABBREV must all be word-constituents in the current mode." | 666 | The characters in ABBREV must all be word-constituents in the current mode." |
| 651 | (interactive "sDefine mode abbrev: \nsExpansion for %s: ") | 667 | (interactive "sDefine mode abbrev: \nsExpansion for %s: ") |
| 652 | (unless local-abbrev-table | 668 | (unless local-abbrev-table |
| @@ -655,8 +671,8 @@ The characters in ABBREV must all be word-constituents in the current mode." | |||
| 655 | (define-abbrev local-abbrev-table (downcase abbrev) expansion)) | 671 | (define-abbrev local-abbrev-table (downcase abbrev) expansion)) |
| 656 | 672 | ||
| 657 | (defun abbrev--active-tables (&optional tables) | 673 | (defun abbrev--active-tables (&optional tables) |
| 658 | "Return the list of abbrev tables currently active. | 674 | "Return the list of abbrev tables that are currently active. |
| 659 | TABLES if non-nil overrides the usual rules. It can hold | 675 | TABLES, if non-nil, overrides the usual rules. It can hold |
| 660 | either a single abbrev table or a list of abbrev tables." | 676 | either a single abbrev table or a list of abbrev tables." |
| 661 | ;; We could just remove the `tables' arg and let callers use | 677 | ;; We could just remove the `tables' arg and let callers use |
| 662 | ;; (or table (abbrev--active-tables)) but then they'd have to be careful | 678 | ;; (or table (abbrev--active-tables)) but then they'd have to be careful |
| @@ -682,7 +698,7 @@ either a single abbrev table or a list of abbrev tables." | |||
| 682 | "Return the symbol representing abbrev named ABBREV in TABLE. | 698 | "Return the symbol representing abbrev named ABBREV in TABLE. |
| 683 | This symbol's name is ABBREV, but it is not the canonical symbol of that name; | 699 | This symbol's name is ABBREV, but it is not the canonical symbol of that name; |
| 684 | it is interned in the abbrev-table TABLE rather than the normal obarray. | 700 | it is interned in the abbrev-table TABLE rather than the normal obarray. |
| 685 | The value is nil if that abbrev is not defined." | 701 | The value is nil if such an abbrev is not defined." |
| 686 | (let* ((case-fold (not (abbrev-table-get table :case-fixed))) | 702 | (let* ((case-fold (not (abbrev-table-get table :case-fixed))) |
| 687 | ;; In case the table doesn't set :case-fixed but some of the | 703 | ;; In case the table doesn't set :case-fixed but some of the |
| 688 | ;; abbrevs do, we have to be careful. | 704 | ;; abbrevs do, we have to be careful. |
| @@ -699,11 +715,11 @@ The value is nil if that abbrev is not defined." | |||
| 699 | sym))) | 715 | sym))) |
| 700 | 716 | ||
| 701 | (defun abbrev-symbol (abbrev &optional table) | 717 | (defun abbrev-symbol (abbrev &optional table) |
| 702 | "Return the symbol representing abbrev named ABBREV. | 718 | "Return the symbol representing the abbrev named ABBREV in TABLE. |
| 703 | This symbol's name is ABBREV, but it is not the canonical symbol of that name; | 719 | This symbol's name is ABBREV, but it is not the canonical symbol of that name; |
| 704 | it is interned in an abbrev-table rather than the normal obarray. | 720 | it is interned in an abbrev-table rather than the normal obarray. |
| 705 | The value is nil if that abbrev is not defined. | 721 | The value is nil if such an abbrev is not defined. |
| 706 | Optional second arg TABLE is abbrev table to look it up in. | 722 | Optional second arg TABLE is the abbrev table to look it up in. |
| 707 | The default is to try buffer's mode-specific abbrev table, then global table." | 723 | The default is to try buffer's mode-specific abbrev table, then global table." |
| 708 | (let ((tables (abbrev--active-tables table)) | 724 | (let ((tables (abbrev--active-tables table)) |
| 709 | sym) | 725 | sym) |
| @@ -716,7 +732,7 @@ The default is to try buffer's mode-specific abbrev table, then global table." | |||
| 716 | 732 | ||
| 717 | (defun abbrev-expansion (abbrev &optional table) | 733 | (defun abbrev-expansion (abbrev &optional table) |
| 718 | "Return the string that ABBREV expands into in the current buffer. | 734 | "Return the string that ABBREV expands into in the current buffer. |
| 719 | Optionally specify an abbrev table as second arg; | 735 | Optionally specify an abbrev TABLE as second arg; |
| 720 | then ABBREV is looked up in that table only." | 736 | then ABBREV is looked up in that table only." |
| 721 | (symbol-value (abbrev-symbol abbrev table))) | 737 | (symbol-value (abbrev-symbol abbrev table))) |
| 722 | 738 | ||
| @@ -780,9 +796,9 @@ then ABBREV is looked up in that table only." | |||
| 780 | (defun abbrev-insert (abbrev &optional name wordstart wordend) | 796 | (defun abbrev-insert (abbrev &optional name wordstart wordend) |
| 781 | "Insert abbrev ABBREV at point. | 797 | "Insert abbrev ABBREV at point. |
| 782 | If non-nil, NAME is the name by which this abbrev was found. | 798 | If non-nil, NAME is the name by which this abbrev was found. |
| 783 | If non-nil, WORDSTART is the place where to insert the abbrev. | 799 | If non-nil, WORDSTART is the buffer position where to insert the abbrev. |
| 784 | If WORDEND is non-nil, the abbrev replaces the previous text between | 800 | If WORDEND is non-nil, it is a buffer position; the abbrev replaces the |
| 785 | WORDSTART and WORDEND. | 801 | previous text between WORDSTART and WORDEND. |
| 786 | Return ABBREV if the expansion should be considered as having taken place. | 802 | Return ABBREV if the expansion should be considered as having taken place. |
| 787 | The return value can be influenced by a `no-self-insert' property; | 803 | The return value can be influenced by a `no-self-insert' property; |
| 788 | see `define-abbrev' for details." | 804 | see `define-abbrev' for details." |
| @@ -847,7 +863,8 @@ see `define-abbrev' for details." | |||
| 847 | 863 | ||
| 848 | (defvar abbrev-expand-function #'abbrev--default-expand | 864 | (defvar abbrev-expand-function #'abbrev--default-expand |
| 849 | "Function that `expand-abbrev' uses to perform abbrev expansion. | 865 | "Function that `expand-abbrev' uses to perform abbrev expansion. |
| 850 | Takes no argument and should return the abbrev symbol if expansion took place.") | 866 | Takes no arguments, and should return the abbrev symbol if expansion |
| 867 | took place.") | ||
| 851 | 868 | ||
| 852 | (defcustom abbrev-suggest nil | 869 | (defcustom abbrev-suggest nil |
| 853 | "Non-nil means suggest using abbrevs to save typing. | 870 | "Non-nil means suggest using abbrevs to save typing. |
| @@ -906,15 +923,17 @@ Expansion is a string of one or more words." | |||
| 906 | 923 | ||
| 907 | (defun abbrev--suggest-above-threshold (expansion) | 924 | (defun abbrev--suggest-above-threshold (expansion) |
| 908 | "Return non-nil if the abbrev in EXPANSION provides significant savings. | 925 | "Return non-nil if the abbrev in EXPANSION provides significant savings. |
| 909 | A significant saving, here, is the difference in length between | 926 | A significant saving, here, means the difference in length between |
| 910 | the abbrev and the abbrev expansion. EXPANSION is a cons cell | 927 | the abbrev and its expansion is not below the threshold specified |
| 911 | where the car is the expansion and the cdr is the abbrev." | 928 | by the value of `abbrev-suggest-hint-threshold'. |
| 929 | EXPANSION is a cons cell where the car is the expansion and the cdr is | ||
| 930 | the abbrev." | ||
| 912 | (>= (- (length (car expansion)) | 931 | (>= (- (length (car expansion)) |
| 913 | (length (cdr expansion))) | 932 | (length (cdr expansion))) |
| 914 | abbrev-suggest-hint-threshold)) | 933 | abbrev-suggest-hint-threshold)) |
| 915 | 934 | ||
| 916 | (defvar abbrev--suggest-saved-recommendations nil | 935 | (defvar abbrev--suggest-saved-recommendations nil |
| 917 | "Keeps a list of expansions that have abbrevs defined. | 936 | "Keeps the list of expansions that have abbrevs defined. |
| 918 | The user can show this list by calling | 937 | The user can show this list by calling |
| 919 | `abbrev-suggest-show-report'.") | 938 | `abbrev-suggest-show-report'.") |
| 920 | 939 | ||
| @@ -930,7 +949,7 @@ EXPANSION is a cons cell where the `car' is the expansion and the | |||
| 930 | (push expansion abbrev--suggest-saved-recommendations)) | 949 | (push expansion abbrev--suggest-saved-recommendations)) |
| 931 | 950 | ||
| 932 | (defun abbrev--suggest-shortest-abbrev (new current) | 951 | (defun abbrev--suggest-shortest-abbrev (new current) |
| 933 | "Return the shortest abbrev of NEW and CURRENT. | 952 | "Return the shortest of the two abbrevs given by NEW and CURRENT. |
| 934 | NEW and CURRENT are cons cells where the `car' is the expansion | 953 | NEW and CURRENT are cons cells where the `car' is the expansion |
| 935 | and the `cdr' is the abbrev." | 954 | and the `cdr' is the abbrev." |
| 936 | (if (not current) | 955 | (if (not current) |
| @@ -959,8 +978,8 @@ informed about the existing abbrev." | |||
| 959 | 978 | ||
| 960 | (defun abbrev--suggest-get-totals () | 979 | (defun abbrev--suggest-get-totals () |
| 961 | "Return a list of all expansions and how many times they were used. | 980 | "Return a list of all expansions and how many times they were used. |
| 962 | Each expansion is a cons cell where the `car' is the expansion | 981 | Each expansion in the returned list is a cons cell where the `car' is the |
| 963 | and the `cdr' is the number of times the expansion has been | 982 | expansion text and the `cdr' is the number of times the expansion has been |
| 964 | typed." | 983 | typed." |
| 965 | (let (total cell) | 984 | (let (total cell) |
| 966 | (dolist (expansion abbrev--suggest-saved-recommendations) | 985 | (dolist (expansion abbrev--suggest-saved-recommendations) |
| @@ -1088,11 +1107,11 @@ Presumes that `standard-output' points to `current-buffer'." | |||
| 1088 | (defun insert-abbrev-table-description (name &optional readable) | 1107 | (defun insert-abbrev-table-description (name &optional readable) |
| 1089 | "Insert before point a full description of abbrev table named NAME. | 1108 | "Insert before point a full description of abbrev table named NAME. |
| 1090 | NAME is a symbol whose value is an abbrev table. | 1109 | NAME is a symbol whose value is an abbrev table. |
| 1091 | If optional 2nd arg READABLE is non-nil, a human-readable description | 1110 | If optional 2nd arg READABLE is non-nil, insert a human-readable |
| 1092 | is inserted. | 1111 | description. |
| 1093 | 1112 | ||
| 1094 | If READABLE is nil, an expression is inserted. The expression is | 1113 | If READABLE is nil, insert an expression. The expression is |
| 1095 | a call to `define-abbrev-table' that when evaluated will define | 1114 | a call to `define-abbrev-table' that, when evaluated, will define |
| 1096 | the abbrev table NAME exactly as it is currently defined. | 1115 | the abbrev table NAME exactly as it is currently defined. |
| 1097 | Abbrevs marked as \"system abbrevs\" are ignored." | 1116 | Abbrevs marked as \"system abbrevs\" are ignored." |
| 1098 | (let ((symbols (abbrev--table-symbols name readable))) | 1117 | (let ((symbols (abbrev--table-symbols name readable))) |
| @@ -1139,10 +1158,10 @@ Properties with special meaning: | |||
| 1139 | case-folding, and the expansion is not capitalized/upcased. | 1158 | case-folding, and the expansion is not capitalized/upcased. |
| 1140 | - `:regexp' is a regular expression that specifies how to extract the | 1159 | - `:regexp' is a regular expression that specifies how to extract the |
| 1141 | name of the abbrev before point. The submatch 1 is treated | 1160 | name of the abbrev before point. The submatch 1 is treated |
| 1142 | as the potential name of an abbrev. If :regexp is nil, the default | 1161 | as the potential name of an abbrev. If `:regexp' is nil, the default |
| 1143 | behavior uses `backward-word' and `forward-word' to extract the name | 1162 | behavior uses `backward-word' and `forward-word' to extract the name |
| 1144 | of the abbrev, which can therefore only be a single word. | 1163 | of the abbrev, which can therefore by default only be a single word. |
| 1145 | - `:enable-function' can be set to a function of no argument which returns | 1164 | - `:enable-function' can be set to a function of no arguments which returns |
| 1146 | non-nil if and only if the abbrevs in this table should be used for this | 1165 | non-nil if and only if the abbrevs in this table should be used for this |
| 1147 | instance of `expand-abbrev'." | 1166 | instance of `expand-abbrev'." |
| 1148 | (declare (doc-string 3)) | 1167 | (declare (doc-string 3)) |
| @@ -1171,7 +1190,7 @@ Properties with special meaning: | |||
| 1171 | 1190 | ||
| 1172 | (defun abbrev-table-menu (table &optional prompt sortfun) | 1191 | (defun abbrev-table-menu (table &optional prompt sortfun) |
| 1173 | "Return a menu that shows all abbrevs in TABLE. | 1192 | "Return a menu that shows all abbrevs in TABLE. |
| 1174 | Selecting an entry runs `abbrev-insert'. | 1193 | Selecting an entry runs `abbrev-insert' for that entry's abbrev. |
| 1175 | PROMPT is the prompt to use for the keymap. | 1194 | PROMPT is the prompt to use for the keymap. |
| 1176 | SORTFUN is passed to `sort' to change the default ordering." | 1195 | SORTFUN is passed to `sort' to change the default ordering." |
| 1177 | (unless sortfun (setq sortfun 'string-lessp)) | 1196 | (unless sortfun (setq sortfun 'string-lessp)) |