2020-08-20 02:10:25 -04:00
|
|
|
;;; os/macos/config.el -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
;;
|
|
|
|
;;; Reasonable defaults for macOS
|
|
|
|
|
|
|
|
;; Use spotlight search backend as a default for M-x locate (and helm/ivy
|
|
|
|
;; variants thereof), since it requires no additional setup.
|
|
|
|
(setq locate-command "mdfind")
|
|
|
|
|
|
|
|
|
|
|
|
;;
|
|
|
|
;;; Compatibilty fixes
|
|
|
|
|
|
|
|
;; Curse Lion and its sudden but inevitable fullscreen mode!
|
2022-09-13 18:19:56 +02:00
|
|
|
;; This is meaningless to railwaycat's emacs-mac build though.
|
2020-08-20 02:10:25 -04:00
|
|
|
(setq ns-use-native-fullscreen nil)
|
|
|
|
|
|
|
|
;; Visit files opened outside of Emacs in existing frame, not a new one
|
|
|
|
(setq ns-pop-up-frames nil)
|
|
|
|
|
|
|
|
;; sane trackpad/mouse scroll settings
|
|
|
|
(setq mac-redisplay-dont-reset-vscroll t
|
|
|
|
mac-mouse-wheel-smooth-scroll nil)
|
|
|
|
|
|
|
|
;; Sets `ns-transparent-titlebar' and `ns-appearance' frame parameters so window
|
|
|
|
;; borders will match the enabled theme.
|
2021-03-06 12:09:28 -05:00
|
|
|
(and (or (daemonp)
|
|
|
|
(display-graphic-p))
|
|
|
|
(require 'ns-auto-titlebar nil t)
|
|
|
|
(ns-auto-titlebar-mode +1))
|
2020-08-20 02:10:25 -04:00
|
|
|
|
|
|
|
;; Integrate with Keychain
|
|
|
|
(after! auth-source
|
|
|
|
(pushnew! auth-sources 'macos-keychain-internet 'macos-keychain-generic))
|
|
|
|
|
2023-11-29 12:32:20 -08:00
|
|
|
;; Delete files to trash on macOS, as an extra layer of precaution against
|
|
|
|
;; accidentally deleting wanted files.
|
|
|
|
(setq delete-by-moving-to-trash t)
|
|
|
|
|
2020-08-20 02:10:25 -04:00
|
|
|
|
|
|
|
;;
|
|
|
|
;;; Packages
|
|
|
|
|
|
|
|
(use-package! osx-trash
|
2023-11-29 12:32:20 -08:00
|
|
|
;; DEPRECATED: Not needed on Emacs 29+. Remove when dropping 28 support.
|
|
|
|
;; Fixed by https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21340.
|
|
|
|
:when (< emacs-major-version 29)
|
2020-08-20 02:10:25 -04:00
|
|
|
:commands osx-trash-move-file-to-trash
|
|
|
|
:init
|
|
|
|
;; Lazy load `osx-trash'
|
2022-09-18 06:46:17 +01:00
|
|
|
(when (not (fboundp 'system-move-file-to-trash))
|
|
|
|
(defun system-move-file-to-trash (file)
|
|
|
|
"Move FILE to trash."
|
2023-12-05 17:05:13 -05:00
|
|
|
(when (and (not (featurep :system 'linux))
|
2022-09-18 06:46:17 +01:00
|
|
|
(not (file-remote-p default-directory)))
|
|
|
|
(osx-trash-move-file-to-trash file)))))
|