unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#5937: 23.1.95; why saving empty abbrev tables
@ 2010-04-12 15:23 Leo
  2010-04-12 18:32 ` Stefan Monnier
  0 siblings, 1 reply; 29+ messages in thread
From: Leo @ 2010-04-12 15:23 UTC (permalink / raw)
  To: 5937

Why empty abbrev tables are saved to file? It seems to make it more
difficult for editing (edit-abbrevs) because the buffer is full of empty
abbrev. I wonder if saving only non-empty tables is better and user
friendlier. For example, any harm of doing something like this:

(defun abbrev-table-empty-p (table)
  "Return nil if there are no abbrev symbols in abbrev table object TABLE."
  (unless (abbrev-table-p table)
    (error "Non abbrev table object"))
  (not (catch 'some
         (mapatoms (lambda (sym)
                     (when (abbrev-symbol (symbol-name sym) table)
                       (throw 'some t)))
                   table))))
(defadvice write-abbrev-file (around nonempty-abbrev-tables activate)
  "Ignore empty abbrev tables when writing to FILE."
  (let ((file (ad-get-arg 0))
        (coding-system-for-write 'emacs-mule)
        (tables (loop for table in abbrev-table-name-list
                      unless (abbrev-table-empty-p (symbol-value table))
                      collect table)))
    (or (and file (> (length file) 0)) (setq file abbrev-file-name))
    (with-temp-file file
      (insert ";;-*-coding: emacs-mule;-*-\n")
      (dolist (table (sort tables
                           (lambda (s1 s2)
                             (string< (symbol-name s1)
                                      (symbol-name s2)))))
        (insert-abbrev-table-description table nil)))))







^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2011-03-30  1:08 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-12 15:23 bug#5937: 23.1.95; why saving empty abbrev tables Leo
2010-04-12 18:32 ` Stefan Monnier
2010-04-15 10:26   ` Leo
2010-04-15 12:44     ` Stefan Monnier
2010-04-16 10:36   ` Leo
2010-04-27  3:49     ` Stefan Monnier
2010-04-27  8:46       ` Leo
2010-04-27 10:12         ` Leo
2010-04-27 10:32         ` Leo
2011-03-27 20:40           ` Stefan Monnier
2011-03-28  4:45             ` Leo
2011-03-28 13:58               ` Stefan Monnier
2011-03-28 14:26                 ` Leo
2011-03-28 15:09                   ` Stefan Monnier
2011-03-29  0:35                     ` Leo
2011-03-29  3:31                       ` Stefan Monnier
2011-03-29  4:41                         ` Leo
2011-03-29  5:16                           ` Leo
2011-03-29 13:49                             ` Stefan Monnier
2011-03-29 15:42                               ` Leo
2011-03-29 20:54                                 ` Stefan Monnier
2011-03-30  1:08                                   ` Leo
2011-03-27  5:09       ` Leo
2011-03-27 17:34         ` Andreas Röhler
2011-03-28  3:38           ` Leo
2011-03-27 20:35         ` Stefan Monnier
2011-03-28  4:03           ` Leo
2011-03-28 14:02             ` Stefan Monnier
2011-03-28 14:40               ` Leo

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).