From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: Re: org-open-link-from-string in a program Date: Sat, 03 Aug 2013 19:04:11 +0800 Message-ID: <87fvur3uj8.fsf@ericabrahamsen.net> References: <87ehab5fgr.fsf@ericabrahamsen.net> <87mwoz16ba.fsf@gmail.com> <87mwoz3w9s.fsf@ericabrahamsen.net> <87iozn11ql.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42895) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5Zcp-0005JL-LW for emacs-orgmode@gnu.org; Sat, 03 Aug 2013 07:04:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V5Zcj-0005yQ-9m for emacs-orgmode@gnu.org; Sat, 03 Aug 2013 07:03:55 -0400 Received: from plane.gmane.org ([80.91.229.3]:35109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5Zcj-0005y7-3W for emacs-orgmode@gnu.org; Sat, 03 Aug 2013 07:03:49 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1V5Zch-00013q-6W for emacs-orgmode@gnu.org; Sat, 03 Aug 2013 13:03:47 +0200 Received: from 221.216.167.20 ([221.216.167.20]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 03 Aug 2013 13:03:47 +0200 Received: from eric by 221.216.167.20 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 03 Aug 2013 13:03:47 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Thorsten Jolitz writes: > Eric Abrahamsen writes: > >> Thorsten Jolitz writes: >> >>> Eric Abrahamsen writes: >>> >>>> I'm trying to write a small function that programmatically follows a >>>> link to a gnus message, then calls >>>> `gnus-summary-wide-reply-with-original' to start a reply to that >>>> message. It seemed like `org-open-link-from-string' (after extracting >>>> the address part from the link) would be the right choice, but I'm >>>> seeing odd behavior. > > [...] > >>> #+begin_src emacs-lisp >>> (defun org-open-link-from-string (s &optional arg reference-buffer) >>> "Open a link in the string S, as if it was in Org-mode." >>> [...snip...] >>> (org-open-at-point arg reference-buffer))))) >>> #+end_src >>> >>> ,---------------------------------------------------------------------- >>> | org-open-at-point is an interactive Lisp function in `org.el'. >>> | >>> | (org-open-at-point &optional ARG REFERENCE-BUFFER) >>> | >>> | Open link at or after point. >>> | If there is no link at point, this function will search forward up to >>> | the end of the current line. >>> | Normally, files will be opened by an appropriate application. If the >>> | optional prefix argument ARG is non-nil, Emacs will visit the file. >>> | With a double prefix argument, try to open outside of Emacs, in the >>> | application the system uses for this file type. >>> `---------------------------------------------------------------------- >>> >>> Maybe because you call >>> >>> ,--------------------------------- >>> | (org-open-link-from-string addr) >>> `--------------------------------- >>> >>> without ARG, Emacs is not visiting the file and thus its buffer does not >>> become current? >> >> Huh, interesting -- I had looked at that function, and assumed that the >> what the arg did was to force a file that might otherwise be opened by >> an external process to be opened in emacs. I still think that's what it >> means (and adding a '(4) doesn't solve the problem), but there's other >> stuff in there that might lead to a solution. > > Yes, you are right about the meaning of ARG, I should have looked twice. > >>> Anyway, when you're done - please share, this is quite interesting. >> >> I will! It's pretty much done, except for this one little bug. > > I can imagine that this is very useful for managing phonecalls to be > made in the future... Well this will only cover composing and replying to emails, but if you have a function that automatically makes a phone call, I suppose it would serve as a template... Mostly I'm doing it because a full half of my work seems to be replying to interminable emails, and I wanted something that would keep me in the agenda as much as possible: hit a key on a TODO, type the email, send it, and there you are back in the agenda again. It's turning out to be a little more complicated than I thought!