all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: emacs-devel@gnu.org
Subject: Re: Emacs Lisp code formatting
Date: Sun, 07 Nov 2021 02:37:25 +0100	[thread overview]
Message-ID: <87zgqglp9m.fsf@web.de> (raw)
In-Reply-To: <87lf23o5qh.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 05 Nov 2021 00:34:14 +0100")

Lars Ingebrigtsen <larsi@gnus.org> writes:

> with `pp-emacs-lisp-code'.

Cool - thanks for that.

May I ask why something like (pp-emacs-lisp-code '(when t 1)) fails -
can you have a look please?  Seems there is a minor problem with edebug
spec inspection.

  (wrong-type-argument listp t)
  car(t)
  (consp (car edebug))
  (and (consp (car edebug)) (eq (car (car edebug)) '&rest))
  (if (and (consp (car edebug)) (eq (car (car edebug)) '&rest)) (pp--insert-binding (car-safe (prog1 sexp (setq sexp (cdr sexp))))) (if (null (car sexp)) (insert "()") (pp--insert-lisp (car sexp))) (car-safe (prog1 sexp (setq sexp (cdr sexp)))))
  (while (and (cl-plusp indent) sexp) (insert " ") (if (and (consp (car edebug)) (eq (car (car edebug)) '&rest)) (pp--insert-binding (car-safe (prog1 sexp (setq sexp (cdr sexp))))) (if (null (car sexp)) (insert "()") (pp--insert-lisp (car sexp))) (car-safe (prog1 sexp (setq sexp (cdr sexp))))) (car-safe (prog1 edebug (setq edebug (cdr edebug)))) (setq indent (1- indent)))
  pp--format-definition((t 1) 1 t)
  (if indent (pp--format-definition sexp indent edebug) (let ((prev 0)) (while sexp (let ((start (point))) (pp--insert (if (> prev 1) "\n" " ") (car-safe (prog1 sexp (setq sexp ...)))) (setq prev (count-lines start (point)))))))
  (let* ((sym (car sexp)) (edebug (get sym 'edebug-form-spec)) (indent (get sym 'lisp-indent-function)) (doc (get sym 'doc-string-elt))) (if (eq indent 'defun) (progn (setq indent 2))) (if doc (progn (setq indent (1- doc)))) (if (and (not indent) (eq sym 'closure)) (progn (setq indent 0))) (pp--insert "(" sym) (car-safe (prog1 sexp (setq sexp (cdr sexp)))) (if indent (pp--format-definition sexp indent edebug) (let ((prev 0)) (while sexp (let ((start (point))) (pp--insert (if (> prev 1) "\n" " ") (car-safe (prog1 sexp ...))) (setq prev (count-lines start (point))))))) (insert ")"))
  pp--format-function((when t 1))
  [...]

Thanks,

Michael.



  parent reply	other threads:[~2021-11-07  1:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-02 15:27 Emacs Lisp code formatting Lars Ingebrigtsen
2021-11-02 23:31 ` Campbell Barton
2021-11-03 23:59   ` Lars Ingebrigtsen
2021-11-04  0:31     ` Campbell Barton
2021-11-04  5:47       ` Lars Ingebrigtsen
2021-11-04  6:51         ` Campbell Barton
2021-11-04  8:39           ` Helmut Eller
2021-11-04 16:51           ` Lars Ingebrigtsen
2021-11-04 23:34 ` Lars Ingebrigtsen
2021-11-06 19:01   ` Juri Linkov
2021-11-06 21:34     ` Lars Ingebrigtsen
2021-11-07 17:27       ` Juri Linkov
2021-11-07 21:06         ` Lars Ingebrigtsen
2021-11-08  8:59           ` Juri Linkov
2021-11-08  9:06             ` Lars Ingebrigtsen
2021-11-07  1:37   ` Michael Heerdegen [this message]
2021-11-07  1:45     ` Lars Ingebrigtsen
2021-11-07  2:22       ` Michael Heerdegen
2021-11-07  2:47         ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zgqglp9m.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.