emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master 2f181d60323 3/6: pp.el (pp-fill): New default pp function


From: Michael Heerdegen
Subject: Re: master 2f181d60323 3/6: pp.el (pp-fill): New default pp function
Date: Fri, 14 Jul 2023 05:31:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Stefan Monnier via Mailing list for Emacs changes <emacs-diffs@gnu.org>
writes:

> branch: master
> commit 2f181d60323bd9e0196775828de633100479f4c2
> Author: Stefan Monnier <monnier@iro.umontreal.ca>
> Commit: Stefan Monnier <monnier@iro.umontreal.ca>
>
>     pp.el (pp-fill): New default pp function
> [...]
> +            (when (and paired (not (eq ?\" (char-after paired))))
> +              ;; The sexp has sub-parts, so let's try and spread
> +              ;; them over several lines.
> +              (save-excursion
> +                (goto-char beg)
> +                (when (looking-at "(\\([^][()\" \t\n;']+\\)")
> +                  ;; Inside an expression of the form (SYM ARG1
> +                  ;; ARG2 ... ARGn) where SYM has a `lisp-indent-function'
> +                  ;; property that's a number, insert a newline after
> +                  ;; the corresponding ARGi, because it tends to lead to
> +                  ;; more natural and less indented code.
> +                  (let* ((sym (intern-soft (match-string 1)))
> +                         (lif (and sym (get sym 'lisp-indent-function))))
> +                    (if (eq lif 'defun) (setq lif 2))
> +                    (when (natnump lif)
> +                      (goto-char (match-end 0))
> +                      (forward-sexp lif)

I only want to give the hint that this `forward-sexp' in the last line
will error when the programmer has, e.g., commented out the body of a
lambda expression.  Or the user wants to fill automatically created code
that looks like that, for whatever reason.

Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]