# HG changeset patch # User Stefan Monnier # Date 1100560159 0 # Node ID 1c84cc19e954a6d2d451eabaf9df38aead3c77ae # Parent d1148cd7ee883d2ec98f5a81df5fafda09e83d19 (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. diff -r d1148cd7ee88 -r 1c84cc19e954 lisp/progmodes/compile.el --- 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)