all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: 36832@debbugs.gnu.org
Subject: bug#36832: Supply option to suppress scrolling in compilation mode buffers.
Date: Sun, 28 Jul 2019 20:32:21 +0000	[thread overview]
Message-ID: <20190728203221.GD5072@ACM> (raw)

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).





             reply	other threads:[~2019-07-28 20:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-28 20:32 Alan Mackenzie [this message]
2019-07-30 15:14 ` bug#36832: Supply option to suppress scrolling in compilation mode buffers Eli Zaretskii
2019-07-30 15:59   ` Alan Mackenzie
2019-07-30 16:17     ` Eli Zaretskii
2019-07-30 19:20       ` Juri Linkov
2019-07-31 14:20         ` Eli Zaretskii
2019-07-30 19:32       ` Alan Mackenzie
2019-07-31 14:21         ` Eli Zaretskii
2019-08-25 10:32           ` Alan Mackenzie
2019-09-01 21:50 ` Mattias Engdegård
     [not found] ` <handler.36832.B.156434595120203.ack@debbugs.gnu.org>
2019-09-03 17:44   ` Alan Mackenzie
2019-09-04 12:41 ` Mattias Engdegård
2019-09-05 17:50   ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190728203221.GD5072@ACM \
    --to=acm@muc.de \
    --cc=36832@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.