]> git.eshelyaron.com Git - emacs.git/commitdiff
(kill-all-abbrevs, insert-abbrevs, prepare-abbrev-list-buffer): Use dolist.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 18 Nov 2007 19:32:53 +0000 (19:32 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 18 Nov 2007 19:32:53 +0000 (19:32 +0000)
(clear-abbrev-table): Preserve properties.

lisp/ChangeLog
lisp/abbrev.el

index 63dee8f6e0dd85d9b37f1f33159a72bcc5d7157f..8c1bcf780c43b35e61f406653af0215c3d562378 100644 (file)
@@ -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.
 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.
index b6167d2c1a5a4b9b72d8413529496a75e02d4873..d7dfea2f6d8e82d674342a6c5cff88bfc9ee752e 100644 (file)
@@ -83,10 +83,8 @@ to enable or disable Abbrev mode in the current buffer."
 (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 @@ Mark is set after the inserted text."
   (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 @@ Otherwise display all abbrevs."
     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 @@ the current abbrev table before abbrev lookup happens."
 (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.