summaryrefslogtreecommitdiff
path: root/lisp/abbrev.el
diff options
context:
space:
mode:
authorLeo Liu <sdl.web@gmail.com>2012-04-19 00:43:23 +0800
committerLeo Liu <sdl.web@gmail.com>2012-04-19 00:43:23 +0800
commit12a106a903756aac5fd545ba8cb8f1b5dc7d9304 (patch)
tree879f2807aa77e5a7bc389572e555cb9792828c58 /lisp/abbrev.el
parentbc6494efe328c6b6da13bafd95e035da4e36ca98 (diff)
downloademacs-12a106a903756aac5fd545ba8cb8f1b5dc7d9304.tar.gz
* lisp/abbrev.el (edit-abbrevs): Move point to the abbrev table of
current buffer. (prepare-abbrev-list-buffer): Enter edit-abbrevs-mode only if LOCAL is nil.
Diffstat (limited to 'lisp/abbrev.el')
-rw-r--r--lisp/abbrev.el17
1 files changed, 13 insertions, 4 deletions
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 3845c4ce4e6..7f54d3dc253 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -134,10 +134,13 @@ Otherwise display all abbrevs."
(push table empty-tables)
(insert-abbrev-table-description table t)))
(dolist (table (nreverse empty-tables))
- (insert-abbrev-table-description table t))))
+ (insert-abbrev-table-description table t)))
+ ;; Note: `list-abbrevs' can dispaly only local abbrevs, in
+ ;; which case editing could lose abbrevs of other tables. Thus
+ ;; enter `edit-abbrevs-mode' only if LOCAL is nil.
+ (edit-abbrevs-mode))
(goto-char (point-min))
(set-buffer-modified-p nil)
- (edit-abbrevs-mode)
(current-buffer))))
(defun edit-abbrevs-mode ()
@@ -152,7 +155,8 @@ Otherwise display all abbrevs."
(defun edit-abbrevs ()
"Alter abbrev definitions by editing a list of them.
-Selects a buffer containing a list of abbrev definitions.
+Selects a buffer containing a list of abbrev definitions with
+point located in the abbrev table of current buffer.
You can edit them and type \\<edit-abbrevs-map>\\[edit-abbrevs-redefine] to redefine abbrevs
according to your editing.
Buffer contains a header line for each abbrev table,
@@ -163,7 +167,12 @@ where NAME and EXPANSION are strings with quotes,
USECOUNT is an integer, and HOOK is any valid function
or may be omitted (it is usually omitted)."
(interactive)
- (switch-to-buffer (prepare-abbrev-list-buffer)))
+ (let ((table-name (abbrev-table-name local-abbrev-table)))
+ (switch-to-buffer (prepare-abbrev-list-buffer))
+ (when (and table-name
+ (search-forward
+ (concat "(" (symbol-name table-name) ")\n\n") nil t))
+ (goto-char (match-end 0)))))
(defun edit-abbrevs-redefine ()
"Redefine abbrevs according to current buffer contents."