all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Aaron S. Hawley" <aaron.s.hawley@gmail.com>
To: 7284@debbugs.gnu.org
Subject: bug#7284: [PATCH] `find-change-log' fails in *derived* Diff modes
Date: Tue, 26 Oct 2010 15:47:43 -0400	[thread overview]
Message-ID: <AANLkTi=Fa51CJ2sJGTVabqXQhtym5Wt1KzPyWh34A0N1@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1098 bytes --]

Running `C-x 4 a' (add-change-log-entry-other-window) in a derived mode
of Diff mode (psvn-diff-mode, magit-diff-mode, and so on) does not open
the correct ChangeLog file.  The following patch fixes the problem.

--- lisp/vc/add-log.el~	2010-09-21 14:11:28.216630100 -0400
+++ lisp/vc/add-log.el	2010-10-25 16:46:49.808297800 -0400
@@ -701,7 +701,7 @@
 Optional arg BUFFER-FILE overrides `buffer-file-name'."
   ;; If we are called from a diff, first switch to the source buffer;
   ;; in order to respect buffer-local settings of change-log-default-name, etc.
-  (with-current-buffer (let ((buff (if (eq major-mode 'diff-mode)
+  (with-current-buffer (let ((buff (if (derived-mode-p 'diff-mode)
 				       (car (ignore-errors
 					     (diff-find-source-location))))))
 			 (if (buffer-live-p buff) buff



Perhaps, more of the cases of Emacs's Lisp that have (eq major-mode ...)
should be converted to (derived-mode-p ...).  Obviously, they'll need
to be studied on a case-by-case basis since there might be cases when
only the exact major-mode is intended to be matched.

Thanks for Emacs,
/a

[-- Attachment #2: add-log_derived-diff-mode.patch --]
[-- Type: application/octet-stream, Size: 593 bytes --]

--- lisp/vc/add-log.el	2010-09-21 14:11:28.216630100 -0400
+++ lisp/vc/add-log.el	2010-10-25 16:46:49.808297800 -0400
@@ -701,7 +701,7 @@
 Optional arg BUFFER-FILE overrides `buffer-file-name'."
   ;; If we are called from a diff, first switch to the source buffer;
   ;; in order to respect buffer-local settings of change-log-default-name, etc.
-  (with-current-buffer (let ((buff (if (eq major-mode 'diff-mode)
+  (with-current-buffer (let ((buff (if (derived-mode-p 'diff-mode)
 				       (car (ignore-errors
 					     (diff-find-source-location))))))
 			 (if (buffer-live-p buff) buff

             reply	other threads:[~2010-10-26 19:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-26 19:47 Aaron S. Hawley [this message]
2010-10-26 21:35 ` bug#7284: [PATCH] `find-change-log' fails in *derived* Diff modes Stefan Monnier
2010-10-27 21:38 ` Stefan Monnier

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='AANLkTi=Fa51CJ2sJGTVabqXQhtym5Wt1KzPyWh34A0N1@mail.gmail.com' \
    --to=aaron.s.hawley@gmail.com \
    --cc=7284@debbugs.gnu.org \
    /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.