Use osx-trash for system trash on OS X
This commit is contained in:
parent
48edef187f
commit
cd18b14a7a
|
@ -1,5 +1,6 @@
|
|||
(setq osx-packages
|
||||
'(
|
||||
osx-trash
|
||||
pbcopy
|
||||
launchctl
|
||||
reveal-in-osx-finder
|
||||
|
@ -14,11 +15,9 @@
|
|||
;; See brew info trash (or osx-tools)
|
||||
;; otherwise, enable built-in support for trashing using Finder API
|
||||
|
||||
(if (executable-find "trash")
|
||||
(defun system-move-file-to-trash (file)
|
||||
"Use `trash' to move FILE to the system/volume trash can.
|
||||
Can be installed with `brew install trash'."
|
||||
(call-process (executable-find "trash") nil 0 nil file))
|
||||
;; Enable built-in trash support via finder API if available (only on Emacs
|
||||
;; Mac Port)
|
||||
(when (boundp 'mac-system-move-file-to-trash-use-finder)
|
||||
(setq mac-system-move-file-to-trash-use-finder t))
|
||||
|
||||
;; 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")
|
||||
))
|
||||
|
||||
(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 ()
|
||||
(use-package pbcopy
|
||||
:if (and (spacemacs/system-is-mac) (not (display-graphic-p)))
|
||||
|
|
Loading…
Reference in a new issue