emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] possible bug in org-goto-local-search-headings


From: Carsten Dominik
Subject: Re: [Orgmode] possible bug in org-goto-local-search-headings
Date: Fri, 13 Nov 2009 00:51:48 +0100

Hi Lee,

I do not understand.

Why would you call this function?  It is being called by the
internals of isearch, and when that happens, isearch.el is obviously loaded.

What am I missing here?

- Carsten

On Nov 12, 2009, at 8:04 PM, Lee Hinman wrote:

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



_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten







reply via email to

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