From 5889bd827e5d45e7026ebf0d00b0751ca5f4e049 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 2 Nov 2024 22:05:29 +0100 Subject: emacs: Make loading multiple-cursors silent --- .config/emacs/modules/mm-editing.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.config/emacs/modules/mm-editing.el b/.config/emacs/modules/mm-editing.el index 46eaa0f..6fbb44f 100644 --- a/.config/emacs/modules/mm-editing.el +++ b/.config/emacs/modules/mm-editing.el @@ -170,6 +170,20 @@ region are marked, otherwise all matches in the buffer are marked." (mm--define-mc-marking-command mm-mark-all-in-region-regexp re-search-forward "regexp") +(defun mm-silent-mc-load (args) + "Advice to `load' to force it to be silent. The `multiple-cursors' +package loads an `.mc-lists.el' file without passing `:nomessage' which +causes messages to be sent in the minibuffer and *Messages* buffer. This +forces that to not happen." + (when (and (boundp 'mc/list-file) + (string= (car args) mc/list-file)) + (pcase (length args) + (1 (setq args (list (car args) nil :nomessage))) + (2 (add-to-list 'args :nomessage :append)) + (_ (setf (caddr args) :nomessage))) + (advice-remove #'load #'mm-silent-mc-load)) + args) + (use-package multiple-cursors :ensure t :defer 2 @@ -180,6 +194,7 @@ region are marked, otherwise all matches in the buffer are marked." ("C-$" . #'mm-mark-all-in-region) ("M-$" . #'mm-mark-all-in-region-regexp)) :init + (advice-add #'load :filter-args #'mm-silent-mc-load) (with-eval-after-load 'multiple-cursors-core (dolist (command #'(backward-delete-char capitalize-dwim -- cgit v1.2.3