X-Git-Url: https://git.shemshak.org/~bandali/configs/blobdiff_plain/6b09fc8a2951778cd3ff9807d7132dcfb1f7de38..514148d8bef4b14c8754197197c32b212dfb79c2:/lisp/bandali-utils.el diff --git a/lisp/bandali-utils.el b/lisp/bandali-utils.el index 7a2820d..6669b2a 100644 --- a/lisp/bandali-utils.el +++ b/lisp/bandali-utils.el @@ -24,10 +24,22 @@ ;;; Code: -(defmacro b/setq-every (value &rest vars) - "Set all the variables from VARS to value VALUE." - (declare (indent defun) (debug t)) - `(progn ,@(mapcar (lambda (x) (list 'setq x value)) vars))) +(require 'cl-lib) + +(defmacro csetq (&rest args) + "Set the value of user option VAR to VALUE. + +More generally, you can use multiple variables and values, as in + (csetq VAR VALUE VAR VALUE...) +This sets each user option VAR's value to the corresponding VALUE. + +\(fn [VAR VALUE]...)" + (declare (debug setq)) + `(progn + ,@(cl-loop for (var value) on args by 'cddr + collect + `(funcall (or (get ',var 'custom-set) #'set-default) + ',var ,value)))) (defun b/start-process (program &rest args) "Same as `start-process', but doesn't bother about name and buffer." @@ -62,11 +74,11 @@ (interactive) (insert (concat - "\n\n" + "\n" (make-string (floor (/ (- fill-column (length b/asterism)) 2)) ?\s) b/asterism - "\n\n"))) + "\n"))) (defun b/no-mouse-autoselect-window () "Conveniently disable `focus-follows-mouse'.