This section contains a few customizations I have in my .emacs/init.el file related to FSet
and Misc-Extensions. I have been using these with Emacs 30.0.50, but they’re unlikely to be
version-sensitive. Use whichever ones you like.
For FSet:
;;; Don't indent these like `with-open-file' even though they begin with `with'.
(put 'with-default 'common-lisp-indent-function '(nil nil))
(put 'without-default 'common-lisp-indent-function '(nil nil))
;;; Treat `@' as a symbol. (See The @ Macro.)
(modify-syntax-entry ?\@ "_" lisp-mode-syntax-table)
For Misc-Extensions:
(put 'deflex 'common-lisp-indent-function '(4 4 2))
(put 'deflex-reinit 'common-lisp-indent-function '(4 4 2))
(put 'rlabels 'common-lisp-indent-function '(4 &rest (&whole 2 (&whole 4 &rest 1) &body)))
;;; `define-class' needs some code support along with its indent info.
;;; We put the slots at 2 because there might be a doc string in that position.
(put 'define-class 'common-lisp-indent-function
'(6 (&whole 4 &rest 1) &rest (&whole 2 &rest (&whole 1 &rest 2))))
;;; This fixes the face of doc strings in `define-class'.
(defun lisp-string-after-doc-keyword-p (listbeg startpos)
"Return non-nil if `:documentation' symbol ends at STARTPOS inside a list.
`:doc' can also be used.
LISTBEG is the position of the start of the innermost list
containing STARTPOS."
(and listbeg ; We are inside a Lisp form.
(or (save-excursion
(goto-char startpos)
(ignore-errors
(progn (backward-sexp 1)
(looking-at ":documentation\\_>\\|:doc\\_>"))))
;; Detects a class doc string in `define-class/model'.
(save-excursion
(goto-char listbeg)
(forward-char)
(looking-at "define-class"))
;; Detects doc strings in `define-class/model' slot options.
(save-excursion
(goto-char listbeg)
(ignore-errors
(backward-up-list)
(backward-sexp)
(if (looking-at "\"")
(backward-sexp 3)
(backward-sexp 2))
(looking-at "define-class"))))))