From fccbca14a9fba14c579d1fba6b2814eda65dd7a5 Mon Sep 17 00:00:00 2001 From: Daniel Nicolai Date: Sat, 8 May 2021 14:57:46 +0200 Subject: [PATCH] Small fix to eaf-layer refactor This PR reimplements the refactor changes by @lebensterben but with his fix as he suggested [here](https://github.com/syl20bnr/spacemacs/pull/14681#discussion_r616060958) --- layers/+tools/eaf/README.org | 18 ++++++++++-------- layers/+tools/eaf/packages.el | 12 +++++++----- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/layers/+tools/eaf/README.org b/layers/+tools/eaf/README.org index 8a2c32f6f572..d0b57417935f 100644 --- a/layers/+tools/eaf/README.org +++ b/layers/+tools/eaf/README.org @@ -54,14 +54,19 @@ If you do want to modify the leader keys, then information about the tricks implemented in this layer can be found [[https://github.com/manateelazycat/emacs-application-framework/issues/498][here]] and [[https://github.com/manateelazycat/emacs-application-framework/pull/500][here]]. * Key bindings + Except for the few Spacemacs specific modifications listed below, all EAF + keybindings are documented [[https://github.com/manateelazycat/emacs-application-framework/wiki/Keybindings][here.]] + + Use ~SPC t k m~ to [[https://develop.spacemacs.org/doc/DOCUMENTATION.html#which-key-persistent][show the EAF keybindings persistently in which-key]], or use + ~SPC h d K~ to show the `eaf-mode-map` in a separate buffer. ** Global *** All EAF-applications -| Key binding | Description | -|-------------+----------------------------------------------------------------------------| -| ~SPC a a f~ | EAF open file ([[https://github.com/manateelazycat/emacs-application-framework#launch-eaf-applications][see EAF doc for supported file types]]) | -| ~SPC t k m~ | Show available key commands in which-key (read [[https://develop.spacemacs.org/doc/DOCUMENTATION.html#which-key][here]] for more details) | -| ~SPC m d~ | toggle dark-mode (or in browser press ~M-d~, in pdf-viewer just press ~d~) | +| Key binding | Description | +|-------------+-------------------------------------------------------------------------------| +| ~SPC a a f~ | EAF open file ([[https://github.com/manateelazycat/emacs-application-framework#launch-eaf-applications][see EAF doc for supported file types]]) | +| ~SPC t k m~ | Show available key commands in which-key (read [[https://develop.spacemacs.org/doc/DOCUMENTATION.html#which-key][here]] for more details) | +| ~SPC m d~ | toggle dark-mode (or in browser press ~M-d~ and in pdf-viewer just press ~d~) | *** Browser @@ -102,6 +107,3 @@ implemented in this layer can be found [[https://github.com/manateelazycat/emacs | Key binding | Description | |-------------+------------------------| | ~SPC m e~ | open in eaf pdf-viewer | - -There are many more key bindings. Use ~SPC t k m~ to [[https://develop.spacemacs.org/doc/DOCUMENTATION.html#which-key-persistent][show them persistently in -which-key]], or use ~SPC h d k~ to show the `eaf-mode-map` in a separate buffer. diff --git a/layers/+tools/eaf/packages.el b/layers/+tools/eaf/packages.el index 3b2105e09f6a..cab6a618dcc9 100644 --- a/layers/+tools/eaf/packages.el +++ b/layers/+tools/eaf/packages.el @@ -131,6 +131,7 @@ ("-" . "insert_or_zoom_out") ("=" . "insert_or_zoom_in") ("0" . "insert_or_zoom_reset") + ;; ("d" . "insert_or_dark_mode") ("m" . "insert_or_save_as_bookmark") ("o" . "insert_or_open_browser") ;; ("y" . "insert_or_download_youtube_video") @@ -235,11 +236,12 @@ (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 (not (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"))))