all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#12742: 24.2; [PATCH] flymake cannot goto errors correctly in narrowed buffers
@ 2012-10-27  9:25 Leo
  2012-10-27 10:09 ` Leo
  0 siblings, 1 reply; 2+ messages in thread
From: Leo @ 2012-10-27  9:25 UTC (permalink / raw)
  To: 12742

[-- Attachment #1: Type: text/plain, Size: 212 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-flymake-error-navigation-in-narrowed-buffers.patch --]
[-- Type: text/x-patch, Size: 1574 bytes --]

From 09158f75e02a5e1814f2f00d0083dfc80e8f0bc1 Mon Sep 17 00:00:00 2001
From: Leo Liu <sdl.web@gmail.com>
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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#12742: 24.2; [PATCH] flymake cannot goto errors correctly in narrowed buffers
  2012-10-27  9:25 bug#12742: 24.2; [PATCH] flymake cannot goto errors correctly in narrowed buffers Leo
@ 2012-10-27 10:09 ` Leo
  0 siblings, 0 replies; 2+ messages in thread
From: Leo @ 2012-10-27 10:09 UTC (permalink / raw)
  To: 12742

Flymake.el wasn't written with narrowed buffers in mind so the patch
only fix the problem partially. I'll work out a thorough patch later.

Leo





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-27 10:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-27  9:25 bug#12742: 24.2; [PATCH] flymake cannot goto errors correctly in narrowed buffers Leo
2012-10-27 10:09 ` Leo

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.