From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: bugs in property searches? Date: Wed, 29 Jan 2014 00:05:45 -0500 Message-ID: <87r47r74ye.fsf@gmail.com> References: <87wqhjv96x.fsf@andrew.cmu.edu> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8NLn-0006nG-Jf for emacs-orgmode@gnu.org; Wed, 29 Jan 2014 00:06:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W8NLf-0007kS-FG for emacs-orgmode@gnu.org; Wed, 29 Jan 2014 00:06:11 -0500 Received: from plane.gmane.org ([80.91.229.3]:56523) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8NLf-0007kE-89 for emacs-orgmode@gnu.org; Wed, 29 Jan 2014 00:06:03 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1W8NLd-00079t-D3 for emacs-orgmode@gnu.org; Wed, 29 Jan 2014 06:06:01 +0100 Received: from pool-98-110-175-184.bstnma.fios.verizon.net ([98.110.175.184]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 29 Jan 2014 06:06:01 +0100 Received: from ndokos by pool-98-110-175-184.bstnma.fios.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 29 Jan 2014 06:06:01 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org John Kitchin 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 | 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