kiennq / emacs-mini-modeline Goto Github PK
View Code? Open in Web Editor NEWDisplay emacs mode line in minibuffer
License: GNU General Public License v3.0
Display emacs mode line in minibuffer
License: GNU General Public License v3.0
In emacs server/client mode:
If (mini-modeline-mode t)
is activated in init.el then the mode is started as expected,
however, the mini-modeline-display-gui-line is not activated after emacs client has been started, i.e. the frame has been created.
Regardless, whether emacs is started in normal mode or in server/client mode, mini-modeline-display-gui-line should be active, is set accordingly in init.el.
(if (daemonp)
(add-hook 'after-make-frame-functions (lambda (frame)
(with-selected-frame frame
(if (window-system frame)
(mini-modeline-mode 1)))))
(mini-modeline-mode 1))
However, I feel, this is not as clean is it could be...
I prefer not to clean the echo message automatically, so I would like the message be kept for a really long time. Though I set mini-modeline-echo-duration
to something like (* 1024 1024 1024)
, the message in the echo area still only be kept for around 5 seconds.
Could I configure mini-modeline so it keeps the echo message forever just like the normal mode line behavior? Or the mini-modeline-echo-duration
should be respected that I could workaround this problem?
Hi,
Would it be possible to display echo area messages in between the space of left modeline and right mode line?
I was wondering why during startup there was a noticeable pause just after enabling modeline-mode
. Typically when I startup my emacs it's immediately responsive. I realized that the function mini-modeline--enable
calls redisplay
and I believe this causes this delay.
After advising the modeline-mode
, temporarily setting redisplay
to ignore
during its evaluation, the problem was gone.
The comment here #17 (comment)
Thanks for the cool package!
It works great except for when I tried to use org-capture
which in turn calls make-indirect-buffer
which is a native Emacs function.
If you set mini-modeline-display-gui-line
to t
you can reproduce the error by eval'ing:
;; Either open a file named `inbox.org' or change `inbox.org' to the name of a buffer you already have open..."
(make-indirect-buffer (get-buffer "inbox.org") "CAPTURE-inbox.org" 'clone)
You should get the following error:
Debugger entered--Lisp error: (void-variable make-indirect-buffer)
(progn (defvar bootstrap-version) make-indirect-buffer)
elisp--eval-last-sexp(nil)
eval-last-sexp(nil)
funcall-interactively(eval-last-sexp nil)
command-execute(eval-last-sexp)
The error originates from this block of code.
Is there a way to simulate mini-modeline-display-gui-line
when using Emacs in a terminal, or at least keep the modeline for windows that are not at the bottom of the frame?
I have two frame showing different buffers, but mini-modeline shows the same content in both frames. The frames have their own minibuffers, how can I set mini-modeline to update the buffer names according to the current buffer of each frame?
The package maintainer of exwm thinks that possible.
ch11ng/exwm#637
I want the modeline display to be constant. I don't like the fact that when truncation is t
the modeline is truncated. I find it jarring. But when I set it to nil, the echo area height changes between one and two lines long when a message is displayed. I also find this jarring and distracting. I'd like the option of just suppressing all messages, but still logging them to the messages buffer.
Could you add option to remove gui line that is showed above minibuffer?
I just tried out mini-modeline, and it's indeed a very interesting idea!
One thing I've noticed that after performing one isearch (where I cannot see my typed in search string), the mode-line will never ever be updated again. I still see the I-search:
prompt at the beginning of the mini-modeline and also all other mode-line information like the (line,column) indicator or the current buffer name stays as its current value. Even switching to another buffer will still show the old information.
I can easily reproduce that with emacs -Q
(using emacs master from git) by first manually loading dash
and then mini-modeline
and then activating that.
The mini-modeline gets truncated (the percentage sign of the battery level in this case), which causes the modeline to expand to two lines when changing to another buffer. Setting the visual-line-mode or truncation options on/off doesn't seem to change this behavior. Using the package with EXWM on emacs 26.3 with spacemacs developers edition.
Set mini-modeline-display-gui-line
to t
, and keep pressing C-f
(or C-b
), minibuffer will keep refreshing.
Reproducing is unreliable.
i
(Info-index
) and select the first item.Here is a screenshot where it freezes.
I'm pretty sure the problem is with mini-modeline. Disabling mini-modeline solves things. (I'm using smart-mode-line but this happens even with smart-mode-line disabled).
The default value of mini-modeline-r-format
is:
("%e" mode-line-front-space mode-line-mule-info mode-line-client mode-line-modified mode-line-remote mode-line-frame-identification mode-line-buffer-identification " " mode-line-position " " evil-mode-line-tag (:eval (string-trim (format-mode-line mode-line-modes))) mode-line-misc-info)
If we remove just mode-line-front-space
:
(setq mini-modeline-r-format '("%e" mode-line-mule-info mode-line-client mode-line-modified mode-line-remote mode-line-frame-identification mode-line-buffer-identification " " " " evil-mode-line-tag (:eval (string-trim (format-mode-line mode-line-modes))) mode-line-misc-info))
everything works.
This is the solution I'll adopt. I tried to debug, but because it's unreliable and Emacs froze I couldn't get a good backtrace.
When mini-modeline mode activated titlebar become as thin as active window indicator. You can see it running "list-packages", for example.
Note that face header-line
inherit from mode-line
by default, so set mode-line
height to 0.14 will also make header-line
a thin line.
If there is a percent sign being displayed in the minibuffer, mini-modeline throws an error
Stacktrace:
Debugger entered--Lisp error: (error "Format string ends in middle of format specifier")
#<subr message>("test%")
apply(#<subr message> "test%")
mini-modeline--reroute-msg(#<subr message> "test%")
apply(mini-modeline--reroute-msg #<subr message> "test%")
message("test%")
eval((message "test%") nil)
eval-expression((message "test%") nil nil 127)
Steps to reproduce:
emacs -Q
emacs-mini-modeline
M-x toggle-debug-on-error
M-x eval-expression
and insert (message "test%")
I want to use mini-modeline to display extra information in the minibuffer while continuing to show information in the regular mode line.
So I would like to request that there be an option to keep the mode line open.
Today I updated my emacs package, restart emacs and found that I can't use the M-x run command because it can't display the list in the minibuffer, the picture looks like this:
And what I need is the following picture, because I use the ivy package。
M-x works fine when I change the version of dash.el to 2.12
Do you have time to make mini-modeline have the same effect as the latest version of dash.el and version 2.12 of dash.el?
First, I can say this is not a problem of mini-modeline
alone. I have an old configuration project that doesn't use mini-modeline
and it has exactly the same problem. But vanilla Emacs works well, and the problem appears after enabling mini-modeline-mode
, so I'd like to report it here and see if you have any idea. Here is how to reproduce:
$ emacs -Q
(require 'dash)
(require 'mini-modeline)
(mini-modeline-mode)
M-x delete-other-windows
to keep only one window.C-x C-f
to open a file. I use https://github.com/lsof-org/lsof/blob/master/main.c when testing, but it should happen with any file that's long enough.M-x split-window-horizontally
, so we have 2 window viewing the same file now.C-g
, or maybe press it repeatedly and quickly, then the window may go back to the starting position of the file.If you scroll the other window to some position, and do the same thing, you'll see it actually goes near the position in the other window. Here's a screen recording:
It's a problem that confuses me for a year. I said it doesn't only happen when using mini-modeline
. I believe mode-line-bell also causes the problem (I didn't use it but has some similar code in my configuration). In my current configuration:
ring-bell-function
to ignore
, and don't use mini-modeline
, problem gone.ring-bell-function
to ignore
, and use mini-modeline
, problem appears.mini-modeline
, and use a ring-bell-function
. I've created 3 versions:
mini-modeline--set-buffer-face
does, but restores it with a timer): problem gone.I didn't do this experiment with $ emacs -Q
yet.
My best guess is:
mini-modeline
and mode-line-bell
) causes the problem.I'm on GNU/Linux and Emacs 27.1.
To reproduce this bug, creat a new empty buffer in org-mode, and start typing the following text
* heading
first line after heading
flicker after second line after heading
after reaching the second line after heading, you will notice that after each insertion, there is a flickering in mini-modeline.
First of all: very nice package, thank you!
I noticed that with this mode active Emacs uses ~1-2% of one CPU core when sitting idle. I tried setting mini-modeline-update-interval
to a larger value (0.3), but that had no effect.
I have the following configuration for my mini-modeline
:
(straight-use-package 'mini-modeline)
(progn
(setq mini-modeline-r-format
'("%e" (:eval (number-to-string (winum-get-number)))
" "
evil-mode-line-tag
" "
mode-line-modified
mode-line-buffer-identification
" "
mode-line-position
(:eval (symbol-name major-mode))
" "
(:eval (magit-get-current-branch))
" "
(:eval (format-time-string "%l:%M%P")))
mini-modeline-l-format nil)
(mini-modeline-mode t))
And it was working fine right after I installed it to replace doom-modeline
but when I restarted Emacs, the background for the minibuffer is just all white when mini-modeline-mode
is on. I turn it off and it's black as expected, but then turning it back on just makes the minibuffer white again. I can't figure out what's causing this as it was working before and I don't have any configuration related to colours 🤷♂️
I'm using straight.el to manage my Emacs packages. Its popup is not displayed right when using mini-modeline:
You can see this is a multi-line prompt. When I press some arrow key, they can show for a while but then folds to 1 line (it's in a loop so it calls read-key
again when I don't press the right key).
I looked into the code. straight.el uses read-key
for this, and I saw the thing you did with read-key-sequence
. So I tried wrap it with mini-modeline--wrap
like you did. But this doesn't work.
Hi! I am using mini-modeline (it is awesome). But, when I use it with mode-line-stats, I get this error (and I can't see it in the modeline):
mini-modeline: (error Invalid format operation %%$)
Emacs 25.2.2 here, I am using the last version on MELPA (pkg-info-package-version says 20200306.1000). Thank you!
This mode works great in most scenarios, but when the minibuffer contents are taller than the mini-modeline
text, it gets cut off. I have this problem in org-mode
buffers and when typing in Chinese because my Chinese font is slightly taller than my normal font.
Here it is with mini-modeline
disabled (how I expect the minibuffer text to always look, expanding upward):
Here is the erroneous state with mini-modeline
enabled (text expands downward):
With mini-modeline active, when I eval (message "foo")
I expect to see "foo"
in the minibuffer, but instead I only briefly see: nil
So it seems that mini-modeline is hiding messages that would normally appear in the minibuffer.
When I have resize-mini-windows set to t, message three strings long enough to cause a line break consecutively, the minibuffer height will decrease to 1 line in between, which will cause screen flashes.
For example,
(run-at-time 1 nil (lambda () (message "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")))
(run-at-time 2 nil (lambda () (message "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")))
(run-at-time 3 nil (lambda () (message "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")))
Some input methods uses the echo area to display word candidates, for a very long word or sentence, the constant flashing during updating is a nuisance.
When I have mini-modeline turned off, there is no flashing.
When using emacs as a daemon and opening several clients, the modeline does not seem to work correctly. It always wants to process minibuffer completions on the last opened frame.
I can only show this with the screencast below, the frame on the left was the last frame opened and find-file
works correctly there, it shows me the completions on which I can operate and select a file. The frame on the right was the first opened frame, and issuing find-file
immediately closed the minibuffer completions which appear on the other frame (the one on the left). This is my configuration of the mode-line, I'm also using doom-emacs and maybe and doing something wrong :)
(use-package! mini-modeline
:init
(setq mode-line-position (list "%l:%c %p"))
(setq mode-line-modes (list "%m"))
(setq mini-modeline-enhance-visual t)
(setq mini-modeline-display-gui-line nil)
(setq mini-modeline-echo-duration 10)
(setq mini-modeline-right-padding 1)
(setq mini-modeline-l-format nil)
(setq mini-modeline-r-format
'("%e"
mode-line-front-space
mode-line-position
" "
mode-line-mule-info ; Information on character sets, encodings, and other human-language details
mode-line-client ; Identifies frames created by emacsclient
mode-line-modified ; Modified and read-only status
mode-line-remote ; At-sign (@) for buffers visiting remote files, otherwise a dash
" "
mode-line-modes))
:config
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(mini-modeline-mode t))))
(mini-modeline-mode t)))
NOTE: Github does not support *.webm, which is really weird!
screencast.zip
The follwing fixes it for me.
(setq y-or-n-p-use-read-key t)
(mini-modeline--wrap read-key
(progn (setq mini-modeline--command-state 'exec-read)
(apply orig-func args)))
Hi,
on emacs 27.0.90, opening eshell while mini-modeline-mode is enabled leads to the error
wrong type argument listp, " "
This seems to be caused by the mode-line-format being set to " " under some circumstances:
(defun mini-modeline--enable ()
"Enable 'mini-modeline'."
;; Hide modeline for terminal, or use empty modeline for GUI.
(if (display-graphic-p)
(setq-default mode-line-format " ")
(setq-default mode-line-format nil))
...
When I change this to
(defun mini-modeline--enable ()
"Enable 'mini-modeline'."
;; Hide modeline for terminal, or use empty modeline for GUI.
(if (display-graphic-p)
(setq-default mode-line-format nil)
(setq-default mode-line-format nil))
...
things work fine (I am aware that the if-clause is not needed now, but I wanted to keep it close to the original code).
Is this related to the emacs version? Does the suggested fix make sense in general?
As an example, an unsplit frame looks like
whereas a split frame looks like
Most notably, it appears that the global info, i.e mode-line-misc-info
, only appears when the frame is horizontally split. Now obviously this isn't the reason (that's stupid), but I can't find any better pattern for reproducing this.
http://www.emacswiki.org/emacs/download/awesome-tray.el
also EXWM with minibuffer-auto-raise set to true.
As described in #66, there are changes to the positioning of text in Emacs 29 that causes mini-modeline in its current state to have "cut off" text. I have attempted applying the changes in this PR to no avail.
I am installing this package with straight and use-package as follows.
(use-package mini-modeline
:config
(setq mini-modeline-enhance-visual nil
mini-modeline-truncate-p nil
mini-modeline-echo-duration 1)
(mini-modeline-mode t))
Steps to reproduce:
(setq package-enable-at-startup nil ; don't auto-initialize!
load-prefer-newer t
inhibit-default-init t
package-check-signature nil
package-user-dir (expand-file-name (format "~/.emacs.d/elpa.%s" emacs-major-version)))
(package-initialize)
(use-package vertico
:init
(vertico-mode)
:config
(add-hook 'minibuffer-setup-hook 'vertico--update 'append)
(setq vertico-resize 'grow-only))
(use-package mini-modeline
:ensure nil
:init
(mini-modeline-mode)
:config
(setq mini-modeline-right-padding 2)
(setq mini-modeline-truncate-p nil)
(setq resize-mini-windows t))
to have the output message on a seperate line, we need a file with a long file name, run this command:
emacs -Q -l test-vertico.el hello-----------------------------------------------------------.org
make some modification, then "C-x C-c" exit Emacs, the message "file modified, save or not?" will be displayed. Because the mini-buffer is still at height 1, that message is not visible
I'll start by thanking you for this great package!
It would be great to have an option to echo messages in the right part (as oppose to the left part) of the minibuffer since traditionally the left part of the modeline has more important informations (e.g., evil state, whether the buffer is modified).
I think this is relatively easy to implement (correct me if I am wrong!): change
(setq mini-modeline--cache
(mini-modeline--multi-lr-render
(if mini-modeline--msg
(format-mode-line '(:eval (mini-modeline-msg)))
(format-mode-line mini-modeline-l-format))
(format-mode-line mini-modeline-r-format)))
to
(setq mini-modeline--cache
(mini-modeline--multi-lr-render
(format-mode-line mini-modeline-l-format)
(if mini-modeline--msg
(format-mode-line '(:eval (mini-modeline-msg)))
(format-mode-line mini-modeline-r-format))))
in mini-modeline-display
should do the trick.
Let me know what you think and I can submit a PR.
Sometimes, mini-modeline seems to fail to show multiline things in the minibuffer. It seems to happen occasionally, I haven't been able to reproduce it deterministically, though it's often enough to disrupt my workflow and causes me to turn mini-modeline-mode off sometimes.
The behavior is the following:
I spent some time trying to track down the bug in the mini-modeline code, but could not find the culprit. The resizing code seems to try to do the right thing, at least in mini-modeline-display
. I tested it by printing out what it was doing in a buggy session.
So, I'm starting to suspect it is a bug in emacs, because I didn't have this issue with emacs 27, and mini-modeline-mode doesn't seem to have changed. But I'm not sure where to look from here.
Here's my relevant emacs config:
(use-package mini-modeline
:delight
:config
(setq mini-modeline-enhance-visual nil
mini-modeline-truncate-p nil
mini-modeline-echo-duration 1)
(mini-modeline-mode 1))
M-x emacs-version
GNU Emacs 28.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.17.6) of 2022-04-09
mini-modeline-version 434b98b
Here's my little hack:
(define-advice mini-modeline-enable (:after (&rest _) set-modeline-color)
"Make modelines thin, and set different color for active/inactive ones.
By doing so, we can easily distinguish between active/inactive
windows.
We do nothing for Emacs in terminal. This is because a thin
modeline is impossible in terminal, so we just hide it."
(when (display-graphic-p)
;; `mode-line-format' can't be empty, or modeline will not show.
(setq-default mode-line-format '(" "))
(mapc (lambda (buf)
(unless (string-prefix-p " " (buffer-name buf))
(with-current-buffer buf
(setq mode-line-format " "))))
(buffer-list))
(face-spec-set 'mode-line
'((((background light))
:height 0.14 :box nil
:background "#55ced1")
(t
:height 0.14 :box nil
:background "#008b8b")))
(face-spec-set 'mode-line-inactive
'((((background light))
:height 0.1 :box nil
:background "#dddddd")
(t
:height 0.1 :box nil
:background "#333333")))))
It shows the modeline as a thin bar, and use their height and color to distinguish between active/inactive windows, like this:
I'm not sure if you like it. If you do like it, I can create a PR ;)
I am terrible at using git, and you might disagree with me, so I create this issue instead of a pull requqest.
This is lisp code:
(defvar mini-modeline-frame nil)
(defsubst mini-modeline-lr-render (left right)
"Render the LEFT and RIGHT part of mini-modeline."
(let* ((available-width (- (frame-width mini-modeline-frame) (string-width left) 2))
(required-width (string-width right)))
(if (< available-width required-width)
(format (format "%%%ds\n%%s" (frame-width mini-modeline-frame)) right left)
(format (format "%%s %%%ds" available-width)
(or left "")
(or right "")))))
(defun mini-modeline--multi-lr-render (left right)
"Render the LEFT and RIGHT part of mini-modeline with multiline supported.
Return value is (STRING . LINES)."
(let* ((l (split-string left "\n"))
(r (split-string right "\n"))
(lines (max (length l) (length r)))
re extra-lines)
(--dotimes lines
(setq re (nconc re `(,(mini-modeline-lr-render (elt l it) (elt r it))))))
(setq extra-lines (cl-count ?\n (car re)))
(cons (string-join re "\n") (+ lines extra-lines))))
After using it for several days, I found that mini-modeline-mode is better than many other packages: it doesn 't pollute my Message buffer.
Here is my current configs if anyone is interested:
(use-package mini-modeline
:commands mini-modeline-mode
:init
(if exwm_enable
(add-hook 'exwm-init-hook #'mini-modeline-mode t)
(add-hook 'after-init-hook #'mini-modeline-mode t))
:config
(when (and exwm_enable (exwm-workspace--minibuffer-own-frame-p))
(add-hook 'mini-modeline-mode-hook #'exwm-workspace-attach-minibuffer))
(add-hook 'focus-in-hook 'mini-modeline-display)
(setq display-time-day-and-date nil)
(setq mini-modeline-echo-duration 4)
(display-time-mode t)
(unless exwm_enable (setq exwm-workspace--current nil))
(defvar symon-refresh-rate 4)
(defvar symon-linux--last-network-rx nil)
(defvar symon-linux--last-network-tx nil)
(defvar my-last-symon-message "")
(defun symon-linux--read-lines (file reader indices)
(with-temp-buffer
(insert-file-contents file)
(goto-char 1)
(mapcar (lambda (index)
(save-excursion
(when (search-forward-regexp (concat "^" index "\\(.*\\)$") nil t)
(if reader
(funcall reader (match-string 1))
(match-string 1)))))
indices)))
(defun my-update-symon ()
(setq my-last-symon-message
(concat
;; Receive speed
(format "R:%s "
(with-temp-buffer
(insert-file-contents "/proc/net/dev")
(goto-char 1)
(let ((rx 0))
(while (search-forward-regexp "^[\s\t]*\\(.*\\):" nil t)
(unless (string= (match-string 1) "lo")
(setq rx (+ rx (read (current-buffer))))))
(prog1 (when symon-linux--last-network-rx
(/ (- rx symon-linux--last-network-rx) symon-refresh-rate 1000))
(setq symon-linux--last-network-rx rx)))))
;; Transmit speed
(format "T:%s "
(with-temp-buffer
(insert-file-contents "/proc/net/dev")
(goto-char 1)
(let ((tx 0))
(while (search-forward-regexp "^[\s\t]*\\(.*\\):" nil t)
(unless (string= (match-string 1) "lo")
(forward-word 8)
(setq tx (+ tx (read (current-buffer))))))
(prog1 (when symon-linux--last-network-tx
(/ (- tx symon-linux--last-network-tx) symon-refresh-rate 1000))
(setq symon-linux--last-network-tx tx)))))
;; memory
(format "M:%s"
(cl-destructuring-bind (memtotal memavailable memfree buffers cached)
(symon-linux--read-lines
"/proc/meminfo" (lambda (str) (and str (read str)))
'("MemTotal:" "MemAvailable:" "MemFree:" "Buffers:" "Cached:"))
(if memavailable
(/ (* (- memtotal memavailable) 100) memtotal)
(/ (* (- memtotal (+ memfree buffers cached)) 100) memtotal))))
;; swapped
(cl-destructuring-bind (swaptotal swapfree)
(symon-linux--read-lines
"/proc/meminfo" 'read '("SwapTotal:" "SwapFree:"))
(let ((swapped (/ (- swaptotal swapfree) 1000)))
(unless (zerop swapped) (format " %dMB Swapped" swapped))))
)))
(display-battery-mode 1)
(defun awesome-tray-module-symon-info ()
(if (string-empty-p battery-mode-line-string)
my-last-symon-message
(concat my-last-symon-message " " battery-mode-line-string)))
(setq awesome-tray-symon-timer (run-with-timer 0 symon-refresh-rate 'my-update-symon))
(defun awesome-tray-module-workspace-info ()
(let ((workspace-str ""))
(when (bound-and-true-p ace-window-display-mode)
(setq workspace-str
(concat workspace-str (window-parameter (selected-window) 'ace-window-path))))
(when (boundp 'exwm-workspace-current-index)
(setq workspace-str
(concat workspace-str
(propertize (int-to-string exwm-workspace-current-index) 'face '((:background "#0000ff" :foreground "#ffff00"))))))
(when (and (bound-and-true-p eyebrowse-mode)
(< 1 (length (eyebrowse--get 'window-configs))))
(let* ((num (eyebrowse--get 'current-slot))
(tag (when num (nth 2 (assoc num (eyebrowse--get 'window-configs)))))
(str (if (and tag (< 0 (length tag)))
tag
(when num (int-to-string num)))))
(when str
(setq workspace-str (concat workspace-str (format ":%s" str))))))
workspace-str))
(defun roife/shorten-path (path &optional max-len)
"Shorten PATH to MAX-LEN."
(unless max-len (setq max-len 0))
(if (and path (not (eq path "")))
(let* ((components (split-string (abbreviate-file-name path) "/"))
(len (+ (1- (length components))
(reduce '+ components :key 'length)))
(str ""))
(while (and (> len max-len)
(cdr components))
(setq str (concat str (if (= 0 (length (car components)))
"/"
(string (elt (car components) 0) ?/)))
len (- len (1- (length (car components))))
components (cdr components)))
(concat str (reduce (lambda (a b) (concat a "/" b)) components)))
""))
(defvar my-buffer-id-length 50 "")
(defun my-trim-buffer-id (id suffix-length)
(if (> (length id) my-buffer-id-length)
(concat (substring id 0 (- my-buffer-id-length suffix-length))
(substring id (- 0 suffix-length)))
id))
(defun my-buffer-id ()
(cond ((buffer-file-name)
(let* ((file-name (roife/shorten-path (buffer-file-name) my-buffer-id-length)))
(if (<= (string-width file-name) my-buffer-id-length)
file-name
(my-trim-buffer-id (buffer-name) 4))))
((and exwm_enable (derived-mode-p 'exwm-mode))
(my-trim-buffer-id exwm-title 10))
(t (if (buffer-name) (my-trim-buffer-id (buffer-name) 4) ""))))
;; "chartreuse3"
;; Color the evil tag - colors taken from spaceline
(setq evil-normal-state-tag (propertize "N" 'face '((:background "DarkGoldenrod2" :foreground "black")))
evil-emacs-state-tag (propertize "E" 'face '((:background "SkyBlue2" :foreground "black")))
evil-insert-state-tag (propertize "I" 'face '((:background "red" :foreground "black")))
evil-replace-state-tag (propertize "R" 'face '((:background "chocolate" :foreground "black")))
evil-motion-state-tag (propertize "M" 'face '((:background "plum3" :foreground "black")))
evil-visual-state-tag (propertize "V" 'face '((:background "red" :foreground "black")))
evil-operator-state-tag (propertize "O" 'face '((:background "sandy brown" :foreground "black"))))
(setq display-time-24hr-format t)
(setq display-time-mail-string "")
(setq display-time-string-forms
'((propertize (format-time-string "%H:%M" now) 'face '((:background "#140004" :foreground "green")))))
(set-face-attribute 'mode-line-buffer-id nil :foreground "red")
;; mode-line-mule-info: 当前内容的编码和输入法,U指UTF-8
;; mode-line-modified: **已经被修改,--没被修改,%%表示只读,%* 表示内容只读并且被修改
(setq mini-modeline-r-format '("%e"
;; (:eval (format-mode-line (propertized-buffer-identification "%b")))
(:eval (propertize (my-buffer-id) 'face '((:background "#000000" :foreground "red"))))
" "
mode-line-position
;; (vc-mode vc-mode)
mode-line-remote
evil-mode-line-tag
mode-line-mule-info
mode-line-modified
" "
(:eval (awesome-tray-module-workspace-info))
;; (:eval (propertize (awesome-tray-module-workspace-info) 'face '((:background "#002555" :foreground "#ffff00"))))
" "
display-time-string
" "
(:eval (propertize (awesome-tray-module-symon-info) 'face 'font-lock-warning-face))
))
(defun my-clear-echo-area ()
(let ((mini-modeline--msg-message ""))
(mini-modeline-display 'force)))
(when (featurep 'pyim)
(advice-add 'pyim-terminate-translation :after 'my-clear-echo-area)))
I think this is similar to #2. Some input method use the echo area to display word candidates (https://github.com/tumashu/pyim/). In the case of pyim, it has a variable pyim-translating showing the translation state. There are other packages that need the displayed string in the echo area, so it's unlikely this package can take all of that into consideration. Maybe we should make a function, eg. mini-modeline-inhibited, when it returns t, stop updating the modeline, and the user can set that value to be in their particular use case.
With the following init.el
(require 'mini-modeline)
(mini-modeline-mode)
the GUI line initially fails to draw when using emacs as a server and spawning new buffers via emacsclient. It does work if one evaluates (mini-modeline-mode t)
manually (or just toggles the mode off and back on again), but doing so every time another emacs server is started is kinda tedious. When starting emacs normally (i.e. without server-mode
) everything is showing correctly.
Any idea?
Test files should not provide
a feature. Providing a feature is only suitable for libraries that are loaded by other libraries/packages or by the end user using require
. For require
to be able to do its job, the library that provides the feature has to be located on the load-path
, but test files should not be located on the load-path
.
You are probably already loading this test file using something (load "relative/path/to/it")
and can just remove the provide
form. If not, then you probably just have to replace a require
with a such a load
form somewhere.
One reason why test files should not provide
a feature and/or reside on the load-path
is that authors tend to name those files just tests.el
or something like that. If only one package does that, then that works, but it only two out of several thousands and things start to get problematic. In fact I usually don't notice such issues until there actually are two packages that provide the exact same "testing feature".
I have written similar messages many many times so I now use a template. I try to adjust it to match each individual case but it might still not apply 100% in all cases.
I am trying to show the tab string of toki-tabs on mini-modeline during tab switching.
The displayed tab string let me see the adjacent tab names.
Currently if there is a message display right before or immediately after the display of this tab string, the tab string get overwritten.
I need a definitive behaviour that the tab string get displayed at least 2 seconds for me to see.
Toli-tabs is a very smart tab sorting package here:
https://github.com/AmaiKinono/Tokimacs/blob/master/site-lisp/toki-tabs.el
I have tried this setting so far:
(setq mini-modeline-l-format '((:eval (toki-modeline-tabs))))
(defun my-echo-tabs ()
(let ((mini-modeline--msg (toki-modeline-tabs))
(mini-modeline--msg-message (toki-modeline-tabs)))
(setq mini-modeline--last-update (date-to-time "0001-01-01 00:00"))
(message "%s" (toki-modeline-tabs))
(mini-modeline-display 'force)))
(add-hook 'toki-tabs-update-hook 'my-echo-tabs))
Thank you!
Hi, I'm trying to preserve the interactive nature of modeline and have clickable buttons with menus in the modeline. I've tried to go the same way as done in normal modeline. Here's my modeline config:
The above is normal mode-line, and below mini-modeline with the same format. When I click on the LF
iin the mode-line I can cycle line ending variants, however when I click on it in the mini-modeline I only get Minibuffer window is not active
message. Maybe this is the limitation of minibuffer and not the mini-modeline but I'm curious how I can workaround this and keep the functionality.
I've used this code to make LF
text clickable:
(propertize ;; string related code omitted
'local-map (let ((map (make-sparse-keymap)))
(define-key map [mode-line mouse-1] 'mode-line-change-eol)
map)
Note, that I'm using mode-line
map as it seems that mini-modeline
doesn't work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.