Fix the last commit
This commit is contained in:
44
init.el
44
init.el
@ -2208,28 +2208,28 @@ Note that this erases the buffer before doing anything."
|
|||||||
,@body))
|
,@body))
|
||||||
(defun my/-sly-fontify-current-input ()
|
(defun my/-sly-fontify-current-input ()
|
||||||
"Function called from `post-command-hook' to fontify the current input."
|
"Function called from `post-command-hook' to fontify the current input."
|
||||||
(when-let ((deactivate-mark nil)
|
(let ((deactivate-mark nil))
|
||||||
(proc (get-buffer-process (current-buffer)))
|
(when-let ((proc (get-buffer-process (current-buffer)))
|
||||||
(start (process-mark proc))
|
(start (process-mark proc))
|
||||||
(end (point-max))
|
(end (point-max))
|
||||||
(input (buffer-substring-no-properties start end))
|
(input (buffer-substring-no-properties start end))
|
||||||
(fontified (my/-sly-with-font-lock-buffer
|
(fontified (my/-sly-with-font-lock-buffer
|
||||||
(insert input)
|
(insert input)
|
||||||
(font-lock-ensure)
|
(font-lock-ensure)
|
||||||
(buffer-string)))
|
(buffer-string)))
|
||||||
(len (length fontified))
|
(len (length fontified))
|
||||||
(i 0))
|
(i 0))
|
||||||
;; mostly from:
|
;; mostly from:
|
||||||
;; `python-shell-font-lock-post-command-hook'
|
;; `python-shell-font-lock-post-command-hook'
|
||||||
(while (not (= i len))
|
(while (not (= i len))
|
||||||
(let* ((props (text-properties-at i fontified))
|
(let* ((props (text-properties-at i fontified))
|
||||||
(change-i (or (next-property-change i fontified)
|
(change-i (or (next-property-change i fontified)
|
||||||
len)))
|
len)))
|
||||||
(when-let ((face (plist-get props 'face)))
|
(when-let ((face (plist-get props 'face)))
|
||||||
(setf (plist-get props 'face) nil
|
(setf (plist-get props 'face) nil
|
||||||
(plist-get props 'font-lock-face) face))
|
(plist-get props 'font-lock-face) face))
|
||||||
(set-text-properties (+ start i) (+ start change-i) props)
|
(set-text-properties (+ start i) (+ start change-i) props)
|
||||||
(setq i change-i)))))
|
(setq i change-i))))))
|
||||||
(defun my/-sly-cleanup-fontification-buffer ()
|
(defun my/-sly-cleanup-fontification-buffer ()
|
||||||
(when (buffer-live-p my/-sly-fontification-buffer)
|
(when (buffer-live-p my/-sly-fontification-buffer)
|
||||||
(kill-buffer my/-sly-fontification-buffer)))
|
(kill-buffer my/-sly-fontification-buffer)))
|
||||||
|
Reference in New Issue
Block a user