emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Custom agenda and DONE faces
@ 2012-02-15 17:19 Hans-Peter Deifel
  2012-03-18 17:02 ` David Maus
  0 siblings, 1 reply; 2+ messages in thread
From: Hans-Peter Deifel @ 2012-02-15 17:19 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

In custom agenda-list views, DONE keywords are highlighted with the org-todo
face, instead of org-done. This has been posted before[1], but not solved.

Steps to reproduce:

  1. Create a custom agenda:

     #+begin_src emacs-lisp
       (setq org-agenda-custom-commands '(("x" "Agenda" ((agenda "")))))
     #+end_src

  2. Create a new file, add a DONE item and schedule it for today. Add the file
     to org-agenda-files.

  3. Open the custom agenda (possibly with `C-c a x')

The "DONE" keyword will be red instead of green. This doesn't happen in the
normal agenda view (`C-c a a'). Typing 'C-u C-x =' on it reveals:

#+begin_ascii
                 position: 108 of 315 (34%), column: 28
              character: N (displayed as N) (codepoint 78, #o116, #x4e)
      preferred charset: ascii (ASCII (ISO646 IRV))
  code point in charset: 0x4E
                 syntax: w        which means: word
               category: .:Base, L:Left-to-right (strong), a:ASCII, l:Latin, r:Roman
            buffer code: #x4E
              file code: #x4E (encoded by coding system utf-8-unix)
                display: by this font (glyph code)
      xft:-unknown-DejaVu Sans Mono-bold-normal-normal-*-11-*-*-*-m-0-iso10646-1 (#x31)
  
  Character code properties: customize what to show
    name: LATIN CAPITAL LETTER N
    old-name: 
    general-category: Lu (Letter, Uppercase)
    decomposition: (78) ('N')
  
  There are text properties here:
    date                 (2 14 2012)
    day                  734547
    done-face            org-agenda-done
    dotime               time
    duration             nil
    effort               ""
    effort-minutes       nil
    extra                "Scheduled: "
    face                 org-todo
    format               [Show]
    help-echo            "mouse-2 or RET jump to org file ~/notes/todo.org"
    mouse-face           highlight
    org-agenda-type      agenda
    org-category         "todo"
    org-category-position nil
    org-complex-heading-regexp [Show]
    org-day-cnt          2
    org-habit-p          nil
    org-hd-marker        #<marker at 8712 in todo.org>
    org-heading          t
    org-highest-priority 65
    org-lowest-priority  67
    org-marker           #<marker at 8779 in todo.org>
    org-not-done-regexp  "\\(TODO\\)"
    org-todo-regexp      "\\(TODO\\|DONE\\)"
    priority             1099
    tags                 nil
    time                 ""
    time-of-day          nil
    todo-state           [Show]
    txt                  [Show]
    type                 "scheduled"
    undone-face          org-scheduled
#+end_ascii

I played around in the source code and noticed that the following patch fixes
the problem, but I don't know the code base well enough to understand why it
works and what other implications it might have:

#+begin_src diff
  diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
  index 67e06c0..b12b0d4 100644
  --- a/lisp/org-agenda.el
  +++ b/lisp/org-agenda.el
  @@ -3094,7 +3094,6 @@ the global options and expect it to be applied to the entire view.")
   
   (defun org-prepare-agenda (&optional name)
     (setq org-todo-keywords-for-agenda nil)
  -  (setq org-done-keywords-for-agenda nil)
     (setq org-drawers-for-agenda nil)
     (unless org-agenda-persistent-filter
       (setq org-agenda-tag-filter nil
  @@ -3113,6 +3112,7 @@ the global options and expect it to be applied to the entire view.")
                      (make-string (window-width) org-agenda-block-separator))
                    "\n"))
          (narrow-to-region (point) (point-max)))
  +    (setq org-done-keywords-for-agenda nil)
       (org-agenda-reset-markers)
       (setq org-agenda-contributing-files nil)
       (setq org-agenda-columns-active nil)
#+end_src

I use Emacs 24 from bzr and org-mode from git.

Thanks in advance,

  Hans-Peter


[1] http://lists.gnu.org/archive/html/emacs-orgmode/2011-08/msg00332.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Custom agenda and DONE faces
  2012-02-15 17:19 Custom agenda and DONE faces Hans-Peter Deifel
@ 2012-03-18 17:02 ` David Maus
  0 siblings, 0 replies; 2+ messages in thread
From: David Maus @ 2012-03-18 17:02 UTC (permalink / raw)
  To: Hans-Peter Deifel; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 640 bytes --]

Hi Hans-Peter,

At Wed, 15 Feb 2012 18:19:54 +0100,
Hans-Peter Deifel wrote:
>
> Hi all,
>
> [...]
>
> I played around in the source code and noticed that the following patch fixes
> the problem, but I don't know the code base well enough to understand why it
> works and what other implications it might have:
>
> [...]

I've applied a fix for this problem to master. Your patch did the
right thing; `org-prepare-agenda' was called by `org-agenda-list'
which already set up the done-keywords. But when `org-agenda-list' was
called in a block agenda `org-prepare-agenda' set the variable to nil
and left early.

Best and thanks,
  -- David

[-- Attachment #2: OpenPGP Digital Signature --]
[-- Type: application/pgp-signature, Size: 230 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-18 17:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-15 17:19 Custom agenda and DONE faces Hans-Peter Deifel
2012-03-18 17:02 ` David Maus

Code repositories for project(s) associated with this 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).