From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: Re: org-open-link-from-string in a program Date: Sun, 04 Aug 2013 12:21:11 +0800 Message-ID: <871u6a2iiw.fsf@ericabrahamsen.net> References: <87ehab5fgr.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53494) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5poL-0004Mv-TX for emacs-orgmode@gnu.org; Sun, 04 Aug 2013 00:21:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V5poF-0006sg-LZ for emacs-orgmode@gnu.org; Sun, 04 Aug 2013 00:20:53 -0400 Received: from plane.gmane.org ([80.91.229.3]:48624) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V5poF-0006sP-FY for emacs-orgmode@gnu.org; Sun, 04 Aug 2013 00:20:47 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1V5poE-0000bO-5y for emacs-orgmode@gnu.org; Sun, 04 Aug 2013 06:20:46 +0200 Received: from 221.216.161.92 ([221.216.161.92]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 04 Aug 2013 06:20:46 +0200 Received: from eric by 221.216.161.92 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 04 Aug 2013 06:20:46 +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 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. > > When gnus sets up the reply buffer it also adds several hooks and > actions for restoring windows and marking messages as responded-to, etc, > and these hooks and actions depend on the value of (current-buffer) when > the reply was initiated. That's supposed to be the gnus summary buffer. > > When I call all this from a function, however, (current-buffer) > continues to return the org buffer I started in, even after the link was > opened, which confuses gnus, and me. What I mean is this: > > (let ((addr the-address-part-of-the-link)) > (org-open-link-from-string addr) > (message "%s" (current-buffer)) ; returns the org buffer I started in > (call-interactively > 'gnus-summary-wide-reply-with-original)) > > There must be something I'm misunderstanding about how buffers work when > you're doing something non-interactive. If I manually eval the > org-open-link-from-string statement, I end up in the summary buffer, > obviously, and all works fine. Hmm, I tried sticking a (redisplay) after opening the link, thinking that might "reset" what is considered the current buffer, and it still doesn't do it!