Hey, been working on this emacs problem all day.
I'm running Unstable, up to date.
Cinnamon DE.
64-bit.
dummy@dummy:~$ sudo aptitude show emacs
[sudo] password for default:
Package: emacs
Version: 1:26.3+1-1
New: yes
State: installed
Automatically installed: no
Priority: optional
Section: editors
Maintainer: Rob Browning <
rlb@defaultvalue.org>
Architecture: all
Uncompressed Size: 76.8 k
Depends: emacs-gtk (>= 1:26.3) | emacs-lucid (>= 1:26.3) | emacs-nox (>= 1:26.3)
Provided by: emacs-gtk (1:26.3+1-1), emacs-lucid (1:26.3+1-1), emacs-nox (1:26.3+1-1)
Description: GNU Emacs editor (metapackage)
GNU Emacs is the extensible self-documenting text editor. This is a metapackage that will always
depend on the latest recommended Emacs variant (currently emacs-gtk).
Homepage:
https://www.gnu.org/software/emacs/Tags: devel::editor, role::dummy, role::metapackage, role::program, suite::emacs, suite::gnu,
use::editing
I'm trying to learn Emacs, using:
"Learning GNU Emacs".
Old, but it would still seem to be a reputable and authoritative source.
It says edit .emacs thus:
(setq-default abbrev-mode t)
(read-abbrev-file "~/.abbrev_defs")
(setq save-abbrevs t)
Emacs does NOT like that. It wants the read-abbrev-file to be in emacs.d instead, and not a hidden file, so:
dummy@dummy:~$ ls ~/.emacs.d/abbrev_defs
-rw-r--r-- 1 dummy dummy 1020 Mar 18 16:38 /home/dummy/.emacs.d/abbrev_defs
and .emacs is like this:
dummy@dummy:~$ cat ~/.emacs
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(ansi-color-faces-vector
[default default default italic underline success warning error])
'(ansi-color-names-vector
["black" "red3" "ForestGreen" "yellow3" "blue" "magenta3" "DeepSkyBlue" "gray50"])
'(column-number-mode t)
'(custom-enabled-themes (quote (whiteboard)))
'(display-time-mode t)
'(save-place-mode t)
'(size-indication-mode t))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (:family "DejaVu Sans" :foundry "PfEd" :slant normal :weight normal :height 181 :width normal)))))
;; insert date and time
(defvar current-date-time-format "%Y-%m-%d %H:%M:%S %Z (%a)"
"Format of date to insert with `insert-current-date-time' func
See help of `format-time-string' for possible replacements")
(defvar current-time-format "%H:%M:%S (%a)"
"Format of date to insert with `insert-current-time' func.
Note the weekly scope of the command's precision.")
(defun insert-current-date-time ()
"insert the current date and time into current buffer.
Uses `current-date-time-format' for the formatting the date/time."
(interactive)
(insert (format-time-string current-date-time-format (current-time)))
(insert "\n\n")
)
(defun insert-current-time ()
"insert the current time (1-week scope) into the current buffer."
(interactive)
(insert (format-time-string current-time-format (current-time)))
(insert "\n\n")
)
(global-set-key "\C-c\C-d" 'insert-current-date-time)
(global-set-key "\C-c\C-t" 'insert-current-time)
;; customizations manually added by me:
(setq column-number-indicator-zero-based nil)
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(setq-default fill-column 79)
(setq-default flyspell-mode t)
(setq-default abbrev-mode t)
(read-abbrev-file "~/.emacs.d/abbrev_defs")
(setq save-abbrevs t)
I re-start emacs in abbrev-mode (with .emacs, as above).
Now add a word abbreviation: C-x a i g [Enter]
teh [Enter]
the [Enter]
C-x C-c
Emacs saves it in ~/.emacs.d/abbrev_defs (not ~/.abbrev_defs, as shown in book.)
Re-start emacs. It loads the word abbreviation from ~/.emacs.d/abbrev_defs, and it works as expected.
BUT, now to REMOVE the word abbreviation from ~/.emacs.d/abbrev_defs . . .
The book says:
"You can edit the word abbreviation list by typing M-x edit-abbrevs [Enter]".
Then (the book says):
"To delete any abbreviation, delete the line for that abbreviation and save the file by
typing M-x write-abbrev-file."
So, do:
M-x edit-abbrevs [Enter]
then delete the entry in question,
then do:
M-x write-abbrev-file
It prompts with:
"Write abbrev file: ~/.emacs.d/"
At the prompt, I add "abbrev_defs" like this:
"Write abbrev file: ~/.emacs.d/abbrev_defs"
[Enter].
The prompt disappears, no error message. Good.
Then do:
C-x b to switch to default buffer.
Then do:
C-x C-c to exit emacs.
Now re-enter Emacs.
THE WORD ABBREVIATION I ENTERED STILL WORKS!
IT WAS NEVER REMOVED FROM ~/.emacs.d/abbrev_defs!
(Yes, I am shouting. After spending much of the day fighting with this, I am not happy.)
Note: I can edit ~/.emacs.d/abbrev_defs, remove the entry, and then save ~/.emacs.d/abbrev_defs, thus removing the entry by brute force. It does work.
But I should not have to do that!
So what is M-x write-abbrev-file for?
I did search for an explanation online, and looked at the Debian bug reports for emacs, but did not find an immediately obvious answer.
Grrr . . .