aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2011-11-09 09:04:13 -0500
committerStefan Monnier2011-11-09 09:04:13 -0500
commit1dce71935ccc44369ccc27094be6c5bebc3080b4 (patch)
tree13d8121882805d1d601449f750a4bf06d92e1bb2
parent2cffd68198c4d574f073ab238dc12b1221005eab (diff)
downloademacs-1dce71935ccc44369ccc27094be6c5bebc3080b4.tar.gz
emacs-1dce71935ccc44369ccc27094be6c5bebc3080b4.zip
* lisp/progmodes/compile.el: Better handle TABs.
(compilation-internal-error-properties) (compilation-next-error-function): Obey the target buffer's compilation-error-screen-columns. Fixes: debbugs:9749
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/progmodes/compile.el74
3 files changed, 54 insertions, 36 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 5e7e6cbb47e..59fab6d9107 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -621,6 +621,10 @@ view-diary-entries, list-diary-entries, show-all-diary-entries
621inserted by the compilation filter function, when calling 621inserted by the compilation filter function, when calling
622compilation-filter-hook. 622compilation-filter-hook.
623 623
624*** `compilation-error-screen-columns' is obeyed in the editing buffer.
625So programming language modes can set it, whereas previously only the value
626in the *compilation* buffer was used.
627
624** Customize 628** Customize
625 629
626*** Customize buffers now contain a search field. 630*** Customize buffers now contain a search field.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d0a50366eff..c71cef7cdf9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,8 +1,14 @@
12011-11-09 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * progmodes/compile.el: Better handle TABs (bug#9749).
4 (compilation-internal-error-properties)
5 (compilation-next-error-function): Obey the target buffer's
6 compilation-error-screen-columns.
7
12011-11-09 Martin Rudalics <rudalics@gmx.at> 82011-11-09 Martin Rudalics <rudalics@gmx.at>
2 9
3 * window.el (window-size-fixed-p): Rewrite doc-string. 10 * window.el (window-size-fixed-p): Rewrite doc-string.
4 (window-resizable-p): Rename to window--resizable-p. Update 11 (window-resizable-p): Rename to window--resizable-p. Update callers.
5 callers.
6 (window--resizable): New function. Make all callers of 12 (window--resizable): New function. Make all callers of
7 window-resizable call window--resizable instead. 13 window-resizable call window--resizable instead.
8 (window-resizable): Rewrite in terms of window--resizable. 14 (window-resizable): Rewrite in terms of window--resizable.
@@ -90,7 +96,7 @@
90 (window-size-ignore, window-state-get): Callers changed. 96 (window-size-ignore, window-state-get): Callers changed.
91 (window-normalize-window): Rename from window-normalize-any-window. 97 (window-normalize-window): Rename from window-normalize-any-window.
92 New arg LIVE-ONLY, replacing window-normalize-live-window. 98 New arg LIVE-ONLY, replacing window-normalize-live-window.
93 (window-normalize-live-window): Deleted. 99 (window-normalize-live-window): Delete.
94 (window-combination-p, window-combined-p, window-combinations) 100 (window-combination-p, window-combined-p, window-combinations)
95 (walk-window-subtree, window-atom-root, window-min-size) 101 (walk-window-subtree, window-atom-root, window-min-size)
96 (window-sizable, window-sizable-p, window-size-fixed-p) 102 (window-sizable, window-sizable-p, window-size-fixed-p)
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 156c90159cd..491d5c75671 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1056,7 +1056,7 @@ FMTS is a list of format specs for transforming the file name.
1056 (cadr (compilation--file-struct->loc-tree file-struct))) 1056 (cadr (compilation--file-struct->loc-tree file-struct)))
1057 (marker 1057 (marker
1058 (if marker-line (compilation--loc->marker (cadr marker-line)))) 1058 (if marker-line (compilation--loc->marker (cadr marker-line))))
1059 (compilation-error-screen-columns compilation-error-screen-columns) 1059 (screen-columns compilation-error-screen-columns)
1060 end-marker loc end-loc) 1060 end-marker loc end-loc)
1061 (if (not (and marker (marker-buffer marker))) 1061 (if (not (and marker (marker-buffer marker)))
1062 (setq marker nil) ; no valid marker for this file 1062 (setq marker nil) ; no valid marker for this file
@@ -1064,16 +1064,21 @@ FMTS is a list of format specs for transforming the file name.
1064 (catch 'marker ; find nearest loc, at least one exists 1064 (catch 'marker ; find nearest loc, at least one exists
1065 (dolist (x (cddr (compilation--file-struct->loc-tree 1065 (dolist (x (cddr (compilation--file-struct->loc-tree
1066 file-struct))) ; Loop over remaining lines. 1066 file-struct))) ; Loop over remaining lines.
1067 (if (> (car x) loc) ; still bigger 1067 (if (> (car x) loc) ; Still bigger.
1068 (setq marker-line x) 1068 (setq marker-line x)
1069 (if (> (- (or (car marker-line) 1) loc) 1069 (if (> (- (or (car marker-line) 1) loc)
1070 (- loc (car x))) ; current line is nearer 1070 (- loc (car x))) ; Current line is nearer.
1071 (setq marker-line x)) 1071 (setq marker-line x))
1072 (throw 'marker t)))) 1072 (throw 'marker t))))
1073 (setq marker (compilation--loc->marker (cadr marker-line)) 1073 (setq marker (compilation--loc->marker (cadr marker-line))
1074 marker-line (or (car marker-line) 1)) 1074 marker-line (or (car marker-line) 1))
1075 (with-current-buffer (marker-buffer marker) 1075 (with-current-buffer (marker-buffer marker)
1076 (save-excursion 1076 (let ((screen-columns
1077 ;; Obey the compilation-error-screen-columns of the target
1078 ;; buffer if its major mode set it buffer-locally.
1079 (if (local-variable-p 'compilation-error-screen-columns)
1080 compilation-error-screen-columns screen-columns)))
1081 (save-excursion
1077 (save-restriction 1082 (save-restriction
1078 (widen) 1083 (widen)
1079 (goto-char (marker-position marker)) 1084 (goto-char (marker-position marker))
@@ -1081,17 +1086,15 @@ FMTS is a list of format specs for transforming the file name.
1081 (beginning-of-line (- (or end-line line) marker-line -1)) 1086 (beginning-of-line (- (or end-line line) marker-line -1))
1082 (if (or (null end-col) (< end-col 0)) 1087 (if (or (null end-col) (< end-col 0))
1083 (end-of-line) 1088 (end-of-line)
1084 (compilation-move-to-column 1089 (compilation-move-to-column end-col screen-columns))
1085 end-col compilation-error-screen-columns))
1086 (setq end-marker (point-marker))) 1090 (setq end-marker (point-marker)))
1087 (beginning-of-line (if end-line 1091 (beginning-of-line (if end-line
1088 (- line end-line -1) 1092 (- line end-line -1)
1089 (- loc marker-line -1))) 1093 (- loc marker-line -1)))
1090 (if col 1094 (if col
1091 (compilation-move-to-column 1095 (compilation-move-to-column col screen-columns)
1092 col compilation-error-screen-columns)
1093 (forward-to-indentation 0)) 1096 (forward-to-indentation 0))
1094 (setq marker (point-marker)))))) 1097 (setq marker (point-marker)))))))
1095 1098
1096 (setq loc (compilation-assq line (compilation--file-struct->loc-tree 1099 (setq loc (compilation-assq line (compilation--file-struct->loc-tree
1097 file-struct))) 1100 file-struct)))
@@ -2266,7 +2269,7 @@ This is the value of `next-error-function' in Compilation buffers."
2266 (interactive "p") 2269 (interactive "p")
2267 (when reset 2270 (when reset
2268 (setq compilation-current-error nil)) 2271 (setq compilation-current-error nil))
2269 (let* ((columns compilation-error-screen-columns) ; buffer's local value 2272 (let* ((screen-columns compilation-error-screen-columns)
2270 (last 1) 2273 (last 1)
2271 (msg (compilation-next-error (or n 1) nil 2274 (msg (compilation-next-error (or n 1) nil
2272 (or compilation-current-error 2275 (or compilation-current-error
@@ -2301,29 +2304,34 @@ This is the value of `next-error-function' in Compilation buffers."
2301 marker 2304 marker
2302 (caar (compilation--loc->file-struct loc)) 2305 (caar (compilation--loc->file-struct loc))
2303 (cadr (car (compilation--loc->file-struct loc)))) 2306 (cadr (car (compilation--loc->file-struct loc))))
2304 (save-restriction 2307 (let ((screen-columns
2305 (widen) 2308 ;; Obey the compilation-error-screen-columns of the target
2306 (goto-char (point-min)) 2309 ;; buffer if its major mode set it buffer-locally.
2307 ;; Treat file's found lines in forward order, 1 by 1. 2310 (if (local-variable-p 'compilation-error-screen-columns)
2308 (dolist (line (reverse (cddr (compilation--loc->file-struct loc)))) 2311 compilation-error-screen-columns screen-columns)))
2309 (when (car line) ; else this is a filename w/o a line# 2312 (save-restriction
2310 (beginning-of-line (- (car line) last -1)) 2313 (widen)
2311 (setq last (car line))) 2314 (goto-char (point-min))
2312 ;; Treat line's found columns and store/update a marker for each. 2315 ;; Treat file's found lines in forward order, 1 by 1.
2313 (dolist (col (cdr line)) 2316 (dolist (line (reverse (cddr (compilation--loc->file-struct loc))))
2314 (if (compilation--loc->col col) 2317 (when (car line) ; else this is a filename w/o a line#
2315 (if (eq (compilation--loc->col col) -1) 2318 (beginning-of-line (- (car line) last -1))
2316 ;; Special case for range end. 2319 (setq last (car line)))
2317 (end-of-line) 2320 ;; Treat line's found columns and store/update a marker for each.
2318 (compilation-move-to-column (compilation--loc->col col) 2321 (dolist (col (cdr line))
2319 columns)) 2322 (if (compilation--loc->col col)
2320 (beginning-of-line) 2323 (if (eq (compilation--loc->col col) -1)
2321 (skip-chars-forward " \t")) 2324 ;; Special case for range end.
2322 (if (compilation--loc->marker col) 2325 (end-of-line)
2323 (set-marker (compilation--loc->marker col) (point)) 2326 (compilation-move-to-column (compilation--loc->col col)
2324 (setf (compilation--loc->marker col) (point-marker))) 2327 screen-columns))
2325 ;; (setf (compilation--loc->timestamp col) timestamp) 2328 (beginning-of-line)
2326 ))))) 2329 (skip-chars-forward " \t"))
2330 (if (compilation--loc->marker col)
2331 (set-marker (compilation--loc->marker col) (point))
2332 (setf (compilation--loc->marker col) (point-marker)))
2333 ;; (setf (compilation--loc->timestamp col) timestamp)
2334 ))))))
2327 (compilation-goto-locus marker (compilation--loc->marker loc) 2335 (compilation-goto-locus marker (compilation--loc->marker loc)
2328 (compilation--loc->marker end-loc)) 2336 (compilation--loc->marker end-loc))
2329 (setf (compilation--loc->visited loc) t))) 2337 (setf (compilation--loc->visited loc) t)))