Skip to content
This repository has been archived by the owner on Feb 11, 2024. It is now read-only.

Commit

Permalink
Better handling of space character in filenames.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomp committed Sep 2, 2011
1 parent 27cb132 commit a92fa84
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions dired-launch.el
Expand Up @@ -11,35 +11,46 @@
;; ORG-OPEN-AT-POINT
;;

(defvar dl-mailcap-friend
;; EXO-OPEN
"exo-open"
;; GNOME-OPEN
;; KDE-OPEN
;; XDG-OPEN
;; - issues w/filenames with spaces (see https://bugs.archlinux.org/task/19305, https://bugs.launchpad.net/xdg-utils/+bug/220750)
)

;; using this is problematic since only one process can run at a time (issue: inability to specify distinct async output buffers for each process...)
(defun dired-launch-builtin
;; dired-do-async-shell-command has issues... but plays nicely with xdg-open
;; dired-do-shell-command is a drag since emacs locks until launched app terminates
(dired-do-async-shell-command
(case system-type
(gnu/linux "xdg-open") ; kde-open, gnome-open, ...
(gnu/linux dl-mailcap-friend)
(darwin "open"))
nil
(dired-get-marked-files t current-prefix-arg)))

;; workaround for DIRED-DO-ASYNC-SHELL-COMMAND (see DIRED-LAUNCH-BUILTIN) inability to handle more than one process at a time (due to inability to specify distinct async buffer names?)
(defun dired-launch-homebrew ()
(let ((launch-cmd
(case system-type
(gnu/linux "xdg-open") ; kde-open, gnome-open, ...
(gnu/linux dl-mailcap-friend)
(darwin "open")))
(files (dired-get-marked-files t current-prefix-arg)))
(mapc #'(lambda (file)
(let ((cmd
(concat
launch-cmd
" "
(shell-quote-argument file))))
(start-process-shell-command
cmd
nil ; don't associate process w/a buffer
cmd)))
files)))
(let ((buffer-name "dired-launch-output-buffer")
(cmd
(concat
launch-cmd
" "
(shell-quote-argument file))))
(message cmd)
;; handle file names with spaces
(call-process dl-mailcap-friend
nil
0 ; async-ish...
nil file)))
files)))

(defun dired-launch-command ()
(interactive)
Expand Down

0 comments on commit a92fa84

Please sign in to comment.