Mercurial > emacs
changeset 58244:1c84cc19e954
(compilation-move-to-column): New fun.
(compilation-internal-error-properties)
(compilation-next-error-function): Use it to make sure we don't go past
the end of line.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 15 Nov 2004 23:09:19 +0000 |
parents | d1148cd7ee88 |
children | 0dbdaa78cac7 |
files | lisp/progmodes/compile.el |
diffstat | 1 files changed, 13 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/progmodes/compile.el Mon Nov 15 20:50:08 2004 +0000 +++ b/lisp/progmodes/compile.el Mon Nov 15 23:09:19 2004 +0000 @@ -606,6 +606,14 @@ 2))) (compilation-internal-error-properties file line end-line col end-col type fmt))) +(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 +just char-counts." + (if screen + (move-to-column col) + (goto-char (min (+ (line-beginning-position) col) (line-end-position))))) + (defun compilation-internal-error-properties (file line end-line col end-col type fmt) "Get the meta-info that will be added as text-properties. LINE, END-LINE, COL, END-COL are integers or nil. @@ -640,17 +648,15 @@ (beginning-of-line (- (or end-line line) marker-line -1)) (if (or (null end-col) (< end-col 0)) (end-of-line) - (if compilation-error-screen-columns - (move-to-column end-col) - (forward-char end-col))) + (compilation-move-to-column + end-col compilation-error-screen-columns)) (setq end-marker (list (point-marker)))) (beginning-of-line (if end-line (- line end-line -1) (- loc marker-line -1))) (if col - (if compilation-error-screen-columns - (move-to-column col) - (forward-char col)) + (compilation-move-to-column + col compilation-error-screen-columns) (forward-to-indentation 0)) (setq marker (list (point-marker)))))) @@ -1491,10 +1497,7 @@ (if (car col) (if (eq (car col) -1) ; special case for range end (end-of-line) - (if columns - (move-to-column (car col)) - (beginning-of-line) - (forward-char (car col)))) + (compilation-move-to-column (car col) columns)) (beginning-of-line) (skip-chars-forward " \t")) (if (nth 3 col)