unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: 47879@debbugs.gnu.org
Subject: bug#47879: [PATCH] Ignore mode hooks when analysing diffs
Date: Sun, 18 Apr 2021 19:08:01 +0000	[thread overview]
Message-ID: <878s5fpg1a.fsf@posteo.net> (raw)

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


This fixes a bug related to log-edit-generate-changelog-from-diff.

When I tried to invoke this command in a commit buffer, the error

     signal: Unmatched bracket or quote

was raised. The reason was that I added paredit-mode to
emacs-lisp-mode-hook, that when invoked calls check-parens. This raises
an error when the diff contains a partial s-expression, which is almost
always the case.

The least invasive approach I could come up with was to defer the mode
hooks. Most hooks should not have any effect on what
diff-add-log-current-defuns is doing, but I'm not sure if there are any
exceptions that I didn't think of.

-- 
	Philip K.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-Avoid-calling-mode-hook-when-analysing-diff.patch --]
[-- Type: text/x-diff, Size: 1083 bytes --]

From 6ce025a1c61912ee20083271e821878f049ac801 Mon Sep 17 00:00:00 2001
From: Philip K <philipk@posteo.net>
Date: Sun, 18 Apr 2021 20:40:16 +0200
Subject: [PATCH 3/4] Avoid calling mode hook when analysing diff

Author:
---
 lisp/vc/diff-mode.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 2c72c45f4b..0b77ed11bc 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -2334,7 +2334,8 @@ diff-add-log-current-defuns
                         (if other-buf (set-buffer other-buf)
                           (set-buffer (generate-new-buffer " *diff-other-text*"))
                           (insert (if applied old-text new-text))
-                          (funcall (buffer-local-value 'major-mode buf))
+                          (delay-mode-vhooks
+                            (funcall (buffer-local-value 'major-mode buf)))
                           (setq other-buf (current-buffer)))
                         (goto-char (point-min))
                         (forward-line (+ =lines -1
-- 
2.30.2


             reply	other threads:[~2021-04-18 19:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-18 19:08 Philip Kaludercic [this message]
2021-04-18 19:25 ` bug#47879: [PATCH] Ignore mode hooks when analysing diffs Eli Zaretskii
2021-04-18 20:08   ` Philip Kaludercic
2021-04-21 14:12     ` Stefan Kangas
2021-04-21 14:23       ` Eli Zaretskii
2021-04-21 14:36         ` Philip Kaludercic
2021-04-21 14:45           ` Stefan Kangas
2021-04-21 14:52             ` Philip Kaludercic
2021-05-03 10:28               ` Lars Ingebrigtsen
2021-04-18 20:18 ` Philipp Stephani

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878s5fpg1a.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=47879@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).