I want use Org-mode to keep track of e-mails. When I've read the e-mail, and added it to Org, I want to archive the e-mail but still have a link to the archived e-mail.

Pretty much exactly this:


I've followed the answer, but it doesn't work. It seems the hook has been updated to: org-capture-before-finalize-hook so I've updated the code as necessary, and it runs.

However, I'm getting the message:

Replaced 0 occurrences (skipped 1 filtered out)

So, it seems that while the buffer is in org-mode, the hidden URL link text gets filtered out if I use replace-string on the buffer. Is there a way around this?

1 Answer 1


From the help text for replace-string:

... ignore hidden matches if `search-invisible' is nil ...

So setting (setq search-invisible t) ought to solve your problem.

Or, to avoid side-effects, set it temporarily inside your function, like so:

(defun hs/replace ()
   (goto-char 1)
   (let ((search-invisible t))
     (replace-string "INBOX" "Archive"))

Your Answer

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

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