eaf: refactor

- Refactored function
- Replaced `(when (not foo) bar)` with `(unless foo bar)`
This commit is contained in:
Lucius Hu 2021-03-18 01:18:57 -04:00 committed by duianto
parent 5a6f54c227
commit 2943305254
2 changed files with 8 additions and 7 deletions

View file

@ -52,7 +52,7 @@
(eaf-set app-dark-mode "true")
(when browser
(eaf-proxy-insert_or_dark_mode))))
(when (not browser)
(unless browser
(eaf-restart-process))))))
(defun spacemacs/open-with-eaf ()

View file

@ -230,17 +230,18 @@
(progn
;; the following line are taken from the evil-integration example:
;; https://github.com/manateelazycat/emacs-application-framework/wiki/Evil
(setq eaf-evil-leader-keymap spacemacs-cmds)
(setq eaf-evil-leader-keymap spacemacs-cmds)
(define-key key-translation-map (kbd "SPC")
(lambda (prompt)
(if (derived-mode-p 'eaf-mode)
(pcase eaf--buffer-app-name
("browser" (if (string= (eaf-call-sync "call_function" eaf--buffer-id "is_focus") "True")
(kbd "SPC")
(kbd eaf-evil-leader-key)))
("pdf-viewer" (kbd eaf-evil-leader-key))
("image-viewer" (kbd eaf-evil-leader-key))
((or
(and "browser"
(guard (string= (eaf-call-sync "call_function" eaf--buffer-id "is_focus") "True")))
"image-viewer"
"pdf-viewer")
(kbd eaf-evil-leader-key))
(_ (kbd "SPC")))
(kbd "SPC"))))