diff options
author | Jean-Christophe Helary <jean.christophe.helary@gmail.com> | 2017-05-04 20:32:40 +0200 |
---|---|---|
committer | Anders Lindgren <andlind@gmail.com> | 2017-05-04 20:32:40 +0200 |
commit | d15a4805d6347412ae1d605dcf5e8d3fe0f8e743 (patch) | |
tree | 735a8d502201055a459fd5244c6b5563aec4ccc8 /lisp/term | |
parent | f5ca518b9274e4abaecd1398cce6a24b77139ae3 (diff) | |
download | emacs-d15a4805d6347412ae1d605dcf5e8d3fe0f8e743.tar.gz |
Multiline support in NS "Open Selected File" service.
* lisp/term/ns-win.el (ns-open-file-service): new function. Wraps the
original call in a (split-string) to create as many calls as there
are lines.
(ns-spi-service-call): Call `ns-open-file-service' instead of
`dnd-open-file'.
Diffstat (limited to 'lisp/term')
-rw-r--r-- | lisp/term/ns-win.el | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el index 70bd817d930..4df5f0abe21 100644 --- a/lisp/term/ns-win.el +++ b/lisp/term/ns-win.el @@ -229,6 +229,15 @@ The properties returned may include `top', `left', `height', and `width'." (declare-function dnd-open-file "dnd" (uri action)) +;; Handles multiline strings that are passed to the "open-file" service. +(defun ns-open-file-service (filenames) + "Open multiple files when selecting a multiline string FILENAMES." + (let ((filelist (split-string filenames "[\n\r]+" t "[ \u00A0\t]+"))) + ;; The path strings are trimmed for spaces, nbsp and tabs. + (dolist (filestring filelist) + (dnd-open-file filestring nil)))) + + (defun ns-spi-service-call () "Respond to a service request." (interactive) @@ -236,7 +245,7 @@ The properties returned may include `top', `left', `height', and `width'." (switch-to-buffer (generate-new-buffer "*untitled*")) (insert ns-input-spi-arg)) ((string-equal ns-input-spi-name "open-file") - (dnd-open-file ns-input-spi-arg nil)) + (ns-open-file-service ns-input-spi-arg)) ((string-equal ns-input-spi-name "mail-selection") (compose-mail) (rfc822-goto-eoh) |