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, 29 Mar 2011 23:42:36 +0800 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 1301415114 15263 80.91.229.12 (29 Mar 2011 16:11:54 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 29 Mar 2011 16:11:54 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 29 18:11:48 2011 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 1Q4bWG-0007f4-Dc for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Mar 2011 18:11:48 +0200 Original-Received: from localhost ([127.0.0.1]:45075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4bWF-0000Id-OP for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Mar 2011 12:11:47 -0400 Original-Received: from [140.186.70.92] (port=57199 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4bUL-0007eh-Ve for bug-gnu-emacs@gnu.org; Tue, 29 Mar 2011 12:09:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4bRm-00039o-DR for bug-gnu-emacs@gnu.org; Tue, 29 Mar 2011 12:07:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58242) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4bRm-00039i-8V for bug-gnu-emacs@gnu.org; Tue, 29 Mar 2011 12:07:10 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Q4b5O-00021d-7Z; Tue, 29 Mar 2011 11:44: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: Tue, 29 Mar 2011 15:44: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.13014133887716 (code B ref -1); Tue, 29 Mar 2011 15:44:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Mar 2011 15:43:08 +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 1Q4b4V-00020P-OH for submit@debbugs.gnu.org; Tue, 29 Mar 2011 11:43:08 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q4b4T-0001zv-3M for submit@debbugs.gnu.org; Tue, 29 Mar 2011 11:43:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4b4N-0007p2-74 for submit@debbugs.gnu.org; Tue, 29 Mar 2011 11:43:00 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:58111) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4b4N-0007oy-43 for submit@debbugs.gnu.org; Tue, 29 Mar 2011 11:42:59 -0400 Original-Received: from [140.186.70.92] (port=40529 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4b4L-0007RX-S8 for bug-gnu-emacs@gnu.org; Tue, 29 Mar 2011 11:42:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4b4K-0007od-Ax for bug-gnu-emacs@gnu.org; Tue, 29 Mar 2011 11:42:57 -0400 Original-Received: from mail-iw0-f169.google.com ([209.85.214.169]:50940) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4b4K-0007oZ-7y for bug-gnu-emacs@gnu.org; Tue, 29 Mar 2011 11:42:56 -0400 Original-Received: by iwg8 with SMTP id 8so399756iwg.0 for ; Tue, 29 Mar 2011 08:42:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=6vll5OMlhtMmMaeFQ7QdBcbcCT7BSBZRDTnuQbUDQQs=; b=dNIBkYJdyntc7hixKKBX9ZJhB2g3ukHUMJNnFh21CsRgMkTmxbixIVDehv31dCEwkn kldcyFwvGetYC9yAjTqOTH6jkKJnu43qf378eOQ6jwF4mxfysGDP8AA0Q+6v5vzcBXpI S8BJkk8aa+WtjJKMzaFVi0sgE8+Oz3p7P6QFw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; b=FyhRjR2q+3DoEvWY4PTQ9xCmh1H5D9c8j/+zW3TwtGNYhMkEZrE8WV9wxUhpCizfyX 2XQNobF72ROw7cLQfLlfq2WEJ9H9fhueK8GxxiO74Z7yKOnE/l8vqfQwlq1c1NnaOW3/ tSy2laTv2Yu4N4DzW8DZj7Baxq1YwUncINzuc= Original-Received: by 10.42.74.194 with SMTP id x2mr9581785icj.113.1301413375015; Tue, 29 Mar 2011 08:42:55 -0700 (PDT) Original-Received: from Victoria.local (th041102.ip.tsinghua.edu.cn [59.66.41.102]) by mx.google.com with ESMTPS id u9sm3729886ibe.36.2011.03.29.08.42.43 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 29 Mar 2011 08:42:53 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Tue, 29 Mar 2011 09:49:15 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3.50 (Mac OS X 10.6.7) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 29 Mar 2011 11:44:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 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:45475 Archived-At: Hopefully this patch is ready to commit. diff --git a/lisp/abbrev.el b/lisp/abbrev.el index 0a3e1fd1..fbc4bdbd 100644 --- a/lisp/abbrev.el +++ b/lisp/abbrev.el @@ -73,7 +73,8 @@ (put 'abbrev-mode 'safe-local-variable 'booleanp) (defvar edit-abbrevs-map (let ((map (make-sparse-keymap))) - (define-key map "\C-x\C-s" 'edit-abbrevs-redefine) + (define-key map "\C-x\C-s" 'abbrev-edit-save-buffer) + (define-key map "\C-x\C-w" 'abbrev-edit-save-to-file) (define-key map "\C-c\C-c" 'edit-abbrevs-redefine) map) "Keymap used in `edit-abbrevs'.") @@ -224,13 +225,15 @@ (defun quietly-read-abbrev-file (&optional file) ;(interactive "fRead abbrev file: ") (read-abbrev-file file t)) -(defun write-abbrev-file (&optional file) +(defun write-abbrev-file (&optional file verbose) "Write all user-level abbrev definitions to a file of Lisp code. This does not include system abbrevs; it includes only the abbrev tables listed in listed in `abbrev-table-name-list'. The file written can be loaded in another session to define the same abbrevs. The argument FILE is the file name to write. If omitted or nil, the file -specified in `abbrev-file-name' is used." +specified in `abbrev-file-name' is used. +If VERBOSE is non-nil, display a message indicating where abbrevs +have been saved." (interactive (list (read-file-name "Write abbrev file: " @@ -260,7 +263,25 @@ (defun write-abbrev-file (&optional file) 'emacs-mule))) (goto-char (point-min)) (insert (format ";;-*-coding: %s;-*-\n" coding-system-for-write)) - (write-region nil nil file nil 0)))) + (write-region nil nil file nil (and (not verbose) 0))))) + +(defun abbrev-edit-save-to-file (file) + "Save all user-level abbrev definitions in current buffer to FILE." + (interactive + (list (read-file-name "Save abbrevs to file: " + (file-name-directory + (expand-file-name abbrev-file-name)) + abbrev-file-name))) + (edit-abbrevs-redefine) + (write-abbrev-file file t)) + +(defun abbrev-edit-save-buffer () + "Save all user-level abbrev definitions in current buffer. +The saved abbrevs are written to the file specified by +`abbrev-file-name'." + (interactive) + (abbrev-edit-save-to-file abbrev-file-name)) + (defun add-mode-abbrev (arg) "Define mode-specific abbrev for last word(s) before point.