6

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:

https://stackoverflow.com/questions/15736590/how-to-automatically-track-links-in-org-mode-to-gnus-messages

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?

4

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 ()
   (interactive)
   (goto-char 1)
   (let ((search-invisible t))
     (replace-string "INBOX" "Archive"))
   )
  • Thanks, in all my searching it never occured to me to check the replace-string docs. :/ Also, just a correction to your answer, another set of params is needed around (search-invisible t) in the let form. Thanks! – Mike Apr 15 '15 at 4:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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