From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: Re: following org links to gnus messages and window management Date: Thu, 20 Mar 2014 12:14:50 +0800 Message-ID: <87k3bp4ibp.fsf@ericabrahamsen.net> References: <87k3bqjxtw.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQULK-0003hg-T0 for emacs-orgmode@gnu.org; Thu, 20 Mar 2014 00:12:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQULE-0004YD-7M for emacs-orgmode@gnu.org; Thu, 20 Mar 2014 00:12:34 -0400 Received: from plane.gmane.org ([80.91.229.3]:43952) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQULE-0004Y9-0B for emacs-orgmode@gnu.org; Thu, 20 Mar 2014 00:12:28 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WQULA-0008U1-29 for emacs-orgmode@gnu.org; Thu, 20 Mar 2014 05:12:24 +0100 Received: from 114.248.24.234 ([114.248.24.234]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 20 Mar 2014 05:12:24 +0100 Received: from eric by 114.248.24.234 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 20 Mar 2014 05:12:24 +0100 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 Alan Schmitt writes: > Hi Bastien, > > Bastien writes: > >>> - if not, is there a way to copy a link then open it using the >>> minibuffer (I would then do the switch to screen 0 manually)? >> >> This does not use the minibuffer but you could add that: >> >> (progn >> (org-next-link) >> (org-open-link-from-string >> (org-element-property :raw-link (org-element-link-parser)))) > > This was most helpful: I just need to copy the link I want to follow, go > to the first screen, and interactively call `org-open-link-from-string'. > This works great for the moment. > >>> - finally, do you have alternative window management options to suggest >>> that would work well with following links to gnus messages? >> >> Well, all I can think of now is >> >> (setq org-agenda-window-setup 'other-frame) > > Thanks, but I'm trying to avoid using several frames. (OS > X unfortunately does not come with a window manager that I like ...) > > Thanks again, > > Alan I have a setup that's probably more complicated than what you want, but maybe you'll find something interesting in it. The problem is, you need to somehow specify when or under what conditions you do away with the opened windows and return to your org file or agenda. In my case, I use the following to answer emails. When I open the link it stores the current window configuration, and when the email is sent it triggers the restore. I believe I've confused myself slightly while trying to set up interactive vs non-interactive versions, but so far I've never wanted to use it non-interactively, so it works fine. #+BEGIN_SRC org (defvar org-mail-window-conf nil "Save org-buffer window configuration here, for later restoration.") (defun org-mail-restore-after-send () (gnus-summary-exit nil t) (when (window-configuration-p org-mail-window-conf) (set-window-configuration org-mail-window-conf)) ; Should check here that we actually made it back to the org ; heading. Could save an ID prop on the heading and check for that. (call-interactively 'org-agenda-todo)) (defun org-mail-handle-mail (&optional interactive-p) "Handle mail-related links for current headline." (interactive "p") (unless (org-back-to-heading t) (error "Not in an org item")) (when interactive-p (setq org-mail-window-conf (current-window-configuration))) (let (message mailto) (while (re-search-forward org-any-link-re (line-end-position) t) (let ((addr (or (match-string-no-properties 2) (match-string-no-properties 0)))) (cond ((string-match "^