emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Lee Hinman <hinman@gmail.com>
To: emacs-orgmode@gnu.org
Subject: possible bug in org-goto-local-search-headings
Date: Thu, 12 Nov 2009 13:04:02 -0600	[thread overview]
Message-ID: <m2my2rlg4d.fsf@hades.lhinman.com> (raw)

I noticed some interesting behavior with the
org-goto-local-search-headings function in Emacs 23.1.1.

If you call the function before doing an incremental search, searching
forward fails.  If you call it after doing an incremental search the
function will search forward.  A quick look at the code showed that it
only does a forward search if isearch-forward is defined.  This is both
a variable and a function in isearch.el, and the variable
isearch-forward is set to nil until you do a search.

The following patch against the current orgmode removes the dependency
on isearch-forward and will now search forward first, if it doesn't find
anything will search backward from the original point.  I *think* this
is the behavior that was intended.


diff --git a/lisp/org.el b/lisp/org.el
index dd34816..1e9aad3 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5801,8 +5801,7 @@ or nil."
 (defun org-goto-local-search-headings (string bound noerror)
   "Search and make sure that any matches are in headlines."
   (catch 'return
-    (while (if isearch-forward
-               (search-forward string bound noerror)
+    (while (or (search-forward string bound t)
              (search-backward string bound noerror))
       (when (let ((context (mapcar 'car (save-match-data (org-context)))))
 	      (and (member :headline context)


-- 
Lee Hinman

             reply	other threads:[~2009-11-12 19:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-12 19:04 Lee Hinman [this message]
2009-11-12 23:51 ` possible bug in org-goto-local-search-headings Carsten Dominik
2009-11-13  0:24   ` Lee Hinman
2009-11-13 22:30     ` Carsten Dominik

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.orgmode.org/

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

  git send-email \
    --in-reply-to=m2my2rlg4d.fsf@hades.lhinman.com \
    --to=hinman@gmail.com \
    --cc=emacs-orgmode@gnu.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/org-mode.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).