2

When I try to follow a link [[nov:path/to/epub/ebook.epub][link]] in nov-mode (defined in nov.el) under Doom Emacs, it always opens the file on a new buffer, replacing the org file where the link sits where I keep my notes, which is a nuisance and a major disruption to my reading.

This behavior doesn't change even after customizing my org-link-frame-setup to:

(org-link-frame-setup
   '((vm . vm-visit-folder-other-frame)
     (vm-imap . vm-visit-imap-folder-other-frame)
     (gnus . org-gnus-no-new-news)
     (file . find-file-other-window)
     (wl . wl-other-frame)))

I tried tracing the functions +org/dwim-at-point and org-open-at-point but couldn't find a way to tweak this behavior.

What's the right way to do this?

nohans
  • 70
  • 1
  • 1
  • 7
Sati
  • 775
  • 6
  • 21

1 Answers1

1

What ended up working for me was changing org-link-parameters using the org-link-set-parameters function and swapping out the link opening function with your own.

;; https://emacs.stackexchange.com/a/61949
(defun org-nov-open-new-window (path)
  "Open nov.el link in a new window"
  (setq available-windows
        (delete (selected-window) (window-list)))
  (setq new-window
        (or (car available-windows)
            (split-window-sensibly)
            (split-window-right)))
  (select-window new-window)
  (nov-org-link-follow path))

(org-link-set-parameters "nov" :follow #'org-nov-open-new-window)

If you're curious, you can see my nov.el configuration in at >>>/g/85988659. Stock nov.el is very plain, so it needs a little configuration love to make the epub reading experience more pleasant. A nice font and a little margin go a long way.

g-gundam
  • 1,096
  • 1
  • 3
  • 13