Subject: bug#5937: 23.1.95; why saving empty abbrev tables

From: Stefan Monnier <[email-masked]>
Date: Tue, 29 Mar 2011 09:49:15 -0400

>> +(defun abbrev-save-buffer ()
>> +  "Save all user-level abbrev definitions in current buffer.
>> +The saved abbrevs are written to the file specified by
>> +`abbrev-file-name'."
>> +  (interactive)
>> +  (and (derived-mode-p 'edit-abbrevs-mode)
>> +       (edit-abbrevs-redefine))

No need for the derived-mode-p check.  But this reminds me: the name
should include "edit" (e.g. abbrev-edit-save-buffer) to make it clear
that it's about edit-abbrevs.

>> +(defun abbrev-save-to-file (file)

Same here.

>> +  "Save all user-level abbrev definitions in current buffer to FILE."
>> +  (interactive
>> +   (list (read-file-name "Save abbrevs to file: "
>> +			 (file-name-directory
>> +			  (expand-file-name abbrev-file-name))
>> +			 abbrev-file-name)))
>> +  (and (derived-mode-p 'edit-abbrevs-mode)
>> +       (edit-abbrevs-redefine))
>> +  (write-abbrev-file file t))

> Should define abbrev-save-buffer as:

> (defun abbrev-save-buffer ()
>   "Save all user-level abbrev definitions in current buffer.
> The saved abbrevs are written to the file specified by
> `abbrev-file-name'."
>   (interactive)
>   (abbrev-save-to-file abbrev-file-name))

Yes, that sounds like a good idea.

        Stefan