all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#7284: [PATCH] `find-change-log' fails in *derived* Diff modes
@ 2010-10-26 19:47 Aaron S. Hawley
  2010-10-26 21:35 ` Stefan Monnier
  2010-10-27 21:38 ` Stefan Monnier
  0 siblings, 2 replies; 3+ messages in thread
From: Aaron S. Hawley @ 2010-10-26 19:47 UTC (permalink / raw
  To: 7284

[-- 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

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

* bug#7284: [PATCH] `find-change-log' fails in *derived* Diff modes
  2010-10-26 19:47 bug#7284: [PATCH] `find-change-log' fails in *derived* Diff modes Aaron S. Hawley
@ 2010-10-26 21:35 ` Stefan Monnier
  2010-10-27 21:38 ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2010-10-26 21:35 UTC (permalink / raw
  To: Aaron S. Hawley; +Cc: 7284

> -  (with-current-buffer (let ((buff (if (eq major-mode 'diff-mode)
> +  (with-current-buffer (let ((buff (if (derived-mode-p 'diff-mode)

Thanks.

> Perhaps, more of the cases of Emacs's Lisp that have (eq major-mode ...)
> should be converted to (derived-mode-p ...).

Indeed.

> 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.

These are exceedingly rare.  At least, I can't remember las time I came
across one of those.


        Stefan





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

* bug#7284: [PATCH] `find-change-log' fails in *derived* Diff modes
  2010-10-26 19:47 bug#7284: [PATCH] `find-change-log' fails in *derived* Diff modes Aaron S. Hawley
  2010-10-26 21:35 ` Stefan Monnier
@ 2010-10-27 21:38 ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2010-10-27 21:38 UTC (permalink / raw
  To: Aaron S. Hawley

> -  (with-current-buffer (let ((buff (if (eq major-mode 'diff-mode)
> +  (with-current-buffer (let ((buff (if (derived-mode-p 'diff-mode)

Installed in the emacs-23 branch, thank you,


        Stefan





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

end of thread, other threads:[~2010-10-27 21:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-26 19:47 bug#7284: [PATCH] `find-change-log' fails in *derived* Diff modes Aaron S. Hawley
2010-10-26 21:35 ` Stefan Monnier
2010-10-27 21:38 ` Stefan Monnier

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.