10
votes

In Org-mode it is possible to have links and top open links. As listed by http://orgmode.org/orgcard.txt in Org-mode C-u C-c C-o or mouse-3 forces links to open in another window. How can I do the corresponding for frames, that is, how can I force a link to open in another frame?

What I want is for C-c C-o to work as per default but C-u C-c C-o to force the link to be opened in another frame.

(For the distinction of windows and frames see http://www.gnu.org/software/emacs/manual/html_node/emacs/Frames.html.)

I am running Org-mode 7.6 in 23.3.1.

3

3 Answers

7
votes

I just tested and you can get it to work by wrapping org-open-at-point in a (let ) as a custom function.

In this case I'm just prefixing the current org-link-frame-setup with your desired find-file-other-frame to ensure that if you use the command on another link type it will not fail.

(defun zin/org-open-other-frame ()
  "Jump to bookmark in another frame. See `bookmark-jump' for more."
  (interactive)
  (let ((org-link-frame-setup (acons 'file 'find-file-other-frame org-link-frame-setup)))
    (org-open-at-point)))

I suspect you will need to bind it to a key sequence other than C-u C-c C-o, unless Emacs will permit you to bind it to that sequence specifically.

1
votes

Have a look at the variable org-link-frame-setup (M-x customize-variable RET org-link-frame-setup). The docstring should explain the approach.

0
votes

I just tested this in a non-customized emacs:

emacs -q
GNU Emacs 24.0.92.1 (i386-mingw-nt5.1.2600) of 2011-11-30 on MARVIN
Org-mode version 7.7

When running C-c C-o and C-u C-c C-o on a link similar to the following:

file:~/Dropbox/org/test.org::*Test

I end up with a new frame being opened in both cases. C-u C-u C-c C-o opens the test.org file in my active emacsclient session. When changing the link to .../org/test.txt it still opens in a new frame, however it is unable to create the new file (I'm assuming I don't have .txt properly associated on my end, which is possible).

Testing with [mailto:[email protected]][test-mail]] also results in new frames by default.


Edit: The value for org-link-frame-setup is as follows (it is also the default since it is from emacs -q):

Its value is ((vm . vm-visit-folder-other-frame)
 (gnus . org-gnus-no-new-news)
 (file . find-file-other-window)
 (wl . wl-other-frame))