summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--eww.org2
-rw-r--r--lib/eos/jao-minibuffer.el81
2 files changed, 27 insertions, 56 deletions
diff --git a/eww.org b/eww.org
index 15dde5c..bb96913 100644
--- a/eww.org
+++ b/eww.org
@@ -131,7 +131,7 @@
(eww-download-directory jao-sink-dir)
(eww-header-line-format " %u")
(eww-form-checkbox-selected-symbol "☒")
- (eww-auto-rename-buffer 'title)
+ (eww-auto-rename-buffer 'jao-eww-buffer-title)
(eww-buffer-name-length 180))
:config
diff --git a/lib/eos/jao-minibuffer.el b/lib/eos/jao-minibuffer.el
index 8982011..2fade40 100644
--- a/lib/eos/jao-minibuffer.el
+++ b/lib/eos/jao-minibuffer.el
@@ -26,12 +26,10 @@
(defvar jao-minibuffer-info ())
(defvar jao-minibuffer-msg-info '(""))
-(defvar jao-minibuffer-notification nil)
(defvar jao-minibuffer-align-right-p t)
(defvar jao-minibuffer-right-margin (if window-system "" " "))
(defvar jao-minibuffer-maximized-frames-p t)
(defvar jao-minibuffer-frame-width nil)
-(defvar jao-minibuffer-notification-timeout 5)
(defvar jao-minibuffer-active-buffer-line-color "azure4")
(defvar jao-minibuffer-inactive-buffer-line-color "grey25")
@@ -42,10 +40,6 @@
(format (format "%%%ds" (if jao-minibuffer-align-right-p w (- w))) s)
(substring s 0 w)))
-(defun jao-minibuffer--current ()
- (with-current-buffer jao-minibuffer--name
- (buffer-substring (point-min) (point-max))))
-
(defun jao-minibuffer--width ()
(cond ((numberp jao-minibuffer-frame-width) jao-minibuffer-frame-width)
(jao-minibuffer-maximized-frames-p (frame-width))
@@ -60,16 +54,12 @@
(reverse (or info jao-minibuffer-info)))))
" "))
-(defun jao-minibuffer--aligned (&optional w currentp)
- (let* ((msg (cond (currentp (jao-minibuffer--current))
- (jao-minibuffer-notification
- (format-mode-line jao-minibuffer-notification))
- (t (jao-minibuffer--format-info))))
- (msg (if jao-minibuffer-align-right-p
- (string-trim msg)
- (string-trim-left msg)))
+(defun jao-minibuffer--aligned (&optional w)
+ (let* ((msg (jao-minibuffer--format-info))
+ (msg (cond (jao-minibuffer-align-right-p (string-trim msg))
+ (t (string-trim-left msg))))
(msg (propertize msg :minibuffer-message t)))
- (when (not (string-empty-p msg))
+ (unless (string-empty-p msg)
(let* ((mw (jao-minibuffer--width))
(w (- mw (mod w mw) (length jao-minibuffer-right-margin) -1)))
(if (> w 0) (jao-minibuffer--trim msg w) "")))))
@@ -101,10 +91,6 @@
(defun jao-minibuffer--set-message (msg)
(when jao-minibuffer-mode (jao-minibuffer--format-msg (or msg ""))))
-(defvar-local w3m-current-title nil)
-(defvar-local eww-data nil)
-(defvar-local jao-notmuch--tree-buffer nil)
-(defvar circe-chat-target nil)
(defvar exwm-class-name nil)
(defvar jao-minibuffer--mode-line-position
@@ -112,20 +98,17 @@
("%n %2c %l "
(:eval (format "%d" (line-number-at-pos (point-max)))))))
+(defvar jao-minibuffer--mode-line-bid
+ '(:eval (cond ((derived-mode-p 'gnus-group-mode
+ 'gnus-article-mode
+ 'gnus-summary-mode)
+ mode-line-buffer-identification)
+ ((derived-mode-p 'circe-channel-mode)
+ (format "%s [%d]" (buffer-name) (length (circe-channel-nicks))))
+ (t "%b"))))
+
(defvar jao-minibuffer--mode-line-format
- `("%["
- (:propertize
- (:eval (cond ((derived-mode-p 'gnus-group-mode
- 'gnus-article-mode
- 'gnus-summary-mode)
- mode-line-buffer-identification)
- ((derived-mode-p 'circe-channel-mode)
- (format "%s [%d]" (buffer-name) (length (circe-channel-nicks))))
- (jao-notmuch--tree-buffer (buffer-name jao-notmuch--tree-buffer))
- ((not (null eww-data)) (plist-get eww-data :title))
- (t "%b")))
- face jao-themes-f00)
- "%]"
+ `("%[" (:propertize ,jao-minibuffer--mode-line-bid face jao-themes-f00) "%]"
(:propertize " (" face jao-themes-dimm)
(:propertize mode-name face jao-themes-f00)
(:propertize ("" minor-mode-alist) face jao-themes-f11)
@@ -177,32 +160,20 @@
(jao-minibuffer-adjust-mode-line-faces))
;;;###autoload
-(defun jao-minibuffer-turn-on ()
- (interactive)
- (advice-add 'select-window :after #'jao-minibuffer-refresh)
- (advice-add 'force-mode-line-update :after #'jao-minibuffer-refresh)
- (setq set-message-function #'jao-minibuffer--set-message)
- (setq clear-message-function #'jao-minibuffer-refresh)
- (jao-minibuffer-refresh))
-
-;;;###autoload
-(defun jao-minibuffer-turn-off ()
- (interactive)
- (advice-remove 'select-window #'jao-minibuffer-refresh)
- (advice-remove 'force-mode-line-update #'jao-minibuffer-refresh)
- (setq set-message-function nil)
- (setq clear-message-function nil)
- (jao-minibuffer--insert ""))
-
-;;;###autoload
(define-minor-mode jao-minibuffer-mode
"Show minibuffer status"
- :global t
- :lighter ""
- :group 'jao
+ :global t :lighter "" :group 'jao
(if jao-minibuffer-mode
- (jao-minibuffer-turn-on)
- (jao-minibuffer-turn-off)))
+ (progn (advice-add 'select-window :after #'jao-minibuffer-refresh)
+ (advice-add 'force-mode-line-update :after #'jao-minibuffer-refresh)
+ (setq set-message-function #'jao-minibuffer--set-message)
+ (setq clear-message-function #'jao-minibuffer-refresh)
+ (jao-minibuffer-refresh))
+ (advice-remove 'select-window #'jao-minibuffer-refresh)
+ (advice-remove 'force-mode-line-update #'jao-minibuffer-refresh)
+ (setq set-message-function nil)
+ (setq clear-message-function nil)
+ (jao-minibuffer--insert "")))
;;;###autoload
(defun jao-minibuffer-refresh (&rest _ignore)