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: Tue, 27 Apr 2010 11:12:49 +0100 Organization: University of Cambridge Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1272364053 16325 80.91.229.12 (27 Apr 2010 10:27:33 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 27 Apr 2010 10:27:33 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 27 12:27:32 2010 connect(): No such file or directory 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 1O6i0o-0001cS-GV for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Apr 2010 12:27:31 +0200 Original-Received: from localhost ([127.0.0.1]:38786 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O6i0n-00013h-Ko for geb-bug-gnu-emacs@m.gmane.org; Tue, 27 Apr 2010 06:27:29 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O6hz7-0000f6-Lf for bug-gnu-emacs@gnu.org; Tue, 27 Apr 2010 06:25:45 -0400 Original-Received: from [140.186.70.92] (port=54088 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O6hz4-0000dh-7L for bug-gnu-emacs@gnu.org; Tue, 27 Apr 2010 06:25:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O6hyz-0004y3-8R for bug-gnu-emacs@gnu.org; Tue, 27 Apr 2010 06:25:41 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57408) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O6hyz-0004xy-5L for bug-gnu-emacs@gnu.org; Tue, 27 Apr 2010 06:25:37 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1O6hnm-0001HO-C9; Tue, 27 Apr 2010 06:14:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: 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: Tue, 27 Apr 2010 10:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 5937 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by submit@debbugs.gnu.org id=B.12723631954906 (code B ref -1); Tue, 27 Apr 2010 10:14:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Apr 2010 10:13:15 +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 1O6hn0-0001H5-F4 for submit@debbugs.gnu.org; Tue, 27 Apr 2010 06:13:14 -0400 Original-Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O6hmy-0001Gz-4M for submit@debbugs.gnu.org; Tue, 27 Apr 2010 06:13:13 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:55833) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1O6hmv-00017P-Gd for submit@debbugs.gnu.org; Tue, 27 Apr 2010 06:13:09 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O6hmu-0005LV-MA for bug-gnu-emacs@gnu.org; Tue, 27 Apr 2010 06:13:08 -0400 Original-Received: from [140.186.70.92] (port=46742 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O6hmo-0005H2-Ag for bug-gnu-emacs@gnu.org; Tue, 27 Apr 2010 06:13:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O6hmm-00039J-CM for bug-gnu-emacs@gnu.org; Tue, 27 Apr 2010 06:13:01 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:44493) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O6hmm-000396-13 for bug-gnu-emacs@gnu.org; Tue, 27 Apr 2010 06:13:00 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1O6hmj-0004V8-QM for bug-gnu-emacs@gnu.org; Tue, 27 Apr 2010 12:12:57 +0200 Original-Received: from smaug.linux.pwf.cam.ac.uk ([193.60.95.72]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 27 Apr 2010 12:12:57 +0200 Original-Received: from sdl.web by smaug.linux.pwf.cam.ac.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 27 Apr 2010 12:12:57 +0200 X-Injected-Via-Gmane: http://gmane.org/ connect(): No such file or directory Original-Lines: 49 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: smaug.linux.pwf.cam.ac.uk User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:f+53V9UL5NOnx92/VALFKb5uNHU= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: Tue, 27 Apr 2010 06:14: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:36553 Archived-At: On 2010-04-27 09:46 +0100, Leo wrote: > Do you think we can address this issue in another way for example by > offering a key biding to enter an empty table? For example, make M-RET > move point to the end of current abbrev table and asking for a table > name (with completion)? (this is similar to M-RET in org mode) The attached patch does this. Could you try and see if you like it? diff --git a/lisp/abbrev.el b/lisp/abbrev.el index 21411a5..c27f29a 100644 --- a/lisp/abbrev.el +++ b/lisp/abbrev.el @@ -73,8 +73,9 @@ to enable or disable Abbrev mode in the current buffer." (defvar edit-abbrevs-map (let ((map (make-sparse-keymap))) - (define-key map "\C-x\C-s" 'edit-abbrevs-redefine) - (define-key map "\C-c\C-c" 'edit-abbrevs-redefine) + (define-key map "\C-x\C-s" 'edit-abbrevs-redefine) + (define-key map "\C-c\C-c" 'edit-abbrevs-redefine) + (define-key map [(meta return)] 'edit-abbrevs-new-table-entry) map) "Keymap used in `edit-abbrevs'.") @@ -175,6 +176,24 @@ or may be omitted (it is usually omitted)." (define-abbrevs t) (set-buffer-modified-p nil))) +(defun edit-abbrevs-new-table-entry (tablename) + "Enter a new table entry for TABLENAME into current buffer." + (interactive + (list (intern-soft + (completing-read "Table name: " + (mapcar 'symbol-name abbrev-table-name-list) + (lambda (tn) + (abbrev-table-empty-p + (symbol-value (intern-soft tn)))) + t)))) + (or (looking-at "^(.*)$") + (and (re-search-forward "^(.*)$" nil t) + (goto-char (match-beginning 0))) + (goto-char (point-max))) + (unless (bolp) (insert "\n")) + (insert-abbrev-table-description tablename t) + (forward-line -2)) + (defun define-abbrevs (&optional arg) "Define abbrevs according to current visible buffer contents. See documentation of `edit-abbrevs' for info on the format of the