0

I'm creating a custom agenda command that searches for tags and displays results in column view:

(defun my/org-agenda-search-tags () (interactive) (let* ((tags-input (read-string "Enter tags to search (space-separated): ")) (tags-list (split-string tags-input " " t)) (tags-query (mapconcat (lambda (tag) tag) tags-list "&")) (org-agenda-prefix-format " ") (org-overriding-columns-format "%25ITEM %TODO %PRIORITY %TAGS %CREATED %SWAY") (org-agenda-view-columns-initially t)) (org-tags-view nil tags-query) (org-agenda-columns))) 

The problem I'm encountering is with the PRIORITY column. For TODO items that don't have an explicitly set priority (no [#A], [#B], or [#C] in the headline), Org still displays the default priority (B) in the column view.

Here's an example TODO without explicit priority:

* TODO Sample task :PROPERTIES: :CREATED: [2025-05-11 sø.] :SWAY: 3 :ID: 0648cfbe-05d1-4477-bf8c-b7b3edbd0fb6 :END: 

In the agenda column view, this displays with a "B" in the PRIORITY column, even though there's no [#B] in the headline.

My question: Is there a way to configure the column view to only display priorities that are explicitly set in the headline, and leave the column blank for items with default priority?

I've tried various approaches including:

  • Different formats for the PRIORITY column
  • Setting org-priority-show-all-priorities to nil
  • Post-processing the agenda buffer

But I haven't found a clean solution that works reliably.

Any suggestions would be appreciated!

2
  • org-priority-show-all-priorities is not used at all so setting it to anything is bound to be ineffective. Where did you see that a variable of that name exists? Commented May 12 at 13:52
  • Column view adds overlays to a buffer to present the summary information: any postprocessing you do should be directed at those overlays, not the underlying text of the buffer. That's probably why your third approach did not work. Commented May 12 at 13:55

1 Answer 1

0

[DON'T DO THIS! It will break things (see below).]

If it's just a matter of making the default priority "invisible", you can try setting org-priority-default to 32 (the ASCII code for SPACE):

(setq-default org-priority-default 32) 

That might break other things (e.g. trying to bump up the priority of a headline without a priority cookie using org-priority-up will signal an error). You can try to limit the damage by using setq-local in a buffer, so that only that buffer will see the breakage, but if you are dealing with multiple buffers (e.g. you want the agenda column view), then the setq-default is a blunt but more convenient instrument than using setq-local on each agenda file buffer.

Or you might not care about the org-priority-(up|down) breakage, but there might be other breakage as well - I don't know.

If you try it, reset org-priority-default to its default value to fix the breakage:

(setq-default org-priority-default 66) 

where 66 is the ASCII code for B.

In summary: caveat emptor and do this at your own peril. There is no warranty at all.

EDIT: You could probably advise org-columns (and/or org-agenda-columns) to do the default setting of org-priority-default before the call to the original function; and org-columns-quit to do the unsetting after the call to the original function. That way, when you activate column view, you don't get to see the default priority (and presumably, you don't try to set/change priorities: the underlying buffer in column view is (partially) read-only, but there are ways to modify properties and propagate them back I believe). Then when you exit column view, everything goes back to "normal". But I have not tested this and there are lots of things that could go wrong, I think.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.