akreisher / eshell-syntax-highlighting Goto Github PK
View Code? Open in Web Editor NEWSyntax highlighting for Eshell
License: GNU General Public License v3.0
Syntax highlighting for Eshell
License: GNU General Public License v3.0
After commit a9a0ae9 this package seems to be trying to highlight the last line unconditionally.
This is an issue mostly with interactive commands like shells (for example running bash under eshell) or package managers asking for confirmation (y|n) which most often leads to the first word in the line highlighted red (unknown command). Sometimes this may happen only after switching the window and back or clicking with the mouse.
What I think is happening is that before the commit highlighting was conditional on eshell-prompt-regexp being matched at the current line, while now (eshell-prompt-next)
will just unconditionally drop point to the last line and highlighting will occur unconditionally.
I have reverted the change locally and can verify that it fixes the issue. If indeed eshell-prompt-regexp is going to be deprecated as the commit states, I would suggest finding another way to make highlighting conditional on point being at an actual prompt.
I'm using emacs 29.3 and eat, but I can reproduce the issue with and without eat:
Steps to reproduce:
emacs -Q
Expected results:
No highlighting takes place until bash is left and the next eshell prompt is entered.
Observed results:
The first word of bash prompt is highlighted.
Hi,
first of all I really appreciate this package of yours. It makes Eshell look much better especially when writing elisp inside of it.
But I've stumbled upon an issue. Apparently region selection doesn't work (it is invisible) when the eshell-syntax-highlighting-mode
is enabled. I try to use C-SPC
to set a mark and then I move my cursor to select a region but the selection doesn't appear. It is selected though -- if I select a region (without seeing it) and then try to kill it, it works and I can yank it back. The whole issue is that I don't see it highlighted, the highlight
face doesn't seem to appear in the Eshell buffer.
On a side note -- when I enable the prettify-symbols-mode
in the Eshell buffer it doesn't seem to work. My lambda
s inside of lisp expressions don't change into those fancy greek lambdas. Should I file a separate issue report?
To cite the documentation of eshell-syntax-highlighting-directory-face
:
"Face used for directory cd commands in an Eshell command."
Now, when I type cd, the directory afterwards is highlighted with eshell-syntax-highlighting-file-arg-face
.
Error when loading package on the latest Emacs30:
custom-declare-face: Invalid (or missing) doc string ("/home/st/.config/emacs/.local/straight/build-30.0.50/eshell-syntax-highlighting/eshell-syntax-highlighting.elc" . 228)
Currently, buffers/processes (starting with #<
) are only supported after a redirect >
. Otherwise, they're highlighted as a comment.
However, I have some eshell commands that take buffers as arguments (allowing for, e.g., cat #<mybuffer> | grep foo
). Right now this looks like:
But it's not actually a comment.
For context, the cat
command is:
(defun eshell/cat (&rest args)
"Like cat(1) but with syntax highlighting."
(dolist (thing (flatten-list args))
(let ((data
(cl-typecase thing
(buffer
(with-current-buffer thing
(if (eshell-interactive-output-p)
(progn (font-lock-ensure) (buffer-string))
(buffer-substring-no-properties (point-min) (point-max)))))
(string
(with-temp-buffer
(set-buffer-multibyte t)
(insert-file-contents thing)
(when (eshell-interactive-output-p)
(let ((buffer-file-name (expand-file-name thing)))
(set-auto-mode))
(font-lock-ensure))
(buffer-string))))))
(remove-text-properties 0 (length data) '(read-only nil) data)
(eshell-print data))))
When in a remote directory eshell-syntax-highlighting slows down eshell considerably and I experience input lag.
The profile i ran suggests that file-exists-p might be responsible for this.
962 55% - eshell-syntax-highlighting--enable-highlighting
955 55% - eshell-syntax-highlighting--parse-and-highlight
949 54% - eshell-syntax-highlighting--parse-command
708 40% - eshell-syntax-highlighting--parse-and-highlight
521 30% - eshell-syntax-highlighting--parse-and-highlight
367 21% - eshell-syntax-highlighting--parse-and-highlight
305 17% - eshell-syntax-highlighting--parse-and-highlight
241 13% - eshell-syntax-highlighting--parse-and-highlight
226 13% - file-exists-p
226 13% + tramp-file-name-handler
5 0% eshell-syntax-highlighting--highlight
60 3% + file-exists-p
62 3% + file-exists-p
136 7% + file-exists-p
174 10% + file-exists-p
3 0% eshell-syntax-highlighting--highlight
173 9% + file-directory-p
62 3% + executable-find
Hi. Using eshell-syntax-highlighting-highlight-elisp
breaks Corfu, Company, and likely many other packages. I have linked this to a Doom Emacs PR here: doomemacs/doomemacs#7529.
But basically, the way this syntax highlighting is implemented involves repeatedly deleting and re-inserting the Lisp expression but doing so causes a noticeable typing latency and breaks every package that uses markers or overlays to store state. In particular, this feature breaks completion--in-region
so it basically breaks all incremental autocompletion in Eshell Elisp. Personally, I believe this is an unacceptable trade-off for getting Elisp syntax highlighting in Eshell and probably most users using this package have silently had their Elisp autocompletion broken without knowing as I did.
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.