Comments (3)
It doesn't let me convert this into a draft, but consider this PR on pause until I investigate your solution. Hopefully this can be fixed upstream in
eshell-syntax-highlighting
and without any changes here.
This is an issue. You probably meant the pr on the doom repo?
from eshell-syntax-highlighting.
This is a solution using indirect buffers,
diff --git a/eshell-syntax-highlighting.el b/eshell-syntax-highlighting.el
index 7d06304..7cd4e82 100644
--- a/eshell-syntax-highlighting.el
+++ b/eshell-syntax-highlighting.el
@@ -167,25 +167,34 @@
(t 'eshell-syntax-highlighting-default-face))))
(add-face-text-property beg end face)))
+(defvar eshell-syntax-highlighting--indirect-lisp-buffer nil)
+
+(defun eshell-syntax-highlighting--indriect-buffer ()
+ (or
+ eshell-syntax-highlighting--indirect-lisp-buffer
+ (with-current-buffer
+ (setq-local eshell-syntax-highlighting--indirect-lisp-buffer
+ (make-indirect-buffer
+ (current-buffer)
+ (generate-new-buffer-name
+ (concat " " (buffer-name) "-eshell-indirect"))))
+ (setq-local delay-mode-hooks t)
+ (let ((change-major-mode-hook nil)
+ (after-change-major-mode-hook nil))
+ (emacs-lisp-mode))
+ (setq-local font-lock-dont-widen t)
+ (setq-local font-lock-support-mode nil))
+ comint--indirect-buffer))
+
(defun eshell-syntax-highlighting--highlight-elisp (beg end)
"Highlight Emacs Lisp in region (BEG, END) natively through a temp buffer."
- (let* ((elisp-end (condition-case
- nil (scan-sexps beg 1)
- (scan-error end)))
- (str (buffer-substring-no-properties beg elisp-end)))
- (if (not eshell-syntax-highlighting-highlight-elisp)
- (eshell-syntax-highlighting--highlight beg (point) 'default)
- (goto-char beg)
- (insert
- (with-temp-buffer
- (erase-buffer)
- (insert str)
- (delay-mode-hooks (emacs-lisp-mode))
- (font-lock-default-function 'emacs-lisp-mode)
- (font-lock-default-fontify-region (point-min) (point-max) nil)
- (buffer-string)))
- (delete-region (point) (+ (point) (length str))))
- (goto-char elisp-end)))
+ (let ((elisp-end (condition-case nil
+ (scan-sexps beg 1)
+ (scan-error end))))
+ (with-current-buffer (eshell-syntax-highlighting--indriect-buffer)
+ (narrow-to-region beg elisp-end)
+ (font-lock-ensure beg elisp-end))
+ (goto-char elisp-end)))
(defun eshell-syntax-highlighting--highlight-substitutions (beg end)
"Find and highlight command substitutions in region (BEG, END)."
It is probably better to go the way of comint-fontify-input-mode
and allow running a setup hook in the indirect buffer. E.g. I would like it to turn on highlight-quoted-mode
.
from eshell-syntax-highlighting.
This is a solution using indirect buffers,
...
It doesn't let me convert this into a draft, but consider this PR on pause until I investigate your solution. Hopefully this can be fixed upstream in eshell-syntax-highlighting
and without any changes here.
from eshell-syntax-highlighting.
Related Issues (7)
- Slow down over TRAMP HOT 1
- Highlight buffers/processes anywhere in the line HOT 2
- custom-declare-face: Invalid (or missing) doc string HOT 1
- Inappropriate highlighting in shells or other interactive commands HOT 2
- Wrong face for cd directory commands HOT 1
- the highlight face doesn't show up, selection is invisible HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eshell-syntax-highlighting.