emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* strange behaviour when customising org-agenda-custom-commands
@ 2007-11-08  0:55 Adam Spiers
       [not found] ` <C4B91C21-205E-48BC-9939-E58D6A80AA6C@science.uva.nl>
  0 siblings, 1 reply; 4+ messages in thread
From: Adam Spiers @ 2007-11-08  0:55 UTC (permalink / raw)
  To: org-mode mailing list

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?

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

* Re: strange behaviour when customising org-agenda-custom-commands
       [not found]         ` <20071217140115.GF13112@atlantic.linksys.moosehall>
@ 2007-12-30 19:47           ` Adam Spiers
  2007-12-30 21:32             ` Adam Spiers
  0 siblings, 1 reply; 4+ messages in thread
From: Adam Spiers @ 2007-12-30 19:47 UTC (permalink / raw)
  To: org-mode mailing list

[moving thread to the list in case anyone else can shed light]

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?
> > > > >
> > > > > any more constraints on this?
> > > >
> > > > Not yet sorry - when I find time to finishing customization of
> > > > org-agenda-custom-commands off, I'll try to debug it more fully and
> > > > let you know.
> > > 
> > > I think I may have figured it out as being a general issue with emacs
> > > custom mode.  If you edit a custom variable as a lisp expression, then
> > > change back to normal view without doing "Set for Current Session"
> > > then it loses all the changes you made to the elisp sexp.  Can you
> > > reproduce that?
> > 
> > I don't even need to check, this is how customize is supposed to work.
> > Before using set for current session, nothing changes internally, and
> > when you switch to a different view, th current internal value is used
> > to produce the view.
> 
> Yep, I should have guessed from the wording "Show Saved Lisp
> Expression".  I'm pretty sure this is what caused the loss of config,
> but if I see it still happening I'll let you know.  Thanks.

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?

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

* Re: strange behaviour when customising org-agenda-custom-commands
  2007-12-30 19:47           ` Adam Spiers
@ 2007-12-30 21:32             ` Adam Spiers
  2008-01-04 22:13               ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Adam Spiers @ 2007-12-30 21:32 UTC (permalink / raw)
  To: emacs-orgmode

Adam Spiers (orgmode@adamspiers.org) 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 <orgmode@adamspiers.org>
# 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))))

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

* Re: strange behaviour when customising org-agenda-custom-commands
  2007-12-30 21:32             ` Adam Spiers
@ 2008-01-04 22:13               ` Carsten Dominik
  0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2008-01-04 22:13 UTC (permalink / raw)
  To: Adam Spiers; +Cc: emacs-orgmode


On Dec 30, 2007, at 10:32 PM, Adam Spiers wrote:

> Adam Spiers (orgmode@adamspiers.org) 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:

Fixed, thanks for the analysis!

- Carsten

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

end of thread, other threads:[~2008-01-04 22:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-08  0:55 strange behaviour when customising org-agenda-custom-commands Adam Spiers
     [not found] ` <C4B91C21-205E-48BC-9939-E58D6A80AA6C@science.uva.nl>
     [not found]   ` <20071208183046.GC15129@atlantic.linksys.moosehall>
     [not found]     ` <20071210112539.GH15129@atlantic.linksys.moosehall>
     [not found]       ` <acf852aa0712170449r3168ab73p1e348bb687773e96@mail.gmail.com>
     [not found]         ` <20071217140115.GF13112@atlantic.linksys.moosehall>
2007-12-30 19:47           ` Adam Spiers
2007-12-30 21:32             ` Adam Spiers
2008-01-04 22:13               ` Carsten Dominik

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).