From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#36832: Supply option to suppress scrolling in compilation mode buffers. Date: Sun, 28 Jul 2019 20:32:21 +0000 Message-ID: <20190728203221.GD5072@ACM> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="35721"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) To: 36832@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jul 28 22:33:11 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hrpqx-0009Ba-64 for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Jul 2019 22:33:11 +0200 Original-Received: from localhost ([::1]:46782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrpqv-0004ik-Mh for geb-bug-gnu-emacs@m.gmane.org; Sun, 28 Jul 2019 16:33:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57056) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrpqq-0004iR-Cs for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2019 16:33:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hrpqp-0002Dq-9c for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2019 16:33:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38416) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hrpqp-0002D6-1E for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2019 16:33:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hrpqo-0005HC-Sw for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2019 16:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Jul 2019 20:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 36832 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.156434595120203 (code B ref -1); Sun, 28 Jul 2019 20:33:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 28 Jul 2019 20:32:31 +0000 Original-Received: from localhost ([127.0.0.1]:47237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hrpqJ-0005Fn-H8 for submit@debbugs.gnu.org; Sun, 28 Jul 2019 16:32:31 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:50802) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hrpqH-0005Cu-ER for submit@debbugs.gnu.org; Sun, 28 Jul 2019 16:32:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56932) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hrpqG-0004ff-8v for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2019 16:32:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hrpqF-00018h-5I for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2019 16:32:28 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:14602 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1hrpqE-000142-Pg for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2019 16:32:27 -0400 Original-Received: (qmail 27062 invoked by uid 3782); 28 Jul 2019 19:39:55 -0000 Original-Received: from acm.muc.de (p2E5D5404.dip0.t-ipconnect.de [46.93.84.4]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 28 Jul 2019 21:39:54 +0200 Original-Received: (qmail 9412 invoked by uid 1000); 28 Jul 2019 20:32:21 -0000 Content-Disposition: inline X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:163990 Archived-At: Hello, Emacs. In a compilation mode buffer, hit CR on one of the error lines so as to go to the pertinent line in the erroneous source code. WHAM! The compilation mode buffer is unavoidably scrolled so that the line CR'd upon is at the top of the window. Well, it's unavoidable unless you're running under a GUI and have fringes enabled. This forced scrolling is irritating for at least one Emacs developer. I propose enhancing the customisation variable compilation-context-lines with the extra value t meaning "never scroll the compilation mode buffer". Here is a patch to achieve this: diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 4b2fc516c3..5a8680fd0c 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -2546,26 +2546,30 @@ compilation-context-lines "Display this many lines of leading context before the current message. If nil and the left fringe is displayed, don't scroll the compilation output window; an arrow in the left fringe points to -the current message. If nil and there is no left fringe, the message -displays at the top of the window; there is no arrow." - :type '(choice integer (const :tag "No window scrolling" nil)) +the current message. If nil and there is no left fringe, the +message displays at the top of the window; there is no arrow. If +t, don't scroll the compilation output window at all." + :type '(choice integer + (const :tag "Scroll window when no fringe" nil) + (const :tag "No window scrolling" t)) :version "22.1") (defsubst compilation-set-window (w mk) - "Align the compilation output window W with marker MK near top." - (if (integerp compilation-context-lines) - (set-window-start w (save-excursion - (goto-char mk) - (compilation-beginning-of-line - (- 1 compilation-context-lines)) - (point))) + "Maybe align the compilation output window W with marker MK near top." + (cond ((integerp compilation-context-lines) + (set-window-start w (save-excursion + (goto-char mk) + (compilation-beginning-of-line + (- 1 compilation-context-lines)) + (point)))) + ((eq compilation-context-lines t)) ;; If there is no left fringe. - (when (equal (car (window-fringes w)) 0) - (set-window-start w (save-excursion - (goto-char mk) - (beginning-of-line 1) - (point))))) - (set-window-point w mk)) + ((equal (car (window-fringes w)) 0) + (set-window-start w (save-excursion + (goto-char mk) + (beginning-of-line 1) + (point))) + (set-window-point w mk)))) (defvar next-error-highlight-timer) -- Alan Mackenzie (Nuremberg, Germany).