~gpanders/dotfiles

ref: 2da1dde5ea566f82ebe6532bc6d3b8670fd77ce8 dotfiles/emacs/.emacs.d/lisp/init-os.el -rw-r--r-- 1.7 KiB
2da1dde5Greg Anders Note 'open' subcommand opens editor in NOTES_DIR when no argument given 1 year, 3 months ago
                                                                                
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
;;; init-os.el --- OS specific settings

(with-eval-after-load 'init-ui
  ;; Make sure this comes after init-ui.el
  (when (eq system-type 'darwin)
    (menu-bar-mode)
    (add-hook 'after-make-frame-functions
	      (lambda (frame)
		(set-frame-parameter frame 'menu-bar-lines
				     (if (display-graphic-p frame)
					 1 0))))

    (let ((default-directory "/usr/local/share/emacs/site-lisp"))
      (normal-top-level-add-subdirs-to-load-path))

    ;; Hide Emacs instead of killing it when last frame is closed
    (defun handle-delete-frame-without-kill-emacs (event)
      "Handle delete-frame events from the X server."
      (interactive "e")
      (let ((frame (posn-window (event-start event)))
	    (i 0)
	    (tail (frame-list)))
	(while tail
	  (and (frame-visible-p (car tail))
	       (not (eq (car tail) frame))
	       (setq i (1+ i)))
	  (setq tail (cdr tail)))
	(if (> i 0)
	    (delete-frame frame t)
	  ;; Not (save-buffers-kill-emacs) but instead:
	  (ns-do-hide-emacs))))

    (advice-add 'handle-delete-frame :override
		#'handle-delete-frame-without-kill-emacs)

    ;; Set meta key to Command
    (setq mac-command-modifier 'meta)
    (setq mac-option-modifier 'super)
    (setq mouse-wheel-scroll-amount '(1
				      ((shift) . 5)
				      ((control))))
    (dolist (multiple '("" "double-" "triple-"))
      (dolist (direction '("right" "left"))
	(global-set-key (read-kbd-macro (concat "<" multiple "wheel-" direction ">")) 'ignore)))
    (global-set-key (kbd "M-`") 'ns-next-frame)
    (global-set-key (kbd "M-h") 'ns-do-hide-emacs)
    (global-set-key (kbd "M-˙") 'ns-do-hide-others)
    (with-eval-after-load 'nxml-mode
      (define-key nxml-mode-map (kbd "M-h") nil))
    (global-set-key (kbd "M-ˍ") 'ns-do-hide-others)))

(provide 'init-os)