1

When I do C-c C-o on an org link it opens the org file in a new window. This is fine, but sometimes I'd prefer to open org files within the current window, creating a new key binding for the matter (for example "C-c <C-return>").

I've tried to adapt some code I found on emacs.stackexchange, namely :

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

(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)))

and Open org link in the same window

(setf (cdr (assoc 'file org-link-frame-setup)) 'find-file)

But my understanding of Elisp is so poor that I didn't manage to do it...

1 Answer 1

1

Adding this to your init will allow you to open a link in the current window through C-o:

       (defun mda/org-open-current-window ()                                              
         "Opens file in current window."                                                  
         (interactive)                                                                    
         (let ((org-link-frame-setup (cons (cons 'file 'find-file) org-link-frame-setup)))
           (org-open-at-point)))                                                          
       (define-key global-map (kbd "C-o") #'mda/org-open-current-window)                  

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.