GNU bug report logs -
#5937
23.1.95; why saving empty abbrev tables
Previous Next
Reported by: Leo <sdl.web <at> gmail.com>
Date: Mon, 12 Apr 2010 15:24:02 UTC
Severity: minor
Fixed in version 24.1
Done: Leo <sdl.web <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 2010-04-27 09:46 +0100, Leo wrote:
> Do you think we can address this issue in another way for example by
> offering a key biding to enter an empty table? For example, make M-RET
> move point to the end of current abbrev table and asking for a table
> name (with completion)? (this is similar to M-RET in org mode)
The attached patch does this. Could you try and see if you like it?
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 21411a5..c27f29a 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -73,8 +73,9 @@ to enable or disable Abbrev mode in the current buffer."
(defvar edit-abbrevs-map
(let ((map (make-sparse-keymap)))
- (define-key map "\C-x\C-s" 'edit-abbrevs-redefine)
- (define-key map "\C-c\C-c" 'edit-abbrevs-redefine)
+ (define-key map "\C-x\C-s" 'edit-abbrevs-redefine)
+ (define-key map "\C-c\C-c" 'edit-abbrevs-redefine)
+ (define-key map [(meta return)] 'edit-abbrevs-new-table-entry)
map)
"Keymap used in `edit-abbrevs'.")
@@ -175,6 +176,24 @@ or may be omitted (it is usually omitted)."
(define-abbrevs t)
(set-buffer-modified-p nil)))
+(defun edit-abbrevs-new-table-entry (tablename)
+ "Enter a new table entry for TABLENAME into current buffer."
+ (interactive
+ (list (intern-soft
+ (completing-read "Table name: "
+ (mapcar 'symbol-name abbrev-table-name-list)
+ (lambda (tn)
+ (abbrev-table-empty-p
+ (symbol-value (intern-soft tn))))
+ t))))
+ (or (looking-at "^(.*)$")
+ (and (re-search-forward "^(.*)$" nil t)
+ (goto-char (match-beginning 0)))
+ (goto-char (point-max)))
+ (unless (bolp) (insert "\n"))
+ (insert-abbrev-table-description tablename t)
+ (forward-line -2))
+
(defun define-abbrevs (&optional arg)
"Define abbrevs according to current visible buffer contents.
See documentation of `edit-abbrevs' for info on the format of the
This bug report was last modified 14 years and 115 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.