aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/abbrev.el58
2 files changed, 39 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7b15000f919..927855c6571 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12005-04-23 Eric Hanchrow <offby1@blarg.net> (tiny change)
2
3 * abbrev.el (write-abbrev-file): Write table entries in
4 alphabetical order by table name.
5
12005-04-22 Kim F. Storm <storm@cua.dk> 62005-04-22 Kim F. Storm <storm@cua.dk>
2 7
3 * ido.el (ido-read-internal): Fix `list' completion. 8 * ido.el (ido-read-internal): Fix `list' completion.
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index aa4249d014e..711e8e2ebe9 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -92,11 +92,11 @@ Mark is set after the inserted text."
92 (interactive) 92 (interactive)
93 (push-mark 93 (push-mark
94 (save-excursion 94 (save-excursion
95 (let ((tables abbrev-table-name-list)) 95 (let ((tables abbrev-table-name-list))
96 (while tables 96 (while tables
97 (insert-abbrev-table-description (car tables) t) 97 (insert-abbrev-table-description (car tables) t)
98 (setq tables (cdr tables)))) 98 (setq tables (cdr tables))))
99 (point)))) 99 (point))))
100 100
101(defun list-abbrevs (&optional local) 101(defun list-abbrevs (&optional local)
102 "Display a list of defined abbrevs. 102 "Display a list of defined abbrevs.
@@ -168,23 +168,23 @@ the ones defined from the buffer now."
168 (interactive "P") 168 (interactive "P")
169 (if arg (kill-all-abbrevs)) 169 (if arg (kill-all-abbrevs))
170 (save-excursion 170 (save-excursion
171 (goto-char (point-min)) 171 (goto-char (point-min))
172 (while (and (not (eobp)) (re-search-forward "^(" nil t)) 172 (while (and (not (eobp)) (re-search-forward "^(" nil t))
173 (let* ((buf (current-buffer)) 173 (let* ((buf (current-buffer))
174 (table (read buf)) 174 (table (read buf))
175 abbrevs name hook exp count sys) 175 abbrevs name hook exp count sys)
176 (forward-line 1) 176 (forward-line 1)
177 (while (progn (forward-line 1) 177 (while (progn (forward-line 1)
178 (not (eolp))) 178 (not (eolp)))
179 (setq name (read buf) count (read buf)) 179 (setq name (read buf) count (read buf))
180 (if (equal count '(sys)) 180 (if (equal count '(sys))
181 (setq sys t count (read buf))) 181 (setq sys t count (read buf)))
182 (setq exp (read buf)) 182 (setq exp (read buf))
183 (skip-chars-backward " \t\n\f") 183 (skip-chars-backward " \t\n\f")
184 (setq hook (if (not (eolp)) (read buf))) 184 (setq hook (if (not (eolp)) (read buf)))
185 (skip-chars-backward " \t\n\f") 185 (skip-chars-backward " \t\n\f")
186 (setq abbrevs (cons (list name exp hook count sys) abbrevs))) 186 (setq abbrevs (cons (list name exp hook count sys) abbrevs)))
187 (define-abbrev-table table abbrevs))))) 187 (define-abbrev-table table abbrevs)))))
188 188
189(defun read-abbrev-file (&optional file quietly) 189(defun read-abbrev-file (&optional file quietly)
190 "Read abbrev definitions from file written with `write-abbrev-file'. 190 "Read abbrev definitions from file written with `write-abbrev-file'.
@@ -201,7 +201,7 @@ Optional second argument QUIETLY non-nil means don't display a message."
201Optional argument FILE is the name of the file to read; 201Optional argument FILE is the name of the file to read;
202it defaults to the value of `abbrev-file-name'. 202it defaults to the value of `abbrev-file-name'.
203Does not display any message." 203Does not display any message."
204 ;(interactive "fRead abbrev file: ") 204 ;(interactive "fRead abbrev file: ")
205 (read-abbrev-file file t)) 205 (read-abbrev-file file t))
206 206
207(defun write-abbrev-file (&optional file) 207(defun write-abbrev-file (&optional file)
@@ -221,7 +221,17 @@ specified in `abbrev-file-name' is used."
221 (let ((coding-system-for-write 'emacs-mule)) 221 (let ((coding-system-for-write 'emacs-mule))
222 (with-temp-file file 222 (with-temp-file file
223 (insert ";;-*-coding: emacs-mule;-*-\n") 223 (insert ";;-*-coding: emacs-mule;-*-\n")
224 (dolist (table abbrev-table-name-list) 224 (dolist (table
225 ;; We sort the table in order to ease the automatic
226 ;; merging of different versions of the user's abbrevs
227 ;; file. This is useful, for example, for when the
228 ;; user keeps their home directory in a revision
229 ;; control system, and is therefore keeping multiple
230 ;; slightly-differing copies loosely synchronized.
231 (sort (copy-sequence abbrev-table-name-list)
232 (lambda (s1 s2)
233 (string< (symbol-name s1)
234 (symbol-name s2)))))
225 (insert-abbrev-table-description table nil))))) 235 (insert-abbrev-table-description table nil)))))
226 236
227(defun add-mode-abbrev (arg) 237(defun add-mode-abbrev (arg)