From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Wales Subject: org-entry-get bugs etc. Date: Wed, 13 Jan 2010 16:09:16 -0700 Message-ID: <20524da71001131509r72741172k95c54abf80776b32@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NVCL8-0003dL-Es for emacs-orgmode@gnu.org; Wed, 13 Jan 2010 18:09:26 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NVCL3-0003d0-Rt for emacs-orgmode@gnu.org; Wed, 13 Jan 2010 18:09:26 -0500 Received: from [199.232.76.173] (port=39162 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NVCL3-0003cx-Lp for emacs-orgmode@gnu.org; Wed, 13 Jan 2010 18:09:21 -0500 Received: from mx20.gnu.org ([199.232.41.8]:25003) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NVCL3-0003iG-7m for emacs-orgmode@gnu.org; Wed, 13 Jan 2010 18:09:21 -0500 Received: from mail-fx0-f228.google.com ([209.85.220.228]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NVCL1-00071E-1M for emacs-orgmode@gnu.org; Wed, 13 Jan 2010 18:09:19 -0500 Received: by fxm28 with SMTP id 28so15606871fxm.26 for ; Wed, 13 Jan 2010 15:09:16 -0800 (PST) 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: emacs-orgmode@gnu.org I ran into a bug in which org-entry-get returns the wrong value. It brought up some other points. 1) org-entry-get of "TODO" returns the wrong value when there is a lower case version of a todo kw on a headline. Example: * neowhen I have "NEOWHEN" as a todo kw. What it returns is "neowhen". What I think it should return is the value for a blank state. Currently, this value is nil. 2) This is the 5th bug that I have reported of this type. In all 5 cases, the lower case version of a todo kw at the beginning of a headline caused incorrect behavior. This suggests separate matches. At least as a possibility. This in turn suggests to me that it might be possible to refactor org. By this I mean create a wrapper to do the matching and call that wrapper in all of those places. I wish I could help here, but I cannot. 3) For the user, I think it is more convenient to use org-entry-get for metadata than to parse manually. This is a useful function. 4) Perhaps Lisp keywords can be allowed instead of strings for speed. For example, (org-entry-get point-or-marker :todo) Instead of: (org-entry-get point-or-marker "TODO") I don't know if it would be significant. 5) This isn't directly related, but the value for a blank state is currently nil, not "". I have not thought about this deeply, but as nil is not a string, it is a special case (i.e. the only state that is not a string). In my experience, special cases in return values cause complicated code, because calling code needs to special-case the special case instead of merely composing, funcalling, or applying. Perhaps it's too late to change that. Or perhaps there is a special reason to use nil. But seems worth mentioning just in case it triggers an idea. Thanks. Samuel -- Q: How many CDC "scientists" does it take to change a lightbulb? A: You only think it's dark. [CDC has denied ME/CFS for 25 years] ================================================================= Retrovirus: http://www.wpinstitute.org/xmrv/xmrv_qa.html