Le   jeu.   07/25/19   juil.   2019   à   04:47:14   ,   "Fraga,   Eric"
<e.fr...@ucl.ac.uk> a envoyé ce message:
> On Thursday, 25 Jul 2019 at 18:24, Joseph Vidal-Rosset wrote:
>> But for  gnus-imap-gmail users, it is  more difficult to get  the same
>> thing. 
>
> [...]
>
>> But  I need  to change  the mention  of INBOX  in the  link to  John's
>> email. 
>
> Why is that?  If I create a link to an email from gmail using %a, this
> seems to work (having just tested it).  Am I missing something?

Hi again Eric and everybody,

Considering the code:

#+BEGIN_SRC 
;;capture todo items using C-c c t
(define-key global-map (kbd "C-c c") 'org-capture)
(setq org-capture-templates
      '(
        ("t" "todo" entry (file+headline "~/Dropbox/Orgzly/todo.org" "Tasks")
         "* TODO [#A] %?\n 
[[~/Dropbox/Orgzly/links.org::%(org-insert-time-stamp (org-read-date nil t 
\"%:date\"))]] \n* %(org-insert-time-stamp (org-read-date nil t \"%:date\")) %a 
"
         )
        )
      )

(defun hs/replace ()
   (interactive)
   (goto-char 1)
   (let ((search-invisible t)) (replace-string "gnus:INBOX#" 
"gnus:%5BGmail%5D/Tous les messages#")))
(define-key global-map (kbd "C-c r") 'hs/replace)
(add-hook 'org-capture-prepare-finalize-hook 'hs/replace)
(defun my/refile (file headline &optional arg)
  (let ((pos (save-excursion
               (find-file file)
               (org-find-exact-headline-in-buffer headline))))
    (org-refile arg nil (list headline file nil pos)))
  (switch-to-buffer (current-buffer)))
#+END_SRC

a better option  would be to get in only one function org-capture-template
and hs/replace :  if string "gnus/INBOX" exists,  hs/replace works and
replaces the  string, if not,  the link  is given without  change. The
idea is simple, but  I do not succeed to realize it,  because I do not
know enough  the syntax.  But I  would be surprised  if this  would be
impossible to make it. 


Best wishes,
 

-- 
Joseph 

Reply via email to