gas_della_casa_verde · 2022-03-15 23:37
Hi everyone!
I am starting to use EMacs doom to take notes and organise my digital system (non programmer here).
I am currently trying to build my workflow and I didn’t yet found a solution for the following: searching recursively in all subdirectories and open one file among the result with the default app. I have tried to use projectile and it works for searching recursively but I am not able to open files with defaul app (e.g. a pdf).
Is there a way to achieve this?
Thanks for the help
Danrobi1 · 2022-03-16 01:09
(defun open-file-externally (file)
(call-process (pcase system-type
(_ "xdg-open"))
nil 0 nil
(expand-file-name file)))
(defun dired-open-externally (&optional arg)
"Open marked or current file in operating system's default application."
(interactive "P")
(dired-map-over-marks
(open-file-externally (dired-get-filename))
arg))
(global-set-key (kbd "<f9>") 'dired-open-externally)
Press `f9` when the desired file is under point. `xdg-open` will use the system default apps. Define system default apps with: `xdg-settings` or with: `xdg-mime`.
[Source](https://old.reddit.com/r/emacs/comments/paqvav/how_to_open_different_types_of_file_with_one/)