From 8661a1ffea2a898785633fefeb4378a90f658ba4 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 12 Mar 2021 23:05:42 -0600 Subject: Add `expand-region' --- init.el | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'init.el') diff --git a/init.el b/init.el index d2d5b68..a46ad65 100644 --- a/init.el +++ b/init.el @@ -285,6 +285,10 @@ :now ((acdw/sunrise-sunset #'modus-themes-load-operandi #'modus-themes-load-vivendi))) +;; Expand-region +(acdw/pkg expand-region + :binds (("C-=" er/expand-region))) + ;;; Mode line ;; Minions -- cgit 1.4.1-21-gabe81 From 824b8879000b2335c638342472022aebbed1f783 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 13 Mar 2021 01:54:30 -0600 Subject: Set `fixed-pitch' face Still to do: `variable-pitch' (will need to change based on `acdw/system') --- init.el | 3 +++ 1 file changed, 3 insertions(+) (limited to 'init.el') diff --git a/init.el b/init.el index a46ad65..9a048a8 100644 --- a/init.el +++ b/init.el @@ -258,6 +258,9 @@ (when (require 'imenu) (acdw/set '((imenu-auto-rescan t)))) +;; Fonts +(acdw/set-faces ((fixed-pitch . ((t (:inherit default)))))) + ;;; Packages ;; Undo-fu -- cgit 1.4.1-21-gabe81 From b5b1f51c8837b3d843ee1653473217a0d5da9fc6 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 13 Mar 2021 01:56:40 -0600 Subject: Change `frame-title-format' --- init.el | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'init.el') diff --git a/init.el b/init.el index 9a048a8..c0e9b18 100644 --- a/init.el +++ b/init.el @@ -292,6 +292,11 @@ (acdw/pkg expand-region :binds (("C-=" er/expand-region))) +;;; Frame title + +(acdw/set `((frame-title-format + "%b %+%* GNU Emacs"))) + ;;; Mode line ;; Minions -- cgit 1.4.1-21-gabe81 From b52013f05f6ab3572fd35e4c136b02f520c936d3 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 13 Mar 2021 01:56:50 -0600 Subject: Add keybinding for `unpackaged/org-return-dwim' --- init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'init.el') diff --git a/init.el b/init.el index c0e9b18..8836991 100644 --- a/init.el +++ b/init.el @@ -431,7 +431,8 @@ indicator in the mode-line." (org-export-headline-levels 8) (org-export-with-smart-quotes t) (org-export-with-sub-superscripts t)) - :hooks ((before-save-hook acdw/hook--org-mode-fix-blank-lines))) + :hooks ((before-save-hook acdw/hook--org-mode-fix-blank-lines)) + :binds (("RET" unpackaged/org-return-dwim :map org-mode-map))) ;;; Programming languages -- cgit 1.4.1-21-gabe81 From 8d4d84839e23ac513025000f8882203450063c69 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 14 Mar 2021 19:18:32 -0500 Subject: Change `:map-after' behavior --- init.el | 4 +++- lisp/acdw.el | 27 ++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 6 deletions(-) (limited to 'init.el') diff --git a/init.el b/init.el index 8836991..466c280 100644 --- a/init.el +++ b/init.el @@ -432,7 +432,9 @@ indicator in the mode-line." (org-export-with-smart-quotes t) (org-export-with-sub-superscripts t)) :hooks ((before-save-hook acdw/hook--org-mode-fix-blank-lines)) - :binds (("RET" unpackaged/org-return-dwim :map org-mode-map))) + :binds (("RET" unpackaged/org-return-dwim + :map org-mode-map :map-after 'org))) + ;;; Programming languages diff --git a/lisp/acdw.el b/lisp/acdw.el index 84fcb99..e25de43 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -145,20 +145,37 @@ otherwise it's wrapped in `kbd'. The following keywords are recognized: :after ARGS .. call `autoload' on COMMAND using ARGS before - binding the key. ARGS can be just the filename to - load; in that case it's wrapped in a list. + binding the key. ARGS can be just the filename to + load; in that case it's wrapped in a list. + :map KEYMAP .. define KEY in KEYMAP instead of the - default `acdw/bind-default-map'." + default `acdw/bind-default-map'. If `:after' is also supplied, + run `autoload' on KEYMAP (except when using `:map-after', see). + +:map-after FILE .. run the underlying `define-key' command in an + `with-eval-after-load'. For the rare occasion when the keymap is + defined in a different file than the command it binds (looking + at you, `org-mode')." (let ((after (when-let (sym (plist-get args :after)) (if (not (listp sym)) (list sym) sym))) + (map-after (plist-get args :map-after)) (keymap (or (plist-get args :map) acdw/bind-default-map)) (keycode (if (vectorp key) key (kbd key))) (command-list)) - (push `(define-key ,keymap ,keycode ',command) command-list) + (let ((define-key-command `(define-key ,keymap ,keycode ',command))) + (if map-after + (push `(with-eval-after-load ,map-after + ,define-key-command) + command-list) + (push define-key-command command-list))) (when after - (push `(autoload ',command ,@after) command-list)) + (unless (fboundp command) + (push `(autoload ',command ,@after) command-list)) + (unless (or map-after + (eq keymap acdw/bind-default-map)) + (push `(autoload ',keymap ,(car after) nil nil 'keymap) command-list))) `(progn ,@command-list))) -- cgit 1.4.1-21-gabe81 From 98472a480d46fe5633de192f962b16d5fb20239e Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 14 Mar 2021 19:18:52 -0500 Subject: Add `nov' --- init.el | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'init.el') diff --git a/init.el b/init.el index 466c280..d01c60b 100644 --- a/init.el +++ b/init.el @@ -435,6 +435,12 @@ indicator in the mode-line." :binds (("RET" unpackaged/org-return-dwim :map org-mode-map :map-after 'org))) +;;; Nov.el -- ebook reader +(acdw/pkg nov + :now ((autoload #'nov-mode "nov") + (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))) + :set `((nov-text-width ,fill-column))) + ;;; Programming languages -- cgit 1.4.1-21-gabe81 From 60954ae4ec225344ecafd914aa24f0da2a2067f5 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 14 Mar 2021 19:19:02 -0500 Subject: Add `0x0' --- init.el | 3 +++ 1 file changed, 3 insertions(+) (limited to 'init.el') diff --git a/init.el b/init.el index d01c60b..78d1ffd 100644 --- a/init.el +++ b/init.el @@ -441,6 +441,9 @@ indicator in the mode-line." (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))) :set `((nov-text-width ,fill-column))) +;;; 0x0 -- upload files +(acdw/pkg (0x0 :repo "https://git.sr.ht/~zge/nullpointer-emacs") + :set '((0x0-default-host ttm))) ;;; Programming languages -- cgit 1.4.1-21-gabe81 From eb15a3f8e37604d9b1c5f41b78122354b24bb8b7 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 14 Mar 2021 19:19:11 -0500 Subject: Add `racket-mode' --- init.el | 3 +++ 1 file changed, 3 insertions(+) (limited to 'init.el') diff --git a/init.el b/init.el index 78d1ffd..58ca9ad 100644 --- a/init.el +++ b/init.el @@ -461,6 +461,9 @@ indicator in the mode-line." (put 'dotimes-protect 'common-lisp-indent-function (get 'when 'common-lisp-indent-function))) +;; Racket +(acdw/pkg racket-mode) + ;;; Miscellaneous (acdw/set '((disabled-command-function nil) -- cgit 1.4.1-21-gabe81 From 9128a6abedd096965e6b5993fafb88afb287100d Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 14 Mar 2021 19:19:17 -0500 Subject: Turn `font-lock-mode' off --- init.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'init.el') diff --git a/init.el b/init.el index 58ca9ad..3e5210e 100644 --- a/init.el +++ b/init.el @@ -286,7 +286,9 @@ (modus-themes-scale-headings nil) (modus-themes-mode-line nil)) :now ((acdw/sunrise-sunset #'modus-themes-load-operandi - #'modus-themes-load-vivendi))) + #'modus-themes-load-vivendi) + ;; for june + (global-font-lock-mode -1))) ;; Expand-region (acdw/pkg expand-region -- cgit 1.4.1-21-gabe81 From 4283ccdd2c39ae482ca2dbc46936300329cf7dda Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 14 Mar 2021 23:48:40 -0500 Subject: Further configure the mode line I've broken out extra functions into `acdw-modeline', so they don't clutter up the init.el too much. --- init.el | 56 +++++------------------------------ lisp/acdw-modeline.el | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 48 deletions(-) create mode 100644 lisp/acdw-modeline.el (limited to 'init.el') diff --git a/init.el b/init.el index 3e5210e..aa2039e 100644 --- a/init.el +++ b/init.el @@ -302,63 +302,23 @@ ;;; Mode line ;; Minions -(acdw/pkg minions - :now ((minions-mode +1))) +(acdw/pkg minions) ;; Simple mode line (acdw/pkg simple-modeline :set '((simple-modeline-segments ((;; left - acdw/modeline-modified - simple-modeline-segment-buffer-name - simple-modeline-segment-position) + acdw-modeline/modified + acdw-modeline/buffer-name + simple-modeline-segment-position + simple-modeline-segment-word-count) (;; right - simple-modeline-segment-vc + acdw-modeline/vc-branch simple-modeline-segment-misc-info simple-modeline-segment-process - acdw/modeline-minions + acdw-modeline/minions simple-modeline-segment-major-mode)))) - :now ((defun acdw/modeline-modified () - "Displays a color-coded buffer modification/read-only -indicator in the mode-line." - (if (not (string-match-p "\\*.*\\*" (buffer-name))) - (let* ((read-only (and buffer-read-only (buffer-file-name))) - (modified (buffer-modified-p))) - (propertize - (if read-only " ×" (if modified " ●" " ○")) - 'face `(:inherit - ,(if modified 'simple-modeline-status-modified - (if read-only 'simple-modeline-status-error - 'simple-modeline-unimportant))) - 'help-echo (format - (concat "Buffer is %s and %smodified\n" - "mouse-1: Toggle read-only status.") - (if read-only "read-only" "writable") - (if modified "" "not ")) - 'local-map (purecopy (simple-modeline-make-mouse-map - 'mouse-1 - (lambda (event) - (interactive "e") - (with-selected-window - (posn-window (event-start event)) - (read-only-mode 'toggle))))) - 'mouse-face 'mode-line-highlight)))) - (defun acdw/modeline-minions () - "Display a button for `minions-minor-modes-menu'." - (concat - " " - (propertize - "ⱷ" - 'help-echo (format - "Minor modes menu\nmouse-1: show menu.") - 'local-map (purecopy (simple-modeline-make-mouse-map - 'mouse-1 - (lambda (event) - (interactive "e") - (with-selected-window (posn-window - (event-start event)) - (minions-minor-modes-menu))))) - 'mouse-face 'mode-line-highlight))) + :now ((require 'acdw-modeline) (simple-modeline-mode +1))) ;;; Magit diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el new file mode 100644 index 0000000..89037f9 --- /dev/null +++ b/lisp/acdw-modeline.el @@ -0,0 +1,82 @@ +:;;; acdw-modeline.el -*- lexical-binding: t; coding: utf-8-unix -*- +;; +;; Author: Case Duckworth +;; Created: Sometime during Covid-19, 2020 +;; Keywords: configuration +;; URL: https://tildegit.org/acdw/emacs +;; +;; This file is NOT part of GNU Emacs. +;; +;;; License: +;; +;; Everyone is permitted to do whatever with this software, without +;; limitation. This software comes without any warranty whatsoever, +;; but with two pieces of advice: +;; - Don't hurt yourself. +;; - Make good choices. +;; +;;; Commentary: +;; `acdw-modeline' is a dumping ground for extra modeline functions, so they +;; don't clutter up `init.el'. +;; +;;; Code: + +(require 'simple-modeline) +(require 'minions) + +;; modified from `simple-modeline' +(defun acdw-modeline/modified () + "Displays a color-coded buffer modification/read-only +indicator in the mode-line." + (if (not (string-match-p "\\*.*\\*" (buffer-name))) + (let* ((read-only (and buffer-read-only (buffer-file-name))) + (modified (buffer-modified-p))) + (propertize + (if read-only " =" (if modified " +" " -")) + 'help-echo (format + (concat "Buffer is %s and %smodified\n" + "mouse-1: Toggle read-only status.") + (if read-only "read-only" "writable") + (if modified "" "not ")) + 'local-map (purecopy (simple-modeline-make-mouse-map + 'mouse-1 + (lambda (event) + (interactive "e") + (with-selected-window + (posn-window (event-start event)) + (read-only-mode 'toggle))))) + 'mouse-face 'mode-line-highlight)))) + +;; all me, baby +(defun acdw-modeline/minions () + "Display a button for `minions-minor-modes-menu'." + (concat + " " + (propertize + "&" + 'help-echo (format + "Minor modes menu\nmouse-1: show menu.") + 'local-map (purecopy (simple-modeline-make-mouse-map + 'mouse-1 + (lambda (event) + (interactive "e") + (with-selected-window (posn-window + (event-start event)) + (minions-minor-modes-menu))))) + 'mouse-face 'mode-line-highlight))) + +;; from https://www.gonsie.com/blorg/modeline.html, from Doom +(defun acdw-modeline/vc-branch () + (let ((backend (vc-backend buffer-file-name))) + (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2)))) + +;; from gonsie +(defun acdw-modeline/buffer-name () + (propertize " %b " + 'face + (if (buffer-modified-p) + 'font-lock-warning-face + 'font-lock-type-face) + 'help-echo (buffer-file-name))) + +(provide 'acdw-modeline) -- cgit 1.4.1-21-gabe81