[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] org-agenda-bulk-custom-functions Customize mismatch

From: Phil Hudson
Subject: [O] org-agenda-bulk-custom-functions Customize mismatch
Date: Sun, 08 May 2016 14:57:21 +0100

Another defcustom mismatched with the code.

At line 9962 of org-agenda.el (20160502 release) we have:

  (setq cmd (list (cadr (assoc action org-agenda-bulk-custom-functions)))

This assumes that `org-agenda-bulk-custom-functions` is a
list-of-two-element-lists alist. Thus, the `cadr` form returns (should
return) the second element of one two-element list from the alist.

However, the defcustom is declared as type alist, which in defcustom
means (by default) a list-of-conses alist.

See if you agree with my thinking about this. This means that the code
must always fail if the Customize UI is used to populate
`org-agenda-bulk-custom-functions`. That in turn implies that (to a
first approximation) zero users apart from me have tried to declare a
custom bulk agenda command with its own custom key via Customize. Oh

If my diagnosis is correct, then I see two ways to fix it: either change
the defcustom to create a list-of-two-element-lists alist, or change the
code so that it handles a list-of-conses alist.

The first approach is supported by defcustom and gives us the chance to
be both more descriptive and more prescriptive. It shouldn't break
anything that isn't in fact already broken.

The second approach is as simple as changing that `cadr` to a `cdr`, but
it does risk breaking working configs where the alist was populated

I propose the first. Here's a patch.

Phil Hudson                   http://hudson-it.ddns.net
@UWascalWabbit                 PGP/GnuPG ID: 0x887DCA63

--- org-20160502/org-agenda.el  2016-05-07 10:18:22.000000000 +0100
+++ org-mode-mod/org-agenda.el  2016-05-08 14:39:52.000000000 +0100
@@ -1999,7 +1999,7 @@
 With selected entries in an agenda buffer, `B R' will call
 the custom function `set-category' on the selected entries.
 Note that functions in this alist don't need to be quoted."
-  :type 'alist
+  :type '(alist :key-type character :value-type (group function))
   :version "24.1"
   :group 'org-agenda)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]