BACKGROUND: In org mode, the variable org-archive-location defaults to "% s_archive ::", so the file "toto.org" is archived in the file "toto.org_archive". I would like to archive instead in "toto.ref". I am using org-mode version 7.4 (outside the git server).
I would think that it is as simple as
(setq org-archive-location '(replace-regexp-in-string ".org" ".ref" %s) )
But I was told that this is not correct in LISP (plus, this does not work). My final solution is this: you should be able to adapt to the smartest org-archive-location configurations:
(setq org-archive-location "%s::* ARCHIVES") (defadvice org-extract-archive-file (after org-to-ref activate) (setq ad-return-value (replace-regexp-in-string "\\.org" ".ref" ad-return-value) ) )
Note:
1) I didn’t voluntarily add $ at the end of ".org" so that it correctly changes "test.org.gpg" to "test.ref.gpg".
2) It seems that the regular expression "\ .org" (and not, say, ".org") should be used (a more detailed explanation in the answers below).
source share