~made modeline config separator agnostic

Now I can use any separator for the modeline, like dashes.
This commit is contained in:
2020-08-14 23:51:31 +01:00
parent a560d1d6f7
commit 8034383cc6

View File

@@ -49,10 +49,15 @@ Load my custom "Grayscale" theme (look at [[file:Grayscale-theme.el][this file]]
ring-bell-function 'ignore) ring-bell-function 'ignore)
#+END_SRC #+END_SRC
* Emacs Mode-line * Emacs Mode-line
Firstly, declare a variable for the number of spaces between each Firstly, declare a variable for the separator between each module
#+BEGIN_SRC emacs-lisp
(defconst +modeline/separator " " "Separator between modules.")
#+END_SRC
Then declare a variable for the number of separators between each
module in the modeline. module in the modeline.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defconst +modeline/sep-spaces 4 "Number of spaces separating modules.") (defconst +modeline/sep-count 4 "Number of +modline/separator instances separating modules.")
#+END_SRC #+END_SRC
Then, declare a list of reserved characters for which the previously Then, declare a list of reserved characters for which the previously
@@ -71,7 +76,7 @@ reserved characters to any one string.
(progn (progn
(string-blank-p STR) (string-blank-p STR)
(cond ((cl-member (car (last (split-string STR "" t))) +modeline/reserved-chars :test #'string=) STR) (cond ((cl-member (car (last (split-string STR "" t))) +modeline/reserved-chars :test #'string=) STR)
(t (concat STR (cl-reduce #'concat (cl-loop for i from 1 to +modeline/sep-spaces collect " ")))))) (t (concat STR (cl-reduce #'concat (cl-loop for i from 1 to +modeline/sep-count collect +modeline/separator))))))
(error STR))) (error STR)))
#+END_SRC #+END_SRC