summaryrefslogtreecommitdiff
path: root/lisp/progmodes/compile.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2016-01-11 22:48:10 -0800
committerJohn Wiegley <johnw@newartisans.com>2016-01-11 22:48:10 -0800
commitfb74beed3cf7ed158f18508766ce0ac2685f1d9a (patch)
treeeebde8bdadc53ef70a3e8602707c8921462ef9d1 /lisp/progmodes/compile.el
parent70f3e4e61fc4433ca8ac4517d247df7e7af7b248 (diff)
parent861022ff5f7b8d6ab53c726e009208eadf4ecd41 (diff)
downloademacs-fb74beed3cf7ed158f18508766ce0ac2685f1d9a.tar.gz
emacs-fb74beed3cf7ed158f18508766ce0ac2685f1d9a.tar.bz2
emacs-fb74beed3cf7ed158f18508766ce0ac2685f1d9a.zip
Merge from origin/emacs-25
861022f * doc/misc/texinfo.tex: Revert unwanted copyright change. 46e47a5 ; * etc/refcards/ru-refcard.tex (cyear): Update via M-x set-copyright. 71ea138 * lisp/align.el (align): Simplify a lambda 5618a50 * lisp/align.el (align): Fix arg order in call to `align-region' 1f680db Fix compilation next-error in buffers with selective-display d20a948 * nsm.el (nsm-check-protocol): Fix typo in the message. 1da116f Add SHA1 warnings for high network security settings e48bacd ; * etc/NEWS: Typo fix.
Diffstat (limited to 'lisp/progmodes/compile.el')
-rw-r--r--lisp/progmodes/compile.el22
1 files changed, 17 insertions, 5 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index e5609b8bc5b..b7ab408f744 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1125,6 +1125,16 @@ POS and RES.")
(compilation-internal-error-properties
file line end-line col end-col type fmt)))
+(defun compilation-beginning-of-line (&optional n)
+ "Like `beginning-of-line', but accounts for lines hidden by `selective-display'."
+ (if (or (not (eq selective-display t))
+ (null n)
+ (= n 1))
+ (beginning-of-line n)
+ (re-search-forward "[\n\r]" nil 'end (1- n))
+ (if (< n 0)
+ (beginning-of-line))))
+
(defun compilation-move-to-column (col screen)
"Go to column COL on the current line.
If SCREEN is non-nil, columns are screen columns, otherwise, they are
@@ -1183,13 +1193,15 @@ FMTS is a list of format specs for transforming the file name.
(goto-char (marker-position marker))
;; Set end-marker if appropriate and go to line.
(if (not (or end-col end-line))
- (beginning-of-line (- line marker-line -1))
- (beginning-of-line (- (or end-line line) marker-line -1))
+ (compilation-beginning-of-line (- line marker-line -1))
+ (compilation-beginning-of-line (- (or end-line line)
+ marker-line -1))
(if (or (null end-col) (< end-col 0))
(end-of-line)
(compilation-move-to-column end-col screen-columns))
(setq end-marker (point-marker))
- (when end-line (beginning-of-line (- line end-line -1))))
+ (when end-line
+ (compilation-beginning-of-line (- line end-line -1))))
(if col
(compilation-move-to-column col screen-columns)
(forward-to-indentation 0))
@@ -2469,7 +2481,7 @@ This is the value of `next-error-function' in Compilation buffers."
;; Treat file's found lines in forward order, 1 by 1.
(dolist (line (reverse (cddr (compilation--loc->file-struct loc))))
(when (car line) ; else this is a filename w/o a line#
- (beginning-of-line (- (car line) last -1))
+ (compilation-beginning-of-line (- (car line) last -1))
(setq last (car line)))
;; Treat line's found columns and store/update a marker for each.
(dolist (col (cdr line))
@@ -2541,7 +2553,7 @@ displays at the top of the window; there is no arrow."
(if (integerp compilation-context-lines)
(set-window-start w (save-excursion
(goto-char mk)
- (beginning-of-line
+ (compilation-beginning-of-line
(- 1 compilation-context-lines))
(point)))
;; If there is no left fringe.