BUG: Agenda view invokes custom sort routine even if not configured to
do so.
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
old mode 100644
new mode 100755
index 1314eb2..f34f45d
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -5312,8 +5312,9 @@ HH:MM."
(alpha-up (and (org-em 'alpha-up 'alpha-down ss)
(org-cmp-alpha a b)))
(alpha-down (if alpha-up (- alpha-up) nil))
+ (need-user-cmp (org-em 'user-defined-up 'user-defined-down ss))
user-defined-up user-defined-down)
- (if (and org-agenda-cmp-user-defined
+ (if (and need-user-cmp org-agenda-cmp-user-defined
(functionp org-agenda-cmp-user-defined))
(setq user-defined-up
(funcall org-agenda-cmp-user-defined a b)
;; Sample agenda file
* Tasks
** Task1
<2010-07-19 Mon>
** Task2
<2010-07-19 Mon>
;; turn on custom comparison
(org-agenda-cmp-user-defined (quote my-org-cmp-category))
;; only todo-view requests custom comparison of categories.
;; agenda-view does *NOT* request custom compare function. Despite
;; this custom sort function is triggered on C-c a a.
(org-agenda-sorting-strategy
(quote
((agenda habit-down time-up priority-down category-keep)
(todo priority-down user-defined-up)
(tags priority-down category-keep)
(search category-keep))))
;; user-defined routine for sorting of categories. prints a message
;; to the console on being invoked. Rest of the details not relevant.
(defun my-org-cmp-category (a b)
"Compare the string values of categories of strings A and B."
(let (
(uncategorized 0)
(ca (or (get-text-property 1 'org-category a) ""))
(cb (or (get-text-property 1 'org-category b) ""))
)
(message "my-org-cmp-category")
(setq ca (cdr (assoc ca org-CATEGORY-sort-order)))
(setq cb (cdr (assoc cb org-CATEGORY-sort-order)))
(unless ca
(setq ca uncategorized)
)
(unless cb
(setq cb uncategorized)
)
(cond ((< ca cb) -1)
((< cb ca) +1)
(t nil))
)
)
;; information down below is only for the sake of completion.
;; not relevant to the bug per se.
;; category to priority mappings
(defcustom org-CATEGORY-sort-order nil
"Map CATEGORY to Sort Order"
:group 'org-jambu
:type '(repeat
(cons
(string :tag "CATEGORY")
(integer :tag "VALUE")
)))
;; example categories
(org-CATEGORY-sort-order
(quote (
("PHONE" . 50)
("EMAIL" . 60)
("MISC" . 80)
)
)
)
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
old mode 100644
new mode 100755
index 1314eb2..f34f45d
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -5312,8 +5312,9 @@ HH:MM."
(alpha-up (and (org-em 'alpha-up 'alpha-down ss)
(org-cmp-alpha a b)))
(alpha-down (if alpha-up (- alpha-up) nil))
+ (need-user-cmp (org-em 'user-defined-up 'user-defined-down ss))
user-defined-up user-defined-down)
- (if (and org-agenda-cmp-user-defined
+ (if (and need-user-cmp org-agenda-cmp-user-defined
(functionp org-agenda-cmp-user-defined))
(setq user-defined-up
(funcall org-agenda-cmp-user-defined a b)
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-orgmode