Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force Org-mode to open a link in another frame?

Tags:

emacs

org-mode

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.

like image 977
N.N. Avatar asked Jan 16 '12 14:01

N.N.


2 Answers

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.

like image 102
Jonathan Leech-Pepin Avatar answered Oct 21 '22 18:10

Jonathan Leech-Pepin


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.

like image 41
u-punkt Avatar answered Oct 21 '22 16:10

u-punkt