Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust eaf layer to newer eaf package #14992

Closed
wants to merge 12 commits into from
49 changes: 36 additions & 13 deletions layers/+tools/eaf/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [[#features][Features:]]
- [[#install][Install]]
- [[#usage][Usage]]
- [[#configuring-applications][Configuring applications]]
- [[#configuring-key-bindings][Configuring key bindings]]
- [[#key-bindings][Key bindings]]
- [[#global][Global]]
Expand All @@ -19,27 +20,49 @@
- [[#pdf-view-mode-pdf-tools][pdf-view-mode (pdf-tools)]]

* Description
This layer adds support for the [[https://github.com/manateelazycat/emacs-application-framework][Emacs Application Framework (EAF)]].
This layer adds support for the [[https://github.com/emacs-eaf/emacs-application-framework][Emacs Application Framework (EAF)]].

** Features:
- Browse using a full-fledged browser within Emacs
- PDF viewer (with continuous scroll)
- Video player
- Image viewer
- See [[https://github.com/manateelazycat/emacs-application-framework#launch-eaf-applications][EAF documentation]] for many more features
- See [[https://github.com/emacs-eaf/emacs-application-framework#launch-eaf-applications][EAF documentation]] for many more features

* Install
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
add =eaf= to the existing =dotspacemacs-configuration-layers= list in this
file.

Subsequently install the required dependencies with =SPC SPC
eaf-install-dependencies=. This command only works for Ubuntu and Fedora based
distributions. Users of Arch (based) distributions can run the script manually
in their terminal. If the script does not work for you then [[https://github.com/manateelazycat/emacs-application-framework#dependency-list][install the
required dependencies manually]].
Currently the command =SPC SPC eaf-install-dependencies= no longer works, please
refer to [[https://github.com/emacs-eaf/emacs-application-framework#2-installupdate-eaf-applications-and-dependencies][install the required dependencies manually]].
Copy link
Contributor

@dalanicolai dalanicolai Sep 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new commands eaf-install and eaf-install-and-update work perfectly fine


* Usage
** Configuring applications
By default, all applications provided by eaf package are loaded, including:
Copy link
Contributor

@dalanicolai dalanicolai Sep 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not necessary to remove applications from here, because you have added the NOERROR flag to the require statement, so Emacs will simply skip loading if some package is not available.

Still, this variable is useful for users who would like to load only some of the packages by default.

(You could add this explanation here)


- eaf-jupyter
- eaf-browser
- eaf-airshare
- eaf-file-browser
- eaf-file-manager
- eaf-file-sender
- eaf-music-player
- eaf-system-monitor
- eaf-mindmap
- eaf-org-previewer
- eaf-terminal
- eaf-netease-cloud-music
- eaf-video-player
- eaf-image-viewer
- eaf-demo
- eaf-vue-demo
- eaf-pdf-viewer
- eaf-markdown-previewer
- eaf-camera

To customise applications, please set =eaf=app=

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is =eaf=app= a typo?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, thx 😄


** Configuring key bindings
Configuration of EAF key bindings works in a different way than normally in Spacemacs.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned by @MatthewZMD, some keybindings might be added only conditionally. As checking all these bindings is a lot of work, you could simply add a warning about it. And add a request to report keybinding issues.


Expand All @@ -48,14 +71,14 @@ required to make leader keys in EAF buffers behave as expected in Spacemacs.
Therefore it is recommended to keep these default (major-mode-)leader
keybindings.

For information about configuration of other key bindings for EAF, see [[https://github.com/manateelazycat/emacs-application-framework/wiki/Keybindings][here]].
For information about configuration of other key bindings for EAF, see [[https://github.com/emacs-eaf/emacs-application-framework/wiki/Keybindings][here]].

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]].
implemented in this layer can be found [[https://github.com/emacs-eaf/emacs-application-framework/issues/498][here]] and [[https://github.com/emacs-eaf/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.]]
keybindings are documented [[https://github.com/emacs-eaf/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 key bindings persistently in which-key]], or use
~SPC h d K~ to show the `eaf-mode-map` in a separate buffer.
Expand All @@ -65,7 +88,7 @@ Use ~SPC t k m~ to [[https://develop.spacemacs.org/doc/DOCUMENTATION.html#which-

| 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 a a f~ | EAF open file ([[https://github.com/emacs-eaf/emacs-application-framework#launch-eaf-applications][see EAF doc for supported file types]]) |
| ~SPC a a s~ | EAF open system monitor |
| ~SPC a a M~ | EAF open musik player |
| ~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) |
Expand All @@ -76,7 +99,7 @@ Use ~SPC t k m~ to [[https://develop.spacemacs.org/doc/DOCUMENTATION.html#which-
| Key binding | Description |
|---------------+---------------------------------------------------------------------------------------|
| ~SPC a a b o~ | Open url in new buffer |
| ~SPC a a b s~ | Search with [[https://github.com/manateelazycat/emacs-application-framework/wiki/Customization#default-search-engine][your favorite search engine]]. Defaults to symbol at point or region string |
| ~SPC a a b s~ | Search with [[https://github.com/emacs-eaf/emacs-application-framework/wiki/Customization#default-search-engine][your favorite search engine]]. Defaults to symbol at point or region string |
| ~SPC a a b b~ | Open bookmark in new buffer |
| ~SPC a a b h~ | Search and open buffer from history |

Expand All @@ -97,7 +120,7 @@ Use ~SPC t k m~ to [[https://develop.spacemacs.org/doc/DOCUMENTATION.html#which-
| ~C-s~ | Search/search find next (to enter new search prefix with ~C-g~ |
| ~C-r~ | Search find previous |
| ~SPC m h~ | Open new buffer from history |
| ~SPC m s~ | Search web with [[https://github.com/manateelazycat/emacs-application-framework/wiki/Customization#default-search-engine][favorite search engine]] |
| ~SPC m s~ | Search web with [[https://github.com/emacs-eaf/emacs-application-framework/wiki/Customization#default-search-engine][favorite search engine]] |

*** PDF-viewer

Expand Down
64 changes: 64 additions & 0 deletions layers/+tools/eaf/config.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
;;; config.el --- (const eaf configuration file
;;
;; Copyright (c) 2021 Sylvain Benner & Contributors
;;
;; Author: Leslie Huang <lesliebinbin19900129@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.

(spacemacs|defc eaf-apps
'(eaf-jupyter
eaf-browser
eaf-airshare
eaf-file-browser
eaf-file-manager
eaf-file-sender
eaf-music-player
eaf-system-monitor
eaf-mindmap
eaf-org-previewer
eaf-terminal
eaf-netease-cloud-music
eaf-video-player
eaf-image-viewer
eaf-demo
eaf-vue-demo
eaf-pdf-viewer
eaf-markdown-previewer
eaf-camera)
"The applications loaded from EAF package"
'(set
(const eaf-jupyter)
(const eaf-browser)
(const eaf-airshare)
(const eaf-file-browser)
(const eaf-file-manager)
(const eaf-file-sender)
(const eaf-music-player)
(const eaf-system-monitor)
(const eaf-mindmap)
(const eaf-org-previewer)
(const eaf-terminal)
(const eaf-netease-cloud-music)
(const eaf-video-player)
(const eaf-image-viewer)
(const eaf-demo)
(const eaf-vue-demo)
(const eaf-pdf-viewer)
(const eaf-markdown-previewer)
(const eaf-camera))
'eaf)
13 changes: 5 additions & 8 deletions layers/+tools/eaf/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.


(defconst eaf-packages
'(ctable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the ctable, deferred and epc packages declarations.

deferred
epc
;; s
(eaf :location (recipe
:fetcher github
:repo "manateelazycat/emacs-application-framework"
:repo "emacs-eaf/emacs-application-framework"
:files ("*")))))

(defun eaf/init-ctable ()
Expand All @@ -40,16 +38,13 @@
(defun eaf/init-epc ()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the ctable, deferred and epc init-functions

(use-package epc))

;; (defun eaf/init-s ()
;; (use-package s))

(defun eaf/init-eaf ()
(use-package eaf
:defer t
:init
(progn
(spacemacs/declare-prefix "aa" "application-framework")
(spacemacs/set-leader-keys "aac" 'eaf-camera)
(spacemacs/set-leader-keys "aac" 'eaf-open-camera)
(spacemacs/set-leader-keys "aaf" 'eaf-open)
(spacemacs/set-leader-keys "aaj" 'eaf-open-jupyter)
(spacemacs/set-leader-keys "aao" 'eaf-open-office)
Expand Down Expand Up @@ -210,8 +205,10 @@
;; ("<C-iso-lefttab>" . "select_right_tab")
:config
(progn
(dolist (app eaf-apps)
(require app nil 'noerror))
(setq browse-url-browser-function 'eaf-open-browser)
(eaf-setq eaf-browser-enable-adblocker "true")
(setq eaf-browser-enable-adblocker "true")

(define-key eaf-mode-map* (kbd "C-SPC C-SPC") 'execute-extended-command)
;;;; TODO need to consider the current pdf view mode which does not need to be pdf view mode
Expand Down