From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#47879: [PATCH] Ignore mode hooks when analysing diffs Date: Sun, 18 Apr 2021 19:08:01 +0000 Message-ID: <878s5fpg1a.fsf@posteo.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14797"; mail-complaints-to="usenet@ciao.gmane.io" To: 47879@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 18 21:09:55 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lYCnr-0003jX-8o for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Apr 2021 21:09:55 +0200 Original-Received: from localhost ([::1]:44886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lYCnq-0003DH-Bw for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Apr 2021 15:09:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36000) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYCn1-0002jR-3l for bug-gnu-emacs@gnu.org; Sun, 18 Apr 2021 15:09:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36292) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lYCn0-0008So-S8 for bug-gnu-emacs@gnu.org; Sun, 18 Apr 2021 15:09:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lYCn0-0000un-LH for bug-gnu-emacs@gnu.org; Sun, 18 Apr 2021 15:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Apr 2021 19:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 47879 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16187728893448 (code B ref -1); Sun, 18 Apr 2021 19:09:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Apr 2021 19:08:09 +0000 Original-Received: from localhost ([127.0.0.1]:47838 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYCm9-0000tY-FQ for submit@debbugs.gnu.org; Sun, 18 Apr 2021 15:08:09 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:44060) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lYCm8-0000tR-SP for submit@debbugs.gnu.org; Sun, 18 Apr 2021 15:08:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35850) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYCm8-00029m-Nr for bug-gnu-emacs@gnu.org; Sun, 18 Apr 2021 15:08:08 -0400 Original-Received: from mout02.posteo.de ([185.67.36.66]:55989) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lYCm7-0007u4-0N for bug-gnu-emacs@gnu.org; Sun, 18 Apr 2021 15:08:08 -0400 Original-Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 8A14B2400FC for ; Sun, 18 Apr 2021 21:08:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1618772884; bh=3Rlwx0i7DsBNGEAR3PF/gQSN+Mn0ovl1m6qbvXmJMeI=; h=From:To:Subject:Date:From; b=Eg4XM59E3m4lbZ4SEfqPy+aroTYhQZnSeRTLUts2rLEw3H1LsM/fiXAPnyvVlCAOR CVhrTkLryNfnDRuBNJbEKiYpIMofvrwsd8y694Zf5XCqrnWC6m8z4fEOzVVWCfO7gA LEAxeYmyhHLHsaYVVSkmnupm+hFtNiu6lScgKEnRNWafKkYD2RjOreQ7pYJOAII0rM /O8aDKxpc+tKygChXwXq0mu76NoioAtTXo/Gl5aeFH5APzKvXQha8zSJ/vP6tifFbS JZhdcM6J4L3x2oKGVCBZosekqOMe9rgyjhzG0rwvKrzDuCaSXgF/Y/NHgh1vIdO4St UiLjvAy55KJlQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4FNfbl6NJGz9rxg for ; Sun, 18 Apr 2021 21:08:03 +0200 (CEST) Received-SPF: pass client-ip=185.67.36.66; envelope-from=philipk@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_FMBLA_NEWDOM=1.499, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:204397 Archived-At: --=-=-= Content-Type: text/plain 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0003-Avoid-calling-mode-hook-when-analysing-diff.patch >From 6ce025a1c61912ee20083271e821878f049ac801 Mon Sep 17 00:00:00 2001 From: Philip K 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 --=-=-=--