unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ben North <ben@redfrontdoor.org>
Subject: Re: Patch: bugfix for outline-mode
Date: Fri, 15 Dec 2006 21:29:09 +0000	[thread overview]
Message-ID: <458313A5.8090402@redfrontdoor.org> (raw)
In-Reply-To: <1166199079.4582c927cff99@imp.hosting365.ie>

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	other threads:[~2006-12-15 21:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-15 16:11 Patch: bugfix for outline-mode Ben North
2006-12-15 21:29 ` Ben North [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=458313A5.8090402@redfrontdoor.org \
    --to=ben@redfrontdoor.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).