From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ulf Stegemann Subject: Re: Store link upon sending a message Date: Fri, 12 Nov 2010 16:54:13 +0100 Message-ID: References: <87wrq29qvi.fsf@dasa3.iem.pw.edu.pl> <87oc9u7iet.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=57787 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGvxO-0002yB-2K for emacs-orgmode@gnu.org; Fri, 12 Nov 2010 10:54:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PGvxM-0004Oz-LW for emacs-orgmode@gnu.org; Fri, 12 Nov 2010 10:54:29 -0500 Received: from lo.gmane.org ([80.91.229.12]:56112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PGvxM-0004Ol-AW for emacs-orgmode@gnu.org; Fri, 12 Nov 2010 10:54:28 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PGvxJ-0002hA-Sz for emacs-orgmode@gnu.org; Fri, 12 Nov 2010 16:54:25 +0100 Received: from london.zeitform.net ([146.140.213.100]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 12 Nov 2010 16:54:25 +0100 Received: from ulf-news by london.zeitform.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 12 Nov 2010 16:54:25 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Ulf Stegemann wrote: > Eric S. Fraga wrote: > >> Ulf Stegemann writes: >> >>> I came back to the matter of storing an org link to a copy of a message >>> upon sending that message. The function below does just that and proves >>> to be quite useful together with a sensible key binding (if you use Gnus >>> and Gcc that is). >> >> Very nice! Works very well. Thanks. >> >> Instead of binding this to a command sequence, is there any hook we can >> attach the function to so that it's invoked for every message I send >> (I'm somewhat of a gnus noob unfortunately although I'm learning...)? I >> ask because I alternative between =C-c C-c= and =C-c C-j= for sending >> emails and I would need to provide two alternatives to incorporate your >> function. > > hmmm, never thought of this, probably because I never use > `gnus-delay-article'. You could try to put the function into > `message-send-hook' (but you should remove the call to > `message-send-and-exit' first). I don't know if this would work as I > don't know if the Gcc magic (incl. removal of Gcc header) is done before > or after that hook. If the Gcc header has been removed when > `message-send-hook' is called than you'll have to look for a different > hook to use. If the Gcc header is still present, it should probably > work as expected but note that in that case the org link will be created > before the actual copying of the message took place. If something goes > wrong with the latter this will leave you with a bogus org link (which, > however, is probably not much of a problem). If the hook approach does not work you could also advise `gnus-inews-do-gcc', the function that actually creates the message copies ... ... or you could replace `gnus-inews-do-gcc', e.g. replace the call to `message-send-and-exit' in `ulf-message-send-and-org-gnus-store-link' with something like `gnus-inews-do-gcc-orig' and save it as e.g. `my-gnus-gcc-and-org-store-link'. Then you could do something like (fset 'gnus-inews-do-gcc-orig (symbol-function 'gnus-inews-do-gcc)) (fset 'gnus-inews-do-gcc 'my-gnus-gcc-and-org-store-link) ... but that's all untested ;) Ulf