-
Notifications
You must be signed in to change notification settings - Fork 0
/
darwin.el
92 lines (71 loc) · 3.18 KB
/
darwin.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
;;; darwin.el --- Darwin-specific Emacs init. -*- lexical-binding: t; -*-
;;; Commentary:
;; This file contains Emacs initialization settings that are specific to
;; the Darwin operating system (macOS).
;;; Code:
(defconst my-frame-font
"-*-SFMono Nerd Font-normal-normal-normal-*-12-*-*-*-p-0-iso10646-1"
"My default frame font on Darwin.")
(defconst dotfiles--homebrew-root
(file-name-as-directory
(string-trim-right (shell-command-to-string "brew --prefix")))
"Homebrew installation prefix.")
(unless dotfiles--homebrew-root
(display-warning 'dotfiles "Homebrew not found" :warning))
(defun dotfiles--set-exe-var (var name path)
"Set VAR to PATH and warn if it is not an executable NAME."
(set var path)
(unless (file-executable-p path)
(display-warning
'dotfiles
(format "Executable %s not found at %s" name path) :warning)))
(dotfiles--set-exe-var 'insert-directory-program "gls"
(concat dotfiles--homebrew-root "bin/gls"))
(require 'lsp-clangd)
(dotfiles--set-exe-var 'lsp-clients-clangd-executable "clangd"
(concat dotfiles--homebrew-root "opt/llvm/bin/clangd"))
;; The right option modifier is used by the keyboard layout third level instead.
(setq mac-right-option-modifier nil)
(setq mac-command-modifier 'super)
(setq mac-option-modifier 'meta)
;; s-t binding is very annoying: a popular combination in other apps which opens
;; a font panel popup in macOS Emacs, which I never use.
(global-unset-key (kbd "s-t"))
;;; woman
;; Integrate `woman' with macOS XCode some better by adding the missing man
;; paths.
(defconst dotfiles--xcode-dev-dir
(file-name-as-directory
(string-trim-right (shell-command-to-string "xcode-select -p")))
"The currently active XCode developer directory.")
(unless dotfiles--xcode-dev-dir
(display-warning 'dotfiles "XCode not found" :warning))
(require 'woman)
(defun dotfiles--add-xcode-man-subdir-to-woman (subdir)
"Add SUBDIR below XCode dev dir `woman-manpath' if it exists, warn otherwise."
(let ((dir (file-name-as-directory (concat dotfiles--xcode-dev-dir subdir))))
(if (file-directory-p dir)
(add-to-list 'woman-manpath dir)
(display-warning
'dotfiles (format "Directory %s not found" dir) :warning))))
(dotfiles--add-xcode-man-subdir-to-woman
"Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/share/man")
(dotfiles--add-xcode-man-subdir-to-woman "usr/share/man")
(dotfiles--add-xcode-man-subdir-to-woman
"Toolchains/XcodeDefault.xctoolchain/usr/share/man")
(require 'exec-path-from-shell)
(setq exec-path-from-shell-check-startup-files nil)
(add-to-list 'exec-path-from-shell-variables "LANG")
(exec-path-from-shell-initialize)
;; Fix native compilation warnings: "Warning (comp): ld: warning: -undefined
;; dynamic_lookup may not work with chained fixups"
(setq native-comp-driver-options '("-Wl,-w"))
;;; plantuml
(require 'ob-plantuml)
(setq org-plantuml-jar-path
(concat dotfiles--homebrew-root "opt/plantuml/libexec/plantuml.jar"))
;;; mu4e
(defconst mu4e-lisp-load-path (concat dotfiles--homebrew-root
"opt/mu/share/emacs/site-lisp/mu/mu4e"))
(add-to-list 'load-path mu4e-lisp-load-path)
;;; darwin.el ends here