summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-01-06 22:54:56 -0600
committerCase Duckworth2022-01-06 22:54:56 -0600
commit9b9d026b613fd90230f0bdde9f87b2142d9bfc53 (patch)
tree7b0d48cca8a63b1ce73c81c90b89807aacc554ce
parentMerge branch 'main' of https://tildegit.org/acdw/emacs (diff)
downloademacs-9b9d026b613fd90230f0bdde9f87b2142d9bfc53.tar.gz
emacs-9b9d026b613fd90230f0bdde9f87b2142d9bfc53.zip
Add god-mode
I'm trying this out ... again
-rw-r--r--init.el13
-rw-r--r--lisp/+god-mode.el17
-rw-r--r--lisp/+modeline.el18
3 files changed, 47 insertions, 1 deletions
diff --git a/init.el b/init.el index 7f0733c..970ab83 100644 --- a/init.el +++ b/init.el
@@ -862,6 +862,8 @@ See also `crux-reopen-as-root-mode'."
862 :fork (:repo "duckwork/discord.el")))) 862 :fork (:repo "duckwork/discord.el"))))
863 863
864(setup (:straight electric-cursor) 864(setup (:straight electric-cursor)
865 (:option electric-cursor-alist '((overwrite-mode . hbar)
866 (god-local-mode . box)))
865 (electric-cursor-mode +1)) 867 (electric-cursor-mode +1))
866 868
867(setup (:straight elfeed) 869(setup (:straight elfeed)
@@ -1010,6 +1012,14 @@ See also `crux-reopen-as-root-mode'."
1010 (:file-match (rx ".rkt" eos) 1012 (:file-match (rx ".rkt" eos)
1011 (rx ".scm" eos))) 1013 (rx ".scm" eos)))
1012 1014
1015(setup (:straight god-mode)
1016 (setq god-mode-enable-function-key-translation nil)
1017 (:also-load +god-mode)
1018 (:+key "C-M-g" #'god-local-mode)
1019 (:with-mode god-local-mode
1020 (:bind "i" #'+god-mode-insert
1021 "a" #'+god-mode-append)))
1022
1013(setup (:straight helpful) 1023(setup (:straight helpful)
1014 (run-with-idle-timer 0.5 nil 1024 (run-with-idle-timer 0.5 nil
1015 'require 'helpful) 1025 'require 'helpful)
@@ -1194,7 +1204,8 @@ See also `crux-reopen-as-root-mode'."
1194 +modeline-ace-window-display 1204 +modeline-ace-window-display
1195 +modeline-modified 1205 +modeline-modified
1196 ,(+modeline-concat 1206 ,(+modeline-concat
1197 '(+modeline-reading-mode 1207 '(+modeline-god-mode
1208 +modeline-reading-mode
1198 +modeline-narrowed) 1209 +modeline-narrowed)
1199 ",") 1210 ",")
1200 +modeline-buffer-name 1211 +modeline-buffer-name
diff --git a/lisp/+god-mode.el b/lisp/+god-mode.el new file mode 100644 index 0000000..f70e76b --- /dev/null +++ b/lisp/+god-mode.el
@@ -0,0 +1,17 @@
1;;; +god-mode.el -*- lexical-binding: t; -*-
2
3;;; Code:
4
5(defun +god-mode-insert ()
6 "Leave `god-local-mode' at point."
7 (interactive)
8 (god-local-mode -1))
9
10(defun +god-mode-append ()
11 "Leave `god-local-mode' after point."
12 (interactive)
13 (forward-char 1)
14 (god-local-mode -1))
15
16(provide '+god-mode)
17;;; +god-mode.el ends here
diff --git a/lisp/+modeline.el b/lisp/+modeline.el index 4063d83..a0195f1 100644 --- a/lisp/+modeline.el +++ b/lisp/+modeline.el
@@ -240,5 +240,23 @@ The order of elements matters: whichever one matches first is applied."
240 (concat (or spacer +modeline-default-spacer) 240 (concat (or spacer +modeline-default-spacer)
241 (window-parameter (selected-window) 'ace-window-path)))) 241 (window-parameter (selected-window) 'ace-window-path))))
242 242
243(defun +modeline-god-mode (&optional spacer)
244 "Display an icon when `god-mode' is active."
245 (when (and (boundp 'god-local-mode) god-local-mode)
246 (concat (or spacer +modeline-default-spacer)
247 (propertize "Ω"
248 'help-echo (concat "God mode is active."
249 "\nmouse-1: exit God mode.")
250 'local-map (purecopy
251 (simple-modeline-make-mouse-map
252 'mouse-1 (lambda (e)
253 (interactive "e")
254 (with-selected-window
255 (posn-window
256 (event-start ev))
257 (god-local-mode -1)
258 (force-mode-line-update)))))
259 'mouse-face 'mode-line-highlight))))
260
243(provide '+modeline) 261(provide '+modeline)
244;;; +modeline.el ends here 262;;; +modeline.el ends here