diff options
Diffstat (limited to 'emacs/site-lisp/single-header.el')
| -rwxr-xr-x | emacs/site-lisp/single-header.el | 42 |
1 files changed, 4 insertions, 38 deletions
diff --git a/emacs/site-lisp/single-header.el b/emacs/site-lisp/single-header.el index 1196ea0..796a637 100755 --- a/emacs/site-lisp/single-header.el +++ b/emacs/site-lisp/single-header.el @@ -1,3 +1,5 @@ +(provide 'single-header) + (defvar single-header--current-header-buffer nil "Read the name") (defvar single-header-format '(make-header-info-string) "evaluated to fill the header") @@ -9,23 +11,6 @@ (add-face-text-property 0 (length str) face-plist t str) str) -;; disable normal emms-state and move it to the header -;; (require 'emms-state) -;; (setq single-header-emms-state-format-string -;; '(emms-state -;; (" " emms-state -;; (emms-state-current-playing-time -;; (" " -;; (:propertize emms-state-current-playing-time -;; face emms-state-current-playing-time))) -;; (emms-state-total-playing-time -;; ("(" -;; (:propertize emms-state-total-playing-time -;; face emms-state-total-playing-time) -;; ")")) -;; emms-mode-line-string))) -;; (setq emms-state-mode-line-string "") - (defun make-header-info-string () "generates the mode line string that contains all the info to the right" (let ((win (when (buffer-live-p single-header--current-header-buffer) @@ -45,7 +30,6 @@ :foreground "#00ced1") (with-face (battery-format "[%b%p%%] " (and battery-status-function (funcall battery-status-function))) :weight 'bold) - ;; (format-mode-line single-header-emms-state-format-string) ))) (setq str (concat str (cond (win (make-string @@ -54,23 +38,6 @@ )) (with-face str 'single-header))) - -(defun shorten-path (path) - "Shortens each directory in PATH except for the last directory to its first character." - (let* ((components (split-string path "/")) ; Split the path into components - (last-component (-last (lambda (s) (not (string-empty-p s))) components)) ; Extract the last component - (shortened-components ; Shorten all components except the last - (mapcar (lambda (comp) - (if (or (string-equal comp last-component) (string-empty-p comp)) - comp - (substring comp 0 1))) - components))) - (mapconcat 'identity shortened-components "/"))) ; Recombine components into a path - -;; (setq global-mode-string '("" (:eval (concat (with-face (format " [%s] " (shorten-path default-directory)) -;; :weight 'bold -;; :foreground "green2"))))) - (defun single-header-init-buffer (buf) (with-current-buffer buf (insert "header test") @@ -138,6 +105,5 @@ ;; (single-header-show single-header--current-header-buffer)))) ;; do init frame seperately -;; (single-header-show single-header--current-header-buffer) -;; (run-with-timer 0 1 'single-header-update) - +(single-header-show single-header--current-header-buffer) +(run-with-timer 0 1 'single-header-update) |
