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))
|
||||
(defun my/-sly-fontify-current-input ()
|
||||
"Function called from `post-command-hook' to fontify the current input."
|
||||
(when-let ((deactivate-mark nil)
|
||||
(proc (get-buffer-process (current-buffer)))
|
||||
(start (process-mark proc))
|
||||
(end (point-max))
|
||||
(input (buffer-substring-no-properties start end))
|
||||
(fontified (my/-sly-with-font-lock-buffer
|
||||
(insert input)
|
||||
(font-lock-ensure)
|
||||
(buffer-string)))
|
||||
(len (length fontified))
|
||||
(i 0))
|
||||
;; mostly from:
|
||||
;; `python-shell-font-lock-post-command-hook'
|
||||
(while (not (= i len))
|
||||
(let* ((props (text-properties-at i fontified))
|
||||
(change-i (or (next-property-change i fontified)
|
||||
len)))
|
||||
(when-let ((face (plist-get props 'face)))
|
||||
(setf (plist-get props 'face) nil
|
||||
(plist-get props 'font-lock-face) face))
|
||||
(set-text-properties (+ start i) (+ start change-i) props)
|
||||
(setq i change-i)))))
|
||||
(let ((deactivate-mark nil))
|
||||
(when-let ((proc (get-buffer-process (current-buffer)))
|
||||
(start (process-mark proc))
|
||||
(end (point-max))
|
||||
(input (buffer-substring-no-properties start end))
|
||||
(fontified (my/-sly-with-font-lock-buffer
|
||||
(insert input)
|
||||
(font-lock-ensure)
|
||||
(buffer-string)))
|
||||
(len (length fontified))
|
||||
(i 0))
|
||||
;; mostly from:
|
||||
;; `python-shell-font-lock-post-command-hook'
|
||||
(while (not (= i len))
|
||||
(let* ((props (text-properties-at i fontified))
|
||||
(change-i (or (next-property-change i fontified)
|
||||
len)))
|
||||
(when-let ((face (plist-get props 'face)))
|
||||
(setf (plist-get props 'face) nil
|
||||
(plist-get props 'font-lock-face) face))
|
||||
(set-text-properties (+ start i) (+ start change-i) props)
|
||||
(setq i change-i))))))
|
||||
(defun my/-sly-cleanup-fontification-buffer ()
|
||||
(when (buffer-live-p my/-sly-fontification-buffer)
|
||||
(kill-buffer my/-sly-fontification-buffer)))
|
||||
|
Reference in New Issue
Block a user