From unknown Sat Aug 16 21:12:43 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#46119 <46119@debbugs.gnu.org> To: bug#46119 <46119@debbugs.gnu.org> Subject: Status: 28.0.50; this-error-recenter Reply-To: bug#46119 <46119@debbugs.gnu.org> Date: Sun, 17 Aug 2025 04:12:43 +0000 retitle 46119 28.0.50; this-error-recenter reassign 46119 emacs submitter 46119 Tino Calancha severity 46119 wishlist tag 46119 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 26 16:21:29 2021 Received: (at submit) by debbugs.gnu.org; 26 Jan 2021 21:21:29 +0000 Received: from localhost ([127.0.0.1]:42792 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4VmC-0005Q8-R4 for submit@debbugs.gnu.org; Tue, 26 Jan 2021 16:21:29 -0500 Received: from lists.gnu.org ([209.51.188.17]:44120) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4VmB-0005Q0-9l for submit@debbugs.gnu.org; Tue, 26 Jan 2021 16:21:27 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55446) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l4VmB-0001Kr-34 for bug-gnu-emacs@gnu.org; Tue, 26 Jan 2021 16:21:27 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:40680) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l4Vm9-0007Fk-9G for bug-gnu-emacs@gnu.org; Tue, 26 Jan 2021 16:21:26 -0500 Received: by mail-wm1-x331.google.com with SMTP id c127so3934505wmf.5 for ; Tue, 26 Jan 2021 13:21:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=yscHm85VdPJ++dGjTfeBP7rUpj3w+l3LDZ2fdbPOeBQ=; b=jnLv2q7uJgfKLPqz1Cx0lG+q5+h67uaUZp5obrA3fYpeyIHwqvI0s0uOfkrS9O8DWZ KEFtomiYMlw5EVVwjRRp2TrHmNW76fooawd7t2brPB4IDS6CkdnJ2N6q94z7aJZ5OmCZ 8Lztf+A4KeD30xAnu7OIH2fM9p+9uRhbhxsmEEWfaJNw7xuO3LfeO1+kSLBpwMX/Hsm7 MJzhM2Mc/xOR3tRv0PARNJbnnmK/BlBd2Zu1pHzF6jieLQgwOp2sObdGMZ8O7HqeCknm XDOJF4rhAIz4lPXtPoISzTyFrGEchW4YAKy5GWyyu/9FBBwRTTy6oe0hmVn+AyS/oqDw vWwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=yscHm85VdPJ++dGjTfeBP7rUpj3w+l3LDZ2fdbPOeBQ=; b=N6Bb4mqsO9KU99XU6py6B0mjs5e/JJzZbjsWRUCzBcZNJAybPeGK3uhs56qX4GM179 nGlGPkIB0zg2waiNH0XUBv9qTQhSyR5x9exapaezhIqAbVC/vmxNPCxg8EIDwkoSWQkf zTBUEzomtOs7e3wtrxjuu7GjQlzlfcPyo1b0etJxUbdvrkzfMD5CNW4y4sLzIjD1ACPx e0xx8AoiIXPS65J7I6oeuvECgX6wlpQd5RAXBZndP8dCDFSz0YMepa5MfCXCTsPy4Q0A vDd0A64AU0Ge0gQLBuwFoL9TBkodMfeHShBFrqYOrVOQsqpsQ+LtvFzYQR2OFeKGbAmP Fxvw== X-Gm-Message-State: AOAM531BKkkO3TwJ9H5jTp1YguTt1+RgRWLecU0wRkr5L1+sX4uLg+29 4+RDpt4pMBQ6hy5UbKBI49VImJGfbgo= X-Google-Smtp-Source: ABdhPJzcxRr3L1/wb+P/RPDaaTry9aD0QfQJ2S6Q+yi8QgCBckWa+2J/C3LuRXCBnRnc27U/G7PyWw== X-Received: by 2002:a1c:984a:: with SMTP id a71mr1319251wme.175.1611696078761; Tue, 26 Jan 2021 13:21:18 -0800 (PST) Received: from localhost.example.com ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id d3sm23790911wrp.79.2021.01.26.13.21.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jan 2021 13:21:17 -0800 (PST) From: Tino Calancha To: bug-gnu-emacs@gnu.org Subject: 28.0.50; this-error-recenter Date: Tue, 26 Jan 2021 22:21:16 +0100 Message-ID: <8735yn1jjn.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=tino.calancha@gmail.com; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) 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: -2.3 (--) X-Debbugs-Cc: Juri Linkov ,uyennhi.qm@gmail.com Severity: wishlist Tags: patch As a regular greper with a tiny screen I tend to use this command quite often. Tentatively, I have named it `this-error-recenter'; if you find a better name for it, please let me know. --8<-----------------------------cut here---------------start------------->8--- commit 8cf1b91190013154a82a731a067cdf7d18288379 Author: Tino Calancha Date: Tue Jan 26 21:57:50 2021 +0100 Add command to recenter errors from Occur/Grep buffers It allows to scroll up/down the current displayed occurrence/error without abandon the Occur/Grep buffer. * lisp/simple.el (this-error-recenter): New command. * lisp/progmodes/grep.el (grep-mode-map): Delete bidings for n and p. * lisp/progmodes/compile.el (compilation-minor-mode-map): Move here the n and p bindings. Bind the new command to l. * lisp/replace.el (occur-mode-map): Bind the new command to l. * etc/NEWS (Changes in Specialized Modes and Packages in Emacs 28.1): Announce it. diff --git a/etc/NEWS b/etc/NEWS index e038076e96..a51a6b4f63 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -454,9 +454,15 @@ applied when the option 'tab-line-tab-face-functions' is so-configured. That option may also be used to customize tab-line faces in other ways. -** New bindings in occur-mode, 'next-error-no-select' bound to 'n' and +** Occur mode + +*** New bindings in occur-mode, 'next-error-no-select' bound to 'n' and 'previous-error-no-select' bound to 'p'. +*** The new command 'this-error-recenter', bound to 'l', recenters the +current displayed occurrence from a Occur buffer and the current +displayed error in a compilation buffer. + ** EIEIO +++ diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 94e4f3c6fa..1031f835f8 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -2073,6 +2073,10 @@ compilation-minor-mode-map (define-key map "\M-p" 'compilation-previous-error) (define-key map "\M-{" 'compilation-previous-file) (define-key map "\M-}" 'compilation-next-file) + (define-key map "n" 'next-error-no-select) + (define-key map "p" 'previous-error-no-select) + (define-key map "l" 'this-error-recenter) + (define-key map "g" 'recompile) ; revert ;; Set up the menu-bar (define-key map [menu-bar compilation] diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 1a8435fde3..d6ee8bb423 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -275,8 +275,6 @@ grep-mode-map (define-key map "\C-c\C-f" 'next-error-follow-minor-mode) (define-key map "\r" 'compile-goto-error) ;; ? - (define-key map "n" 'next-error-no-select) - (define-key map "p" 'previous-error-no-select) (define-key map "{" 'compilation-previous-file) (define-key map "}" 'compilation-next-file) (define-key map "\t" 'compilation-next-error) diff --git a/lisp/replace.el b/lisp/replace.el index db5b340631..bd3a96a26e 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -1135,6 +1135,7 @@ occur-mode-map (define-key map "\C-o" 'occur-mode-display-occurrence) (define-key map "n" 'next-error-no-select) (define-key map "p" 'previous-error-no-select) + (define-key map "l" 'this-error-recenter) (define-key map "\M-n" 'occur-next) (define-key map "\M-p" 'occur-prev) (define-key map "r" 'occur-rename-buffer) diff --git a/lisp/simple.el b/lisp/simple.el index c878fdab92..6da1dec003 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -496,6 +496,16 @@ next-error-message-highlight (overlay-put ol 'window (get-buffer-window)) (setf next-error--message-highlight-overlay ol))))) +(defun this-error-recenter (&optional arg) + "Recenter the current displayed error in the `next-error' buffer." + (interactive "P") + (if (not (or (eq major-mode 'occur-mode) + (derived-mode-p 'compilation-mode))) + (user-error "This command is for *Occur* or *Grep* buffers") + (funcall next-error-function 0 nil) + (recenter-top-bottom arg) + (pop-to-buffer next-error-last-buffer))) + ;;; --8<-----------------------------cut here---------------end--------------->8--- In GNU Emacs 28.0.50 (build 9, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw scroll bars) of 2021-01-26 built on localhost.example.com Repository revision: 8cf1b91190013154a82a731a067cdf7d18288379 Repository branch: this-error-recenter Windowing system distributor 'The X.Org Foundation', version 11.0.12010000 System Description: openSUSE Tumbleweed Configured using: 'configure --with-x-toolkit=lucid' Configured features: CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM LUCID ZLIB From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 27 04:37:47 2021 Received: (at 46119) by debbugs.gnu.org; 27 Jan 2021 09:37:47 +0000 Received: from localhost ([127.0.0.1]:43804 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4hGk-0002cp-VA for submit@debbugs.gnu.org; Wed, 27 Jan 2021 04:37:47 -0500 Received: from relay10.mail.gandi.net ([217.70.178.230]:37639) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4hGj-0002ca-0x for 46119@debbugs.gnu.org; Wed, 27 Jan 2021 04:37:45 -0500 Received: from mail.gandi.net (m91-129-98-64.cust.tele2.ee [91.129.98.64]) (Authenticated sender: juri@linkov.net) by relay10.mail.gandi.net (Postfix) with ESMTPSA id AA15324000B; Wed, 27 Jan 2021 09:37:36 +0000 (UTC) From: Juri Linkov To: Tino Calancha Subject: Re: bug#46119: 28.0.50; this-error-recenter Organization: LINKOV.NET References: <8735yn1jjn.fsf@gmail.com> Date: Wed, 27 Jan 2021 11:19:19 +0200 In-Reply-To: <8735yn1jjn.fsf@gmail.com> (Tino Calancha's message of "Tue, 26 Jan 2021 22:21:16 +0100") Message-ID: <87czxqbwp4.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com 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.5 (-) > +(defun this-error-recenter (&optional arg) > + "Recenter the current displayed error in the `next-error' buffer." > + (interactive "P") > + (if (not (or (eq major-mode 'occur-mode) > + (derived-mode-p 'compilation-mode))) > + (user-error "This command is for *Occur* or *Grep* buffers") > + (funcall next-error-function 0 nil) > + (recenter-top-bottom arg) > + (pop-to-buffer next-error-last-buffer))) I wonder why restrict this only to occur and compilation? Like C-M-v/C-M-S-v and M-PgUp/M-PgDown can scroll up/down other window in any mode, you can use such code to recenter other window everywhere: (with-selected-window (other-window-for-scrolling) (recenter-top-bottom)) From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 28 01:38:24 2021 Received: (at 46119) by debbugs.gnu.org; 28 Jan 2021 06:38:24 +0000 Received: from localhost ([127.0.0.1]:46883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l50wh-0002nr-QE for submit@debbugs.gnu.org; Thu, 28 Jan 2021 01:38:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47460) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l50wg-0002nc-GP for 46119@debbugs.gnu.org; Thu, 28 Jan 2021 01:38:22 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37060) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l50wb-0003Sy-7x; Thu, 28 Jan 2021 01:38:17 -0500 Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1l50wX-0004cF-7e; Thu, 28 Jan 2021 01:38:13 -0500 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman To: Tino Calancha In-Reply-To: <8735yn1jjn.fsf@gmail.com> (message from Tino Calancha on Tue, 26 Jan 2021 22:21:16 +0100) Subject: Re: bug#46119: 28.0.50; this-error-recenter References: <8735yn1jjn.fsf@gmail.com> Message-Id: Date: Thu, 28 Jan 2021 01:38:13 -0500 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com 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: , Reply-To: rms@gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > As a regular greper with a tiny screen I tend to use this command quite often. > Tentatively, I have named it `this-error-recenter'; if you find a > better name for it, please let me know. Would you please say what the command does? I see this > Add command to recenter errors from Occur/Grep buffers > It allows to scroll up/down the current displayed occurrence/error > without abandon the Occur/Grep buffer. but I am not sure what that means, concretely. -- Dr Richard Stallman Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org) From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 30 09:50:30 2021 Received: (at 46119) by debbugs.gnu.org; 30 Jan 2021 14:50:30 +0000 Received: from localhost ([127.0.0.1]:54381 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l5rZq-0007xV-9R for submit@debbugs.gnu.org; Sat, 30 Jan 2021 09:50:30 -0500 Received: from mail-wr1-f53.google.com ([209.85.221.53]:45987) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l5rZm-0007xD-U5 for 46119@debbugs.gnu.org; Sat, 30 Jan 2021 09:50:16 -0500 Received: by mail-wr1-f53.google.com with SMTP id m13so11778705wro.12 for <46119@debbugs.gnu.org>; Sat, 30 Jan 2021 06:50:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=xoyThKm5d82O9x23E36ldtON0dE/8I9hcuPBkI9hcps=; b=Po1DqAifv0wk6XMxIF1GDIKF3IDF0o8HXmOhrvjbmZy25R7bjWLJqTnK2mWKK5EYGj Fb3NLsRY4dbmBTlknM9q3RzD7RL/Sz4/FEtGksT/uGz9jfFTVJ/1baxAXzTz5VcDMGjG 072MUKASC3KHaQ9bf0G6YGuvyHGulFgt5bRrGaIKVrJpsjpQbZR54b3Q9XvtonTGemWN xg7lR9HRFzahDhFsH4Pl2XxDQk0XGy2KcnETTyt1m14N5epVT/rrlw89G4FGE4GLsbTB h8208Is8NbwvvAacnuPy4pAVJxTHIdNUR/6F7eqfY6SfkCl5NeFmurQOxXQSfTxF9SuQ aObw== 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:date:in-reply-to :message-id:user-agent:mime-version; bh=xoyThKm5d82O9x23E36ldtON0dE/8I9hcuPBkI9hcps=; b=TMWpVUqRWYG0pRE61icys01TYpngWeCM4xMYe5En2gXK7H7AlEY9qcxZIGFurdjYI7 JR9n1bQz5FCCrb64QDcmVLfcnTerY8e19ee9TyKO2DsUdvwYQvM+C3Gd6vO0QgbhQZfD jronVVyWM4gNBA5p3ou+4ZTWOj2VTnGQgAk1c7kFwTl28OVGEPT3SX70pSDu2MA+FJMl lNOF7+UQ1u0iC60Gut3nkE2PpQ0C3Sb4czjHhQwgZ56kSEeGK6i858u99ofT9Lqs85Jo tMVhTCkhLa75B+CsUTz3zeKmD1l4KRFH5pZEK4Wvz6gMbh+MsuQ8TtGauV1Ox0JiOsE+ RpPA== X-Gm-Message-State: AOAM53059IXnrt/yDnwk1qcNORA2GgjylE+xDTFAN5oMo06YkYaZmbjQ kCxf/L493MAuaOS7jELB7objiRijCaw= X-Google-Smtp-Source: ABdhPJx5bfSv5o53GATycYCe0p5n3RCAx4sYgel2XxzadhE/6ExDY193JOHHt/b+7Vndi52ArW8uhA== X-Received: by 2002:a5d:51c8:: with SMTP id n8mr10039168wrv.18.1612018209322; Sat, 30 Jan 2021 06:50:09 -0800 (PST) Received: from localhost.example.com ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id z15sm17389336wrs.25.2021.01.30.06.50.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Jan 2021 06:50:08 -0800 (PST) From: Tino Calancha To: Richard Stallman Subject: Re: bug#46119: 28.0.50; this-error-recenter References: <8735yn1jjn.fsf@gmail.com> Date: Sat, 30 Jan 2021 15:50:07 +0100 In-Reply-To: (Richard Stallman's message of "Thu, 28 Jan 2021 01:38:13 -0500") Message-ID: <87lfcaqy1s.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com 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 (-) Richard Stallman writes: > > As a regular greper with a tiny screen I tend to use this command quite often. > > > Tentatively, I have named it `this-error-recenter'; if you find a > > better name for it, please let me know. > > Would you please say what the command does? I see this > > > Add command to recenter errors from Occur/Grep buffers > > > It allows to scroll up/down the current displayed occurrence/error > > without abandon the Occur/Grep buffer. > > but I am not sure what that means, concretely. ;; Grep example (Call Emacs from the root Emacs source code using my patch) emacs -Q lisp M-x rgrep RET (defun RET *.el RET RET C-x o n ; display errors w/o selecting its window l ; scroll up/down the current displayed error ;; Occur example emacs -Q lisp/subr.el M-s o (defun RET C-x o n ; display occurrences w/o selecting its window l ; scroll up/down the current displayed occurrence From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 30 10:01:53 2021 Received: (at 46119) by debbugs.gnu.org; 30 Jan 2021 15:01:53 +0000 Received: from localhost ([127.0.0.1]:55516 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l5rl1-0008WG-7Z for submit@debbugs.gnu.org; Sat, 30 Jan 2021 10:01:52 -0500 Received: from mail-wm1-f48.google.com ([209.85.128.48]:51724) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l5rky-0008W2-6P for 46119@debbugs.gnu.org; Sat, 30 Jan 2021 10:01:49 -0500 Received: by mail-wm1-f48.google.com with SMTP id m2so9022180wmm.1 for <46119@debbugs.gnu.org>; Sat, 30 Jan 2021 07:01:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=/B26/1/1cwULWRkS0TAU+hoQcg7G0ZxnzqETy9LDf7A=; b=Kg3CuKq97bd1KjqIMbBsYFhwterbr3kBdXMKgrwdetIvnU0PWxNTI4/RzJT1+bJRNP jlthqlAg5/o3nPKXCyA+2748c6PJHY88wnfuSKvW+oO/4yyXvOAlR+Jg/nUD4Zj0N/47 rmBzLJvJnptac+fht12CWnksXRT8/egwknCFikkiJcFWUT7jheK1YG94f23P7bjVZO7Z 6rOrDX+CveLZbLGpe4JqpNJ1xcpc6CG1t0y/ka5d2e7zkULacn2pki7tUldXt8Uho3I8 sxRhBDdhSA2rKmeznmfwKHPgpEEf4kQDfOe2ePvZYlgpJkKcYjvqD+ynT+IQqSY6jCOG RE7A== 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:date:in-reply-to :message-id:user-agent:mime-version; bh=/B26/1/1cwULWRkS0TAU+hoQcg7G0ZxnzqETy9LDf7A=; b=Vd2eBL004upm9DmSHKq8JKnsMDXWDdkgvyXLOHoujEBjK8e5Aj+UyXLKbaG78JyQz6 m6RsHkoqZ78rtwt+AOzLDx70VLo+Y12yCzcflY/kKhRJx6nHlf/lsSfu1TsNSDXHkdVF EolFeu1zQ7dPEl4bJJZtJP7LkcQg03b3RK2rqj9XxKT8aEX1SzczHLpbGlwpcp4xGod3 2r/DxdDNQ29RnMllErWWqM9LYI8FUevRL0oSmdDBA/hgaq3NADlBBoJXRRDLao4/CS2z tjbZOVQzBB+DRcOUBfWxSUa2sLjJxUBpBzfpIBTfTNLgraBQ5xytDYC6DGCst3hR8BqT DdzA== X-Gm-Message-State: AOAM532Vcy+u7xw+XuClq0+9bDNaoBIRLm83DH2IReRF82LFcQY8Dkpk sgfH0mMJUvtNyxts7I3R0nM= X-Google-Smtp-Source: ABdhPJycP1lruzcgBKmvPaSfI5vJTrZuWye2bhkJO/scxhxUuDg6RZZHl69wlze2gBzuPMO47Eq6yA== X-Received: by 2002:a05:600c:3589:: with SMTP id p9mr6098913wmq.18.1612018902243; Sat, 30 Jan 2021 07:01:42 -0800 (PST) Received: from localhost.example.com ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id o12sm18441251wrx.82.2021.01.30.07.01.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Jan 2021 07:01:41 -0800 (PST) From: Tino Calancha To: Juri Linkov Subject: Re: bug#46119: 28.0.50; this-error-recenter References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> Date: Sat, 30 Jan 2021 16:01:40 +0100 In-Reply-To: <87czxqbwp4.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 27 Jan 2021 11:19:19 +0200") Message-ID: <87im7eqxij.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com 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 (-) Juri Linkov writes: >> +(defun this-error-recenter (&optional arg) >> + "Recenter the current displayed error in the `next-error' buffer." >> + (interactive "P") >> + (if (not (or (eq major-mode 'occur-mode) >> + (derived-mode-p 'compilation-mode))) >> + (user-error "This command is for *Occur* or *Grep* buffers") >> + (funcall next-error-function 0 nil) >> + (recenter-top-bottom arg) >> + (pop-to-buffer next-error-last-buffer))) > > I wonder why restrict this only to occur and compilation? I think because I was blindly looking only to my particular use case: Occur/Grep. > Like C-M-v/C-M-S-v and M-PgUp/M-PgDown can scroll up/down other window > in any mode, you can use such code to recenter other window everywhere: > > (with-selected-window (other-window-for-scrolling) (recenter-top-bottom)) Yeah, it makes sense. The only thing is that it makes harder to find the right name for this command; I think by improving the docstring makes more clear what is this about. How does it look now?: (defun this-error-recenter (&optional arg) "Recenter the current displayed error in the `next-error' buffer. If called not from a `next-error' buffer, then it just calls `recenter-top-bottom' in the other window." (interactive "P") (if (not (or (eq major-mode 'occur-mode) (derived-mode-p 'compilation-mode))) (with-selected-window (other-window-for-scrolling) (recenter-top-bottom arg)) (funcall next-error-function 0 nil) (recenter-top-bottom arg) (pop-to-buffer next-error-last-buffer))) From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 30 13:53:47 2021 Received: (at 46119) by debbugs.gnu.org; 30 Jan 2021 18:53:47 +0000 Received: from localhost ([127.0.0.1]:55810 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l5vNT-0001fC-IT for submit@debbugs.gnu.org; Sat, 30 Jan 2021 13:53:47 -0500 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:49173) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l5vNQ-0001el-6O for 46119@debbugs.gnu.org; Sat, 30 Jan 2021 13:53:45 -0500 X-Originating-IP: 91.129.108.204 Received: from mail.gandi.net (m91-129-108-204.cust.tele2.ee [91.129.108.204]) (Authenticated sender: juri@linkov.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 37235C0002; Sat, 30 Jan 2021 18:53:35 +0000 (UTC) From: Juri Linkov To: Tino Calancha Subject: Re: bug#46119: 28.0.50; this-error-recenter Organization: LINKOV.NET References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> <87im7eqxij.fsf@gmail.com> Date: Sat, 30 Jan 2021 20:40:09 +0200 In-Reply-To: <87im7eqxij.fsf@gmail.com> (Tino Calancha's message of "Sat, 30 Jan 2021 16:01:40 +0100") Message-ID: <87mtwqqose.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com 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.5 (-) >> Like C-M-v/C-M-S-v and M-PgUp/M-PgDown can scroll up/down other window >> in any mode, you can use such code to recenter other window everywhere: >> >> (with-selected-window (other-window-for-scrolling) (recenter-top-bottom)) > > Yeah, it makes sense. The only thing is that it makes harder to find > the right name for this command; I think by improving the docstring > makes more clear what is this about. Indeed, then it has no relation to errors at all. Like the existing command scroll-other-window-down bound to 'S-C-M-v', a new command could be named recenter-other-window bound to 'S-C-l'. > How does it look now?: > > (defun this-error-recenter (&optional arg) > "Recenter the current displayed error in the `next-error' buffer. > If called not from a `next-error' buffer, then it just calls > `recenter-top-bottom' in the other window." > (interactive "P") > (if (not (or (eq major-mode 'occur-mode) (derived-mode-p 'compilation-mode))) > (with-selected-window (other-window-for-scrolling) (recenter-top-bottom arg)) > (funcall next-error-function 0 nil) > (recenter-top-bottom arg) > (pop-to-buffer next-error-last-buffer))) But then no special case is needed for occur/compilation-mode. From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 30 15:41:45 2021 Received: (at 46119) by debbugs.gnu.org; 30 Jan 2021 20:41:45 +0000 Received: from localhost ([127.0.0.1]:55882 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l5x3x-0006J6-Dx for submit@debbugs.gnu.org; Sat, 30 Jan 2021 15:41:45 -0500 Received: from mail-wr1-f48.google.com ([209.85.221.48]:34091) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l5x3u-0006It-NU for 46119@debbugs.gnu.org; Sat, 30 Jan 2021 15:41:44 -0500 Received: by mail-wr1-f48.google.com with SMTP id g10so12403960wrx.1 for <46119@debbugs.gnu.org>; Sat, 30 Jan 2021 12:41:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=yzyIwisQEfgjFnoUfdkbvKxhjTIzXYxY7t4jbd/vcU8=; b=aARLcZCd/J/mjk5R8U3cKeOT5bDdWcAVv1CRvci/nVQhGQfF0gyXJdOi9KZA17xgNk i53Jv91PGYhuk0s9qvtXWuGZQ7c72/QxSCH5uDMokBJggYUilODk2NDrybXWy/VEcBlw dRrI7q14OaIx8MKQH/hflUn3ISue78lJbB+YzVxCyMMw3QuucSNFnutZGJ/S5EM89npR VBGVFMoQzPJIVz30ZGlQhBlBUABBxzPD4nknCMaCIT/mzdWY408nDuwsclPC+cwiuxLs HMydI5NRTaecsixvh+TkgTyILG40f8CjVQp7ZVPyrOX7XFCD91Wd2TKvL4OIw6ioog5S t8bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=yzyIwisQEfgjFnoUfdkbvKxhjTIzXYxY7t4jbd/vcU8=; b=cxb4tPEOWqX4FRg0Bi7bWfxEmozRcWAhmPzlmKGPBkGwDlxmh/LARSj1QrhB5kPTXP aa5THOrHSbT4Pw7y1oqdzo5+BGyu4exmT0eMrbLp5Ue9TsybbYDIGzyU5WBJ1JUsgd9a i1vIf4OnIjsi983Jw2BCWzXPoeFFNY57i+0MaO6DgFLBBc3wc+nxe45C0GHrEaumnbF8 owqyal8HydiZ/OarMljMViSUOOJGLXE/TI2anveIX/Ifw4LAmsWOITaXxbXm9fAaOYsM ISusxPU0pTniXKew8Y8nljfEV2gquCq9dftEl+kIIu7yuInls4yIRnm9i54xpQ3+RDU0 8/Ow== X-Gm-Message-State: AOAM531jmY5tIYScJjvguZAY2dskYr/XMLsUFGNdKyehsBqyMgHGSaIP Gt+8NvpChdrib1cfe+MgakQ= X-Google-Smtp-Source: ABdhPJxhzjSk8Ytr2T7TD4ai7ucrSKIaR2hq0bXvn3skcuSkySWEIzg+JjjaOSrL4QGeEkU4lCTLSw== X-Received: by 2002:adf:ffcd:: with SMTP id x13mr10993017wrs.149.1612039296861; Sat, 30 Jan 2021 12:41:36 -0800 (PST) Received: from [10.200.4.109] ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id y14sm19299682wro.58.2021.01.30.12.41.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Jan 2021 12:41:36 -0800 (PST) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Sat, 30 Jan 2021 21:41:30 +0100 (CET) To: Juri Linkov Subject: Re: bug#46119: 28.0.50; this-error-recenter In-Reply-To: <87mtwqqose.fsf@mail.linkov.net> Message-ID: References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> <87im7eqxij.fsf@gmail.com> <87mtwqqose.fsf@mail.linkov.net> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com, Tino Calancha 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 Sat, 30 Jan 2021, Juri Linkov wrote: > Like the existing command scroll-other-window-down bound to 'S-C-M-v', > a new command could be named recenter-other-window bound to 'S-C-l'. I like that. >> (defun this-error-recenter (&optional arg) >> "Recenter the current displayed error in the `next-error' buffer. >> If called not from a `next-error' buffer, then it just calls >> `recenter-top-bottom' in the other window." >> (interactive "P") >> (if (not (or (eq major-mode 'occur-mode) (derived-mode-p 'compilation-mode))) >> (with-selected-window (other-window-for-scrolling) (recenter-top-bottom arg)) >> (funcall next-error-function 0 nil) >> (recenter-top-bottom arg) >> (pop-to-buffer next-error-last-buffer))) > > But then no special case is needed for occur/compilation-mode. I expected someone will ask that; I should write my reason in the previous email: I like to see the pulse highlight, as with `next-error-no-select', that's why I call `next-error-function' here. [I customize `next-error-highlight' and `next-error-highlight-no-select' to 3 s] From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 31 04:53:24 2021 Received: (at 46119) by debbugs.gnu.org; 31 Jan 2021 09:53:24 +0000 Received: from localhost ([127.0.0.1]:56441 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l69Q3-000213-Sk for submit@debbugs.gnu.org; Sun, 31 Jan 2021 04:53:24 -0500 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:48389) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l69Py-00020U-Tj for 46119@debbugs.gnu.org; Sun, 31 Jan 2021 04:53:20 -0500 X-Originating-IP: 91.129.108.204 Received: from mail.gandi.net (m91-129-108-204.cust.tele2.ee [91.129.108.204]) (Authenticated sender: juri@linkov.net) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 54ECFC0002; Sun, 31 Jan 2021 09:53:10 +0000 (UTC) From: Juri Linkov To: Tino Calancha Subject: Re: bug#46119: 28.0.50; this-error-recenter Organization: LINKOV.NET References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> <87im7eqxij.fsf@gmail.com> <87mtwqqose.fsf@mail.linkov.net> Date: Sun, 31 Jan 2021 11:29:43 +0200 In-Reply-To: (Tino Calancha's message of "Sat, 30 Jan 2021 21:41:30 +0100 (CET)") Message-ID: <87y2g9bgjc.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com 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.5 (-) >> Like the existing command scroll-other-window-down bound to 'S-C-M-v', >> a new command could be named recenter-other-window bound to 'S-C-l'. > I like that. > >> But then no special case is needed for occur/compilation-mode. > > I expected someone will ask that; I should write my reason in the previous > email: I like to see the pulse highlight, as with `next-error-no-select', > that's why I call `next-error-function' here. > [I customize `next-error-highlight' and `next-error-highlight-no-select' to > 3 s] Woundn't such pulse highlighting be useful for all cases, not only compilation and occur? Then you can use: (with-selected-window (other-window-for-scrolling) (recenter-top-bottom) (pulse-momentary-highlight-one-line (point))) and customize pulse-delay to 3 s, and pulse-iterations to 1. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 31 10:57:09 2021 Received: (at 46119) by debbugs.gnu.org; 31 Jan 2021 15:57:09 +0000 Received: from localhost ([127.0.0.1]:57750 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6F64-00074k-IU for submit@debbugs.gnu.org; Sun, 31 Jan 2021 10:57:09 -0500 Received: from mail-wm1-f41.google.com ([209.85.128.41]:54466) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6F62-00074F-9q for 46119@debbugs.gnu.org; Sun, 31 Jan 2021 10:57:08 -0500 Received: by mail-wm1-f41.google.com with SMTP id u14so10560377wml.4 for <46119@debbugs.gnu.org>; Sun, 31 Jan 2021 07:57:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Oh87tznBM3I/DBgjJyuszL5e6XD6GzxkonvI968mPLQ=; b=JYxLzy78Jvg37ucz9NFrjqcQgIUSBA+PoB/J2e0BwMaU7JgZJjReRIe9cSdd1B8tJQ ZL+Y49poAHJ0zVspCCGEjW/uqWBqP+IVBCnXTwJU2wbIy+bM4KIuRhhN8FJ0MjAzDa7T IK8ERif77cQyUlvn+SjYuKn8Xva9nk1ZlJxpFKdHJtEu5YPU6iJYB4+V/rBixZPliI6E x4izx/zqmPOTfcfgs5DNsM66o1QEPO7T60i+1zzFi3hCWNOHQlIYlHW2+kTd/42r1vt5 s/b4L7wlOT+rtHcyw2+IU9x9MjOSGhrpdiDCDJN4ahC5+/JWqEkDZN6MF06Qcq/hs7CO YJSw== 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:date:in-reply-to :message-id:user-agent:mime-version; bh=Oh87tznBM3I/DBgjJyuszL5e6XD6GzxkonvI968mPLQ=; b=rQnQqJB6xwi/Jy5cN31f+tNN2ZGRgtcruopYN74ihzKa8Ivtmy3jE9khbiUM/2b3o2 i1pa2foQzBJPuFH4K+8T5rIS0BGkBkH9KnFhckB/wDIuC75ryxPgeUJ430sUrsehps3f amgb9STuWzD7zYiFpZ1NxShpbhh+SfbXL0ofam+EL/XHxqk1nRuh+bP379D2EGxMJ9vj E6ZfyRghV092LXLP52Gl5gPdyxu2Xj8vtolepIBCCVMKE+p7OGenxba+2vZ4uJF+HpaX nyNsBn7DsqmxteLfNfttBowFNYm6gIAK2Xo7BBDoV5ql0VPhCzJiRScfNm8s15+ZiAb5 HMfA== X-Gm-Message-State: AOAM531x6io/PA5ojTzTUCZpO6cP3xlKDU+kZa188+eif3ettVHU5tBJ 1S+RplP3WCbQWHqej3cuq+M= X-Google-Smtp-Source: ABdhPJxXzeMLEWFTeJf18OvME3STURQMtdGTjWhW18islbhW2s/z478L/VukHhyeMsuoONN6gY7ITQ== X-Received: by 2002:a05:600c:2253:: with SMTP id a19mr11309256wmm.75.1612108620375; Sun, 31 Jan 2021 07:57:00 -0800 (PST) Received: from localhost.example.com ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id k131sm18900932wmb.37.2021.01.31.07.56.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Jan 2021 07:56:59 -0800 (PST) From: Tino Calancha To: Juri Linkov Subject: Re: bug#46119: 28.0.50; this-error-recenter References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> <87im7eqxij.fsf@gmail.com> <87mtwqqose.fsf@mail.linkov.net> <87y2g9bgjc.fsf@mail.linkov.net> Date: Sun, 31 Jan 2021 16:56:58 +0100 In-Reply-To: <87y2g9bgjc.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 31 Jan 2021 11:29:43 +0200") Message-ID: <87o8h5f6b9.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com 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 (-) Juri Linkov writes: >> I like to see the pulse highlight, as with `next-error-no-select', >> that's why I call `next-error-function' here. >> [I customize `next-error-highlight' and `next-error-highlight-no-select' to >> 3 s] > > Woundn't such pulse highlighting be useful for all cases, > not only compilation and occur? Yes, that helps to drive the eye to the position of the line. > Then you can use: > > (with-selected-window (other-window-for-scrolling) > (recenter-top-bottom) > (pulse-momentary-highlight-one-line (point))) > > and customize pulse-delay to 3 s, and pulse-iterations to 1. There is a problem: It is not guaranteed that Occur/Grep will scroll the right target window. Users might have divided the frame in 3 or more windows. For Occur/Grep, to ensure we scroll the right window, we would need to let bind `other-window-scroll-buffer' to the right targets (available at *Occur* and *Grep* as text properties); that part complicates the code. The original implementation, i.e.: + (funcall next-error-function 0 nil) + (recenter-top-bottom arg) + (pop-to-buffer next-error-last-buffer))) automatically takes care of finding the target. I'd prefer adding them as two separated entities: - recenter-other-window: as you have suggested, including the pulse. - recenter-this-error (or this-error-recenter): For occur/grep with the original proposal. Another small benefit is that for occur/grep, the pulse highlight automatically behaves the same as in `next-error-no-select': it matches only the occurrence/error. Do you agree with adding two separated commands? From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 31 16:50:09 2021 Received: (at 46119) by debbugs.gnu.org; 31 Jan 2021 21:50:10 +0000 Received: from localhost ([127.0.0.1]:58235 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6Kbh-0007Lu-Io for submit@debbugs.gnu.org; Sun, 31 Jan 2021 16:50:09 -0500 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:16923) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6Kbe-0007L4-AQ for 46119@debbugs.gnu.org; Sun, 31 Jan 2021 16:50:08 -0500 X-Originating-IP: 91.129.108.204 Received: from mail.gandi.net (m91-129-108-204.cust.tele2.ee [91.129.108.204]) (Authenticated sender: juri@linkov.net) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 79620240002; Sun, 31 Jan 2021 21:49:58 +0000 (UTC) From: Juri Linkov To: Tino Calancha Subject: Re: bug#46119: 28.0.50; this-error-recenter Organization: LINKOV.NET References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> <87im7eqxij.fsf@gmail.com> <87mtwqqose.fsf@mail.linkov.net> <87y2g9bgjc.fsf@mail.linkov.net> <87o8h5f6b9.fsf@gmail.com> Date: Sun, 31 Jan 2021 23:43:24 +0200 In-Reply-To: <87o8h5f6b9.fsf@gmail.com> (Tino Calancha's message of "Sun, 31 Jan 2021 16:56:58 +0100") Message-ID: <87sg6gbx4z.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com 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.5 (-) >> (with-selected-window (other-window-for-scrolling) >> (recenter-top-bottom) >> (pulse-momentary-highlight-one-line (point))) >> >> and customize pulse-delay to 3 s, and pulse-iterations to 1. > > There is a problem: It is not guaranteed that > Occur/Grep will scroll the right target window. Users might have > divided the frame in 3 or more windows. > > For Occur/Grep, to ensure we scroll the right window, we would need to > let bind `other-window-scroll-buffer' to the right targets (available at > *Occur* and *Grep* as text properties); that part complicates the code. This is exactly what we need for bug#45688 where other-window-scroll-buffer could help to find the previous-window where the previous error or grep hit was displayed, and display the next error in the same window. > The original implementation, i.e.: > + (funcall next-error-function 0 nil) > + (recenter-top-bottom arg) > + (pop-to-buffer next-error-last-buffer))) > > automatically takes care of finding the target. > > I'd prefer adding them as two separated entities: > - recenter-other-window: > as you have suggested, including the pulse. > > - recenter-this-error (or this-error-recenter): > For occur/grep with the original proposal. > > Another small benefit is that for occur/grep, the pulse highlight > automatically behaves the same as in `next-error-no-select': > it matches only the occurrence/error. > > Do you agree with adding two separated commands? Maybe two commands is fine. Then the users can decide what command better suites user's needs. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 01 12:24:13 2021 Received: (at 46119) by debbugs.gnu.org; 1 Feb 2021 17:24:13 +0000 Received: from localhost ([127.0.0.1]:33048 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6cvs-0003to-RT for submit@debbugs.gnu.org; Mon, 01 Feb 2021 12:24:12 -0500 Received: from relay11.mail.gandi.net ([217.70.178.231]:35649) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6cvr-0003tU-FW for 46119@debbugs.gnu.org; Mon, 01 Feb 2021 12:24:11 -0500 Received: from mail.gandi.net (m91-129-108-204.cust.tele2.ee [91.129.108.204]) (Authenticated sender: juri@linkov.net) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 987ED100017; Mon, 1 Feb 2021 17:24:04 +0000 (UTC) From: Juri Linkov To: Tino Calancha Subject: Re: bug#46119: 28.0.50; this-error-recenter Organization: LINKOV.NET References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> <87im7eqxij.fsf@gmail.com> <87mtwqqose.fsf@mail.linkov.net> <87y2g9bgjc.fsf@mail.linkov.net> <87o8h5f6b9.fsf@gmail.com> <87sg6gbx4z.fsf@mail.linkov.net> Date: Mon, 01 Feb 2021 19:19:12 +0200 In-Reply-To: <87sg6gbx4z.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 31 Jan 2021 23:43:24 +0200") Message-ID: <87k0rr97jj.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.4 (/) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com 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.4 (-) >> Do you agree with adding two separated commands? > > Maybe two commands is fine. Then the users can decide what command > better suites user's needs. Actually everything is much simpler. The hint is in the default value of 'xref-after-jump-hook' that contains 'recenter' by default. So when you customize 'xref-after-jump-hook' to the value: (recenter-top-bottom xref-pulse-momentarily) you can use 'C-o' to recenter another window from xref buffer, exactly like 'C-l' does for the selected window. The same way you can add: (add-hook 'next-error-hook 'recenter-top-bottom) then use 'C-o' in any next-error capable buffer (compilation, occur, ...) to recenter its corresponding window exactly like you want. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 01 13:45:57 2021 Received: (at 46119) by debbugs.gnu.org; 1 Feb 2021 18:45:57 +0000 Received: from localhost ([127.0.0.1]:33198 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6eCz-00082j-FX for submit@debbugs.gnu.org; Mon, 01 Feb 2021 13:45:57 -0500 Received: from mail-wm1-f54.google.com ([209.85.128.54]:34178) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6eCy-00082U-3c for 46119@debbugs.gnu.org; Mon, 01 Feb 2021 13:45:56 -0500 Received: by mail-wm1-f54.google.com with SMTP id o10so470677wmc.1 for <46119@debbugs.gnu.org>; Mon, 01 Feb 2021 10:45:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=ETvS9gDgufAePK2M3zdt5nqMuUziFZVhID74uuwaeFE=; b=Y/DUknuYtEifW6HGdXkn13q5QJ8XnOYDCd2aUuaYr5F7J19O/US4q60ciVuUQP2cmI bThKdMZ/xz5ql7f0ejh6e2J7P94Asofq0Wwv1ojK0/dnREhmCDGdYrYuEQsflNDoHEFt c0trjah6Hvk+eX8e51HN+VjsadTpKpnDRueJqMiUW6KXq6Mxk6gKLCNLV04G+4493Djc tJu1E1VSuv32Q4rhKkbyjg1Xt7zcDn85q4caDQI9Q9l/xa6fdgo48tkFMRf4wKZjsAGM oNpFgHfUW9eU4vrjdftuDSD49MYYa+QBSF/7kmAWWgUsmf5KQ/aEx/QI1w03C6xb6Wwu DBCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=ETvS9gDgufAePK2M3zdt5nqMuUziFZVhID74uuwaeFE=; b=YghgoJcktgStWgY27Y0BbBB6nfY9MLrVfG8Iv19UOBIVsoK4ICZUcCd0pkELrqLXiH 2ZNKBobUCSrwTEb2QBQcAu6HBX69QS3bTJcF8IsTBpbtkhxanTniCNcwnISDt0+cQze+ hGaAWVaOuXA2RqKX7J5FSvrEb61vJSZf5mcWT7o4dWvl6jrAUWsVZB56UhVKRNw4KEKr BqZKv51fQE4yz+VvH4H72QEQ1rAMA0O8cT9caH/1eqQ31CIYWe0bD+bo0+2dAmNuZM9H y4XDD9Y5n5bHADcYcfS7aejOW0+n7qbjLQR5PxOfup+ENKqvwTCA9mLCM/XnftC2n6sC /n8Q== X-Gm-Message-State: AOAM533/byumGT6UAUFbX8KIOxz4XQlQBCWHAPeGAqR5OLU4LevEpKVA H4yyH25X630Ca+dD29wDMr0= X-Google-Smtp-Source: ABdhPJygJ9HM8k0iP6ZM3GslZ1ftZ5euQMNADjt+anlSVR5umU6aPvNXPvgBgLRsKClWgm2xpIBRjQ== X-Received: by 2002:a05:600c:230e:: with SMTP id 14mr199504wmo.161.1612205150227; Mon, 01 Feb 2021 10:45:50 -0800 (PST) Received: from [10.200.4.109] ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id f7sm7299646wre.78.2021.02.01.10.45.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 10:45:49 -0800 (PST) From: Tino Calancha X-Google-Original-From: Tino Calancha Date: Mon, 1 Feb 2021 19:45:45 +0100 (CET) To: Juri Linkov Subject: Re: bug#46119: 28.0.50; this-error-recenter In-Reply-To: <87k0rr97jj.fsf@mail.linkov.net> Message-ID: <8242543f-d690-859a-3156-a024c8a1ae51@gmail.com> References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> <87im7eqxij.fsf@gmail.com> <87mtwqqose.fsf@mail.linkov.net> <87y2g9bgjc.fsf@mail.linkov.net> <87o8h5f6b9.fsf@gmail.com> <87sg6gbx4z.fsf@mail.linkov.net> <87k0rr97jj.fsf@mail.linkov.net> MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com, Tino Calancha 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 Mon, 1 Feb 2021, Juri Linkov wrote: > Actually everything is much simpler. The hint is in the default value > of 'xref-after-jump-hook' that contains 'recenter' by default. > So when you customize 'xref-after-jump-hook' to the value: > > (recenter-top-bottom xref-pulse-momentarily) > > you can use 'C-o' to recenter another window from xref buffer, > exactly like 'C-l' does for the selected window. > > The same way you can add: > > (add-hook 'next-error-hook 'recenter-top-bottom) > > then use 'C-o' in any next-error capable buffer (compilation, occur, ...) > to recenter its corresponding window exactly like you want. Thank you, that's nice. I still see superior adding a new command for 2 resons. - I like to provide the binding by default to the users; same as we do with `n' or `p' to navigate the matches without selecting the buffer. It is quite convenient. - The hook above doesn't accept a prefix. With the original proposal I can do: 2 l ; scroll the current displayed match at the second line. This become handy when you want to inspect the context of the match. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 01 14:17:48 2021 Received: (at 46119) by debbugs.gnu.org; 1 Feb 2021 19:17:48 +0000 Received: from localhost ([127.0.0.1]:33251 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6ehn-0000PL-Tf for submit@debbugs.gnu.org; Mon, 01 Feb 2021 14:17:48 -0500 Received: from mail-wr1-f53.google.com ([209.85.221.53]:46857) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6ehe-0000P1-W2 for 46119@debbugs.gnu.org; Mon, 01 Feb 2021 14:17:45 -0500 Received: by mail-wr1-f53.google.com with SMTP id q7so17837222wre.13 for <46119@debbugs.gnu.org>; Mon, 01 Feb 2021 11:17:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=wWFdbJEW4EceV8sMaTy6SzQZYlK0XHP9sdAe+o224e4=; b=C11Ir0it5MMKhoNCoySy55EPrjh9jQBA0cPODcMViPAHaHDWx575I1QhTQPgMtpMsf FRxnK61W/1AhtZ/CcR4Jz9VsT2VHFE0Waa0GyTGNufHYw7UdL19HgUXPsUWetk7uDgNu 1GX5lZTTuOhIkRntQx1frof7Z9Kk7D6DFeLsZfiIc/Rt2cB+DY8U+RzV0MLhirU4QQDQ iZ9coD180aQ+IPitdUnL+fGqa0XF7E7hw33T1PVDCQHJcejekh13GtCZPl76yb2JmWmb 9drbEIA7RCk0HtLcvH9eop2YFfgtRBGaasbdW897A/m+2UEERaZperAfAoo7LWXrsMJj PjNA== 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:date:in-reply-to :message-id:user-agent:mime-version; bh=wWFdbJEW4EceV8sMaTy6SzQZYlK0XHP9sdAe+o224e4=; b=YD2oUsGUKqunpfp2o7p2HbvdA05raUcV3hnv0nlhA73Nf4fesIGFpJsAqsGLxgz/E0 Tp6CGeH3BA/xv6eG39JDYRURPmOssBqxOSCORX5DXJftHqW4ekdGYFYTvqYtVUu+VNQc KB+i5W8O5OhoSZIq5lXFd3zeBPUW1wkrJwJFDBmmFsE6L9EAiRQQDHQHlXwx/nIRCuGk MTjJKDwl8VbHXyvEXBPYhhY1p8RZ+hbM+fpFMbBp/u1s/kkJDsCuANjNwbHkY9tW5cq5 zrSmsrWSJVITpRHDlMC6mhuekpoEa3eP/6qv56m5A/ABiDQCPWQSV13SAoULMYeaJXJA dU6w== X-Gm-Message-State: AOAM531tINK2WLsxam7dzjgvuJbBZOuX1Zl6GYa5HWSGfJGVTb/mMWZW IPnFVEMmaXO3ypdpw6iqd7c= X-Google-Smtp-Source: ABdhPJychBH5fBkUXwkLRQ7iZ1GmqPw0kj3XRQD5xh8lbVmvkW1S5LPImAbzZeEXB+aItgQpYVVl+Q== X-Received: by 2002:a5d:414f:: with SMTP id c15mr19938393wrq.42.1612207053125; Mon, 01 Feb 2021 11:17:33 -0800 (PST) Received: from localhost.example.com ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id r15sm28154618wrj.61.2021.02.01.11.17.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Feb 2021 11:17:32 -0800 (PST) From: Tino Calancha To: Juri Linkov Subject: Re: bug#46119: 28.0.50; this-error-recenter References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> <87im7eqxij.fsf@gmail.com> <87mtwqqose.fsf@mail.linkov.net> <87y2g9bgjc.fsf@mail.linkov.net> <87o8h5f6b9.fsf@gmail.com> <87sg6gbx4z.fsf@mail.linkov.net> Date: Mon, 01 Feb 2021 20:17:31 +0100 In-Reply-To: <87sg6gbx4z.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 31 Jan 2021 23:43:24 +0200") Message-ID: <874kivlhro.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com 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 (-) Juri Linkov writes: >> Do you agree with adding two separated commands? > > Maybe two commands is fine. Then the users can decide what command > better suites user's needs. I am posting now the approach using two new commands: --8<-----------------------------cut here---------------start------------->8--- commit 16ea65701456ce7071f56d337f518d49a03e723f Author: Tino Calancha Date: Mon Feb 1 20:07:22 2021 +0100 Add command to recenter errors from Occur/Grep buffers To scroll up/down the current displayed occurrence/error without abandon the Occur/Grep buffer. Add also a command 'recenter-other-window' to recenter the other window from any kind of buffer. * lisp/window.el (recenter-other-window): New command. Bind recenter-other-window to M-C-l. * lisp/simple.el (this-error-recenter): New command. * lisp/progmodes/grep.el (grep-mode-map): Delete bidings for n and p. * lisp/progmodes/compile.el (compilation-minor-mode-map): Move here the n and p bindings. Bind `this-error-recenter' to l. * lisp/replace.el (occur-mode-map): Same. * etc/NEWS (Changes in Specialized Modes and Packages in Emacs 28.1): Announce the changes. diff --git a/etc/NEWS b/etc/NEWS index e038076e96..dbe53b3f29 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -85,6 +85,8 @@ useful on systems such as FreeBSD which ships only with "etc/termcap". * Changes in Emacs 28.1 +** The new command 'recenter-other-window' is bound to 'M-C-l'. + ** The new NonGNU ELPA archive is enabled by default alongside GNU ELPA ** Minibuffer scrolling is now conservative by default. @@ -454,9 +456,15 @@ applied when the option 'tab-line-tab-face-functions' is so-configured. That option may also be used to customize tab-line faces in other ways. -** New bindings in occur-mode, 'next-error-no-select' bound to 'n' and +** Occur mode + +*** New bindings in occur-mode, 'next-error-no-select' bound to 'n' and 'previous-error-no-select' bound to 'p'. +*** The new command 'this-error-recenter', bound to 'l', recenters the +current displayed occurrence from a Occur buffer and the current +displayed error in a compilation buffer. + ** EIEIO +++ diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 94e4f3c6fa..1031f835f8 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -2073,6 +2073,10 @@ compilation-minor-mode-map (define-key map "\M-p" 'compilation-previous-error) (define-key map "\M-{" 'compilation-previous-file) (define-key map "\M-}" 'compilation-next-file) + (define-key map "n" 'next-error-no-select) + (define-key map "p" 'previous-error-no-select) + (define-key map "l" 'this-error-recenter) + (define-key map "g" 'recompile) ; revert ;; Set up the menu-bar (define-key map [menu-bar compilation] diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 1a8435fde3..d6ee8bb423 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -275,8 +275,6 @@ grep-mode-map (define-key map "\C-c\C-f" 'next-error-follow-minor-mode) (define-key map "\r" 'compile-goto-error) ;; ? - (define-key map "n" 'next-error-no-select) - (define-key map "p" 'previous-error-no-select) (define-key map "{" 'compilation-previous-file) (define-key map "}" 'compilation-next-file) (define-key map "\t" 'compilation-next-error) diff --git a/lisp/replace.el b/lisp/replace.el index db5b340631..bd3a96a26e 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -1135,6 +1135,7 @@ occur-mode-map (define-key map "\C-o" 'occur-mode-display-occurrence) (define-key map "n" 'next-error-no-select) (define-key map "p" 'previous-error-no-select) + (define-key map "l" 'this-error-recenter) (define-key map "\M-n" 'occur-next) (define-key map "\M-p" 'occur-prev) (define-key map "r" 'occur-rename-buffer) diff --git a/lisp/simple.el b/lisp/simple.el index c878fdab92..31a2ac3c88 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -496,6 +496,16 @@ next-error-message-highlight (overlay-put ol 'window (get-buffer-window)) (setf next-error--message-highlight-overlay ol))))) +(defun this-error-recenter (&optional arg) + "Recenter the current displayed error in the `next-error' buffer." + (interactive "P") + (if (not (or (eq major-mode 'occur-mode) (derived-mode-p 'compilation-mode))) + (user-error "This command is for *Occur* or *Grep* buffers") + (funcall next-error-function 0 nil) + (recenter-top-bottom arg) + (pop-to-buffer next-error-last-buffer))) + + ;;; diff --git a/lisp/window.el b/lisp/window.el index 0a37d16273..c75ed90ef5 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -9771,6 +9771,19 @@ recenter-top-bottom (define-key global-map [?\C-l] 'recenter-top-bottom) +(defun recenter-other-window (&optional arg) + "Call `recenter-top-bottom' in the other window. + +A prefix argument is handled like `recenter': + With numeric prefix ARG, move current line to window-line ARG. + With plain `C-u', move current line to window center." + (interactive "P") + (with-selected-window (other-window-for-scrolling) + (recenter-top-bottom arg) + (pulse-momentary-highlight-one-line (point)))) + +(define-key global-map [?\M-\C-l] 'recenter-other-window) + (defun move-to-window-line-top-bottom (&optional arg) "Position point relative to window. --8<-----------------------------cut here---------------end--------------->8--- From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 02 12:19:23 2021 Received: (at 46119) by debbugs.gnu.org; 2 Feb 2021 17:19:23 +0000 Received: from localhost ([127.0.0.1]:36111 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6zKk-0004ZO-4u for submit@debbugs.gnu.org; Tue, 02 Feb 2021 12:19:23 -0500 Received: from relay11.mail.gandi.net ([217.70.178.231]:35849) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6zKf-0004Z2-FU for 46119@debbugs.gnu.org; Tue, 02 Feb 2021 12:19:20 -0500 Received: from mail.gandi.net (m91-129-108-204.cust.tele2.ee [91.129.108.204]) (Authenticated sender: juri@linkov.net) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 361B5100002; Tue, 2 Feb 2021 17:19:08 +0000 (UTC) From: Juri Linkov To: Tino Calancha Subject: Re: bug#46119: 28.0.50; this-error-recenter Organization: LINKOV.NET References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> <87im7eqxij.fsf@gmail.com> <87mtwqqose.fsf@mail.linkov.net> <87y2g9bgjc.fsf@mail.linkov.net> <87o8h5f6b9.fsf@gmail.com> <87sg6gbx4z.fsf@mail.linkov.net> <87k0rr97jj.fsf@mail.linkov.net> <8242543f-d690-859a-3156-a024c8a1ae51@gmail.com> Date: Tue, 02 Feb 2021 19:04:06 +0200 In-Reply-To: <8242543f-d690-859a-3156-a024c8a1ae51@gmail.com> (Tino Calancha's message of "Mon, 1 Feb 2021 19:45:45 +0100 (CET)") Message-ID: <87wnvqafyx.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.4 (/) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com 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.4 (-) >> (add-hook 'next-error-hook 'recenter-top-bottom) >> >> then use 'C-o' in any next-error capable buffer (compilation, occur, ...) >> to recenter its corresponding window exactly like you want. > > Thank you, that's nice. I still see superior adding a new command for > 2 resons. > > - I like to provide the binding by default to the users; same as we do with > `n' or `p' to navigate the matches without selecting the buffer. It is > quite convenient. > > - The hook above doesn't accept a prefix. With the original proposal I can > do: > 2 l ; scroll the current displayed match at the second line. > This become handy when you want to inspect the context of the match. Is it possible to add a prefix to `C-o'? What I'm worried about is two commands `C-o' and `l' doing the same thing. Or maybe these commands are used for different purposes? From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 02 12:19:23 2021 Received: (at 46119) by debbugs.gnu.org; 2 Feb 2021 17:19:23 +0000 Received: from localhost ([127.0.0.1]:36113 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6zKl-0004ZU-5g for submit@debbugs.gnu.org; Tue, 02 Feb 2021 12:19:23 -0500 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:52673) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l6zKi-0004Z6-Dt for 46119@debbugs.gnu.org; Tue, 02 Feb 2021 12:19:22 -0500 X-Originating-IP: 91.129.108.204 Received: from mail.gandi.net (m91-129-108-204.cust.tele2.ee [91.129.108.204]) (Authenticated sender: juri@linkov.net) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 74A2424000E; Tue, 2 Feb 2021 17:19:12 +0000 (UTC) From: Juri Linkov To: Tino Calancha Subject: Re: bug#46119: 28.0.50; this-error-recenter Organization: LINKOV.NET References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> <87im7eqxij.fsf@gmail.com> <87mtwqqose.fsf@mail.linkov.net> <87y2g9bgjc.fsf@mail.linkov.net> <87o8h5f6b9.fsf@gmail.com> <87sg6gbx4z.fsf@mail.linkov.net> <874kivlhro.fsf@gmail.com> Date: Tue, 02 Feb 2021 19:05:10 +0200 In-Reply-To: <874kivlhro.fsf@gmail.com> (Tino Calancha's message of "Mon, 01 Feb 2021 20:17:31 +0100") Message-ID: <87v9baafyp.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.4 (/) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com 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.4 (-) > I am posting now the approach using two new commands: > > * lisp/window.el (recenter-other-window): New command. > Bind recenter-other-window to M-C-l. M-C-l can't be used because M-C-l is already bound to 'reposition-window'. Only S-M-C-l is free. > * lisp/simple.el (this-error-recenter): New command. Wouldn't a better name be recenter-current-error since existing name is compilation-current-error? > +(defun this-error-recenter (&optional arg) > + "Recenter the current displayed error in the `next-error' buffer." > + (interactive "P") > + (if (not (or (eq major-mode 'occur-mode) (derived-mode-p 'compilation-mode))) > + (user-error "This command is for *Occur* or *Grep* buffers") This is bad restriction that needs to be removed. > + (funcall next-error-function 0 nil) > + (recenter-top-bottom arg) > + (pop-to-buffer next-error-last-buffer))) `(pop-to-buffer next-error-last-buffer)' has problems and should be replaced with `save-selected-window'. Please see the commit 072b4c679dfd5528e74849cad18246730a991933 and bug#32607 for explanations. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 02 16:10:29 2021 Received: (at 46119) by debbugs.gnu.org; 2 Feb 2021 21:10:29 +0000 Received: from localhost ([127.0.0.1]:36271 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l72wO-0003jd-VE for submit@debbugs.gnu.org; Tue, 02 Feb 2021 16:10:29 -0500 Received: from mail-ej1-f54.google.com ([209.85.218.54]:43520) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l72wM-0003jQ-Tn for 46119@debbugs.gnu.org; Tue, 02 Feb 2021 16:10:28 -0500 Received: by mail-ej1-f54.google.com with SMTP id y9so10575792ejp.10 for <46119@debbugs.gnu.org>; Tue, 02 Feb 2021 13:10:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=ZTuWqoBhTFDHplhjC8A5YVWbDoxGOwy32PalfBAy2iQ=; b=rKe4DazKoBAeX5VkX+Guz+whbfBRX/IvHZjkLhHIydwxn5ufeyA2ayTPiP1BeQQsP1 8wWX+dYTKGd/ZFcwKUgNPnGGqF8c3dJEVDyXxzBDGmtLayiqvQsr7pgWD7Lm7Xib4uBR EKI+BisTKS7JtxvoymH/QW8e7oAtLbO8+CU+A1RctIRp4uBN2BEvevJVXURU17sdITMK 0EjlRcY621B01IhdG1IT6G3f/JXPu3LypPjRVQoqVPNEKqhcJfeNMe1mnZXsUnYGt3pF cZLR5gA39yylteYV0JIW6BygC2V2yjNwYsiX+lsDWaTT4uvXIPWRP2720SaagikxMQTn P8DA== 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:date:in-reply-to :message-id:user-agent:mime-version; bh=ZTuWqoBhTFDHplhjC8A5YVWbDoxGOwy32PalfBAy2iQ=; b=MYbRK3gBQ7HeCpQ35Qpdi0wRzdr1FT/W0ztnWNOB9RDPmWmL3ANyMaH9MdF99uA87E 87QQ3r7AevGsob/z3rYYYrtYK4D0P7H/vL+DQbqPm0uYb3yziz4a7qsWtLbUGr1YaVae gI0mfJ+8WLTrd/vRYRZ64f/kC01dSJUULONCcyD4C+9cmssywroXqw9G289rArInaEcl E6LwDsRyqnelWdPOW/jCPkNXAiAtg/yEQws4lLG04neL18/2+x/hjL20xCA8yqQrBqCM 36Ecnk/Y81f08OSlAsr8yG8ZzpwgmJ9OUkQ/t4Y8+Y4R2dEmcLYvYd7sur+xvg/1sx/+ MZnA== X-Gm-Message-State: AOAM531ewHZRoSVSGAEVk2ialhvDTcYmdjwtdiI9UNB/EoXI9gKgEnwJ M5s8cBqeuFtC86eSbX3JBtA= X-Google-Smtp-Source: ABdhPJyF38/5oySeHp72NZDghFppzobrp7EsE7JlHux0poQqL0sKTXE4UKzaOaE2ln5GZJQs24wxzg== X-Received: by 2002:a17:906:2583:: with SMTP id m3mr23814382ejb.499.1612300221142; Tue, 02 Feb 2021 13:10:21 -0800 (PST) Received: from localhost.example.com ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id dt17sm13565ejb.70.2021.02.02.13.10.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Feb 2021 13:10:20 -0800 (PST) From: Tino Calancha To: Juri Linkov Subject: Re: bug#46119: 28.0.50; this-error-recenter References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> <87im7eqxij.fsf@gmail.com> <87mtwqqose.fsf@mail.linkov.net> <87y2g9bgjc.fsf@mail.linkov.net> <87o8h5f6b9.fsf@gmail.com> <87sg6gbx4z.fsf@mail.linkov.net> <87k0rr97jj.fsf@mail.linkov.net> <8242543f-d690-859a-3156-a024c8a1ae51@gmail.com> <87wnvqafyx.fsf@mail.linkov.net> Date: Tue, 02 Feb 2021 22:10:19 +0100 In-Reply-To: <87wnvqafyx.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 02 Feb 2021 19:04:06 +0200") Message-ID: <87tuquqipw.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com 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 (-) Juri Linkov writes: > Is it possible to add a prefix to `C-o'? What I'm worried about is > two commands `C-o' and `l' doing the same thing. Or maybe these > commands are used for different purposes? I see your point. After adding the new command, `C-o' becomes an idempotent subset of `l'. Conceptually they are still different things. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 02 16:16:14 2021 Received: (at 46119) by debbugs.gnu.org; 2 Feb 2021 21:16:15 +0000 Received: from localhost ([127.0.0.1]:36277 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l731y-0003sC-Mm for submit@debbugs.gnu.org; Tue, 02 Feb 2021 16:16:14 -0500 Received: from mail-wm1-f51.google.com ([209.85.128.51]:34519) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l731w-0003ry-KB for 46119@debbugs.gnu.org; Tue, 02 Feb 2021 16:16:14 -0500 Received: by mail-wm1-f51.google.com with SMTP id o10so2709700wmc.1 for <46119@debbugs.gnu.org>; Tue, 02 Feb 2021 13:16:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=fafJA+UcJMQZAnva4gSrexSUpQipbRFYEwNO68/aI48=; b=ZfDgKF0n3zX0I3AV5isn7D3UYtMfYcMKTAhagkEBvGK83CR9Ce33KbMjhUp7MyRN0X yCo+q5gFdi5xqITpQW+CZXNBwlEasiWIZNIDq/itvNiJfhk00eCQMsbRCMiwCf/taAtt STLVIWEu9T/uLfnNWvAP3iDqOT90kW8f+cRf3XtnRL2hmsPARFJUjcwgGYu0P9FEZSec rkI6jigeRPrztcMHgb6OswQ4C+1qPTC+2+8W4LObnMahXZdyRP3gPKXtqn2t7O5DiNGh 1yzhC3z6k94/t6lNHFm8a7IbV0Nspee5fqRq1DnLt/JKCwUGlh7dgI+UV/t+2YL4J2gN oFQQ== 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:date:in-reply-to :message-id:user-agent:mime-version; bh=fafJA+UcJMQZAnva4gSrexSUpQipbRFYEwNO68/aI48=; b=k/r/ovoTq6LW5IIfm3rvm0Cq1s8nVdbqhuS2RXuLMJ1K32xVrUMMmP1bxuz6F416KD uq1XtkHU4TQq0OGmQ/rNLGOJ6CROIr47wv5H/Px9HV1+SmXdRCqJc+cdoH+9iFijTQ4i TtZbCxjIQtmW8gpuqTzqR0afsxl3S8631xlo7jM3OAL81WBNbMOuut+V/qXnWOtKOcN8 zcNhg2dlAh6sGKc+2mj8fC+qCDaOR3swiFyXgEqX8G1mFe8dntx2qQ/zAnqnhnyH6nQh jFBqLekiE2nMPT9TAX4u/sURWhXsrTWPygsxWcTqcsAXzyMPcuPhWXpmvabqFOzLGUOI cz/g== X-Gm-Message-State: AOAM530OlD3tRhm9t+vrRdZyHL38+ed1pjAcCJn4E5BYE35lwd8zOVh8 CYBGk2q6Ncc8/8ywAl2ZF1E= X-Google-Smtp-Source: ABdhPJx7bGYTMXM97FlmKbM7F13kEHeHJa5OSEvCs1ib+ARpN49zzhmixpgIJ0riJ22QGEchEXf72A== X-Received: by 2002:a7b:c77a:: with SMTP id x26mr5322384wmk.143.1612300566641; Tue, 02 Feb 2021 13:16:06 -0800 (PST) Received: from localhost.example.com ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id i64sm3727634wmi.19.2021.02.02.13.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Feb 2021 13:16:05 -0800 (PST) From: Tino Calancha To: Juri Linkov Subject: Re: bug#46119: 28.0.50; this-error-recenter References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> <87im7eqxij.fsf@gmail.com> <87mtwqqose.fsf@mail.linkov.net> <87y2g9bgjc.fsf@mail.linkov.net> <87o8h5f6b9.fsf@gmail.com> <87sg6gbx4z.fsf@mail.linkov.net> <874kivlhro.fsf@gmail.com> <87v9baafyp.fsf@mail.linkov.net> Date: Tue, 02 Feb 2021 22:16:05 +0100 In-Reply-To: <87v9baafyp.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 02 Feb 2021 19:05:10 +0200") Message-ID: <87r1lyqiga.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com 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 (-) Juri Linkov writes: >> * lisp/window.el (recenter-other-window): New command. >> Bind recenter-other-window to M-C-l. > > M-C-l can't be used because M-C-l is already bound to 'reposition-window'. > Only S-M-C-l is free. Right, my bad. Ok, I will use S-M-C-l then. >> * lisp/simple.el (this-error-recenter): New command. > > Wouldn't a better name be recenter-current-error > since existing name is compilation-current-error? Agreed. >> +(defun this-error-recenter (&optional arg) >> + "Recenter the current displayed error in the `next-error' buffer." >> + (interactive "P") >> + (if (not (or (eq major-mode 'occur-mode) (derived-mode-p 'compilation-mode))) >> + (user-error "This command is for *Occur* or *Grep* buffers") > > This is bad restriction that needs to be removed. OK >> + (funcall next-error-function 0 nil) >> + (recenter-top-bottom arg) >> + (pop-to-buffer next-error-last-buffer))) > > `(pop-to-buffer next-error-last-buffer)' has problems > and should be replaced with `save-selected-window'. > > Please see the commit 072b4c679dfd5528e74849cad18246730a991933 > and bug#32607 for explanations. I must set the buffer with the locus current, otherwise `recenter' rises an error: (defun recenter-current-error (&optional arg) "Recenter the current displayed error in the `next-error' buffer." (interactive "P") (save-selected-window (let ((next-error-highlight next-error-highlight-no-select) (display-buffer-overriding-action '(nil (inhibit-same-window . t)))) (next-error 0) (set-buffer (window-buffer)) (recenter-top-bottom arg)))) From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 03 04:41:43 2021 Received: (at 46119) by debbugs.gnu.org; 3 Feb 2021 09:41:43 +0000 Received: from localhost ([127.0.0.1]:36832 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l7EfP-0005QS-6t for submit@debbugs.gnu.org; Wed, 03 Feb 2021 04:41:43 -0500 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:34379) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l7EfM-0005Q5-M6 for 46119@debbugs.gnu.org; Wed, 03 Feb 2021 04:41:41 -0500 X-Originating-IP: 91.129.108.204 Received: from mail.gandi.net (m91-129-108-204.cust.tele2.ee [91.129.108.204]) (Authenticated sender: juri@linkov.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id DFB80E001C; Wed, 3 Feb 2021 09:41:32 +0000 (UTC) From: Juri Linkov To: Tino Calancha Subject: Re: bug#46119: 28.0.50; this-error-recenter Organization: LINKOV.NET References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> <87im7eqxij.fsf@gmail.com> <87mtwqqose.fsf@mail.linkov.net> <87y2g9bgjc.fsf@mail.linkov.net> <87o8h5f6b9.fsf@gmail.com> <87sg6gbx4z.fsf@mail.linkov.net> <874kivlhro.fsf@gmail.com> <87v9baafyp.fsf@mail.linkov.net> <87r1lyqiga.fsf@gmail.com> Date: Wed, 03 Feb 2021 10:58:55 +0200 In-Reply-To: <87r1lyqiga.fsf@gmail.com> (Tino Calancha's message of "Tue, 02 Feb 2021 22:16:05 +0100") Message-ID: <87h7mtsdxs.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.4 (/) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com 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.4 (-) > I must set the buffer with the locus current, otherwise `recenter' rises > an error: > > (defun recenter-current-error (&optional arg) > "Recenter the current displayed error in the `next-error' buffer." > (interactive "P") > (save-selected-window > (let ((next-error-highlight next-error-highlight-no-select) > (display-buffer-overriding-action > '(nil (inhibit-same-window . t)))) > (next-error 0) > (set-buffer (window-buffer)) > (recenter-top-bottom arg)))) Would it be possible to avoid code duplication between next-error-no-select and recenter-current-error? From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 03 08:03:19 2021 Received: (at 46119) by debbugs.gnu.org; 3 Feb 2021 13:03:19 +0000 Received: from localhost ([127.0.0.1]:37233 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l7HoU-00059q-RL for submit@debbugs.gnu.org; Wed, 03 Feb 2021 08:03:19 -0500 Received: from mail-wr1-f47.google.com ([209.85.221.47]:37995) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l7HoT-00059a-Jl for 46119@debbugs.gnu.org; Wed, 03 Feb 2021 08:03:18 -0500 Received: by mail-wr1-f47.google.com with SMTP id b3so6056143wrj.5 for <46119@debbugs.gnu.org>; Wed, 03 Feb 2021 05:03:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=FDsTPhzwHz778XgzAftqKm2y9Nr4rAF/NprnRD73278=; b=gv4aDki/+Xj+YvkMSs7STExpqrzajg5APcv2NjxqUhjiew3rPmSw2+PB/ndu8Sk+Sy jgVx5CCiwYTFpLI2EqC+wvMfiv964p/3DTNXAI0KifnPRug2E/l6hj90RrQLQgKx/LNq 33fPK6vlwQeoxmxUNC5gF+G/891l74bs28ndvDqkHwotj1/lmFQ3xYWV/LB2v1N+5f4p 4J3nRk69gQAbnTIz9lAxwKrwgEcl70KeBX12x79on882AMxm9699js8Am4r0OwaUmt8a UwLwmOBHnyX/U8vjnaicZTyeC7rsOe7nlDV5nP5bIfS6j+AIhvX/waWJQvtff0k6Jytv DDOw== 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:date:in-reply-to :message-id:user-agent:mime-version; bh=FDsTPhzwHz778XgzAftqKm2y9Nr4rAF/NprnRD73278=; b=lg8A3P/A8vnGJo+r0vO8z5gd5DI2O1KW5qVlWzfL/ngtoaDkrjVF+OTKqsaVS6JNY6 aslNFgydJI6IA07dRXjj67qbTV3uIOSrmvAMbhCMrsI06pVXiQxSVt6xIDjobUFwAW10 JNKLSAEJFsBzqy4wwBEEforFDml1BpFQYBfu7YRt3gfd0Tlk+Pg6l6Sb/dU0/AQmbYuq aG17RBd6OZ/rcVyRd9uDutWisyyGuIFAl0erWZ/2orgurT1GZmZ/W1DM4WRj7LH3vklc pQE7ihUM0wu1LuYBr3kbrNWa20lGhJ5w/tklVNGo7RycbMMsmUZqNClFAhePvgwY/0A3 uQRQ== X-Gm-Message-State: AOAM530Qwgd43GVWjkrzdSYiuWjbZ89tmw7qwQAvOvVB7VGxbeeKBAHC edTqFML7/J+MH5xjdKGN61s= X-Google-Smtp-Source: ABdhPJzjkp+if0wJbG+kSbgW2UbuH6YFRG6m/VVJRA+VhrVFMtdWPpkbU30hZ7fD7yPnDxyloZ2zFA== X-Received: by 2002:adf:ecc1:: with SMTP id s1mr3612967wro.146.1612357391737; Wed, 03 Feb 2021 05:03:11 -0800 (PST) Received: from localhost.example.com ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id m24sm2727781wmi.24.2021.02.03.05.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 05:03:10 -0800 (PST) From: Tino Calancha To: Juri Linkov Subject: Re: bug#46119: 28.0.50; this-error-recenter References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> <87im7eqxij.fsf@gmail.com> <87mtwqqose.fsf@mail.linkov.net> <87y2g9bgjc.fsf@mail.linkov.net> <87o8h5f6b9.fsf@gmail.com> <87sg6gbx4z.fsf@mail.linkov.net> <874kivlhro.fsf@gmail.com> <87v9baafyp.fsf@mail.linkov.net> <87r1lyqiga.fsf@gmail.com> <87h7mtsdxs.fsf@mail.linkov.net> Date: Wed, 03 Feb 2021 14:03:09 +0100 In-Reply-To: <87h7mtsdxs.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 03 Feb 2021 10:58:55 +0200") Message-ID: <87o8h1qp6a.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com 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 (-) Juri Linkov writes: > Would it be possible to avoid code duplication between > next-error-no-select and recenter-current-error? How about adding this macro? (defmacro with-selected-locus (n &rest body) "Visit the Nth error and execute BODY, then select the previously selected window." (declare (indent 1) (debug (form body))) `(save-selected-window (let ((next-error-highlight next-error-highlight-no-select) (display-buffer-overriding-action '(nil (inhibit-same-window . t)))) (next-error ,n) ,@body))) (defun next-error-no-select (&optional n) "Move point to the next error in the `next-error' buffer and highlight match. Prefix arg N says how many error messages to move forwards (or backwards, if negative). Finds and highlights the source line like \\[next-error], but does not select the source buffer." (interactive "p") (with-selected-locus n)) (defun recenter-current-error (&optional arg) "Recenter the current displayed error in the `next-error' buffer." (interactive "P") (with-selected-locus 0 (set-buffer (window-buffer)) (recenter-top-bottom arg))) From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 03 12:46:28 2021 Received: (at 46119) by debbugs.gnu.org; 3 Feb 2021 17:46:28 +0000 Received: from localhost ([127.0.0.1]:38772 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l7MEW-00082u-2I for submit@debbugs.gnu.org; Wed, 03 Feb 2021 12:46:28 -0500 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:23111) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l7MEU-00082I-1H for 46119@debbugs.gnu.org; Wed, 03 Feb 2021 12:46:27 -0500 X-Originating-IP: 91.129.108.204 Received: from mail.gandi.net (m91-129-108-204.cust.tele2.ee [91.129.108.204]) (Authenticated sender: juri@linkov.net) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 1E30F240003; Wed, 3 Feb 2021 17:46:17 +0000 (UTC) From: Juri Linkov To: Tino Calancha Subject: Re: bug#46119: 28.0.50; this-error-recenter Organization: LINKOV.NET References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> <87im7eqxij.fsf@gmail.com> <87mtwqqose.fsf@mail.linkov.net> <87y2g9bgjc.fsf@mail.linkov.net> <87o8h5f6b9.fsf@gmail.com> <87sg6gbx4z.fsf@mail.linkov.net> <874kivlhro.fsf@gmail.com> <87v9baafyp.fsf@mail.linkov.net> <87r1lyqiga.fsf@gmail.com> <87h7mtsdxs.fsf@mail.linkov.net> <87o8h1qp6a.fsf@gmail.com> Date: Wed, 03 Feb 2021 19:39:15 +0200 In-Reply-To: <87o8h1qp6a.fsf@gmail.com> (Tino Calancha's message of "Wed, 03 Feb 2021 14:03:09 +0100") Message-ID: <87a6slrqyk.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.4 (/) X-Debbugs-Envelope-To: 46119 Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com 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.4 (-) >> Would it be possible to avoid code duplication between >> next-error-no-select and recenter-current-error? > > How about adding this macro? > > (defmacro with-selected-locus (n &rest body) > > (defun next-error-no-select (&optional n) >... > (with-selected-locus n)) I don't know, a macro call with empty body doesn't look nice. I guess then better to have code duplication than such macro. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 07 10:56:37 2021 Received: (at 46119-done) by debbugs.gnu.org; 7 Feb 2021 15:56:37 +0000 Received: from localhost ([127.0.0.1]:48532 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l8mQP-0004Kb-Ko for submit@debbugs.gnu.org; Sun, 07 Feb 2021 10:56:37 -0500 Received: from mail-wr1-f51.google.com ([209.85.221.51]:43430) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l8mQM-0004KL-A1 for 46119-done@debbugs.gnu.org; Sun, 07 Feb 2021 10:56:36 -0500 Received: by mail-wr1-f51.google.com with SMTP id z6so14203611wrq.10 for <46119-done@debbugs.gnu.org>; Sun, 07 Feb 2021 07:56:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=9Un0gY7V37oC9Cro+QKVTCIVQkW561X1VuA2qKYg6O8=; b=s+erQ1K/PHx32jWg3WZwExHEo4fQLXiKl15tW+mGGstkR2A8coRJPz1QuZXrep2BMj o2WNfJkj7KEfXFYwBnlvyamFqge1TXYpGD4Ook0uHxGkxP7kGMV5p74k5UKZwf7qVisA d/rIOlr2HZm1ScnosCeBFwtU9qBBY1pZV0QbUTEOWGnZrD+FFvnMxd6HuNJQkk9ruWBy dwxdNyX49IWvLtBt3Ru7+3G5GWOog+jKec39mHW+N76abDSpHOT148uD7vs2sm1HL8I9 LgzHBRPsQJ7ZNoLccQ4nKu1t83FmIi3r1XuLqp1FGbYeWOxFtwcQTBUdWgO0EI2e79O1 uMYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=9Un0gY7V37oC9Cro+QKVTCIVQkW561X1VuA2qKYg6O8=; b=fzsBg+Q8+8HxipP6mDKx5Xzh6wZkSRle9b/EX2/ouG/6HndB3LYSqA8wnCyfoHn6HT 5qS7hQnqU4gsKm5rU0QNbhlxAoUS7b3vpUysAmD98I+tPg8Djs33xtqm77KUuUzuzWB9 dwI2zAbE/6VWmPebFM/ABE5qYWPc//p7LHGhbXG2cU0KpmjPcD8fhOTOIzvQcJO90fv3 J3H6u6QWvjaTHCgAzl/qNOCYlCS7Ilse9o0es7/ZhbCaP+/zyswY+74mja/4DB1bVi2t WyybmtwZZxBZpz73ZIqba8DLYtqJmptvxs5r1uDvGSPuDnuCzSg836JSTmbV/cX2btKv CyDg== X-Gm-Message-State: AOAM532Oz79MMdsJXDRfgC/SJ2M74MCiC2HEboFscCrbtVcyAUCDrrQl t5nNHhXykDSQL1g5iTNUpn0p7o6TOFI= X-Google-Smtp-Source: ABdhPJy4d3XYB6kqvKbQ7ihamgkEjFb3aWNRrClYDabS/XY9h1nP//UWdy+ujzeEVm3rOTaCnniEJQ== X-Received: by 2002:adf:f58f:: with SMTP id f15mr2648753wro.21.1612713388172; Sun, 07 Feb 2021 07:56:28 -0800 (PST) Received: from localhost.example.com ([31.7.242.222]) by smtp.gmail.com with ESMTPSA id q4sm23376461wrg.22.2021.02.07.07.56.27 for <46119-done@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Feb 2021 07:56:27 -0800 (PST) From: Tino Calancha To: 46119-done@debbugs.gnu.org Subject: Re: bug#46119: 28.0.50; this-error-recenter References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> <87im7eqxij.fsf@gmail.com> <87mtwqqose.fsf@mail.linkov.net> <87y2g9bgjc.fsf@mail.linkov.net> <87o8h5f6b9.fsf@gmail.com> <87sg6gbx4z.fsf@mail.linkov.net> <874kivlhro.fsf@gmail.com> <87v9baafyp.fsf@mail.linkov.net> <87r1lyqiga.fsf@gmail.com> <87h7mtsdxs.fsf@mail.linkov.net> <87o8h1qp6a.fsf@gmail.com> <87a6slrqyk.fsf@mail.linkov.net> Date: Sun, 07 Feb 2021 16:56:26 +0100 In-Reply-To: <87a6slrqyk.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 03 Feb 2021 19:39:15 +0200") Message-ID: <877dnjub11.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 46119-done 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 (-) Juri Linkov writes: >>> Would it be possible to avoid code duplication between >>> next-error-no-select and recenter-current-error? >> >> How about adding this macro? >> >> (defmacro with-selected-locus (n &rest body) >> >> (defun next-error-no-select (&optional n) >>... >> (with-selected-locus n)) > > I don't know, a macro call with empty body doesn't look nice. I guess > then better to have code duplication than such macro. Thank you. Then, I have chosen the previous one without the macro. Pushed into master as commit "Add command to recenter errors from Occur/Grep buffers" (9380a7ed906e667df4fc5b9d9c8e487fafa7c654) From unknown Sat Aug 16 21:12:43 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 08 Mar 2021 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator