diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-07-13 16:07:29 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-07-13 18:37:58 +0100 |
commit | 22e8e9011fa92cebfeec1e69b2528cc8aec6fd55 (patch) | |
tree | 01bc7206faa68fa4272b71fd30eff3e813eccec7 /Emacs/.config/emacs | |
parent | 961846882829919367b9d9f28be8e99445b058f3 (diff) | |
download | dotfiles-22e8e9011fa92cebfeec1e69b2528cc8aec6fd55.tar.gz dotfiles-22e8e9011fa92cebfeec1e69b2528cc8aec6fd55.tar.bz2 dotfiles-22e8e9011fa92cebfeec1e69b2528cc8aec6fd55.zip |
(Emacs)~mode line is done by hand
The evaluation system was really just an excuse for me to try and
write some Lisp code when I was first learning it; the inclusion
of (vc-mode vc-mode) meant I couldn't utilise it the way I wanted.
Diffstat (limited to 'Emacs/.config/emacs')
-rw-r--r-- | Emacs/.config/emacs/config.org | 70 |
1 files changed, 17 insertions, 53 deletions
diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index 47f5a12..5e4584d 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -283,62 +283,26 @@ little. I customised the Emacs modeline to give me a bit of info, Currently I use the default mode line with some customisation; simplicity is above all. *** Emacs Mode-line -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. -#+begin_src emacs-lisp -(defconst +modeline/sep-count 4 - "Number of +modline/separator instances separating modules.") -#+end_src - -Then, declare a list of reserved characters for which the previously -declared seperator won't be applied when placed at the end of a module -string. -#+begin_src emacs-lisp -(defconst +modeline/reserved-chars (list "[" "(") - "Characters that, when at the end of a module string, won't - have the separator applied to them.") -#+end_src - -Now declare a function that applies the separator with respect to the -reserved characters to any one string. -#+begin_src emacs-lisp -(defun +modeline/handle-string (STR) - (condition-case nil - (progn - (string-blank-p STR) - (if (cl-member (car (last (split-string STR "" t))) +modeline/reserved-chars :test #'string=) - STR - (concat STR (cl-reduce #'concat (cl-loop for i from 1 to +modeline/sep-count collect +modeline/separator))))) - (error STR))) -#+end_src - -Finally, set the mode-line-format. #+begin_src emacs-lisp (setq-default mode-line-format - (mapcar #'+modeline/handle-string - (list "%l:%c" - "%p[" - '(:eval (upcase - (substring - (format "%s" (if (bound-and-true-p evil-state) - evil-state - "")) - 0 1))) - "]" - "%+%b(" - '(:eval (format "%s" major-mode)) - ")" - "%I" - vc-mode - " " - mode-line-misc-info - mode-line-end-spaces))) + (list "%l:%c " ;; Line and column + "%p[" ;; Where in file + Evil state + '(:eval (upcase + (substring + (format "%s" (if (bound-and-true-p evil-state) + evil-state + "")) + 0 1))) + "] " + "%+%b(" + '(:eval (format "%s" major-mode)) + ") " + "%I " + '(vc-mode vc-mode) + " " + mode-line-misc-info + mode-line-end-spaces)) #+end_src *** WIP Telephone-line :PROPERTIES: |