1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-15 17:00:26 +00:00

Preserve special abbrev properties when writing

Fixes bug#29924

* lisp/abbrev.el (abbrev--write): Write abbrev properties when set.
This commit is contained in:
Allen Li 2017-12-31 20:14:09 -08:00 committed by Noam Postavsky
parent 5b464a9cea
commit 0f5cc9a085
3 changed files with 29 additions and 1 deletions

View File

@ -122,6 +122,11 @@ characters that quote text "like this" are replaced by double
typographic quotes, “like this”, in text modes, and in comments in
non-text modes.
---
** 'write-abbrev-file' now includes special properties.
'write-abbrev-file' now writes special properties like ':case-fixed'
for abbrevs that have them.
* Changes in Specialized Modes and Packages in Emacs 27.1

View File

@ -908,8 +908,14 @@ Presumes that `standard-output' points to `current-buffer'."
(prin1 (symbol-value sym))
(insert " ")
(prin1 (symbol-function sym))
(insert " ")
(insert " :count ")
(prin1 (abbrev-get sym :count))
(when (abbrev-get sym :case-fixed)
(insert " :case-fixed ")
(prin1 (abbrev-get sym :case-fixed)))
(when (abbrev-get sym :enable-function)
(insert " :enable-function ")
(prin1 (abbrev-get sym :enable-function)))
(insert ")\n")))
(defun abbrev--describe (sym)

View File

@ -38,6 +38,12 @@
(abbrev-table-put ert-test-abbrevs :ert-test "ert-test-value")
ert-test-abbrevs)
(defun setup-test-abbrev-table-with-props ()
(defvar ert-test-abbrevs nil)
(define-abbrev-table 'ert-test-abbrevs '(("fb" "fooBar" nil :case-fixed t)))
(abbrev-table-put ert-test-abbrevs :ert-test "ert-test-value")
ert-test-abbrevs)
(ert-deftest abbrev-table-p-test ()
(should-not (abbrev-table-p 42))
(should-not (abbrev-table-p "aoeu"))
@ -230,6 +236,17 @@
(should (equal "abbrev-ert-test" (abbrev-expansion "a-e-t" ert-test-abbrevs)))
(delete-file temp-test-file)))
(ert-deftest read-write-abbrev-file-test-with-props ()
"Test reading and writing abbrevs from file"
(let ((temp-test-file (make-temp-file "ert-abbrev-test"))
(ert-test-abbrevs (setup-test-abbrev-table-with-props)))
(write-abbrev-file temp-test-file)
(clear-abbrev-table ert-test-abbrevs)
(should (abbrev-table-empty-p ert-test-abbrevs))
(read-abbrev-file temp-test-file)
(should (equal "fooBar" (abbrev-expansion "fb" ert-test-abbrevs)))
(delete-file temp-test-file)))
(ert-deftest abbrev-edit-save-to-file-test ()
"Test saving abbrev definitions in buffer to file"
(defvar ert-save-test-table nil)