-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmac.el
39 lines (36 loc) · 1.16 KB
/
mac.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
;;; mac.el -*- lexical-binding: t; -*-
;; https://lists.gnu.org/archive/html/help-gnu-emacs/2016-01/msg00236.html
(defun my/handle-delete-frame-without-kill-emacs ()
"Handle delete-frame events from the X server."
(interactive)
(let ((frame (selected-frame))
(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:
(progn
(cd default-directory)
(+doom-dashboard/open (selected-frame))
(ns-do-hide-emacs)))))
(when (eq system-type 'darwin)
(advice-add 'handle-delete-frame :override
#'my/handle-delete-frame-without-kill-emacs)
(map! :map global-map "s-q"
(lambda ()
(interactive)
(cd default-directory)
(+doom-dashboard/open (selected-frame))
(ns-do-hide-emacs))))
(map! :when (and
(modulep! :editor macos-key)
(not IS-MAC))
"s-z" #'undo
"s-Z" #'undo-redo
"s-v" #'yank
"s-/" #'comment-line)