changeset 86216:93c3f233e481

(kill-all-abbrevs, insert-abbrevs, prepare-abbrev-list-buffer): Use dolist. (clear-abbrev-table): Preserve properties.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 18 Nov 2007 19:32:53 +0000
parents 4b2a5a1e790d
children 974997c83cee
files lisp/ChangeLog lisp/abbrev.el
diffstat 2 files changed, 41 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Nov 18 18:57:06 2007 +0000
+++ b/lisp/ChangeLog	Sun Nov 18 19:32:53 2007 +0000
@@ -1,19 +1,24 @@
+2007-11-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* abbrev.el (kill-all-abbrevs, insert-abbrevs)
+	(prepare-abbrev-list-buffer): Use dolist.
+	(clear-abbrev-table): Preserve properties.
+
 2007-11-18  Shigeru Fukaya  <shigeru.fukaya@gmail.com>  (tiny change)
 
-	* textmodes/texinfmt.el (texinfo-format-printindex): Collect
-	combined indexes using texinfo-short-index-format-cmds-alist.
+	* textmodes/texinfmt.el (texinfo-format-printindex):
+	Collect combined indexes using texinfo-short-index-format-cmds-alist.
 	Reported on <bug-texinfo@gnu.org>.
 
 2007-11-18  Michael Albinus  <michael.albinus@gmx.de>
 
-	* net/tramp.el (tramp-completion-reread-directory-timeout): New
-	defcustom.
+	* net/tramp.el (tramp-completion-reread-directory-timeout):
+	New defcustom.
 	(tramp-handle-file-name-all-completions): Flush directory contents
 	from cache regularly.
-	(tramp-set-auto-save-file-modes): Check also for
-	`buffer-modified-p'.
-	(tramp-open-connection-setup-interactive-shell): Call
-	`tramp-cleanup-connection' via funcall.
+	(tramp-set-auto-save-file-modes): Check also for `buffer-modified-p'.
+	(tramp-open-connection-setup-interactive-shell):
+	Call `tramp-cleanup-connection' via funcall.
 
 	* net/tramp-ftp.el (tramp-ftp-file-name-handler): Temp file is already
 	created when copying.
@@ -21,18 +26,17 @@
 2007-11-17  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* eshell/esh-util.el (eshell-under-xemacs-p): Remove.
-	* eshell/esh-mode.el (eshell-mode-syntax-table)
-	(command-running-p):
+	* eshell/esh-mode.el (eshell-mode-syntax-table, command-running-p):
 	* eshell/esh-ext.el (eshell-external-command):
 	* eshell/esh-cmd.el (require):
 	* eshell/em-unix.el (eshell-plain-locate-behavior):
-	* eshell/em-cmpl.el (eshell-cmpl-initialize): Replace
-	eshell-under-xemacs-p with (featurep 'xemacs).
+	* eshell/em-cmpl.el (eshell-cmpl-initialize):
+	Replace eshell-under-xemacs-p with (featurep 'xemacs).
 	* eshell/esh-mode.el (characterp,char-int): Remove unused
 	conditional defaliases.
 
-	* pcomplete.el (pcomplete-event-matches-key-specifier-p): Rename
-	from event-matches-key-specifier-p, define unconditionally.
+	* pcomplete.el (pcomplete-event-matches-key-specifier-p):
+	Rename from event-matches-key-specifier-p, define unconditionally.
 	(event-basic-type): Remove unused defalias.
 	(pcomplete-show-completions):
 	Use pcomplete-event-matches-key-specifier-p.
--- a/lisp/abbrev.el	Sun Nov 18 18:57:06 2007 +0000
+++ b/lisp/abbrev.el	Sun Nov 18 19:32:53 2007 +0000
@@ -83,10 +83,8 @@
 (defun kill-all-abbrevs ()
   "Undefine all defined abbrevs."
   (interactive)
-  (let ((tables abbrev-table-name-list))
-    (while tables
-      (clear-abbrev-table (symbol-value (car tables)))
-      (setq tables (cdr tables)))))
+  (dolist (tablesym abbrev-table-name-list)
+    (clear-abbrev-table (symbol-value tablesym))))
 
 (defun copy-abbrev-table (table)
   "Make a new abbrev-table with the same abbrevs as TABLE."
@@ -106,10 +104,8 @@
   (interactive)
   (push-mark
    (save-excursion
-     (let ((tables abbrev-table-name-list))
-       (while tables
-	 (insert-abbrev-table-description (car tables) t)
-	 (setq tables (cdr tables))))
+     (dolist (tablesym abbrev-table-name-list)
+       (insert-abbrev-table-description tablesym t))
      (point))))
 
 (defun list-abbrevs (&optional local)
@@ -131,18 +127,17 @@
     found))
 
 (defun prepare-abbrev-list-buffer (&optional local)
-  (save-excursion
-    (let ((table local-abbrev-table))
-      (set-buffer (get-buffer-create "*Abbrevs*"))
-      (erase-buffer)
-      (if local
-	  (insert-abbrev-table-description (abbrev-table-name table) t)
-	(dolist (table abbrev-table-name-list)
-	  (insert-abbrev-table-description table t)))
-      (goto-char (point-min))
-      (set-buffer-modified-p nil)
-      (edit-abbrevs-mode)
-      (current-buffer))))
+  (with-current-buffer (get-buffer-create "*Abbrevs*")
+    (erase-buffer)
+    (if local
+        (insert-abbrev-table-description
+         (abbrev-table-name local-abbrev-table) t)
+      (dolist (table abbrev-table-name-list)
+        (insert-abbrev-table-description table t)))
+    (goto-char (point-min))
+    (set-buffer-modified-p nil)
+    (edit-abbrevs-mode)
+    (current-buffer)))
 
 (defun edit-abbrevs-mode ()
   "Major mode for editing the list of abbrev definitions.
@@ -524,8 +519,14 @@
 (defun clear-abbrev-table (table)
   "Undefine all abbrevs in abbrev table TABLE, leaving it empty."
   (setq abbrevs-changed t)
-  (dotimes (i (length table))
-    (aset table i 0)))
+  (let* ((sym (intern-soft "" table)))
+    (dotimes (i (length table))
+      (aset table i 0))
+    ;; Preserve the table's properties.
+    (assert sym)
+    (intern sym table)
+    (abbrev-table-put table :abbrev-table-modiff
+                      (1+ (abbrev-table-get table :abbrev-table-modiff)))))
 
 (defun define-abbrev (table name expansion &optional hook &rest props)
   "Define an abbrev in TABLE named NAME, to expand to EXPANSION and call HOOK.