doomemacs/core/core-os-osx.el

73 lines
2.7 KiB
EmacsLisp
Raw Normal View History

2015-06-06 18:40:33 +08:00
;;; core-os-osx.el --- Mac-specific settings
2015-06-05 06:23:21 +08:00
2015-08-06 18:49:32 +08:00
(eval-when-compile (require 'core))
2015-06-05 06:23:21 +08:00
;; Use a shared clipboard
(setq x-select-enable-clipboard t
2015-08-23 11:42:42 +08:00
;; Prefixes: Command = M, Alt = A
mac-command-modifier 'meta
mac-option-modifier 'alt
2015-11-10 04:52:55 +08:00
;; sane trackpad/mouse scroll settings
mac-mouse-wheel-smooth-scroll nil
mouse-wheel-scroll-amount '(8 ((shift) . 2)) ;; one line at a time
mouse-wheel-progressive-speed nil ;; don't accelerate scrolling
2015-08-23 11:42:42 +08:00
;;; NOTE These mean nothing to railwaycat's emacs-mac build on OSX
2015-06-05 06:23:21 +08:00
;; Curse Lion and its sudden but inevitable fullscreen mode!
ns-use-native-fullscreen nil
;; Don't open files from the workspace in a new frame
2015-11-10 04:52:55 +08:00
ns-pop-up-frames nil)
2015-06-05 06:23:21 +08:00
;; fix emacs PATH on OSX (GUI only)
2015-06-24 21:36:05 +08:00
(when window-system
2015-06-05 06:23:21 +08:00
(setenv "SHELL" "/usr/local/bin/zsh")
2015-06-06 18:40:33 +08:00
(setenv "EMACS" "1") ; make sure the world knows
2015-10-26 13:34:16 +08:00
(setq exec-path (eval-when-compile
(require 'exec-path-from-shell)
(exec-path-from-shell-initialize)
exec-path)))
2015-06-05 06:23:21 +08:00
2015-06-06 18:40:33 +08:00
;; OSX Related Plugins ;;;;;;;;;;;;;;;;;
2015-06-05 06:23:21 +08:00
2015-06-06 18:40:33 +08:00
(use-package applescript-mode :mode "\\.applescript$")
2015-06-05 06:23:21 +08:00
(use-package dash-at-point
:commands (dash-at-point dash-at-point-with-docset)
:config
2015-11-09 06:58:00 +08:00
(mapc (lambda (r) (add-to-list 'dash-at-point-mode-alist r))
`((java-mode . "java,droid,javafx,grails,groovy,playjava,spring,cvj,processing,javadoc")
(scss-mode . ,(cdr (assoc 'sass-mode dash-at-point-mode-alist)))
)))
2015-06-05 06:23:21 +08:00
2015-06-06 18:40:33 +08:00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2015-06-15 15:05:52 +08:00
(after! evil
2015-06-05 06:23:21 +08:00
(when (featurep 'ns)
;; 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))))
2015-06-06 18:40:33 +08:00
(defun narf-open-with (&optional app-name path)
2015-06-15 15:05:52 +08:00
"Send PATH to APP-NAME on OSX."
2015-06-05 06:23:21 +08:00
(interactive)
(let* ((path (f-full (s-replace "'" "\\'" (or path (if (eq major-mode 'dired-mode) (dired-get-file-for-visit) (buffer-file-name))))))
(command (concat "open " (when app-name (concat "-a " (shell-quote-argument app-name))) " '" path "'")))
(message "Running: %s" command)
(shell-command command)))
2015-10-01 01:49:37 +08:00
(defun narf-switch-to-iterm ()
(interactive)
(shell-command "osascript -e 'tell application \"iTerm2\" to activate'" nil))
(defun narf-switch-to-iterm-and-cd ()
(interactive)
(narf:tmux-chdir nil t)
(shell-command "osascript -e 'tell application \"iTerm2\" to activate'" nil))
2015-06-06 18:40:33 +08:00
(provide 'core-os-osx)
;;; core-os-osx.el ends here