diff options
| author | Gerd Moellmann | 2000-08-28 16:07:10 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-08-28 16:07:10 +0000 |
| commit | c88a9944d644e42d779d7b205fc78db6be2de5d2 (patch) | |
| tree | 70aaa46c882492998b6157ca69469821cffeef91 | |
| parent | bb17930d2345e74364a856dcb8556ca74ea8f94b (diff) | |
| download | emacs-c88a9944d644e42d779d7b205fc78db6be2de5d2.tar.gz emacs-c88a9944d644e42d779d7b205fc78db6be2de5d2.zip | |
(list-abbrevs): Add optional parameter LOCAL.
(abbrev-table-name): New function.
(prepare-abbrev-list-buffer): Add optional parameter LOCAL.
If non-nil list local abbrev, only.
| -rw-r--r-- | lisp/abbrev.el | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/lisp/abbrev.el b/lisp/abbrev.el index 7e60541aaf0..5cb4cc96838 100644 --- a/lisp/abbrev.el +++ b/lisp/abbrev.el | |||
| @@ -86,23 +86,37 @@ Mark is set after the inserted text." | |||
| 86 | (setq tables (cdr tables)))) | 86 | (setq tables (cdr tables)))) |
| 87 | (point)))) | 87 | (point)))) |
| 88 | 88 | ||
| 89 | (defun list-abbrevs () | 89 | (defun list-abbrevs (&optional local) |
| 90 | "Display a list of all defined abbrevs." | 90 | "Display a list of defined abbrevs. |
| 91 | (interactive) | 91 | If LOCAL is non-nil, interactively when invoked with a |
| 92 | (display-buffer (prepare-abbrev-list-buffer))) | 92 | prefix arg, display only local, i.e. mode-specific, abbrevs. |
| 93 | 93 | Otherwise display all abbrevs." | |
| 94 | (defun prepare-abbrev-list-buffer () | 94 | (interactive "P") |
| 95 | (display-buffer (prepare-abbrev-list-buffer local))) | ||
| 96 | |||
| 97 | (defun abbrev-table-name (table) | ||
| 98 | "Value is the name of abbrev table TABLE." | ||
| 99 | (let ((tables abbrev-table-name-list) | ||
| 100 | found) | ||
| 101 | (while (and (not found) tables) | ||
| 102 | (when (eq (symbol-value (car tables)) table) | ||
| 103 | (setq found (car tables))) | ||
| 104 | (setq tables (cdr tables))) | ||
| 105 | found)) | ||
| 106 | |||
| 107 | (defun prepare-abbrev-list-buffer (&optional local) | ||
| 95 | (save-excursion | 108 | (save-excursion |
| 96 | (set-buffer (get-buffer-create "*Abbrevs*")) | 109 | (set-buffer (get-buffer-create "*Abbrevs*")) |
| 97 | (erase-buffer) | 110 | (erase-buffer) |
| 98 | (let ((tables abbrev-table-name-list)) | 111 | (if local |
| 99 | (while tables | 112 | (insert-abbrev-table-description (abbrev-table-name |
| 100 | (insert-abbrev-table-description (car tables) t) | 113 | local-abbrev-table) t) |
| 101 | (setq tables (cdr tables)))) | 114 | (dolist (table abbrev-table-name-list) |
| 115 | (insert-abbrev-table-description table t))) | ||
| 102 | (goto-char (point-min)) | 116 | (goto-char (point-min)) |
| 103 | (set-buffer-modified-p nil) | 117 | (set-buffer-modified-p nil) |
| 104 | (edit-abbrevs-mode)) | 118 | (edit-abbrevs-mode) |
| 105 | (get-buffer-create "*Abbrevs*")) | 119 | (current-buffer))) |
| 106 | 120 | ||
| 107 | (defun edit-abbrevs-mode () | 121 | (defun edit-abbrevs-mode () |
| 108 | "Major mode for editing the list of abbrev definitions. | 122 | "Major mode for editing the list of abbrev definitions. |