Emacs support
This commit is contained in:
parent
cbf4c267df
commit
d8be7aaeb2
1 changed files with 25 additions and 0 deletions
25
superfluous-parentheses.el
Normal file
25
superfluous-parentheses.el
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
;;; superfluous-parentheses --- Emacs support for [] and {} in lisp-mode
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
(defun superfluous-modify-font-lock-keywords (rule-table)
|
||||||
|
(dolist (rule rule-table)
|
||||||
|
(when (and (consp rule) (stringp (car rule)))
|
||||||
|
(when (string-prefix-p "(" (car rule))
|
||||||
|
(rplaca rule (concat "\\s(" (substring (car rule) 1)))))))
|
||||||
|
|
||||||
|
(add-hook! lisp-mode
|
||||||
|
(modify-syntax-entry ?\[ "(]" lisp-mode-syntax-table)
|
||||||
|
(modify-syntax-entry ?\] ")[" lisp-mode-syntax-table)
|
||||||
|
(modify-syntax-entry ?\{ "(}" lisp-mode-syntax-table)
|
||||||
|
(modify-syntax-entry ?\} "){" lisp-mode-syntax-table)
|
||||||
|
(superfluous-modify-font-lock-keywords lisp-cl-font-lock-keywords-1)
|
||||||
|
(superfluous-modify-font-lock-keywords lisp-cl-font-lock-keywords-2)
|
||||||
|
(superfluous-modify-font-lock-keywords lisp-cl-font-lock-keywords))
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
;; This package modifies the lisp-mode syntax table and font-lock keywords to
|
||||||
|
;; provide proper support for using square brackets and curly braces in Common
|
||||||
|
;; Lisp code, as per superfluous-parentheses.
|
||||||
|
|
||||||
|
(provide 'superfluous-parentheses)
|
||||||
|
;;; superfluous-parentheses.el ends here
|
Loading…
Reference in a new issue