From unknown Sun Jun 22 07:56:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#37856: 27.0.50; 'next-error' advised with 'recenter' signals error when run from "*grep*" buffer Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Oct 2019 18:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 37856 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 37856@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15716831466874 (code B ref -1); Mon, 21 Oct 2019 18:40:02 +0000 Received: (at submit) by debbugs.gnu.org; 21 Oct 2019 18:39:06 +0000 Received: from localhost ([127.0.0.1]:57826 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMca9-0001mo-Ps for submit@debbugs.gnu.org; Mon, 21 Oct 2019 14:39:06 -0400 Received: from lists.gnu.org ([209.51.188.17]:46888) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMca7-0001mc-Fu for submit@debbugs.gnu.org; Mon, 21 Oct 2019 14:39:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54957) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMca6-0004iq-6Y for bug-gnu-emacs@gnu.org; Mon, 21 Oct 2019 14:39:03 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMca4-00070J-SH for bug-gnu-emacs@gnu.org; Mon, 21 Oct 2019 14:39:01 -0400 Received: from mail-pf1-f169.google.com ([209.85.210.169]:33778) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMca4-0006zV-NE for bug-gnu-emacs@gnu.org; Mon, 21 Oct 2019 14:39:00 -0400 Received: by mail-pf1-f169.google.com with SMTP id q10so8978793pfl.0 for ; Mon, 21 Oct 2019 11:38:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=cju5zD5fcjOCm/rF9AMi9ImBg28HRa4EnOyPrnfd4eU=; b=Q4flMABbouhg5HqBHyYJ1F/7/ZPfU3Ub21IpH7F0kpKMTWwKmIxxfDRVUQHmc/HbDs TGrsB39p+oYhA4c1Ys8GA2s4taL1HHcVb890rdIvvqBQ6bHITLgVRTOLHaOLPSbkTm/E UYTwybkA7TaQLmtesL7oQh1ksgQ7oEXmA3ZHyUnC4gSeL29GuYB4OFbH5tq86G9ZpZjd 4rj0xC0967MSed7vlYFGP3BYDu2G4c2fz0ZB4EdqZmtlPcqlGyQD3goM6v6NkOGApwe1 MNuMYKGtExeRDza365YtY9WUkTRG9HJiqpSKWLLIW4VrEXq+XuwqyxAouvwjgvWVeJDq WWXw== X-Gm-Message-State: APjAAAWeUorUcbOiu4yXvK7YBwiAOmBDgtUeqhbhn60ZROsEviXMe95B 8NAqDFy+mZUG5bsx/hT4jmUfpy5Rp8LGPMsh+B3RicdW X-Google-Smtp-Source: APXvYqwxBF+hdYSxjkf6uAqbVwqCc+OANSlYgD7ZvYVh/seUOJLDt9HZVJeB4etFhgXFKKzDE+t/TineNpIJ4I+Jg1A= X-Received: by 2002:a17:90a:f491:: with SMTP id bx17mr31262818pjb.106.1571683138145; Mon, 21 Oct 2019 11:38:58 -0700 (PDT) MIME-Version: 1.0 From: Stefan Kangas Date: Mon, 21 Oct 2019 20:38:47 +0200 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.210.169 X-Spam-Score: 1.1 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: I get an error when advising 'next-error' with 'recenter'. Steps to reproduce: 1. Under "emacs -Q", evaluate: (defun my-advice (&rest args) (recenter)) (advice-add 'next-error :after #'my-advice) 2. M-x rgrep RET [... grep for something] 3. Run 'next-error' ( [...] Content analysis details: (1.1 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: gnu.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stefankangas[at]gmail.com) 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [209.51.188.17 listed in list.dnswl.org] 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different 2.0 SPOOFED_FREEMAIL No description available. X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) I get an error when advising 'next-error' with 'recenter'. Steps to reproduce: 1. Under "emacs -Q", evaluate: (defun my-advice (&rest args) (recenter)) (advice-add 'next-error :after #'my-advice) 2. M-x rgrep RET [... grep for something] 3. Run 'next-error' (M-g M-n) from the "*grep*" buffer. Result: I get the error: recenter-top-bottom: =E2=80=98recenter=E2=80=99ing a window that does n= ot display current-buffer. (I also get the error when I run it in the second window when 'next-error' would take you to a different file.) Expected result: I get no error. --- Backtrace: Debugger entered--Lisp error: (error "=E2=80=98recenter=E2=80=99ing a windo= w that does not display curre...") recenter() my-advice(nil) apply(my-advice nil) next-error(nil) funcall-interactively(next-error nil) #(next-error nil nil) apply(# next-error (nil nil)) call-interactively@ido-cr+-record-current-command(# next-error nil nil) apply(call-interactively@ido-cr+-record-current-command # (next-error nil nil)) call-interactively(next-error nil nil) command-execute(next-error) --- This seems to be due to this code in window.c: /* For reasons why we signal an error here, see https://lists.gnu.org/r/emacs-devel/2014-06/msg00053.html, https://lists.gnu.org/r/emacs-devel/2014-06/msg00094.html. */ if (buf !=3D current_buffer) error ("`recenter'ing a window that does not display current-buffer."); This code was added here: 3da983f8c4 2014-06-06 Stefan Monnier * src/window.c (Frecenter): Signal an error if window-buffer is not current-buffer. --- In GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin17.7.0, NS appkit-1561.61 Version 10.13.6 (Build 17G8037)) of 2019-10-21 built on Stefans-MBP Repository revision: 0e6f4628d8fff53505e4399e71da9f531a64fff7 Repository branch: master Windowing system distributor 'Apple', version 10.3.1561 System Description: Mac OS X 10.13.6 From unknown Sun Jun 22 07:56:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#37856: 27.0.50; 'next-error' advised with 'recenter' signals error when run from "*grep*" buffer Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Oct 2019 19:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37856 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Kangas Cc: 37856@debbugs.gnu.org Received: via spool by 37856-submit@debbugs.gnu.org id=B37856.157168625612077 (code B ref 37856); Mon, 21 Oct 2019 19:31:02 +0000 Received: (at 37856) by debbugs.gnu.org; 21 Oct 2019 19:30:56 +0000 Received: from localhost ([127.0.0.1]:57855 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMdOK-00038i-Fw for submit@debbugs.gnu.org; Mon, 21 Oct 2019 15:30:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52613) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMdOJ-00038V-1W for 37856@debbugs.gnu.org; Mon, 21 Oct 2019 15:30:55 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:43984) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iMdOD-0004v9-JQ; Mon, 21 Oct 2019 15:30:49 -0400 Received: from [176.228.60.248] (port=3995 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iMdOC-0000sJ-Q4; Mon, 21 Oct 2019 15:30:49 -0400 Date: Mon, 21 Oct 2019 22:30:42 +0300 Message-Id: <83lftd28wt.fsf@gnu.org> From: Eli Zaretskii In-reply-to: (message from Stefan Kangas on Mon, 21 Oct 2019 20:38:47 +0200) References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Kangas > Date: Mon, 21 Oct 2019 20:38:47 +0200 > > 1. Under "emacs -Q", evaluate: > (defun my-advice (&rest args) > (recenter)) > (advice-add 'next-error :after #'my-advice) > 2. M-x rgrep RET [... grep for something] > 3. Run 'next-error' (M-g M-n) from the "*grep*" buffer. > > Result: I get the error: > recenter-top-bottom: ‘recenter’ing a window that does not display > current-buffer. Why isn't this a cockpit error: you force a function that happens to switch buffers to recenter. It's like you've added a call to 'recenter' in some arbitrary place in a random function: you are responsible for that code, and if it does stuff that it shouldn't, your code is wrong. No? > This seems to be due to this code in window.c: > > /* For reasons why we signal an error here, see > https://lists.gnu.org/r/emacs-devel/2014-06/msg00053.html, > https://lists.gnu.org/r/emacs-devel/2014-06/msg00094.html. */ > if (buf != current_buffer) > error ("`recenter'ing a window that does not display current-buffer."); Yes, and that's on purpose, see the cited discussion. From unknown Sun Jun 22 07:56:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#37856: 27.0.50; 'next-error' advised with 'recenter' signals error when run from "*grep*" buffer Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Oct 2019 20:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37856 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 37856@debbugs.gnu.org Received: via spool by 37856-submit@debbugs.gnu.org id=B37856.157168872923777 (code B ref 37856); Mon, 21 Oct 2019 20:13:02 +0000 Received: (at 37856) by debbugs.gnu.org; 21 Oct 2019 20:12:09 +0000 Received: from localhost ([127.0.0.1]:57890 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMe2D-0006BR-Ab for submit@debbugs.gnu.org; Mon, 21 Oct 2019 16:12:09 -0400 Received: from mail-pf1-f181.google.com ([209.85.210.181]:44041) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMe2B-0006BA-Pt for 37856@debbugs.gnu.org; Mon, 21 Oct 2019 16:12:08 -0400 Received: by mail-pf1-f181.google.com with SMTP id q21so9085337pfn.11 for <37856@debbugs.gnu.org>; Mon, 21 Oct 2019 13:12:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Ga9kQdfgj0vOMf16qgrZwjRgNs5ZRBJNPjb3zxJQ5/Y=; b=VfTCgjfeLU2QdSLdeGyKh+Yc7bJ0aZHUXuwJ6Z5LrsDx226F3pudOFCAj4GXy5/GSp PEKF98C6gvxq05ZJTiYehKd0ov43F4GtncReuVLDowGvb6EvNnXGYqPnhbaSkx0/IjZh Qtenzdpxtfn7vAViQ0Smd27+sWDE8P1hHKs5tFGoBLEp+xWd4zeshNkAVTkDCHhrWpPa rCGlMZVNhzVjwUA8moEAA8Zs1Z4ABydFHWI5gs1+nXFTzTPl8xTlUcUB8ph8YIjRlUtb oapYkaQBldzC379NGI72lwfMUGgeMUa55sQP8TuNlAGQcbzIsONAYuAwYc0q9mxIO6CP UlUA== X-Gm-Message-State: APjAAAX4vXM5V2+jIAgaDa/jQcQjWHGgh/bhMNWXuRCpcibhyiW2e4ot XpY+AGuYAsGoAfJ8Xo4vFfhv1Igfp5WI+QZ78uizi0bd X-Google-Smtp-Source: APXvYqxSLNHsxhcz+gM0wqwveEKtVy2r7xd/vtNXhyaPvRZcUlJAZ+VB565D8W5/BS87fWWZ2StQG4gMxtj7G93DEA0= X-Received: by 2002:aa7:8652:: with SMTP id a18mr24510500pfo.190.1571688721907; Mon, 21 Oct 2019 13:12:01 -0700 (PDT) MIME-Version: 1.0 References: <83lftd28wt.fsf@gnu.org> In-Reply-To: <83lftd28wt.fsf@gnu.org> From: Stefan Kangas Date: Mon, 21 Oct 2019 22:11:50 +0200 Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) Eli Zaretskii writes: > > 1. Under "emacs -Q", evaluate: > > (defun my-advice (&rest args) > > (recenter)) > > (advice-add 'next-error :after #'my-advice) > > 2. M-x rgrep RET [... grep for something] > > 3. Run 'next-error' (M-g M-n) from the "*grep*" buffer. > > > > Result: I get the error: > > recenter-top-bottom: =E2=80=98recenter=E2=80=99ing a window that do= es not display > > current-buffer. > > Why isn't this a cockpit error: you force a function that happens to > switch buffers to recenter. It's like you've added a call to > 'recenter' in some arbitrary place in a random function: you are > responsible for that code, and if it does stuff that it shouldn't, > your code is wrong. No? In this case my expectation was that this code would be run *after* the command, i.e. when it had already done all the switching. I'm not sure that's comparable to placing recenter in an arbitrary place inside the function. It was surprising to me that this didn't work, and it's not clear what I should do instead. For example, the following code exhibits the same problem: (defun my-next-error () (interactive) (next-error) (recenter)) What am I missing? Best regards, Stefan Kangas From unknown Sun Jun 22 07:56:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#37856: 27.0.50; 'next-error' advised with 'recenter' signals error when run from "*grep*" buffer Resent-From: Juanma Barranquero Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 21 Oct 2019 21:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37856 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Kangas Cc: 37856@debbugs.gnu.org, Eli Zaretskii Received: via spool by 37856-submit@debbugs.gnu.org id=B37856.157169388623504 (code B ref 37856); Mon, 21 Oct 2019 21:39:01 +0000 Received: (at 37856) by debbugs.gnu.org; 21 Oct 2019 21:38:06 +0000 Received: from localhost ([127.0.0.1]:58012 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMfNN-000671-V0 for submit@debbugs.gnu.org; Mon, 21 Oct 2019 17:38:06 -0400 Received: from mail-qk1-f175.google.com ([209.85.222.175]:39228) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMfNM-00066I-Tt for 37856@debbugs.gnu.org; Mon, 21 Oct 2019 17:38:05 -0400 Received: by mail-qk1-f175.google.com with SMTP id 4so14273077qki.6 for <37856@debbugs.gnu.org>; Mon, 21 Oct 2019 14:38:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=eDscZsxJi0V2aIk88/Jp+YYc+6RJlKodvsbyXuul9Mk=; b=aozeGejnLFkqxfY+Y81zLv6QcpMpPv7tuT1EI6v/L7FItplZ9H5UGkUrqaS9DSm49A 76jVnjbKq4jY5yu8lp6MMMSzPMzGo3CtFDKwNCY98NtVVUJ4PicXCHjyG4Hs6d6BYN9c 4uzFCMSnkf6EeVgBLTvsAeBZdHA0U0QRam5UEgaNyk7Awj/mp7HQgO+9Ci8iNwq+BR5S Il/LYQmbelFhpHjlRjS9icMZcwBz9RDoLZvdKsnsW/dCL8rtkErsbFsU1uOqlLMsvyRt dOu9uxqKgpex0xDYckCTZd3AQOhxUz3S4Z4ECvJLRXJkKfyv9TB8eDAvrKo/o85/lfK9 NvsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=eDscZsxJi0V2aIk88/Jp+YYc+6RJlKodvsbyXuul9Mk=; b=Fyw3u4PaVSU5GBSVAuX79ITzimyqekDriDQZpuRrg9Gunwj5TArsvWEx7J1XP/poEm j6BrhSo5VMdvFDzKkzAm9TzPCrwU/kfWl9bz1t3qOka2C/bvYtkb8ufqw/6BGxcY5wxu CAL6jgXnHsPUdV1qm7fMBMeNrkiG3JXk0tdU52wCVsJLr09GYZm7qnVNIttob3fVKubX EdT04BK5lDePSwhEmFnXKm1cUq0a3dt3/MD7nvhuQyqy1cc6y9jZAF6LIlnaXtHxPn8x LaMN+BM2/YuNOSA64r1aS/sUgbe2Ej/2UDjm+SzlhNQ8HcB2VZx9BclaTNVN6Ep0APtf KwEA== X-Gm-Message-State: APjAAAV2ALHOMXYHLUxWGCTxEWAY/DDqc2EHnNmIa1h8y5W7uBqyU/q7 49Ha5YkexkmU8EyWkq0oz5WXSuOZ5u24FKvX+GvR5A== X-Google-Smtp-Source: APXvYqyrWYC2mHtppnlnFYdSvrg9TfEa3mEX8ChtU1mrXATyUOWcsvxP4vupLZFulIZLs3ZRLNbkbKAFOMSaLQvJ4Z4= X-Received: by 2002:a37:4949:: with SMTP id w70mr12871752qka.216.1571693879139; Mon, 21 Oct 2019 14:37:59 -0700 (PDT) MIME-Version: 1.0 References: <83lftd28wt.fsf@gnu.org> In-Reply-To: From: Juanma Barranquero Date: Mon, 21 Oct 2019 23:37:22 +0200 Message-ID: Content-Type: multipart/alternative; boundary="0000000000005ca2600595727fa6" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000005ca2600595727fa6 Content-Type: text/plain; charset="UTF-8" On Mon, Oct 21, 2019 at 10:13 PM Stefan Kangas wrote: > (defun my-next-error () > (interactive) > (next-error) > (recenter)) > > What am I missing? What's wrong with (add-hook 'next-error-hook 'recenter) ? --0000000000005ca2600595727fa6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Mon, Oct 21, 2019 at 10:13 PM Stefan Kangas <= ;stefan@marxist.se> wrote:
<= br>
> (defun my-next-error ()
> =C2=A0 (interactive)
> = =C2=A0 (next-error)
> =C2=A0 (recenter))
>
> What am I mi= ssing?

What's wrong with

=C2= =A0 (add-hook 'next-error-hook 'recenter)

= ?
--0000000000005ca2600595727fa6-- From unknown Sun Jun 22 07:56:46 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Stefan Kangas Subject: bug#37856: closed (Re: bug#37856: 27.0.50; 'next-error' advised with 'recenter' signals error when run from "*grep*" buffer) Message-ID: References: X-Gnu-PR-Message: they-closed 37856 X-Gnu-PR-Package: emacs Reply-To: 37856@debbugs.gnu.org Date: Mon, 21 Oct 2019 22:20:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1571696403-27314-1" This is a multi-part message in MIME format... ------------=_1571696403-27314-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #37856: 27.0.50; 'next-error' advised with 'recenter' signals error when ru= n from "*grep*" buffer which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 37856@debbugs.gnu.org. --=20 37856: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D37856 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1571696403-27314-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 37856-done) by debbugs.gnu.org; 21 Oct 2019 22:19:33 +0000 Received: from localhost ([127.0.0.1]:58038 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMg1V-00075i-0R for submit@debbugs.gnu.org; Mon, 21 Oct 2019 18:19:33 -0400 Received: from mail-pg1-f178.google.com ([209.85.215.178]:39761) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMg1T-00075W-GW for 37856-done@debbugs.gnu.org; Mon, 21 Oct 2019 18:19:31 -0400 Received: by mail-pg1-f178.google.com with SMTP id p12so8650571pgn.6 for <37856-done@debbugs.gnu.org>; Mon, 21 Oct 2019 15:19:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hNlDjZFjcBSbMyj3TeFLeqEwCy8cVu3JInllgDtinWw=; b=ShVdf/dL+Qadp0L2BLqIR/qUKkQY8ow/2v1uuLNrq5X/xEq1rU8e5yTj0knSu4FYLE 8WQDuqZrsy8YNbd32tokVDxXB2CkXWN/lewlraZUPTr5HaNjNLYPTa4sE+0mg1ABWISI LDXiMwEdlvc+4KssuzeYxxDFNQufIUhCQKEH6nSn3m3AC80ru76msoBxdhflf3VijGxt J0m0PYzc5xRQT6QU4iqFwF28+LlWSlYA2rTMDagYqGXBCEc3uAzi+HlBmIsLTydU76dr DG096sseBKbcXikeKefE40QoTL19J5iPzGa3ZN+VTyrOJ33NAR3c8DSl94A6+T4PdGRN l0ig== X-Gm-Message-State: APjAAAWkUz92k73j0Cd0OI5NEilJWM71CWrpAe+F4c8/+NwVRX+iQSWL rn3BGrE0pM41wfDpHGx1ojgHPunoMUlyyQD/fYs= X-Google-Smtp-Source: APXvYqwIgFQlVdQWcv2mof2jn17BDZM9Gkk4n2ce71g6srSrq78MeL9FkW3OYtcVzYcoEBzwntHE4tQQxhXTe570HI4= X-Received: by 2002:aa7:8652:: with SMTP id a18mr388265pfo.190.1571696365557; Mon, 21 Oct 2019 15:19:25 -0700 (PDT) MIME-Version: 1.0 References: <83lftd28wt.fsf@gnu.org> In-Reply-To: From: Stefan Kangas Date: Tue, 22 Oct 2019 00:19:13 +0200 Message-ID: Subject: Re: bug#37856: 27.0.50; 'next-error' advised with 'recenter' signals error when run from "*grep*" buffer To: Juanma Barranquero Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 37856-done Cc: 37856-done@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) Juanma Barranquero writes: > > What am I missing? > > What's wrong with > > (add-hook 'next-error-hook 'recenter) Oops, how silly of me. Yes, I'll just use that. Thanks. I'm still a bit confounded by the above behaviour, but if everyone else feels that everything is in order I'll just go ahead and close this. Sorry about the noise. Best regards, Stefan Kangas ------------=_1571696403-27314-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 21 Oct 2019 18:39:06 +0000 Received: from localhost ([127.0.0.1]:57826 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMca9-0001mo-Ps for submit@debbugs.gnu.org; Mon, 21 Oct 2019 14:39:06 -0400 Received: from lists.gnu.org ([209.51.188.17]:46888) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMca7-0001mc-Fu for submit@debbugs.gnu.org; Mon, 21 Oct 2019 14:39:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54957) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMca6-0004iq-6Y for bug-gnu-emacs@gnu.org; Mon, 21 Oct 2019 14:39:03 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMca4-00070J-SH for bug-gnu-emacs@gnu.org; Mon, 21 Oct 2019 14:39:01 -0400 Received: from mail-pf1-f169.google.com ([209.85.210.169]:33778) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMca4-0006zV-NE for bug-gnu-emacs@gnu.org; Mon, 21 Oct 2019 14:39:00 -0400 Received: by mail-pf1-f169.google.com with SMTP id q10so8978793pfl.0 for ; Mon, 21 Oct 2019 11:38:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-transfer-encoding; bh=cju5zD5fcjOCm/rF9AMi9ImBg28HRa4EnOyPrnfd4eU=; b=Q4flMABbouhg5HqBHyYJ1F/7/ZPfU3Ub21IpH7F0kpKMTWwKmIxxfDRVUQHmc/HbDs TGrsB39p+oYhA4c1Ys8GA2s4taL1HHcVb890rdIvvqBQ6bHITLgVRTOLHaOLPSbkTm/E UYTwybkA7TaQLmtesL7oQh1ksgQ7oEXmA3ZHyUnC4gSeL29GuYB4OFbH5tq86G9ZpZjd 4rj0xC0967MSed7vlYFGP3BYDu2G4c2fz0ZB4EdqZmtlPcqlGyQD3goM6v6NkOGApwe1 MNuMYKGtExeRDza365YtY9WUkTRG9HJiqpSKWLLIW4VrEXq+XuwqyxAouvwjgvWVeJDq WWXw== X-Gm-Message-State: APjAAAWeUorUcbOiu4yXvK7YBwiAOmBDgtUeqhbhn60ZROsEviXMe95B 8NAqDFy+mZUG5bsx/hT4jmUfpy5Rp8LGPMsh+B3RicdW X-Google-Smtp-Source: APXvYqwxBF+hdYSxjkf6uAqbVwqCc+OANSlYgD7ZvYVh/seUOJLDt9HZVJeB4etFhgXFKKzDE+t/TineNpIJ4I+Jg1A= X-Received: by 2002:a17:90a:f491:: with SMTP id bx17mr31262818pjb.106.1571683138145; Mon, 21 Oct 2019 11:38:58 -0700 (PDT) MIME-Version: 1.0 From: Stefan Kangas Date: Mon, 21 Oct 2019 20:38:47 +0200 Message-ID: Subject: 27.0.50; 'next-error' advised with 'recenter' signals error when run from "*grep*" buffer To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.210.169 X-Spam-Score: 1.1 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: I get an error when advising 'next-error' with 'recenter'. Steps to reproduce: 1. Under "emacs -Q", evaluate: (defun my-advice (&rest args) (recenter)) (advice-add 'next-error :after #'my-advice) 2. M-x rgrep RET [... grep for something] 3. Run 'next-error' ( [...] Content analysis details: (1.1 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: gnu.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stefankangas[at]gmail.com) 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [209.51.188.17 listed in list.dnswl.org] 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different 2.0 SPOOFED_FREEMAIL No description available. X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) I get an error when advising 'next-error' with 'recenter'. Steps to reproduce: 1. Under "emacs -Q", evaluate: (defun my-advice (&rest args) (recenter)) (advice-add 'next-error :after #'my-advice) 2. M-x rgrep RET [... grep for something] 3. Run 'next-error' (M-g M-n) from the "*grep*" buffer. Result: I get the error: recenter-top-bottom: =E2=80=98recenter=E2=80=99ing a window that does n= ot display current-buffer. (I also get the error when I run it in the second window when 'next-error' would take you to a different file.) Expected result: I get no error. --- Backtrace: Debugger entered--Lisp error: (error "=E2=80=98recenter=E2=80=99ing a windo= w that does not display curre...") recenter() my-advice(nil) apply(my-advice nil) next-error(nil) funcall-interactively(next-error nil) #(next-error nil nil) apply(# next-error (nil nil)) call-interactively@ido-cr+-record-current-command(# next-error nil nil) apply(call-interactively@ido-cr+-record-current-command # (next-error nil nil)) call-interactively(next-error nil nil) command-execute(next-error) --- This seems to be due to this code in window.c: /* For reasons why we signal an error here, see https://lists.gnu.org/r/emacs-devel/2014-06/msg00053.html, https://lists.gnu.org/r/emacs-devel/2014-06/msg00094.html. */ if (buf !=3D current_buffer) error ("`recenter'ing a window that does not display current-buffer."); This code was added here: 3da983f8c4 2014-06-06 Stefan Monnier * src/window.c (Frecenter): Signal an error if window-buffer is not current-buffer. --- In GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin17.7.0, NS appkit-1561.61 Version 10.13.6 (Build 17G8037)) of 2019-10-21 built on Stefans-MBP Repository revision: 0e6f4628d8fff53505e4399e71da9f531a64fff7 Repository branch: master Windowing system distributor 'Apple', version 10.3.1561 System Description: Mac OS X 10.13.6 ------------=_1571696403-27314-1-- From unknown Sun Jun 22 07:56:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#37856: 27.0.50; 'next-error' advised with 'recenter' signals error when run from "*grep*" buffer Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Oct 2019 02:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37856 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Kangas Cc: 37856@debbugs.gnu.org Received: via spool by 37856-submit@debbugs.gnu.org id=B37856.157171130325884 (code B ref 37856); Tue, 22 Oct 2019 02:29:02 +0000 Received: (at 37856) by debbugs.gnu.org; 22 Oct 2019 02:28:23 +0000 Received: from localhost ([127.0.0.1]:58109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMjuI-0006jP-P3 for submit@debbugs.gnu.org; Mon, 21 Oct 2019 22:28:23 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34215) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMjuE-0006j9-Rl for 37856@debbugs.gnu.org; Mon, 21 Oct 2019 22:28:19 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48820) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iMju9-0000qL-IP; Mon, 21 Oct 2019 22:28:13 -0400 Received: from [176.228.60.248] (port=1483 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iMju8-0001iX-2g; Mon, 21 Oct 2019 22:28:12 -0400 Date: Tue, 22 Oct 2019 05:28:07 +0300 Message-Id: <83k18x1pl4.fsf@gnu.org> From: Eli Zaretskii In-reply-to: (message from Stefan Kangas on Mon, 21 Oct 2019 22:11:50 +0200) References: <83lftd28wt.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Kangas > Date: Mon, 21 Oct 2019 22:11:50 +0200 > Cc: 37856@debbugs.gnu.org > > It was surprising to me that this didn't work, and it's not clear what > I should do instead. For example, the following code exhibits the > same problem: > > (defun my-next-error () > (interactive) > (next-error) > (recenter)) > > What am I missing? The advice effectively "injects" your code into the advised function, just before it returns. From unknown Sun Jun 22 07:56:46 2025 X-Loop: help-debbugs@gnu.org Subject: bug#37856: 27.0.50; 'next-error' advised with 'recenter' signals error when run from "*grep*" buffer Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Oct 2019 07:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37856 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 37856@debbugs.gnu.org Cc: stefan@marxist.se Received: via spool by 37856-submit@debbugs.gnu.org id=B37856.157173098528478 (code B ref 37856); Tue, 22 Oct 2019 07:57:01 +0000 Received: (at 37856) by debbugs.gnu.org; 22 Oct 2019 07:56:25 +0000 Received: from localhost ([127.0.0.1]:58195 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMp1k-0007PG-OL for submit@debbugs.gnu.org; Tue, 22 Oct 2019 03:56:24 -0400 Received: from mail-wm1-f47.google.com ([209.85.128.47]:51550) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iMp1i-0007Oy-GZ for 37856@debbugs.gnu.org; Tue, 22 Oct 2019 03:56:23 -0400 Received: by mail-wm1-f47.google.com with SMTP id q70so8832849wme.1 for <37856@debbugs.gnu.org>; Tue, 22 Oct 2019 00:56:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:mail-copies-to:gmane-reply-to-list :date:in-reply-to:message-id:mime-version:content-transfer-encoding; bh=LbEiS1wLF8cDwWEuyFCNdz2IblrxeUyjuSr8YGgahAw=; b=GQ8cg4AvG1ALWXaQWZx6L/DEnlG7Kmft/wyCFPsAbd3zxzVMA5yYoKfq+pi36aZGAY flKD+CVP+aHWSLbBptUVeLANX4osM8ejP8O4Q404daf2CX2K+HXyHdp3vSQoQ6yo5mz9 bFLMx5smjGp2eUK9H5+mqEGz1oE8L6CfuQFZ69y0R3e44wSAFcVM4Zkjd/V/FMKcvv+w MeJ8ZW2AglYi/QiO+rXIPtrxJViI+NyvGAjLwhYTQHhT+lW33Y7Fl/jvquuaYcq1k3Qw GHn6QjrskWP+BGP8q26zwaT75Y4mg+lrtGzvIYAT4k6v7IP8RQZC24R0rah+OHllmiUO bNrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:mail-copies-to :gmane-reply-to-list:date:in-reply-to:message-id:mime-version :content-transfer-encoding; bh=LbEiS1wLF8cDwWEuyFCNdz2IblrxeUyjuSr8YGgahAw=; b=DjIKK52SInvRh+++lPONafOrnNzmA6qPOMhgD0Ed80qwOVLFLn7q6XN7XuszeGCApw ngntiABO8o2Y6n33aZtQsZjfoidkMX6Tkpq1+Td0LfQ1B4DgoUpzs1FmyKNQDI/2HEjm vjR6VUpe2zxzxmxcMZJYurQEn4LfnmqQ5hJ6kzQVDtYksvRh2lhwzuGsqg1YAq5iV7AM g6N2GMksyJc4CzTyOl4ajo/Qn85uxqWpuGcXj6gEyOtH0IZUXLdFdbQOMWyUoKJC8Oej Bq79yGOp8xWB/XZ5cqdXBbEKCPlqBIaoh07GFmHsopdMkCR2qyaN5I4h7/+1Z8E2KQ+/ 3JCA== X-Gm-Message-State: APjAAAUUeFTrXYERePnhQukzjGcyncWwCPHCnT+wvwWD8AY/0XQPBda8 hMo948KuriuQP6TywAoHgmcMMiDj X-Google-Smtp-Source: APXvYqwzbGQh/xkWd4jFDx5mMHv1m7VEhKrk7aHFG+GM+DObGn4/Wg5Ex7u8FK8DMSWFu5dUFkUpPQ== X-Received: by 2002:a1c:a556:: with SMTP id o83mr1842814wme.0.1571730976177; Tue, 22 Oct 2019 00:56:16 -0700 (PDT) Received: from rpluim-mac ([149.5.228.1]) by smtp.gmail.com with ESMTPSA id q3sm17541146wru.33.2019.10.22.00.56.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 00:56:15 -0700 (PDT) From: Robert Pluim References: <83lftd28wt.fsf@gnu.org> Mail-Copies-To: never Gmane-Reply-To-List: yes Date: Tue, 22 Oct 2019 09:56:14 +0200 In-Reply-To: (Stefan Kangas's message of "Tue, 22 Oct 2019 00:19:13 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Tue, 22 Oct 2019 00:19:13 +0200, Stefan Kangas = said: Stefan> Juanma Barranquero writes: >> > What am I missing? >>=20 >> What's wrong with >>=20 >> (add-hook 'next-error-hook 'recenter) Stefan> Oops, how silly of me. Yes, I'll just use that. Thanks. Stefan> I'm still a bit confounded by the above behaviour, but if every= one Stefan> else feels that everything is in order I'll just go ahead and c= lose Stefan> this. Sorry about the noise. The add-function docstring says: Add a piece of advice on the function stored at PLACE. FUNCTION describes the code to add. WHERE describes where to add it. WHERE can be explained by showing the resulting new function, as the result of combining FUNCTION and the previous value of PLACE, which we call OLDFUN here: `:before' (lambda (&rest r) (apply FUNCTION r) (apply OLDFUN r)) `:after' (lambda (&rest r) (prog1 (apply OLDFUN r) (apply FUNCTION r))) `:around' (lambda (&rest r) (apply FUNCTION OLDFUN r)) so I think I=CA=BCd agree with your expectations. Of course, you could use :around and call 'next-error' yourself in your function (untested). Robert