0

My Emacs version is 27.1

I am developing a major mode and I want to include some abbrevs to ship with it. I noticed that Emacs asks if user wants to save the abbrevs even if abbrevs have property :system t.

Here is the sample code:

(defun abbrev-test-generate-abbrevs ()

  (define-abbrev
    abbrev-test-mode-abbrev-table
    "test1"
    "test1\ntest1\ndone"
    nil
    :system t))


(define-derived-mode abbrev-test-mode prog-mode "TEST ABBR"
  ""
  
  (clear-abbrev-table abbrev-test-mode-abbrev-table)
  (abbrev-test-generate-abbrevs))

(provide 'abbrev-test-mode)

Listing abbrevs after M-x abbrev-test-mode correctly notes that "test1" is a system abbrev:

(abbrev-test-mode-abbrev-table)

"test1" (sys)       0 "test1
test1
done"

Yet Emacs asks if I want to save abbrevs when I exit.

The Elisp reference in Emacs, as well as here specify that abbrevs with :system property non-nil are not saved. Is that a bug or is the documentation wrong? Or do I misunderstand?

I do not want to pester the users with save prompts for abbrevs that are part of the mode, unless they define their own abbrevs. Is that possible? If not, is there a more bare-bones snippeting functionality that I can use to write my own snippeting functions?

Using yasnippet is overkill for what I want to do. I just need the simplest possible snippet expansion and abbrev functionality is perfect for me, except this saving prompts.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.