feat: lean4-mode: highlight inaccessible names in goal display using font-lock-comment-face

This commit is contained in:
Sebastian Ullrich 2021-02-07 18:26:04 +01:00
parent be10f35a8d
commit 8b1d02c083
2 changed files with 13 additions and 27 deletions

View file

@ -73,8 +73,16 @@
(-lambda ((goal &as &lean:PlainGoal? :rendered))
(when goal
(let ((rerendered (lsp--render-string rendered "markdown")))
(lean4-with-info-output-to-buffer lean4-show-goal-buffer-name
(insert rerendered)))))
(lean4-with-info-output-to-buffer
lean4-show-goal-buffer-name
(insert rerendered)
(when lean4-highlight-inaccessible-names
(goto-char 0)
(while (re-search-forward "\\(\\sw+\\)✝\\([¹²³⁴-⁹⁰]*\\)" nil t)
(replace-match
(propertize (s-concat (match-string-no-properties 1) (match-string-no-properties 2))
'font-lock-face 'font-lock-comment-face)
'fixedcase 'literal)))))))
:error-handler #'ignore
:mode 'tick
:cancel-token :plain-goal))))

View file

@ -49,16 +49,6 @@
:group 'lean
:type '(list string))
(defcustom lean4-eldoc-use t
"Use eldoc mode for lean."
:group 'lean
:type 'boolean)
(defcustom lean4-eldoc-nay-retry-time 0.3
"When eldoc-function had nay, try again after this amount of time."
:group 'lean
:type 'number)
(defcustom lean4-delete-trailing-whitespace nil
"Set this variable to true to automatically delete trailing
whitespace when a buffer is loaded from a file or when it is
@ -66,24 +56,12 @@ written."
:group 'lean
:type 'boolean)
(defcustom lean4-show-type-add-to-kill-ring nil
"If it is non-nil, add the type information to the kill-ring so
that user can yank(paste) it later. By default, it's
false (nil)."
(defcustom lean4-highlight-inaccessible-names t
"Set this variable to `t` to highlight inaccessible names in the goal display
using `font-lock-comment-face' instead of the `` suffix used by Lean."
:group 'lean
:type 'boolean)
(defcustom lean4-server-show-pending-tasks t
"Highlights pending tasks in the current buffer."
:group 'lean
:type 'boolean)
(defcustom lean4-server-check-mode 'visible-lines-and-above
"What parts of the open files the Lean server should check"
:group 'lean
:type 'symbol
:options '(nothing visible-lines visible-lines-and-above visible-files open-files))
(defcustom lean4-keybinding-std-exe1 (kbd "C-c C-x")
"Lean Keybinding for std-exe #1"
:group 'lean4-keybinding :type 'key-sequence)