[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Small enhancement for add-log.el
From: |
Kim F. Storm |
Subject: |
Small enhancement for add-log.el |
Date: |
Fri, 08 Oct 2004 00:06:18 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) |
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 <address@hidden> http://www.cua.dk
- Small enhancement for add-log.el,
Kim F. Storm <=