all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Adam Spiers <orgmode@adamspiers.org>
To: emacs-orgmode@gnu.org
Subject: Re: strange behaviour when customising org-agenda-custom-commands
Date: Sun, 30 Dec 2007 21:32:55 +0000	[thread overview]
Message-ID: <20071230213255.GH20947@atlantic.linksys.moosehall> (raw)
In-Reply-To: <20071230194707.GG20947@atlantic.linksys.moosehall>

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

  reply	other threads:[~2007-12-30 21:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2008-01-04 22:13               ` Carsten Dominik

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071230213255.GH20947@atlantic.linksys.moosehall \
    --to=orgmode@adamspiers.org \
    --cc=emacs-orgmode@gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.