From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.bugs Subject: bug#5937: 23.1.95; why saving empty abbrev tables Date: Mon, 12 Apr 2010 16:23:44 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1271086149 30817 80.91.229.12 (12 Apr 2010 15:29:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 12 Apr 2010 15:29:09 +0000 (UTC) To: 5937@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Apr 12 17:29:07 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O1LZS-00087K-Nm for geb-bug-gnu-emacs@m.gmane.org; Mon, 12 Apr 2010 17:29:07 +0200 Original-Received: from localhost ([127.0.0.1]:55041 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O1LZQ-0004YU-LN for geb-bug-gnu-emacs@m.gmane.org; Mon, 12 Apr 2010 11:29:04 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O1LZK-0004YH-RW for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2010 11:28:58 -0400 Original-Received: from [140.186.70.92] (port=35614 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O1LZF-0004XO-2J for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2010 11:28:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O1LZB-0007vm-Is for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2010 11:28:51 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39628) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O1LZB-0007vh-ED for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2010 11:28:49 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1O1LUY-0007hc-9k; Mon, 12 Apr 2010 11:24:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Leo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Apr 2010 15:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 5937 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.127108583529600 (code B ref -1); Mon, 12 Apr 2010 15:24:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Apr 2010 15:23:55 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O1LUR-0007hN-Jk for submit@debbugs.gnu.org; Mon, 12 Apr 2010 11:23:55 -0400 Original-Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O1LUQ-0007hH-3L for submit@debbugs.gnu.org; Mon, 12 Apr 2010 11:23:54 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:52988) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1O1LUL-00065b-6R for submit@debbugs.gnu.org; Mon, 12 Apr 2010 11:23:49 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O1LUK-0000dm-JP for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2010 11:23:48 -0400 Original-Received: from [140.186.70.92] (port=44136 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O1LUJ-0000dR-6G for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2010 11:23:48 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O1LUF-0006qM-MW for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2010 11:23:46 -0400 Original-Received: from ppsw-31.csi.cam.ac.uk ([131.111.8.131]:36133 helo=ppsw-1.csi.cam.ac.uk) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O1LUF-0006qF-Hv for bug-gnu-emacs@gnu.org; Mon, 12 Apr 2010 11:23:43 -0400 X-Cam-AntiVirus: no malware found X-Cam-SpamDetails: not scanned X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Original-Received: from wlan-gw.st-edmunds.cam.ac.uk ([131.111.223.101]:52065 helo=Victoria.local) by ppsw-1.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.151]:587) with esmtpsa (PLAIN:sl392) (TLSv1:DHE-RSA-AES128-SHA:128) id 1O1LUF-0001X7-3a (Exim 4.70) for bug-gnu-emacs@gnu.org (return-path ); Mon, 12 Apr 2010 16:23:43 +0100 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 12 Apr 2010 11:24:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:36206 Archived-At: 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)))))