Use osx-trash for system trash on OS X

This commit is contained in:
Sebastian Wiesner 2015-10-08 20:00:02 +02:00 committed by syl20bnr
parent 48edef187f
commit cd18b14a7a

View file

@ -1,5 +1,6 @@
(setq osx-packages (setq osx-packages
'( '(
osx-trash
pbcopy pbcopy
launchctl launchctl
reveal-in-osx-finder reveal-in-osx-finder
@ -14,11 +15,9 @@
;; See brew info trash (or osx-tools) ;; See brew info trash (or osx-tools)
;; otherwise, enable built-in support for trashing using Finder API ;; otherwise, enable built-in support for trashing using Finder API
(if (executable-find "trash") ;; Enable built-in trash support via finder API if available (only on Emacs
(defun system-move-file-to-trash (file) ;; Mac Port)
"Use `trash' to move FILE to the system/volume trash can. (when (boundp 'mac-system-move-file-to-trash-use-finder)
Can be installed with `brew install trash'."
(call-process (executable-find "trash") nil 0 nil file))
(setq mac-system-move-file-to-trash-use-finder t)) (setq mac-system-move-file-to-trash-use-finder t))
;; Use `gls' if `coreutils' was installed prefixed ('g') otherwise, leave ;; Use `gls' if `coreutils' was installed prefixed ('g') otherwise, leave
@ -32,6 +31,12 @@ Can be installed with `brew install trash'."
dired-listing-switches "-aBhl --group-directories-first") dired-listing-switches "-aBhl --group-directories-first")
)) ))
(defun osx/init-osx-trash ()
(use-package osx-trash
:if (and (spacemacs/system-is-mac)
(not (boundp 'mac-system-move-file-to-trash-use-finder)))
:init (osx-trash-setup)))
(defun osx/init-pbcopy () (defun osx/init-pbcopy ()
(use-package pbcopy (use-package pbcopy
:if (and (spacemacs/system-is-mac) (not (display-graphic-p))) :if (and (spacemacs/system-is-mac) (not (display-graphic-p)))