emacs-devel
[Top][All Lists]
Advanced

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

Re: Patch: bugfix for outline-mode


From: Ben North
Subject: Re: Patch: bugfix for outline-mode
Date: Fri, 15 Dec 2006 21:29:09 +0000
User-agent: Thunderbird 1.5 (X11/20051201)

Earlier I wrote:
> I noticed a couple of bugs in outline-mode, which surface when the last
> line of the file is a heading line, and there is no final newline in the
> buffer.

Apologies; the patch got mangled.  Second try, also making a tiny
stylistic improvement (no double parentheses in (let) form):

--- ORIG--outline.el    2006-12-15 15:37:59.538393000 +0000
+++ NEW--outline.el     2006-12-15 15:38:53.575300000 +0000
@@ -652,19 +652,22 @@
  (if (< arg 0)
      (beginning-of-line)
    (end-of-line))
-  (while (and (not (bobp)) (< arg 0))
-    (while (and (not (bobp))
-               (re-search-backward (concat "^\\(?:" outline-regexp "\\)")
-                                   nil 'move)
-               (outline-invisible-p)))
-    (setq arg (1+ arg)))
-  (while (and (not (eobp)) (> arg 0))
-    (while (and (not (eobp))
-               (re-search-forward (concat "^\\(?:" outline-regexp "\\)")
-                                  nil 'move)
-               (outline-invisible-p (match-beginning 0))))
-    (setq arg (1- arg)))
-  (beginning-of-line))
+  (let (found-heading-p)
+    (while (and (not (bobp)) (< arg 0))
+      (while (and (not (bobp))
+                  (setq found-heading-p
+ (re-search-backward (concat "^\\(?:" outline-regexp "\\)")
+                                            nil 'move))
+                  (outline-invisible-p)))
+      (setq arg (1+ arg)))
+    (while (and (not (eobp)) (> arg 0))
+      (while (and (not (eobp))
+                  (setq found-heading-p
+ (re-search-forward (concat "^\\(?:" outline-regexp "\\)")
+                                           nil 'move))
+                  (outline-invisible-p (match-beginning 0))))
+      (setq arg (1- arg)))
+    (if found-heading-p (beginning-of-line))))

(defun outline-previous-visible-heading (arg)
  "Move to the previous heading line.


Doc fix patch made it OK.





reply via email to

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