From: Leo <sdl.web@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 5937@debbugs.gnu.org
Subject: bug#5937: 23.1.95; why saving empty abbrev tables
Date: Mon, 28 Mar 2011 12:45:47 +0800 [thread overview]
Message-ID: <m1ei5r6ef8.fsf@gmail.com> (raw)
In-Reply-To: <jwv1v1sfgfa.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sun, 27 Mar 2011 16:40:10 -0400")
On 2011-03-28 04:40 +0800, Stefan Monnier wrote:
> You mean keep C-c C-c bound to edit-abbrevs-redefine, but change C-x C-s
> to call write-abbrev-file? Sounds good (tho it'll have to call
> edit-abbrevs-redefine before write-abbrev-file beforehand, of course).
> Oh and by the way: the abbrev.el file should be (slowly) fixed to use
> the "abbrev-" prefix for all functions and commands, so whenever you
> introduce a new function/command/variable please use this prefix rather
> than the previous style of <verb>-abbrev-<thing>.
How about this patch?
=== modified file 'lisp/abbrev.el'
--- lisp/abbrev.el 2011-03-22 15:38:40 +0000
+++ lisp/abbrev.el 2011-03-28 04:42:26 +0000
@@ -65,7 +65,8 @@
\f
(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-save-buffer)
+ (define-key map "\C-x\C-w" 'write-abbrev-file)
(define-key map "\C-c\C-c" 'edit-abbrevs-redefine)
map)
"Keymap used in `edit-abbrevs'.")
@@ -211,13 +212,14 @@
;(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 where abbrevs have been saved."
(interactive
(list
(read-file-name "Write abbrev file: "
@@ -225,6 +227,7 @@
abbrev-file-name)))
(or (and file (> (length file) 0))
(setq file abbrev-file-name))
+ (edit-abbrevs-redefine)
(let ((coding-system-for-write 'utf-8))
(with-temp-buffer
(dolist (table
@@ -247,7 +250,14 @@
'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-save-buffer ()
+ "Save all user-level abbrev definitions in current buffer.
+The file name to use is `abbrev-file-name'."
+ (interactive)
+ (write-abbrev-file abbrev-file-name t))
+
\f
(defun add-mode-abbrev (arg)
"Define mode-specific abbrev for last word(s) before point.
next prev parent reply other threads:[~2011-03-28 4:45 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m1ei5r6ef8.fsf@gmail.com \
--to=sdl.web@gmail.com \
--cc=5937@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.