I use split-frame (split-window-right in setup) for most things but would like Emacs to open some file types (specifically PDF files) in a new frame when using find-file.

Other files (for example .org files) should be opened in split-frame as before. I use pdf-tools for viewing PDFs.

Any suggestions welcome.

  • Here is a link to a complex example of how to target a specific frame with buffers or filenames matching a particular regexp: stackoverflow.com/questions/18346785/… If you Google a bit, you'll find simpler examples using the display-buffer-alist and also the special-display-regexps. See also the two examples in the manual for some additional ideas: gnu.org/software/emacs/manual/html_node/elisp/… – lawlist Jun 12 '18 at 9:23
  • As @lawlist suggested, see variables special-display-regexps and special-display-buffer-names. Put the PDF buffers in dedicated windows. Alternatively, can fiddle with display-buffer-alist. – Drew Jun 12 '18 at 13:20
  • I tried (add-to-list 'special-display-regexps ".*\.pdf$") but no luck. – Erik Jun 15 '18 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.