Git Product home page Git Product logo

eshell-syntax-highlighting's People

Contributors

aikrahguzar avatar akreisher avatar danieljamesross avatar jcs090218 avatar leungbk avatar mrcnski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

eshell-syntax-highlighting's Issues

Inappropriate highlighting in shells or other interactive commands

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.

Screenshot_20240428_004852

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:

  • Start emacs -Q
  • M-x eshell-syntax-highlighting-global-mode
  • M-x eshell
  • ~ $ bash
  • <backspace>

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.

the highlight face doesn't show up, selection is invisible

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 lambdas inside of lisp expressions don't change into those fancy greek lambdas. Should I file a separate issue report?

Wrong face for cd directory commands

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.

custom-declare-face: Invalid (or missing) doc string

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)

Highlight buffers/processes anywhere in the line

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:

screen-3

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))))

Slow down over TRAMP

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

Using `eshell-syntax-highlighting-highlight-elisp` breaks autocompletion

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.