Allows [] and {} to be used in place of normal parentheses in Common Lisp code.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

25 lines
1.1 KiB

;;; 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