这样的高亮插件Emacs下有么?

最近在写 Common Lisp, 也被太多的括号困扰,发现了你写的这段脚本,非常符合需求,不过高亮的段太多了,简单做了下修改,只高亮光标所在的括号,提升了阅读代码的效率

(defun highlight-blocks--get-bounds ()
  "Get the bounds of the nested blocks the point is in.
The returned value is a list of conses, where car is the start of a
block and cdr is the end of a block, starting from the outermost
block."
  (let ((result '())
        (parse-sexp-ignore-comments t))
    (condition-case nil
        (let* ((parse-state (syntax-ppss))
               (starting-pos (if (or (nth 3 parse-state)
                                     (nth 4 parse-state))
                                 (nth 8 parse-state)
                               (point)))
               (begins (nreverse (nth 9 parse-state)))
               (end starting-pos)
               (i 0))
          (while (or (eq highlight-blocks-max-innermost-block-count t)
                     (< i highlight-blocks-max-innermost-block-count))
            (setq end (scan-lists end 1 1))
            (push (cons (pop begins) end) result)
            (setq i (1+ i))))
      (scan-error))
;; 修改下这个函数函数的返回值,可以只高亮当前所在的块
    (last result)))

3 个赞