From 29c287a8c31bebe9dd40b499415511c96a1ef6fa Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 30 Mar 2022 18:14:56 -0500 Subject: I waited way too long to make this commit --- lisp/+consult.el | 2 +- lisp/+elfeed.el | 8 ++++++++ lisp/+modeline.el | 13 +++++++------ lisp/acdw.el | 12 ++++++++++++ lisp/user-save.el | 18 +++++++++++++++++- 5 files changed, 45 insertions(+), 8 deletions(-) (limited to 'lisp') diff --git a/lisp/+consult.el b/lisp/+consult.el index 0f5bf45..dc06ad5 100644 --- a/lisp/+consult.el +++ b/lisp/+consult.el @@ -12,7 +12,7 @@ ;;; Cribbed functions ;; https://github.com/minad/consult/wiki -(defun consult--orderless-regexp-compiler (input type) +(defun consult--orderless-regexp-compiler (input type &rest _) (setq input (orderless-pattern-compiler input)) (cons (mapcar (lambda (r) (consult--convert-regexp r type)) input) diff --git a/lisp/+elfeed.el b/lisp/+elfeed.el index 8f7f17a..7f9e193 100644 --- a/lisp/+elfeed.el +++ b/lisp/+elfeed.el @@ -31,6 +31,14 @@ (interactive) (elfeed-show-visit t)) +(defun +elfeed-show-mark-read-and-advance () + "Mark an item as read and advance to the next item. +If multiple items are selected, don't advance." + (interactive) + (call-interactively #'elfeed-search-untag-all-unread) + (unless (region-active-p) + (call-interactively #'next-line))) + ;;; Fetch feeds async ;; https://github.com/skeeto/elfeed/issues/367 diff --git a/lisp/+modeline.el b/lisp/+modeline.el index 7bef5c6..3cc8806 100644 --- a/lisp/+modeline.el +++ b/lisp/+modeline.el @@ -93,12 +93,13 @@ This function makes a lambda, so you can throw it straight into (defun +modeline-major-mode (&optional spacer) "Display the current `major-mode'." (concat (or spacer +modeline-default-spacer) - (propertize (+string-truncate (format-mode-line mode-name) 16) - 'face 'bold - 'keymap mode-line-major-mode-keymap - 'help-echo (concat (format-mode-line mode-name) - " mode\nmouse-1: show menu.") - 'mouse-face 'mode-line-highlight))) + (propertize ;; (+string-truncate (format-mode-line mode-name) 16) + (format-mode-line mode-name) + 'face 'font-lock-keyword-face + 'keymap mode-line-major-mode-keymap + 'help-echo (concat (format-mode-line mode-name) + " mode\nmouse-1: show menu.") + 'mouse-face 'mode-line-highlight))) (defcustom +modeline-modified-icon-alist '((ephemeral . "*") (readonly . "=") diff --git a/lisp/acdw.el b/lisp/acdw.el index de2b8e7..764a246 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -374,5 +374,17 @@ the `format' call in a list." (prog1 (progn ,@body) (progress-reporter-done ,reporter))))) +(defmacro +with-eval-after-loads (features &rest body) + "Execute BODY after all FEATURES are loaded." + (declare (indent 1) (debug (form def-body))) + (unless (listp features) + (setq features (list features))) + (if (null features) + (macroexp-progn body) + (let* ((this (car features)) + (rest (cdr features))) + `(with-eval-after-load ',this + (+with-eval-after-loads ,rest ,@body))))) + (provide 'acdw) ;;; acdw.el ends here diff --git a/lisp/user-save.el b/lisp/user-save.el index 8e01af1..33b6f4c 100644 --- a/lisp/user-save.el +++ b/lisp/user-save.el @@ -8,6 +8,8 @@ ;;; Code: +(require 'cl-lib) + (defgroup user-save nil "Group for `user-save-mode' customizations." :group 'emacs @@ -19,11 +21,16 @@ This option is only useful is `user-save-mode' is active when Emacs is killed." :type 'boolean) +(defcustom user-save-inhibit '(special-mode) + "List of modes to inhibit `user-save-mode' from activation in." + :type '(repeat symbol)) + (defvar user-save-hook nil "Hook to run when the user, not Emacs, saves the buffer.") (defvar user-save-mode-map (let ((map (make-sparse-keymap))) (define-key map (kbd "C-x C-s") #'user-save-buffer) + (define-key map (kbd "C-x s") #'user-save-some-buffers) map) "Keymap for `user-save-mode'. This map shadows the default map for `save-buffer'.") @@ -81,7 +88,16 @@ whether the buffer needs to be saved." (user-save-mode -1)) ;;;###autoload -(define-globalized-minor-mode user-save-global-mode user-save-mode user-save-mode +(defun user-save-mode-in-some-buffers () + "Enable `user-save-mode', but only in some buffers. +The mode will not be enabled in buffers derived from modes in +`user-save-inhibit', or in the minibuffer." + (unless (or (cl-some #'derived-mode-p user-save-inhibit) + (minibufferp)) + (user-save-mode +1))) + +;;;###autoload +(define-globalized-minor-mode user-save-global-mode user-save-mode user-save-mode-in-some-buffers (if user-save-global-mode (when user-save-hook-into-kill-emacs (add-hook 'kill-emacs-hook #'user-save-some-buffers)) -- cgit 1.4.1-21-gabe81