I'm doing time logging with Org, and I want to associate a numeric code with each entry -- the code says which project the entry is associated with. But I'm awful at remembering the numbers, so I'd like to somehow be able to associate aliases with the codes.

For example: I may associate "coolnewfeature1" with 123456; then when I type C-c C-x p and enter "coolnewfeature1" for the "project" property value, Org would record 123456, so later when I use column view, I can see all the numbers. (Which is where I really need to see them.)

Is there some way to do this? If not, one alternative would be recording "coolnewfeature1" for the property, and somehow getting column view to map the easy-to-remember names to the codes.

1 Answer 1


Here's one way to do it: instead of trying to make C-c C-x p (which runs org-set-property) smarter, just write my own function that acts as a friendly UI around org-entry-put:

(defun set-projectcode-org-property ()
  "Prompt for a project name and set the 'projectcode' org-mode
   property to the corresponding code number."
  (setq projects '(("coolfeature1" . "111")
                   ("coolfeature2" . "222")
                   ("bugfixes-in-old-code" . "333")
  (defun get-project-code ()
    "Prompts for input, converts that to project code number."
    (setq friendly-names (mapcar 'car projects))
    (cdr (assoc (ido-completing-read "Which project? " friendly-names) projects)))
  (org-entry-put (point) "projectcode" (get-project-code)))

(You'll need a (require 'ido) in your .emacs.) The alist maps the friendly names to the codes, and then you use ido-completing-read and the (cdr (assoc ... to get the code. Feed that to org-entry-put and it sets the "projectcode" property to the expected value.

The downside is that the mapping is in the source code. It would be a bit more elegant and generalizable to have it generated from something in your org file, but for me these project names and codes don't change often and editing my .emacs is good enough.

I should add that I'm pretty poor with elisp and I don't claim that anything above is idiomatic, efficient, accepted style, etc. But it works!

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.