all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Small enhancement for add-log.el
@ 2004-10-07 22:06 Kim F. Storm
  2004-10-07 22:21 ` David Kastrup
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Kim F. Storm @ 2004-10-07 22:06 UTC (permalink / raw)



When I look through ChangeLog files, I often type `q' to quit --
but instead a q is inserted into the buffer.

What about the following change [I know it's a hack] which kills the
buffer if you type `q' in an unmodified ChangeLog buffer.

It should be pretty safe, as the buffer is modified after C-x 4 a
and similar commands.


Index: lisp/add-log.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/add-log.el,v
retrieving revision 1.151
diff -u -r1.151 add-log.el
--- lisp/add-log.el	25 Jun 2004 14:45:00 -0000	1.151
+++ lisp/add-log.el	7 Oct 2004 22:01:34 -0000
@@ -256,6 +256,7 @@
   (let ((map (make-sparse-keymap)))
     (define-key map [?\C-c ?\C-p] 'add-log-edit-prev-comment)
     (define-key map [?\C-c ?\C-n] 'add-log-edit-next-comment)
+    (define-key map "q" 'add-log-edit-quit-if-unmod)
     map)
   "Keymap for Change Log major mode.")
 
@@ -322,6 +323,13 @@
   (interactive "*p")
   (add-log-edit-prev-comment (- arg)))
 
+(defun add-log-edit-quit-if-unmod (&optional arg)
+  "Quit change log buffer if never modified."
+  (interactive "p")
+  (if (buffer-modified-p)
+      (insert-char (aref (this-single-command-keys) 0) arg)
+    (kill-buffer nil)))
+
 ;;;###autoload
 (defun prompt-for-change-log-name ()
   "Prompt for a change log name."

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

end of thread, other threads:[~2004-10-12 14:40 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-07 22:06 Small enhancement for add-log.el Kim F. Storm
2004-10-07 22:21 ` David Kastrup
2004-10-07 23:00   ` Kim F. Storm
2004-10-08 12:25     ` Kai Grossjohann
2004-10-07 23:07 ` Luc Teirlinck
2004-10-08  8:54   ` Kim F. Storm
2004-10-08 13:01     ` Luc Teirlinck
2004-10-08 13:44       ` Kim F. Storm
2004-10-08 22:45         ` Luc Teirlinck
2004-10-11 22:23       ` Kim F. Storm
2004-10-12 14:28         ` Juri Linkov
2004-10-12 14:40         ` Stefan Monnier
2004-10-08 13:19     ` Stefan
2004-10-08 13:54       ` Kim F. Storm
2004-10-09 15:44 ` Richard Stallman

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.