1

I would like to display file names in my global TODO list in column view without directories and extensions.

(setq org-columns-default-format "%TODO %FILE %ITEM") followed by C-catC-cC-xC-c leads to something like

Global list of TODO items of type: ALL Available with ‘N r’: (0)[ALL]
(1)TODO (2)QUICK (3)WAITING (4)NEXT (5)STALL (6)DONE (7)CANCELLED  
TODO   | c:/Users/micha/Dropbox/org/175-stuff.org                      | * Todo 1
TODO   | c:/Users/micha/Dropbox/org/175-stuff.org                      | * Todo 2
TODO   | c:/Users/micha/Dropbox/org/175-stuff.org                      | * Todo 3
TODO   | c:/Users/micha/Dropbox/org/250-petcare.org                    | * Clean dog

I tried setting up a summarizer with

(setq org-columns-default-format "%TODO %FILE{filenamebase} %ITEM")

(defun summarize-file-name-base (values printf)
  (format (or printf "%s") (file-name-base (car values))))

(add-to-list 'org-columns-summary-types '("filenamebase" . summarize-file-name-base))

If I go back to the agenda list and refresh with g then go back to column mode with C-cC-xC-c I get org-entry-put: The FILE property cannot be set with ‘org-entry-put’. If I remove the file-name-base call from the summarizer so that it just returns its input in the case of a list of a single string I don't get an error but I also get no change in formatting.

(defun summarize-file-name-base (values printf)
      (format (or printf "%s") (car values)))

Is there another way to do this?

2
  • 1
    I can reproduce the problem but I have no idea how to fix it. I would suggest posting it to the org-mode ML.
    – NickD
    Commented Jun 13, 2018 at 17:12
  • Good idea. I'll do that after it falls off the front page on emacs.stackexchange Commented Jun 13, 2018 at 18:08

1 Answer 1

0

This should do it:

(defun my-column-display-value-transformer (column-title value)
  "Modifies the value to display in column view."
  (when (equal column-title "FILE")
    (file-name-base value)))

(setq org-columns-modify-value-for-display-function
      #'my-column-display-value-transformer)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.