From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH] Added backward isearch support for headings Date: Wed, 3 Sep 2008 11:36:51 +0200 Message-ID: <8C4A3CD6-DA8E-476F-866F-A80BC4B4585A@uva.nl> References: <3c12eb8d0808031241w5e9fd842k753853abc4f4c520@mail.gmail.com> Mime-Version: 1.0 (Apple Message framework v926) Content-Type: multipart/mixed; boundary="===============1451751546==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KaonK-0005NW-Jx for emacs-orgmode@gnu.org; Wed, 03 Sep 2008 05:36:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KaonI-0005LV-S7 for emacs-orgmode@gnu.org; Wed, 03 Sep 2008 05:36:57 -0400 Received: from [199.232.76.173] (port=56484 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KaonI-0005KX-A7 for emacs-orgmode@gnu.org; Wed, 03 Sep 2008 05:36:56 -0400 Received: from ug-out-1314.google.com ([66.249.92.171]:49629) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KaonI-0005gQ-6O for emacs-orgmode@gnu.org; Wed, 03 Sep 2008 05:36:56 -0400 Received: by ug-out-1314.google.com with SMTP id m2so2428766uge.17 for ; Wed, 03 Sep 2008 02:36:55 -0700 (PDT) In-Reply-To: <3c12eb8d0808031241w5e9fd842k753853abc4f4c520@mail.gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Piotr Zielinski Cc: emacs-orgmode@gnu.org --===============1451751546== Content-Type: multipart/alternative; boundary=Apple-Mail-14--538240615 --Apple-Mail-14--538240615 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Applied, thanks. - Carsten On Aug 3, 2008, at 9:41 PM, Piotr Zielinski wrote: > Changed org-goto-local-search-forward-headings to support backward > search, and renamed it to org-goto-local-search-headings. > --- > lisp/org.el | 8 +++++--- > 1 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/lisp/org.el b/lisp/org.el > index 57c6dae..62ad9ea 100644 > --- a/lisp/org.el > +++ b/lisp/org.el > @@ -4350,7 +4350,7 @@ or nil." > (let ((isearch-mode-map org-goto-local-auto-isearch-map) > (isearch-hide-immediately nil) > (isearch-search-fun-function > - (lambda () 'org-goto-local-search-forward-headings)) > + (lambda () 'org-goto-local-search-headings)) > (org-goto-selected-point org-goto-exit-command)) > (save-excursion > (save-window-excursion > @@ -4391,10 +4391,12 @@ or nil." > (define-key org-goto-local-auto-isearch-map "\C-i" 'isearch-other- > control-char) > (define-key org-goto-local-auto-isearch-map "\C-m" 'isearch-other- > control-char) > > -(defun org-goto-local-search-forward-headings (string bound noerror) > +(defun org-goto-local-search-headings (string bound noerror) > "Search and make sure that anu matches are in headlines." > (catch 'return > - (while (search-forward string bound noerror) > + (while (if isearch-forward > + (search-forward string bound noerror) > + (search-backward string bound noerror)) > (when (let ((context (mapcar 'car (save-match-data (org- > context))))) > (and (member :headline context) > (not (member :tags context)))) > -- > 1.5.2.5 > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode --Apple-Mail-14--538240615 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Applied, = thanks.

- Carsten

On Aug 3, = 2008, at 9:41 PM, Piotr Zielinski wrote:

Changed= org-goto-local-search-forward-headings to support backward
search, = and renamed it to org-goto-local-search-headings.
---
lisp/org.el = |    8 +++++---
1 files changed, 5 insertions(+), 3 = deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index = 57c6dae..62ad9ea 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ = -4350,7 +4350,7 @@ or nil."
  (let ((isearch-mode-map = org-goto-local-auto-isearch-map)
=        (isearch-hide-immediately = nil)
=        (isearch-search-fun-function
= -        (lambda () = 'org-goto-local-search-forward-headings))
+ =        (lambda () = 'org-goto-local-search-headings))
=        (org-goto-selected-point = org-goto-exit-command))
    (save-excursion
=       (save-window-excursion
@@ = -4391,10 +4391,12 @@ or nil."
(define-key = org-goto-local-auto-isearch-map "\C-i" 'isearch-other-control-char)
= (define-key org-goto-local-auto-isearch-map "\C-m" = 'isearch-other-control-char)

-(defun = org-goto-local-search-forward-headings (string bound noerror)
+(defun = org-goto-local-search-headings (string bound noerror)
=   "Search and make sure that anu matches are in = headlines."
  (catch 'return
-    (while = (search-forward string bound noerror)
+    (while (if = isearch-forward
+ =             &n= bsp; (search-forward string bound noerror)
+ =             (s= earch-backward string bound noerror))
=       (when (let ((context (mapcar 'car = (save-match-data (org-context)))))
=             &n= bsp;(and (member :headline context)
=             &n= bsp;     (not (member :tags context))))
-- =
1.5.2.5


_______________________________________________
= Emacs-orgmode mailing list
Remember: use `Reply All' to send replies = to the list.
Emacs-orgmode@gnu.org
http://= lists.gnu.org/mailman/listinfo/emacs-orgmode
<= br>
= --Apple-Mail-14--538240615-- --===============1451751546== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --===============1451751546==--