Opening files with default Windows application from within emacs

前端 未结 8 1612
难免孤独
难免孤独 2021-02-07 21:06

I\'m trying to tweak the dired-find-file function in emacs on Windows XP so that when I open (say) a pdf file from dired it fires up a copy of Acrobat Reader and op

8条回答
  •  旧巷少年郎
    2021-02-07 21:51

    1. Evaluate the following elisp
    2. Run dired (M-x dired)
    3. Browse to directory and file
    4. With point on file, pressing F3 will open the file based on the windows extension.

      (defun w32-browser (doc) (w32-shell-execute 1 doc))

      (eval-after-load "dired" '(define-key dired-mode-map [f3] (lambda () (interactive) (w32-browser (dired-replace-in-string "/" "\\" (dired-get-filename))))))

提交回复
热议问题