Subject: bug#12742: closed (Re: bug#12742)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 13 Feb 2014 23:55:03 +0000

Your bug report

#12742: 24.2; [PATCH] flymake cannot goto errors correctly in narrowed buffers

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
12742: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12742
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#12742
From: Glenn Morris <[email-masked]>
To: [email-masked]
Date: Thu, 13 Feb 2014 18:54:17 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 24.4

Daniel Colascione wrote:

> ------------------------------------------------------------
> revno: 116436
> revision-id: [email-masked]
> parent: [email-masked]
> committer: Daniel Colascione <[email-masked]>
> branch nick: trunk
> timestamp: Thu 2014-02-13 14:37:29 -0800
> message:
>   Fix flymake in narrowed buffers
> modified:
>   lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
>   lisp/progmodes/flymake.el      flymake.el-20091113204419-o5vbwnq5f7feedwu-3065
>
> === modified file 'lisp/ChangeLog'
> --- a/lisp/ChangeLog	2014-02-13 18:23:36 +0000
> +++ b/lisp/ChangeLog	2014-02-13 22:37:29 +0000
> @@ -1,3 +1,9 @@
> +2014-02-13  Daniel Colascione  <[email-masked]>
> +
> +	* progmodes/flymake.el (flymake-post-syntax-check): Widen buffer
> +	when adding overlays so that line numbers from compiler match line
> +	numbers we use.
> +
>  2014-02-13  Glenn Morris  <[email-masked]>
>  
>  	* mail/rmail.el (rmail-probe): Be less strict.  (Bug#16743)
>
> === modified file 'lisp/progmodes/flymake.el'
> --- a/lisp/progmodes/flymake.el	2014-01-25 19:15:42 +0000
> +++ b/lisp/progmodes/flymake.el	2014-02-13 22:37:29 +0000
> @@ -555,29 +555,31 @@
>               (setq flymake-is-running nil))))))))
>  
>  (defun flymake-post-syntax-check (exit-status command)
> -  (setq flymake-err-info flymake-new-err-info)
> -  (setq flymake-new-err-info nil)
> -  (setq flymake-err-info
> -        (flymake-fix-line-numbers
> -         flymake-err-info 1 (count-lines (point-min) (point-max))))
> -  (flymake-delete-own-overlays)
> -  (flymake-highlight-err-lines flymake-err-info)
> -  (let (err-count warn-count)
> -    (setq err-count (flymake-get-err-count flymake-err-info "e"))
> -    (setq warn-count  (flymake-get-err-count flymake-err-info "w"))
> -    (flymake-log 2 "%s: %d error(s), %d warning(s) in %.2f second(s)"
> -		 (buffer-name) err-count warn-count
> -		 (- (float-time) flymake-check-start-time))
> -    (setq flymake-check-start-time nil)
> +  (save-restriction
> +    (widen)
> +    (setq flymake-err-info flymake-new-err-info)
> +    (setq flymake-new-err-info nil)
> +    (setq flymake-err-info
> +          (flymake-fix-line-numbers
> +           flymake-err-info 1 (count-lines (point-min) (point-max))))
> +    (flymake-delete-own-overlays)
> +    (flymake-highlight-err-lines flymake-err-info)
> +    (let (err-count warn-count)
> +      (setq err-count (flymake-get-err-count flymake-err-info "e"))
> +      (setq warn-count  (flymake-get-err-count flymake-err-info "w"))
> +      (flymake-log 2 "%s: %d error(s), %d warning(s) in %.2f second(s)"
> +                   (buffer-name) err-count warn-count
> +                   (- (float-time) flymake-check-start-time))
> +      (setq flymake-check-start-time nil)
>  
> -    (if (and (equal 0 err-count) (equal 0 warn-count))
> -	(if (equal 0 exit-status)
> -	    (flymake-report-status "" "")	; PASSED
> -	  (if (not flymake-check-was-interrupted)
> -	      (flymake-report-fatal-status "CFGERR"
> -					   (format "Configuration error has occurred while running %s" command))
> -	    (flymake-report-status nil ""))) ; "STOPPED"
> -      (flymake-report-status (format "%d/%d" err-count warn-count) ""))))
> +      (if (and (equal 0 err-count) (equal 0 warn-count))
> +          (if (equal 0 exit-status)
> +              (flymake-report-status "" "") ; PASSED
> +            (if (not flymake-check-was-interrupted)
> +                (flymake-report-fatal-status "CFGERR"
> +                                             (format "Configuration error has occurred while running %s" command))
> +              (flymake-report-status nil ""))) ; "STOPPED"
> +        (flymake-report-status (format "%d/%d" err-count warn-count) "")))))
>  
>  (defun flymake-parse-output-and-residual (output)
>    "Split OUTPUT into lines, merge in residual if necessary."

Subject: 24.2; [PATCH] flymake cannot goto errors correctly in narrowed buffers
From: Leo <[email-masked]>
To: [email-masked]
Date: Sat, 27 Oct 2012 17:25:35 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

In a narrowed buffer, both flymake-goto-next-error and
flymake-goto-prev-error stop working correctly. Any objection to install
the attached fix in the emacs-24 branch?

(ChangeLog change omitted for now).

Leo

>From 09158f75e02a5e1814f2f00d0083dfc80e8f0bc1 Mon Sep 17 00:00:00 2001
From: Leo Liu <[email-masked]>
Date: Sat, 27 Oct 2012 17:14:42 +0800
Subject: [PATCH] Fix flymake error navigation in narrowed buffers

---
 lisp/progmodes/flymake.el | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 2614af9f..8ef09466 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -1262,7 +1262,9 @@ (defun flymake-on-timer-event (buffer)
 
 (defun flymake-current-line-no ()
   "Return number of current line in current buffer."
-  (count-lines (point-min) (if (eobp) (point) (1+ (point)))))
+  (save-restriction
+    (widen)
+    (count-lines (point-min) (if (eobp) (point) (1+ (point))))))
 
 (defun flymake-count-lines ()
   "Return number of lines in buffer BUFFER."
@@ -1491,16 +1493,13 @@ (defun flymake-get-prev-err-line-no (err-info-list line-no)
       (if (> count 0)
 	  (flymake-er-get-line (nth (1- count) err-info-list))))))
 
-(defun flymake-skip-whitespace ()
-  "Move forward until non-whitespace is reached."
-  (while (looking-at "[ \t]")
-    (forward-char)))
-
 (defun flymake-goto-line (line-no)
   "Go to line LINE-NO, then skip whitespace."
-  (goto-char (point-min))
-  (forward-line (1- line-no))
-  (flymake-skip-whitespace))
+  (save-restriction
+    (widen)
+    (goto-char (point-min))
+    (forward-line (1- line-no))
+    (skip-chars-forward "[[:blank:]]")))
 
 (defun flymake-goto-next-error ()
   "Go to next error in err ring."
-- 
1.8.0