Concatenate strings in elisp

Solution 1:

You can use (concat "foo" "bar") rather than (concatenate 'string "foo" "bar"). Both work, but of course the former is shorter.

Solution 2:

Use expand-file-name to build filenames relative to a directory:

(let ((default-directory "~/smcho/time/"))
  (setq org-default-notes-file-path (expand-file-name "notes.org"))
  (setq todo-file-path (expand-file-name "gtd.org"))
  (setq journal-file-path (expand-file-name "journal.org"))
  (setq today-file-path (expand-file-name "2010.org")))

Solution 3:

First of all, don't use "_"; use '-' instead. Insert this into your .emacs and restart emacs (or evaluate the S-exp in a buffer) to see the effects:

(setq org-base-path (expand-file-name "~/smcho/time"))

(setq org-default-notes-file-path (format "%s/%s" org-base-path "notes.org")
      todo-file-path              (format "%s/%s" org-base-path "gtd.org")
      journal-file-path           (format "%s/%s" org-base-path "journal.org")
      today-file-path             (format "%s/%s" org-base-path "2010.org"))