New module, :app everywhere

This commit is contained in:
TEC 2021-02-07 20:15:27 +08:00
parent 16a495c97d
commit 74613c25e2
No known key found for this signature in database
GPG key ID: 779591AFDB81F06C
6 changed files with 112 additions and 0 deletions

View file

@ -175,6 +175,7 @@
:app :app
;;calendar ;;calendar
;;everywhere ; *leave* Emacs!? You must be joking
;;irc ; how neckbeards socialize ;;irc ; how neckbeards socialize
;;(rss +org) ; emacs as an RSS reader ;;(rss +org) ; emacs as an RSS reader
;;twitter ; twitter client https://twitter.com/vnought ;;twitter ; twitter client https://twitter.com/vnought

View file

@ -0,0 +1,58 @@
#+title: app/everywhere
#+date: February 7, 2021
#+since: v3.0
#+startup: inlineimages nofold
* Table of Contents :TOC_3:noexport:
- [[#description][Description]]
- [[#maintainers][Maintainers]]
- [[#module-flags][Module Flags]]
- [[#plugins][Plugins]]
- [[#prerequisites][Prerequisites]]
- [[#features][Features]]
- [[#configuration][Configuration]]
* Description
This module adds system-wide popup Emacs windows for quick edits.
** Maintainers
+ [[https://github.com/tecosaur][@tecosaur]]
** Module Flags
This module provides no flags.
** Plugins
+ [[https://github.com/tecosaur/emacs-everywhere][emacs-everywhere]]
* Prerequisites
On Linux =xclip=, =xdotool=, =xprop=, and =xwininfo= are needed.
On MacOS, Emacs must be allowed to "control your computer" under *Settings > Accessibility*.
* Features
To use this, invoke the =emacs-everywhere= executable. This can be done in two
ways:
+ ~emacsclient --eval "(emacs-everywhere)"~
+ ~doom everywhere~
It is recommended that you add a keybinding for this.
From here, you can edit away to your hearts content in the created frame, then
return to the original window and paste the content with =C-c C-c= or =SPC q f=.
To exit without pasting, use =C-c C-k=.
* Configuration
=emacs-everywhere= likes to guess if you triggered it from an application which
supports markdown. Configure ~emacs-everywhere-markdown-windows~ and
~emacs-everywhere-markdown-apps~ to improve how accurate this is on your system.
By default, when markdown is detected, ~markdown-mode~ is used. It is possible to
instead use pandoc to convert the content to Org (and export to markdown when
closing the frame) by setting ~emacs-everywhere-major-mode-function~ to
=#'org-mode=.
Most other behaviour is implemented as hooks on ~emacs-everywhere-init-hooks~.

View file

@ -0,0 +1,5 @@
;;; app/everywhere/cli.el -*- lexical-binding: t; -*-
(defcli! everywhere ()
"Spawn an emacsclient window for quick edits."
(throw 'exit (list "emacsclient" "--eval" "(emacs-everywhere)")))

View file

@ -0,0 +1,30 @@
;;; app/everywhere/config.el -*- lexical-binding: t; -*-
(use-package! emacs-everywhere
:defer ; entry point is autoloaded
:config
(after! doom-modeline
(doom-modeline-def-segment emacs-everywhere
(concat (doom-modeline-spc)
(when (emacs-everywhere-markdown-p)
(concat
(all-the-icons-octicon "markdown" :face 'all-the-icons-green :v-adjust 0.02)
(doom-modeline-spc)))
(propertize emacs-everywhere-app-name
'face 'doom-modeline-project-dir)
(doom-modeline-spc)
(propertize (truncate-string-to-width emacs-everywhere-window-title
45 nil nil "")
'face 'doom-modeline-buffer-minor-mode)))
(doom-modeline-def-modeline 'emacs-everywhere
'(bar modals emacs-everywhere buffer-position word-count parrot selection-info)
'(input-method major-mode checker))
(defun emacs-everywhere-set-modeline ()
(doom-modeline-set-modeline 'emacs-everywhere))
(add-hook 'emacs-everywhere-init-hooks #'emacs-everywhere-set-modeline))
(when (featurep! :ui workspaces)
(defun emacs-everywhere-clear-persp-info ()
(setq persp-emacsclient-init-frame-behaviour-override nil))
(add-hook 'emacs-everywhere-init-hooks #'emacs-everywhere-clear-persp-info))
(after! solaire-mode
(add-hook 'emacs-everywhere-init-hooks #'solaire-mode)))

View file

@ -0,0 +1,12 @@
;;; app/everywhere/doctor.el -*- lexical-binding: t; -*-
(when IS-WINDOWS
(error! "emacs-everywhere package does not support windows."))
(when IS-LINUX
(let (unmet-deps)
(dolist (dep '("xclip" "xdotool" "xprop" "xwininfo"))
(unless (executable-find dep)
(push dep unmet-deps)))
(when unmet-deps
(error! "Unmet dependencies: %s" (string-join unmet-deps ", ")))))

View file

@ -0,0 +1,6 @@
;; -*- no-byte-compile: t; -*-
;;; app/everywhere/packages.el
(package! emacs-everywhere
:recipe (:host github :repo "tecosaur/emacs-everywhere")
:pin "d84b397c9a82c2fea1b0c87740c395a2c7af3be8")