aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu2011-03-30 09:06:00 +0800
committerLeo Liu2011-03-30 09:06:00 +0800
commiteb7ffc147d1b6910e73b5323ecfa4cc45f7464a4 (patch)
tree768d539b5c4400c415746a83b3a87980e3d2391a
parent77861b9528e3fbb5f406267ff298a95009530b7f (diff)
downloademacs-eb7ffc147d1b6910e73b5323ecfa4cc45f7464a4.tar.gz
emacs-eb7ffc147d1b6910e73b5323ecfa4cc45f7464a4.zip
Improve key bindings in edit-abbrevs-mode
C-x C-s and C-x C-w in edit-abbrevs-mode now do something similar to their corresponding global bindings.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/abbrev.el29
2 files changed, 32 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8e6e78c705e..7ce8b62b333 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12011-03-30 Leo Liu <sdl.web@gmail.com>
2
3 * abbrev.el (abbrev-edit-save-to-file, abbrev-edit-save-buffer):
4 New commands.
5 (edit-abbrevs-map): Bind them here.
6 (write-abbrev-file): New optinal arg VERBOSE. (Bug#5937)
7
12011-03-29 Ken Manheimer <ken.manheimer@gmail.com> 82011-03-29 Ken Manheimer <ken.manheimer@gmail.com>
2 9
3 * allout.el (allout-hide-by-annotation, allout-flag-region): 10 * allout.el (allout-hide-by-annotation, allout-flag-region):
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 504d9fcbbce..ddf37aff58f 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -65,7 +65,8 @@ abbreviation causes it to expand and be replaced by its expansion."
65 65
66(defvar edit-abbrevs-map 66(defvar edit-abbrevs-map
67 (let ((map (make-sparse-keymap))) 67 (let ((map (make-sparse-keymap)))
68 (define-key map "\C-x\C-s" 'edit-abbrevs-redefine) 68 (define-key map "\C-x\C-s" 'abbrev-edit-save-buffer)
69 (define-key map "\C-x\C-w" 'abbrev-edit-save-to-file)
69 (define-key map "\C-c\C-c" 'edit-abbrevs-redefine) 70 (define-key map "\C-c\C-c" 'edit-abbrevs-redefine)
70 map) 71 map)
71 "Keymap used in `edit-abbrevs'.") 72 "Keymap used in `edit-abbrevs'.")
@@ -216,13 +217,15 @@ Does not display any message."
216 ;(interactive "fRead abbrev file: ") 217 ;(interactive "fRead abbrev file: ")
217 (read-abbrev-file file t)) 218 (read-abbrev-file file t))
218 219
219(defun write-abbrev-file (&optional file) 220(defun write-abbrev-file (&optional file verbose)
220 "Write all user-level abbrev definitions to a file of Lisp code. 221 "Write all user-level abbrev definitions to a file of Lisp code.
221This does not include system abbrevs; it includes only the abbrev tables 222This does not include system abbrevs; it includes only the abbrev tables
222listed in listed in `abbrev-table-name-list'. 223listed in listed in `abbrev-table-name-list'.
223The file written can be loaded in another session to define the same abbrevs. 224The file written can be loaded in another session to define the same abbrevs.
224The argument FILE is the file name to write. If omitted or nil, the file 225The argument FILE is the file name to write. If omitted or nil, the file
225specified in `abbrev-file-name' is used." 226specified in `abbrev-file-name' is used.
227If VERBOSE is non-nil, display a message indicating where abbrevs
228have been saved."
226 (interactive 229 (interactive
227 (list 230 (list
228 (read-file-name "Write abbrev file: " 231 (read-file-name "Write abbrev file: "
@@ -252,7 +255,25 @@ specified in `abbrev-file-name' is used."
252 'emacs-mule))) 255 'emacs-mule)))
253 (goto-char (point-min)) 256 (goto-char (point-min))
254 (insert (format ";;-*-coding: %s;-*-\n" coding-system-for-write)) 257 (insert (format ";;-*-coding: %s;-*-\n" coding-system-for-write))
255 (write-region nil nil file nil 0)))) 258 (write-region nil nil file nil (and (not verbose) 0)))))
259
260(defun abbrev-edit-save-to-file (file)
261 "Save all user-level abbrev definitions in current buffer to FILE."
262 (interactive
263 (list (read-file-name "Save abbrevs to file: "
264 (file-name-directory
265 (expand-file-name abbrev-file-name))
266 abbrev-file-name)))
267 (edit-abbrevs-redefine)
268 (write-abbrev-file file t))
269
270(defun abbrev-edit-save-buffer ()
271 "Save all user-level abbrev definitions in current buffer.
272The saved abbrevs are written to the file specified by
273`abbrev-file-name'."
274 (interactive)
275 (abbrev-edit-save-to-file abbrev-file-name))
276
256 277
257(defun add-mode-abbrev (arg) 278(defun add-mode-abbrev (arg)
258 "Define mode-specific abbrev for last word(s) before point. 279 "Define mode-specific abbrev for last word(s) before point.