diff options
| author | Allen Li | 2018-09-29 15:19:04 -0700 |
|---|---|---|
| committer | Eli Zaretskii | 2018-10-12 11:44:15 +0300 |
| commit | f5896e2cbf0e537ec6b79ba139220239f934c840 (patch) | |
| tree | 51604349e1190449caf75043d689694a84212441 /doc | |
| parent | 5bd8cfc14d4b0c78c07e65a583f42a10c4cbc06d (diff) | |
| download | emacs-f5896e2cbf0e537ec6b79ba139220239f934c840.tar.gz emacs-f5896e2cbf0e537ec6b79ba139220239f934c840.zip | |
Rework empty abbrev table omitting
There were two problems with the original implementation:
1. It changed the behavior of insert-abbrev-table-description when
READABLE is nil to sometimes insert one Emacs Lisp expression and
sometimes insert nothing.
2. It broke the tests.
This commit reworks this so that insert-abbrev-table-description
always inserts an expressions even if no abbrevs need to be saved and
making only write-abbrev-file check that a table has any abbrevs to
save before calling insert-abbrev-table-description. This duplicates
the work of filtering the table for savable abbrevs, but the benefit
of keeping the API is worth it.
* doc/lispref/abbrevs.texi (Abbrev Tables): Update documentation.
* lisp/abbrev.el (write-abbrev-file): Skip tables without user abbrevs
(insert-abbrev-table-description): Always insert the define
expression.
(abbrev--table-symbols): New function.
* test/lisp/abbrev-tests.el (abbrev--table-symbols-test):
Add test for abbrev--table-symbols.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/abbrevs.texi | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/doc/lispref/abbrevs.texi b/doc/lispref/abbrevs.texi index 4c9e653cb19..1e9471ba27a 100644 --- a/doc/lispref/abbrevs.texi +++ b/doc/lispref/abbrevs.texi | |||
| @@ -122,9 +122,7 @@ System abbrevs are listed and identified as such. Otherwise the | |||
| 122 | description is a Lisp expression---a call to @code{define-abbrev-table} | 122 | description is a Lisp expression---a call to @code{define-abbrev-table} |
| 123 | that would define @var{name} as it is currently defined, but without | 123 | that would define @var{name} as it is currently defined, but without |
| 124 | the system abbrevs. (The mode or package using @var{name} is supposed | 124 | the system abbrevs. (The mode or package using @var{name} is supposed |
| 125 | to add these to @var{name} separately.) If the Lisp expression would | 125 | to add these to @var{name} separately.) |
| 126 | not define any abbrevs (i.e.@: it defines an empty abbrev table), this | ||
| 127 | function inserts nothing. | ||
| 128 | @end defun | 126 | @end defun |
| 129 | 127 | ||
| 130 | @node Defining Abbrevs | 128 | @node Defining Abbrevs |
| @@ -234,7 +232,8 @@ Emacs commands to offer to save your abbrevs. | |||
| 234 | Save all abbrev definitions (except system abbrevs), for all abbrev | 232 | Save all abbrev definitions (except system abbrevs), for all abbrev |
| 235 | tables listed in @code{abbrev-table-name-list}, in the file | 233 | tables listed in @code{abbrev-table-name-list}, in the file |
| 236 | @var{filename}, in the form of a Lisp program that when loaded will | 234 | @var{filename}, in the form of a Lisp program that when loaded will |
| 237 | define the same abbrevs. If @var{filename} is @code{nil} or omitted, | 235 | define the same abbrevs. Tables that do not have any abbrevs to save |
| 236 | are omitted. If @var{filename} is @code{nil} or omitted, | ||
| 238 | @code{abbrev-file-name} is used. This function returns @code{nil}. | 237 | @code{abbrev-file-name} is used. This function returns @code{nil}. |
| 239 | @end deffn | 238 | @end deffn |
| 240 | 239 | ||