[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] strange behaviour when customising org-agenda-custom-comma
From: |
Adam Spiers |
Subject: |
Re: [Orgmode] strange behaviour when customising org-agenda-custom-commands |
Date: |
Sun, 30 Dec 2007 21:32:55 +0000 |
User-agent: |
Mutt/1.5.14 (2007-02-12) |
Adam Spiers (address@hidden) wrote:
> Adam Spiers wrote:
> > On Mon, Dec 17, 2007 at 01:49:49PM +0100, Carsten Dominik wrote:
> > > On Dec 10, 2007 12:25 PM, Adam Spiers wrote:
> > > > On Sat, Dec 08, 2007 at 06:30:46PM +0000, Adam Spiers wrote:
> > > > > On Tue, Nov 13, 2007 at 12:38:06PM +0100, Carsten Dominik wrote:
> > > > > > On 8Nov2007, at 1:55 AM, Adam Spiers wrote:
> > > > > > > I haven't figured out how to reproduce this reliably yet, but
> > > > > > > there
> > > > > > > seems to be a bug in 5.13h where when customizing
> > > > > > > org-agenda-custom-commands, sometimes during a Set or Save (not
> > > > > > > sure
> > > > > > > which) all the prefix key documentation entries vanish. Any
> > > > > > > ideas why
> > > > > > > this would happen?
[snipped]
> Argh, it just happened again with 5.17a! And it was definitely only
> (and all) the prefix key documentation entries which vanished, such as
>
> ("#" . "TODOs by priority")
>
> Additionally I have been most careful to regularly save customizations
> since the discussion above, so I'm now sure that there is a bug
> somewhere after all; I just don't know how to trigger it. Is the
> defcustom definition for prefix key documentation definitely correct?
I just cracked it :-)
I noticed that the prefix key documentation cons cells only vanished when
the *Customize Option: Org Agenda Custom Commands* buffer was generated via
M-x org-agenda C and never via M-x customize-option. So that led me to
the culprit:
(defun org-agenda (arg &optional keys restriction)
[...]
(let* ((prefix-descriptions nil)
(org-agenda-custom-commands
;; normalize different versions
(delq nil
(mapcar
(lambda (x)
(cond ((stringp (cdr x))
(push x prefix-descriptions)
nil)
((stringp (nth 1 x)) x)
((not (nth 1 x)) (cons (car x) (cons "" (cddr x))))
(t (cons (car x) (cons "" (cdr x))))))
org-agenda-custom-commands)))
So that when customize-variable is invoked later on in the same function:
((equal keys "C") (customize-variable 'org-agenda-custom-commands))
it is done within the scope of the local value of
org-agenda-custom-commands which has the prefix-descriptions stripped out
by the above code.
Here is a workaround, but it's very ugly since it overrides the local scope
with another value. No doubt Carsten will come up with a cleaner fix -
perhaps assigning the first "stripped" value to a different symbol name
such as `org-agenda-custom-commands-normalized' would work?
http://www.adamspiers.org/cgi-bin/hg.cgi/org-atlantic/rev/0e3d335dbc2c
# HG changeset patch
# User Adam Spiers <address@hidden>
# Date 1199050134 0
# Node ID 0e3d335dbc2c1c388a63702e2d59e550a0e52383
# Parent 8b97b436208cd3b766f2323e392945984ddf0cc7
stop org-agenda losing prefix descriptions from org-agenda-custom-commands
diff -r 8b97b436208c -r 0e3d335dbc2c org.el
--- a/org.el Sun Dec 30 19:29:52 2007 +0000
+++ b/org.el Sun Dec 30 21:28:54 2007 +0000
@@ -19170,7 +19170,10 @@ Pressing `<' twice means to restrict to
(org-let lprops '(funcall type match)))
(t (error "Invalid custom agenda command type %s" type))))
(org-run-agenda-series (nth 1 entry) (cddr entry))))
- ((equal keys "C") (customize-variable 'org-agenda-custom-commands))
+ ((equal keys "C")
+ (let ((org-agenda-custom-commands
+ (append prefix-descriptions org-agenda-custom-commands)))
+ (customize-variable 'org-agenda-custom-commands)))
((equal keys "a") (call-interactively 'org-agenda-list))
((equal keys "t") (call-interactively 'org-todo-list))
((equal keys "T") (org-call-with-arg 'org-todo-list (or arg '(4))))