Skip to content
Browse files

Better handling of space character in filenames.

  • Loading branch information...
1 parent 27cb132 commit a92fa846b72366f19210d3977d327593f3945f14 @thomp committed Sep 2, 2011
Showing with 24 additions and 13 deletions.
  1. +24 −13 dired-launch.el
View
37 dired-launch.el
@@ -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)

0 comments on commit a92fa84

Please sign in to comment.
Something went wrong with that request. Please try again.