bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.


From: Howard Melman
Subject: bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.el)
Date: Sun, 24 Oct 2021 12:35:23 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin)

Juri Linkov <juri@linkov.net> writes:

>> Such a command emulates what double clicking on an icon does
>> which most of the time is what a user wants (because it's
>> configured it do what their most common app need is).
>
> Such a command is long overdue.  I used the following command
> for a long time, and forgot it's not in dired-x.  I don't suggest
> to use this implementation, but something like this.  

FWIW, my version is quite different:

#+begin_src emacs-lisp
;;; open a file as if double clicking on its icon
(declare-function w32-shell-execute "w32fns.c")
(defun hrm-open-file (file)
  "Open FILE as the system would."
  (interactive "fFile: ")
  (cond ((memq system-type '(darwin))
         (call-process-shell-command (concat "open " (shell-quote-argument 
file))))
        ((memq system-type '(windows-nt))
         (w32-shell-execute "open" (convert-standard-filename file)))
        ((memq system-type '(gnu/linux))
         (call-process-shell-command (concat "xdg-open " (shell-quote-argument 
file))))
        (t
         (error "Open not supported on this system"))))

(defun dired-do-open (&optional arg)
  "Open the marked (or next ARG) files as the system would."
  (interactive "P")
  (mapc #'hrm-open-file (dired-get-marked-files nil arg)))
#+end_src

-- 

Howard






reply via email to

[Prev in Thread] Current Thread [Next in Thread]