From: Eshel Yaron Date: Sun, 6 Aug 2023 08:01:20 +0000 (+0300) Subject: Configure Emacs mode-line X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4bd2e9429fc1b523ea369ffb6f7345bf426285ba;p=dotfiles.git Configure Emacs mode-line --- diff --git a/.emacs.d/early-init.el b/.emacs.d/early-init.el index 2e5822e..322c763 100644 --- a/.emacs.d/early-init.el +++ b/.emacs.d/early-init.el @@ -5,6 +5,7 @@ (tool-bar-mode -1) (set-scroll-bar-mode nil) +(setq mode-line-format nil) (unless (eq system-type 'darwin) (menu-bar-mode -1) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 6c04a8d..4e3322e 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -11,14 +11,11 @@ ;;; Temporarily increase GC threshold to expedite Emacs startup (let ((normal-gc-cons-threshold (* 20 1024 1024)) - (init-gc-cons-threshold (* 1024 1024 1024)) - (normal-mode-line-format mode-line-format)) - (setq gc-cons-threshold init-gc-cons-threshold - mode-line-format nil) + (init-gc-cons-threshold (* 1024 1024 1024))) + (setq gc-cons-threshold init-gc-cons-threshold) (add-hook 'after-init-hook (lambda () - (setq gc-cons-threshold normal-gc-cons-threshold - mode-line-format normal-mode-line-format)))) + (setq gc-cons-threshold normal-gc-cons-threshold)))) ;;; OS-specific settings (pcase system-type @@ -236,7 +233,7 @@ set-mark-command-repeat-pop t ;; fine-tune some theme settings ef-themes-mixed-fonts t - ef-themes-variable-pitch-ui t + ef-themes-variable-pitch-ui nil ef-themes-region nil osm-copyright nil ;; follow links to version-controlled files without confirming @@ -367,6 +364,8 @@ corfu-cycle t corfu-indexed-start 1 shell-kill-buffer-on-exit t + compilation-scroll-output t + display-time-default-load-average nil ;; allow disabling confirming before compilation via local variables safe-local-variable-values '((compilation-read-command . nil)) ;; TeX-view-program-selection '((output-pdf "PDF Tools")) @@ -382,6 +381,9 @@ display-line-numbers-type 'relative ;; persist Git commit message history savehist-additional-variables '(log-edit-comment-ring) + eldoc-minor-mode-string nil + flyspell-mode-line-string nil + paredit-lighter nil ;; IRC stuff rcirc-default-nick "esy" rcirc-server-alist '(("irc.libera.chat" @@ -496,7 +498,8 @@ (defun esy/ttyper () (interactive) - (eat "ttyper" t)) + (let ((default-directory "~")) + (eat "ttyper" t))) (defun esy/hut-builds () (interactive) @@ -521,6 +524,11 @@ (interactive (list user-init-file)) (find-file init)) +(defun esy/ttyper () + (interactive) + (let ((default-directory "~")) + (eat "ttyper" t))) + (with-eval-after-load 'shell (keymap-set shell-mode-map "SPC" #'comint-magic-space)) @@ -623,7 +631,7 @@ the root to the element at POS." "Display the JSON path at POINT. When KILL is non-nil, kill it too. Interactively, POINT is point and KILL is the prefix argument." - (interactive "d\nP" json-ts-mode) + (interactive "d\nP") (let ((path (mapconcat (lambda (o) (format "%s" o)) (esy/json-path-to-position point) "."))) @@ -795,6 +803,7 @@ Interactively, POINT is point and KILL is the prefix argument." (keymap-global-set "C-c l" #'org-store-link) (keymap-global-set "C-c a" #'org-agenda) (keymap-global-set "C-c v" #'vterm-other-window) +(keymap-global-set "C-c p" #'sweeprolog-prefix-map) (keymap-global-set "C-c S" #'scratch-buffer) (keymap-global-set "C-c m" #'esy/emms-map) (keymap-global-set "C-c !" #'consult-flymake) @@ -1163,7 +1172,6 @@ as the initial input for completion, and return that directory." (with-eval-after-load 'sweeprolog (setq sweeprolog-top-level-persistent-history (locate-user-emacs-file ".sweep_history")) - (keymap-global-set "C-c p" sweeprolog-prefix-map) (add-hook 'sweeprolog-mode-hook #'sweeprolog-electric-layout-mode) (add-hook 'sweeprolog-top-level-mode-hook #'compilation-shell-minor-mode)) @@ -1262,6 +1270,10 @@ as the initial input for completion, and return that directory." ;; read feeds list from a separate file elfeed-feeds (esy/feeds))) + +(with-eval-after-load 'whitespace-cleanup-mode + (setf (alist-get 'whitespace-cleanup-mode minor-mode-alist) '(""))) + ;;; Track currency exchange rates (defvar esy/eur-to-ils-rates nil) @@ -1301,7 +1313,7 @@ as the initial input for completion, and return that directory." (let* ((svg (svg-create width height :stroke "green")) (time (float-time)) - (frame (* 60 60 24)) + (frame (* 60 60 24 7)) (data (named-let loop ((rates esy/eur-to-ils-rates) (acc nil) (min most-positive-fixnum) @@ -1336,8 +1348,23 @@ as the initial input for completion, and return that directory." (insert-image (esy/plot-eur-to-ils-rates 300 500)) (insert "\n"))) -(push '(:eval (concat "1€=" (number-to-string (cdar esy/eur-to-ils-rates)) "₪ ")) - global-mode-string) +(defvar esy/mode-line-format + '(" %+ " + mode-line-buffer-identification + " (%[" mode-name minor-mode-alist "%])" + (vc-mode vc-mode) + mode-line-process + mode-line-format-right-align + "%l:%c " + (-3 "%p") + " " + (:eval (concat "€~" (number-to-string (cdar esy/eur-to-ils-rates)) "₪ ")) + display-time-string battery-mode-line-string)) + +(add-hook 'after-init-hook + (lambda () + (setq-default mode-line-format esy/mode-line-format) + (force-mode-line-update t))) (provide 'init) ;;; init.el ends here