2014-12-05 17:28:03 -05:00
|
|
|
;; Mac-specific settings
|
2014-09-05 17:08:40 -04:00
|
|
|
(provide 'core-osx)
|
2014-07-20 09:01:56 -04:00
|
|
|
|
2014-12-05 17:28:03 -05:00
|
|
|
;; Use a shared clipboard
|
|
|
|
(setq x-select-enable-clipboard t)
|
|
|
|
;; Curse Lion and its sudden but inevitable fullscreen mode!
|
|
|
|
(setq ns-use-native-fullscreen nil)
|
|
|
|
;; Don't open files from the workspace in a new frame
|
|
|
|
(setq ns-pop-up-frames nil)
|
2014-08-07 18:35:22 -04:00
|
|
|
|
2014-12-10 15:54:36 -05:00
|
|
|
;; (setq ns-auto-hide-menu-bar t)
|
|
|
|
|
2014-12-05 17:28:03 -05:00
|
|
|
;; fix emacs PATH on OSX (GUI only)
|
|
|
|
(use-package exec-path-from-shell
|
|
|
|
:if (memq window-system '(mac ns))
|
|
|
|
:init (exec-path-from-shell-initialize))
|
2014-11-29 20:21:03 -05:00
|
|
|
|
2014-12-05 17:28:03 -05:00
|
|
|
(after "evil"
|
2014-11-29 20:21:03 -05:00
|
|
|
;; On OSX, stop copying each visual state move to the clipboard:
|
|
|
|
;; https://bitbucket.org/lyro/evil/issue/336/osx-visual-state-copies-the-region-on
|
|
|
|
;; Most of this code grokked from:
|
|
|
|
;; http://stackoverflow.com/questions/15873346/elisp-rename-macro
|
|
|
|
(defadvice evil-visual-update-x-selection (around clobber-x-select-text activate)
|
|
|
|
(unless (featurep 'ns) ad-do-it)))
|
2014-12-05 17:28:03 -05:00
|
|
|
|
|
|
|
;; Send current file to OSX apps
|
|
|
|
(defun my--open-file-with (path &optional appName)
|
|
|
|
(if (and appName
|
|
|
|
(stringp appName)
|
|
|
|
(not (string= "" appName)))
|
|
|
|
(setq appName (concat "-a " appName ".app")))
|
|
|
|
(shell-command (concat "open " appName " " (shell-quote-argument path))))
|
|
|
|
|
|
|
|
(defun my-open-with (appName)
|
|
|
|
(interactive "sApp name: ")
|
|
|
|
(my--open-file-with buffer-file-name appName))
|
|
|
|
|
|
|
|
(defun my-send-to-transmit ()
|
|
|
|
(interactive) (my-open-with "Transmit"))
|
|
|
|
|
|
|
|
(defun my-send-to-launchbar ()
|
|
|
|
(interactive) (my-open-with "LaunchBar"))
|
|
|
|
|
|
|
|
(defun my-send-dir-to-launchbar ()
|
|
|
|
(interactive) (my--open-file-with default-directory "LaunchBar"))
|
|
|
|
|
|
|
|
(defun my-send-dir-to-finder ()
|
|
|
|
(interactive) (my--open-file-with default-directory "Finder"))
|
2014-12-10 15:54:36 -05:00
|
|
|
|
|
|
|
(defun my-osx-psuedo-fullscreen ()
|
|
|
|
(interactive)
|
|
|
|
(set-frame-position nil 0 0)
|
|
|
|
(set-frame-size nil 362 112))
|