From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#46119: 28.0.50; this-error-recenter Date: Sat, 30 Jan 2021 16:01:40 +0100 Message-ID: <87im7eqxij.fsf@gmail.com> References: <8735yn1jjn.fsf@gmail.com> <87czxqbwp4.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37114"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 46119@debbugs.gnu.org, uyennhi.qm@gmail.com To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 30 16:02:33 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l5rlg-0009ZW-Gk for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 30 Jan 2021 16:02:32 +0100 Original-Received: from localhost ([::1]:38404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5rlf-0006ws-Em for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 30 Jan 2021 10:02:31 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41188) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5rlH-0006wi-Tr for bug-gnu-emacs@gnu.org; Sat, 30 Jan 2021 10:02:08 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43970) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5rlB-0001lS-Sk for bug-gnu-emacs@gnu.org; Sat, 30 Jan 2021 10:02:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l5rlB-00004z-QE for bug-gnu-emacs@gnu.org; Sat, 30 Jan 2021 10:02:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Jan 2021 15:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46119 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 46119-submit@debbugs.gnu.org id=B46119.161201891332757 (code B ref 46119); Sat, 30 Jan 2021 15:02:01 +0000 Original-Received: (at 46119) by debbugs.gnu.org; 30 Jan 2021 15:01:53 +0000 Original-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 Original-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 Original-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) Original-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) In-Reply-To: <87czxqbwp4.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 27 Jan 2021 11:19:19 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:198940 Archived-At: 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)))