open with now works on files with spaces
This commit is contained in:
parent
c2bbfdbda0
commit
354b73ea95
11
conf.org
11
conf.org
|
@ -290,8 +290,10 @@ multiple files at once for given MIMETYPE."
|
||||||
(seq-filter (lambda (a) (string-match ".*%[FU].*" (car a))) (nd/get-apps-from-mime mimetype))))
|
(seq-filter (lambda (a) (string-match ".*%[FU].*" (car a))) (nd/get-apps-from-mime mimetype))))
|
||||||
|
|
||||||
(defun nd/execute-desktop-command (cmd file)
|
(defun nd/execute-desktop-command (cmd file)
|
||||||
"Opens FILE using CMD in separate process."
|
"Opens FILE using CMD in separate process where CMD is from a
|
||||||
(call-process-shell-command (concat (replace-regexp-in-string "%[fuFU]" file cmd t) " &")))
|
desktop file exec directive."
|
||||||
|
(let* ((cmd-arg (replace-regexp-in-string "%[fuFU]" file cmd t t)))
|
||||||
|
(call-process-shell-command (concat cmd-arg " &"))))
|
||||||
|
|
||||||
(defun nd/get-mime-type (file)
|
(defun nd/get-mime-type (file)
|
||||||
"Get the mime type of FILE."
|
"Get the mime type of FILE."
|
||||||
|
@ -493,8 +495,9 @@ Keeping confirmation enabled does weird stuff with helm. Not ideal at the moment
|
||||||
"Open marked non-text files in external app via open-with dialog
|
"Open marked non-text files in external app via open-with dialog
|
||||||
according to mime types as listed in all available desktop files."
|
according to mime types as listed in all available desktop files."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let* ((marked-files (seq-filter #'file-regular-p (dired-get-marked-files)))
|
(let* ((mf (seq-filter #'file-regular-p (dired-get-marked-files)))
|
||||||
(file-mime-list (mapcar (lambda (f) (list f (nd/get-mime-type f))) marked-files)))
|
(qmf (mapcar #'shell-quote-argument mf))
|
||||||
|
(file-mime-list (mapcar (lambda (f) (list f (nd/get-mime-type f))) qmf)))
|
||||||
|
|
||||||
(if (= (length file-mime-list) 0)
|
(if (= (length file-mime-list) 0)
|
||||||
(message "No files selected")
|
(message "No files selected")
|
||||||
|
|
Loading…
Reference in New Issue