Matt Lundin <m...@imapmail.org> writes: > "Martin Beck" <elwood...@web.de> writes: > >> I'm working with a lot of pre-defined agendas, but I sometimes would >> like to change the sorting order of one of those to different criteria >> (by time, alphanumerically, etc.). >> >> I did not find a way to do that in org-mode directly - did I overlook >> something, or do I really have to change the configuration of the >> whole agenda and rebuild it? >> >> Related problem: >> If I change the configuration of the agenda by changing the >> customizing options, those changes do only have an effect, if I kill >> the agenda buffer and launch the agenda again. >> It would be nice, if I just could rebuild the existing agenda with "r" >> or "g", but that does not seem to be sufficient? >> > > Here's a quick function that works for me: > > (defun my-org-agenda-change-sorting-strategy (strategy) > "Change the sorting strategy." > (interactive (list > (completing-read "Choose a strategy: " > (mapcar 'cdr (cdr org-sorting-choice)) > nil t))) > ;; adjust the following types as needed - e.g., add 'agenda, etc. > (org-agenda-check-type t 'todo 'tags 'search) > (let ((org-agenda-sorting-strategy (list (intern strategy)))) > (org-agenda-redo)))
I should add that with this function the new sort order is temporary. Pressing "r" for refresh will restore the default sort order for the buffer. Matt