emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106335: * lisp/progmodes/compile.el:


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106335: * lisp/progmodes/compile.el: Better handle TABs.
Date: Wed, 09 Nov 2011 09:04:13 -0500
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106335
fixes bug(s): http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9749
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2011-11-09 09:04:13 -0500
message:
  * lisp/progmodes/compile.el: Better handle TABs.
  (compilation-internal-error-properties)
  (compilation-next-error-function): Obey the target buffer's
  compilation-error-screen-columns.
modified:
  etc/NEWS
  lisp/ChangeLog
  lisp/progmodes/compile.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2011-11-06 06:14:01 +0000
+++ b/etc/NEWS  2011-11-09 14:04:13 +0000
@@ -621,6 +621,10 @@
 inserted by the compilation filter function, when calling
 compilation-filter-hook.
 
+*** `compilation-error-screen-columns' is obeyed in the editing buffer.
+So programming language modes can set it, whereas previously only the value
+in the *compilation* buffer was used.
+
 ** Customize
 
 *** Customize buffers now contain a search field.

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-11-09 09:36:05 +0000
+++ b/lisp/ChangeLog    2011-11-09 14:04:13 +0000
@@ -1,8 +1,14 @@
+2011-11-09  Stefan Monnier  <address@hidden>
+
+       * progmodes/compile.el: Better handle TABs (bug#9749).
+       (compilation-internal-error-properties)
+       (compilation-next-error-function): Obey the target buffer's
+       compilation-error-screen-columns.
+
 2011-11-09  Martin Rudalics  <address@hidden>
 
        * window.el (window-size-fixed-p): Rewrite doc-string.
-       (window-resizable-p): Rename to window--resizable-p.  Update
-       callers.
+       (window-resizable-p): Rename to window--resizable-p.  Update callers.
        (window--resizable): New function.  Make all callers of
        window-resizable call window--resizable instead.
        (window-resizable): Rewrite in terms of window--resizable.
@@ -90,7 +96,7 @@
        (window-size-ignore, window-state-get): Callers changed.
        (window-normalize-window): Rename from window-normalize-any-window.
        New arg LIVE-ONLY, replacing window-normalize-live-window.
-       (window-normalize-live-window): Deleted.
+       (window-normalize-live-window): Delete.
        (window-combination-p, window-combined-p, window-combinations)
        (walk-window-subtree, window-atom-root, window-min-size)
        (window-sizable, window-sizable-p, window-size-fixed-p)

=== modified file 'lisp/progmodes/compile.el'
--- a/lisp/progmodes/compile.el 2011-10-20 00:26:14 +0000
+++ b/lisp/progmodes/compile.el 2011-11-09 14:04:13 +0000
@@ -1056,7 +1056,7 @@
           (cadr (compilation--file-struct->loc-tree file-struct)))
         (marker
           (if marker-line (compilation--loc->marker (cadr marker-line))))
-        (compilation-error-screen-columns compilation-error-screen-columns)
+        (screen-columns compilation-error-screen-columns)
         end-marker loc end-loc)
     (if (not (and marker (marker-buffer marker)))
        (setq marker nil)               ; no valid marker for this file
@@ -1064,16 +1064,21 @@
       (catch 'marker                   ; find nearest loc, at least one exists
        (dolist (x (cddr (compilation--file-struct->loc-tree
                           file-struct)))       ; Loop over remaining lines.
-         (if (> (car x) loc)           ; still bigger
+         (if (> (car x) loc)           ; Still bigger.
              (setq marker-line x)
            (if (> (- (or (car marker-line) 1) loc)
-                  (- loc (car x)))     ; current line is nearer
+                  (- loc (car x)))     ; Current line is nearer.
                (setq marker-line x))
            (throw 'marker t))))
       (setq marker (compilation--loc->marker (cadr marker-line))
            marker-line (or (car marker-line) 1))
       (with-current-buffer (marker-buffer marker)
-       (save-excursion
+        (let ((screen-columns
+               ;; Obey the compilation-error-screen-columns of the target
+               ;; buffer if its major mode set it buffer-locally.
+               (if (local-variable-p 'compilation-error-screen-columns)
+                   compilation-error-screen-columns screen-columns)))
+          (save-excursion
          (save-restriction
            (widen)
            (goto-char (marker-position marker))
@@ -1081,17 +1086,15 @@
              (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 compilation-error-screen-columns))
+               (compilation-move-to-column end-col screen-columns))
              (setq end-marker (point-marker)))
            (beginning-of-line (if end-line
                                   (- line end-line -1)
                                 (- loc marker-line -1)))
            (if col
-               (compilation-move-to-column
-                col compilation-error-screen-columns)
+               (compilation-move-to-column col screen-columns)
              (forward-to-indentation 0))
-           (setq marker (point-marker))))))
+           (setq marker (point-marker)))))))
 
     (setq loc (compilation-assq line (compilation--file-struct->loc-tree
                                       file-struct)))
@@ -2266,7 +2269,7 @@
   (interactive "p")
   (when reset
     (setq compilation-current-error nil))
-  (let* ((columns compilation-error-screen-columns) ; buffer's local value
+  (let* ((screen-columns compilation-error-screen-columns)
         (last 1)
         (msg (compilation-next-error (or n 1) nil
                                      (or compilation-current-error
@@ -2301,29 +2304,34 @@
            marker
            (caar (compilation--loc->file-struct loc))
            (cadr (car (compilation--loc->file-struct loc))))
-       (save-restriction
-         (widen)
-         (goto-char (point-min))
-         ;; 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))
-             (setq last (car line)))
-           ;; Treat line's found columns and store/update a marker for each.
-           (dolist (col (cdr line))
-             (if (compilation--loc->col col)
-                 (if (eq (compilation--loc->col col) -1)
-                      ;; Special case for range end.
-                     (end-of-line)
-                   (compilation-move-to-column (compilation--loc->col col)
-                                                columns))
-               (beginning-of-line)
-               (skip-chars-forward " \t"))
-             (if (compilation--loc->marker col)
-                  (set-marker (compilation--loc->marker col) (point))
-               (setf (compilation--loc->marker col) (point-marker)))
-              ;; (setf (compilation--loc->timestamp col) timestamp)
-              )))))
+        (let ((screen-columns
+               ;; Obey the compilation-error-screen-columns of the target
+               ;; buffer if its major mode set it buffer-locally.
+               (if (local-variable-p 'compilation-error-screen-columns)
+                   compilation-error-screen-columns screen-columns)))
+          (save-restriction
+            (widen)
+            (goto-char (point-min))
+            ;; 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))
+                (setq last (car line)))
+              ;; Treat line's found columns and store/update a marker for each.
+              (dolist (col (cdr line))
+                (if (compilation--loc->col col)
+                    (if (eq (compilation--loc->col col) -1)
+                        ;; Special case for range end.
+                        (end-of-line)
+                      (compilation-move-to-column (compilation--loc->col col)
+                                                  screen-columns))
+                  (beginning-of-line)
+                  (skip-chars-forward " \t"))
+                (if (compilation--loc->marker col)
+                    (set-marker (compilation--loc->marker col) (point))
+                  (setf (compilation--loc->marker col) (point-marker)))
+                ;; (setf (compilation--loc->timestamp col) timestamp)
+                ))))))
     (compilation-goto-locus marker (compilation--loc->marker loc)
                             (compilation--loc->marker end-loc))
     (setf (compilation--loc->visited loc) t)))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]