From 9b9d026b613fd90230f0bdde9f87b2142d9bfc53 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Thu, 6 Jan 2022 22:54:56 -0600 Subject: Add god-mode I'm trying this out ... again --- lisp/+god-mode.el | 17 +++++++++++++++++ lisp/+modeline.el | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 lisp/+god-mode.el (limited to 'lisp') 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 @@ +;;; +god-mode.el -*- lexical-binding: t; -*- + +;;; Code: + +(defun +god-mode-insert () + "Leave `god-local-mode' at point." + (interactive) + (god-local-mode -1)) + +(defun +god-mode-append () + "Leave `god-local-mode' after point." + (interactive) + (forward-char 1) + (god-local-mode -1)) + +(provide '+god-mode) +;;; +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." (concat (or spacer +modeline-default-spacer) (window-parameter (selected-window) 'ace-window-path)))) +(defun +modeline-god-mode (&optional spacer) + "Display an icon when `god-mode' is active." + (when (and (boundp 'god-local-mode) god-local-mode) + (concat (or spacer +modeline-default-spacer) + (propertize "Ω" + 'help-echo (concat "God mode is active." + "\nmouse-1: exit God mode.") + 'local-map (purecopy + (simple-modeline-make-mouse-map + 'mouse-1 (lambda (e) + (interactive "e") + (with-selected-window + (posn-window + (event-start ev)) + (god-local-mode -1) + (force-mode-line-update))))) + 'mouse-face 'mode-line-highlight)))) + (provide '+modeline) ;;; +modeline.el ends here -- cgit 1.4.1-21-gabe81