emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: bugs in property searches?
Date: Wed, 29 Jan 2014 00:05:45 -0500	[thread overview]
Message-ID: <87r47r74ye.fsf@gmail.com> (raw)
In-Reply-To: 87wqhjv96x.fsf@andrew.cmu.edu

John Kitchin <jkitchin@andrew.cmu.edu> writes:

> 1. the point moves in org-map-entries, and I thought it would not since
> the documentation says the function is wrapped in save-excursion. This
> lead to the results going in the wrong place. 
>

I can duplicate this, but I'm not sure whether it's a bug or not. The
doc says that org-map-entries calls FUNC within a save-excursion, not
that org-map-entries itself is wrapped. The code does

	  (cond ((eq scope 'tree)
		 (org-back-to-heading t)
		 (org-narrow-to-subtree)
		 (setq scope nil))
                 ...)

and org-back-to-heading moves point. You can certainly wrap the calls to
org-map-entries within save-excursion and that would work around the
problem. Whether org-map-entries should do that internally, I don't
know. The fact that 7.9.3f does not move point might indicate that
this is indeed a bug.

[Later...]
OK, I played the git blame game and found commit 3ec38f5c:

,----
| commit 3ec38f5c064c3270f54876ba33c5ca1097b46853
| Author: Bastien Guerry <bzg@altern.org>
| Date:   Thu Mar 14 14:40:00 2013 +0100
| 
|     org.el (org-map-entries): Use `save-window-excursion'
|     
|     * org.el (org-map-entries): Use `save-window-excursion'.
| 
| diff --git a/lisp/org.el b/lisp/org.el
| index 66c79f5..52ae163 100644
| --- a/lisp/org.el
| +++ b/lisp/org.el
| @@ -14638,7 +14638,7 @@ a *different* entry, you cannot use these techniques."
|         ((eq match nil) (setq matcher t))
|         (t (setq matcher (if match (cdr (org-make-tags-matcher match)) t))))
|  
| -      (save-excursion
| +      (save-window-excursion
|  	(save-restriction
|  	  (cond ((eq scope 'tree)
|  		 (org-back-to-heading t)
`----

If I change the save-window-excursion back to a save-excursion,
org-map-entries doe not move point. So I guess the ball is in
Bastien's court: why was the save-excursion changed to a
save-window-excursion? Should the whole thing be wrapped in
a save-excursion as well?

> 2. In using a PROPERTY search, headings that did not have the property
> got "mapped".

I can duplicate this too but haven't dug any further.

-- 
Nick

  reply	other threads:[~2014-01-29  5:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-29  2:00 bugs in property searches? John Kitchin
2014-01-29  5:05 ` Nick Dokos [this message]
2014-01-31 12:33   ` Bastien

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=87r47r74ye.fsf@gmail.com \
    --to=ndokos@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).