emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Aaron Ecay <aaronecay@gmail.com>
To: Ted Wiles <thewiles@wharton.upenn.edu>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] quick patch to org-habit todo state keywords
Date: Sun, 15 Dec 2013 23:27:12 -0500	[thread overview]
Message-ID: <87a9g1fmjj.fsf@gmail.com> (raw)
In-Reply-To: <87haa9a363.fsf@dorewiles.com>

Hi Ted,

Welcome to org-mode, and thanks for the patch!

I have one small comment:

2013ko abenudak 15an, Ted Wiles-ek idatzi zuen:
> 
> Took out the hardcoded todo-state
> 
> * lisp/org-habit.el 
> 
>   The "DONE" keyword was hardcoded in. This is my first patch (ever, to anything).
> 
>   TINYCHANGE
> 
> 1 file changed, 2 insertions(+), 1 deletion(-)
>  lisp/org-habit.el |    3 ++-
> 
> 	Modified   lisp/org-habit.el
> diff --git a/lisp/org-habit.el b/lisp/org-habit.el
> index eba9037..69d0fa6 100644
> --- a/lisp/org-habit.el
> +++ b/lisp/org-habit.el
> @@ -200,7 +200,8 @@ This list represents a \"habit\" for the rest of this module."
>  	     (count 0))
>  	(unless reversed (goto-char end))
>  	(while (and (< count maxdays)
> -		    (funcall search "- State \"DONE\".*\\[\\([^]]+\\)\\]" limit t))
> +		    (funcall search (format "- State \"%s\".*\\[\\([^]]+\\)\\]" 
> +					    (car (reverse (car org-todo-keywords)))) limit t))

I think this will not be the correct value when the org-todo-keywords
variable contains characters for fast todo selection (cf. the fifth
paragraph of the docstring at C-h v org-todo-keywords).  For example, my
org-todo-keywords is set to:
((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
 (sequence "WAIT(w@/!)" "|" "CANCELLED(c@/!)"))

I think you can get the value you want with:
(concat "\\(" (mapconcat 'regexp-quote org-done-keywords "\\|") "\\)")

The org-done-keywords variable is not documented, but it is set (locally
in each buffer) to the list of done keywords in that buffer by the code
that initializes org mode.  (I found and slightly adapted the above bit
of code from line 6283 of org.el, where some fontification regexps are
calculated.)

Aaron

PS You should make a new message to the list when you send a new patch,
rather than replying to another one.  The replies interfere with the
threading algorithms in some MUAs which parse the References or
In-Reply-To header of the email in order to determine its parent.

-- 
Aaron Ecay

  reply	other threads:[~2013-12-16  4:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-11  2:30 [parser] subscripts and underlines interacting badly Aaron Ecay
2013-12-11  8:22 ` Nicolas Goaziou
2013-12-11 18:36   ` Aaron Ecay
2013-12-11 20:55     ` Nicolas Goaziou
2013-12-12  7:56       ` Aaron Ecay
2013-12-12 17:33         ` Nicolas Goaziou
2013-12-12 19:42           ` Aaron Ecay
2013-12-12 20:47             ` Nicolas Goaziou
2013-12-16  3:15               ` Aaron Ecay
2013-12-16  3:24                 ` [PATCH] quick patch to org-habit todo state keywords Ted Wiles
2013-12-16  4:27                   ` Aaron Ecay [this message]
2013-12-17 16:57                 ` [parser] subscripts and underlines interacting badly Nicolas Goaziou
2013-12-18  6:57                   ` Aaron Ecay
2013-12-18 15:01                     ` Nicolas Goaziou

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=87a9g1fmjj.fsf@gmail.com \
    --to=aaronecay@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=thewiles@wharton.upenn.edu \
    /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).