Le sam. 27 juil. 2019  à 11:32:01 , Bob Newell <bobnew...@bobnewell.net>
a envoyé ce message:
> Bonjour Josef,
>
> Je ne suis pas assez doué avec org-mode pour donner des conseils
> expertes. Mais j'ai quand même une idée. Peut-être vous pouviez utiliser
> 'advice' au lieu d'un 'hook' sur org-capture-finalize
>
> Par exemple (attention! pas verifié!)
>
> (defun jr/fix-the-link (&rest args)
>  (interactive)
>  (save-excursion
>    (find-file "~/Dropbox/Orgzly/links.org")
>    (goto-char (point-min))
>    (while (search-forward "INBOX" nil t)
>      (replace-match "Tous les messages"))
>    (save-buffer)))
> (advice-add 'org-capture-finalize :after #'jr/fix-the-link)
>
> Bonne chance ... !

Dear Bob,

In fact, I just realized that this code works as I wanted:

  (defun jr/fix-the-link (&rest args)
 (interactive)
 (save-excursion
   (find-file "~/Dropbox/Orgzly/todo.org")
   (goto-char (point-min))
   (while (search-forward "gnus:INBOX#" nil t)
     (replace-match "gnus:%5BGmail%5D/Tous les messages#"))
   (save-buffer)))
(advice-add 'org-capture-finalize :after #'jr/fix-the-link)

after C-c c t  the link is in todo.org, and with C-c C-w , once refiled
in links.org, the email link is  correctly changed! I do not understand
this magic trick, but many many  thanks for your kind and very efficient
help !


Best wishes, 
-- 
Joseph 

Reply via email to