summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmin Bandali <bandali@gnu.org>2019-11-18 11:50:09 -0500
committerAmin Bandali <bandali@gnu.org>2019-11-18 11:50:09 -0500
commit3214b7ca9380f41f1f5482c530abd605b9a13502 (patch)
tree43cea7637eabf2f4ed3943ec84c25db395789a55
parent2bd7f890edc38884131c196e2c0652bb33912d1b (diff)
downloadconfigs-3214b7ca9380f41f1f5482c530abd605b9a13502.tar.gz
configs-3214b7ca9380f41f1f5482c530abd605b9a13502.tar.xz
configs-3214b7ca9380f41f1f5482c530abd605b9a13502.zip
emacs: make b/insert-asterism more robust w.r.t. fill-column
-rw-r--r--.emacs.d/init.el17
1 files changed, 13 insertions, 4 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 4f286c0..85aeba0 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -266,9 +266,21 @@
(previous-line)
(insert "\n \n;;; "))
+(defvar b/fill-column 47
+ "My custom `fill-column'.")
+
+(defconst b/asterism "* * *")
+
(defun b/insert-asterism ()
+ "Insert a centred asterism."
(interactive)
- (insert "\n\n * * *\n\n"))
+ (insert
+ (concat
+ "\n\n"
+ (make-string (floor (/ (- b/fill-column (length b/asterism)) 2))
+ ?\s)
+ b/asterism
+ "\n\n")))
(defun b/no-mouse-autoselect-window ()
"Conveniently disable `focus-follows-mouse'.
@@ -281,9 +293,6 @@ For disabling the behaviour for certain buffers and/or modes."
;;;; C-level customizations
-(defvar b/fill-column 47
- "My custom `fill-column'.")
-
(setq
;; minibuffer
enable-recursive-minibuffers t