BIBLIOGRAPHY

“Emacs-Eaf/Emacs-Application-Framework.” (2018) 2024. Emacs Application Framework. https://github.com/emacs-eaf/emacs-application-framework.

History

  • [2025-04-07 Mon 15:57] 설치부터 다시 정리한다. #설치

manateelazycat emacs-eaf/emacs-application-framework

(“Emacs-Eaf/Emacs-Application-Framework” [2018] 2024)

  • EAF, an extensible framework that revolutionizes the graphical capabilities of Emacs

2025 둠이맥스 한방에 되다니?!

뭐지?! 다 소용 없던 것인가?

패키지 정의

;;;; Emacs Application Framework (EAF)
 
(defun +eaf-install-deps-for-app(app-dir)
  "Install deps from dependencies.json."
  (let* ((deps-dict (with-temp-buffer
                      (insert-file-contents
                       (expand-file-name "dependencies.json" app-dir))
                      (json-parse-string (buffer-string))))
         (pip-deps (gethash (if IS-LINUX "linux" "darwin")
                            (or (gethash "pip" deps-dict)
                                (make-hash-table))))
         (vue-install (gethash "vue_install" deps-dict))
         (npm-install (gethash "npm_install" deps-dict))
         (npm-rebuild (gethash "npm_rebuild" deps-dict)))
    (when pip-deps
      (dolist (pkg (append pip-deps nil))
        (message "%s" (shell-command-to-string (format "pip install %s" pkg)))))
    (when vue-install
      (let ((default-directory app-dir))
        (message "%s" (shell-command-to-string "npm install"))
        (message "%s" (shell-command-to-string "npm run build"))))
    (when npm-install
      (let ((default-directory app-dir))
        (message "%s" (shell-command-to-string "npm install"))))
    (when npm-rebuild
      (let ((default-directory app-dir))
        (message "%s" (shell-command-to-string "npm rebuild"))))))
 
(package! eaf
  :recipe (:host github :repo "emacs-eaf/emacs-application-framework"
           :files ("*")
           :post-build
           (shell-command "/usr/bin/python install-eaf.py --install-core-deps"))) ;; use builtin python
 
(package! eaf-browser
  :recipe (:host github :repo "emacs-eaf/eaf-browser"
           :files ("*")
           :post-build
           (+eaf-install-deps-for-app
            (concat straight-base-dir "/straight/" straight-build-dir "/eaf-browser"))))
 
(package! eaf-pdf-viewer
  :recipe (:host github :repo "emacs-eaf/eaf-pdf-viewer"
           :files ("*")
           :post-build
           (+eaf-install-deps-for-app
            (concat straight-base-dir "/straight/" straight-build-dir "/eaf-pdf-viewer"))))
 
(package! eaf-mind-elixir
  :recipe (:host github :repo "emacs-eaf/eaf-mind-elixir"
           :files ("*")
           :post-build
           (+eaf-install-deps-for-app
            (concat straight-base-dir "/straight/" straight-build-dir "/eaf-mind-elixir"))))
 
➜ ps aux | grep emacs
junghan   683052  0.0  0.0  86896  2820 ?        Ss   16:52   0:00 gpg-agent --homedir /home/junghan/doomemacs-git/.local/elpa/gpg --use-standard-socket --daemon
junghan   724682  0.0  0.0   2800  1664 ?        S    17:09   0:00 sh /home/junghan/doomemacs-git/bin/doom run
junghan   724691  0.0  0.0   2800  1664 ?        S    17:09   0:00 sh /tmp//doom.724682.0.sh /home/junghan/doomemacs-git/bin/doom run
junghan   724692 27.3  6.1 1524728 744632 ?      Sl   17:09   0:30 emacs-git
junghan   725396  2.8  2.5 3217900 310192 pts/3  Ssl+ 17:09   0:02 /usr/bin/python /home/junghan/doomemacs-git/.local/straight/build-30.1.50/eaf/eaf.py 1920 1013 33449
junghan   729245  0.0  0.0  10488  2304 pts/0    S+   17:11   0:00 grep --color=auto emacs
(base) ~ via  v20.14.0

설정

;;; Emacs Application Framework (EAF)
 
;; check  'C-h v' eaf-var-list
 
(progn
  (setq eaf-python-command "/usr/bin/python")
  (require 'eaf)
  (require 'eaf-browser)
  (require 'eaf-pdf-viewer)
  (require 'eaf-mind-elixir)
 
  (add-hook 'eaf-mode-hook #'doom-mark-buffer-as-real-h)
 
  (progn
    ;; https://github.com/emacs-eaf/emacs-application-framework/wiki/Evil
    (require 'eaf-evil)
    (define-key key-translation-map (kbd "SPC")
                (lambda (prompt)
                  (if (derived-mode-p 'eaf-mode)
                      (pcase eaf--buffer-app-name
                        ("browser" (if  eaf-buffer-input-focus
                                       (kbd "SPC")
                                     (kbd eaf-evil-leader-key)))
                        ("pdf-viewer" (kbd eaf-evil-leader-key))
                        ("mind-elixir" (kbd eaf-evil-leader-key))
                        ;; ("image-viewer" (kbd eaf-evil-leader-key))
                        (_  (kbd "SPC")))
                    (kbd "SPC"))))
    )
 
  ;; See https://github.com/emacs-eaf/emacs-application-framework/wiki/Customization
  (progn
    (setq eaf-browser-translate-language "ko")
 
    ;; make default browser
    ;; (setq browse-url-browser-function 'eaf-open-browser)
    ;; (defalias 'browse-web #'eaf-open-browser)
    (eaf-bind-key nil "M-q" eaf-browser-keybinding) ;; unbind, see more in the Wiki
 
    ;; /home/junghan/sync/man/dotsamples/vanilla/gavinok-dotfiles/lisp/eaf-config.el
    (defun slurp (f)
      (with-temp-buffer
        (insert-file-contents f)
        (buffer-substring-no-properties
         (point-min)
         (point-max))))
 
    ;; https://www.abc.com abc
    (defun my/bm ()
      (interactive)
      (require 'eaf-browser)
      (let ((selected (completing-read
                       "Select URL: " (split-string
                                       (slurp "~/url-bookmarks.el") "\n" t))))
        (let ((url (car (split-string
                         selected
                         " " t))))
          (if (string-match-p "\\http.*\\'" url)
              ;; Open selected url
              (eaf-open-browser url)
            ;; Search entered text
            (eaf-search-it selected)))))
    (setq eaf-browser-continue-where-left-off t)
    (setq eaf-browser-dnefault-search-engine "duckduckgo")
    (setq eaf-browser-enable-adblocker "true")
    ;; (eaf-bind-key scroll_up "C-n" eaf-pdf-viewer-keybinding)
    ;; (eaf-bind-key scroll_down "C-p" eaf-pdf-viewer-keybinding)
    )
  ) ; end-of eaf
 

스크린샷

보관

DONT 실패: 시스템 패키지로 설치해야 동작한다