unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "Emacs-Devel" <emacs-devel@gnu.org>
Subject: pretty-print sexps in Customize
Date: Sat, 8 Dec 2007 11:04:54 -0800	[thread overview]
Message-ID: <DHEEKFAFJEFOJHLCFPFDEELHCCAA.drew.adams@oracle.com> (raw)

I don't have the time or knowledge to work on this, but if someone else
does, it could be useful: Use pretty-printing for an input-field sexp in
Customize.

For example, I see things like this, which is not very readable or conducive
to editing:

imenu-tree-window-function: Hide Value (lambda (trbuf buf)
(delete-other-windows) (let* ((w1 (selected-window)) (w2 (split-window w1
imenu-tree-window-width t))) (set-window-buffer w1 trbuf) (set-window-buffer
w2 buf) (other-window 1)))
   State: this option is unchanged from its standard setting.

It would be nice to (at least be able to) see this instead:

imenu-tree-window-function: Hide Value

(lambda (trbuf buf)
  (delete-other-windows)
  (let* ((w1 (selected-window))
         (w2 (split-window w1 imenu-tree-window-width t)))
    (set-window-buffer w1 trbuf)
    (set-window-buffer w2 buf)
    (other-window 1)))

   State: this option is unchanged from its standard setting.

This might mean a change to the widget code, not just to the customize code;
I don't know. Perhaps it would mean creating a new widget type, `pp-sexp',
which would be like `sexp' but pretty-printed? Or perhaps type `sexp' should
always be pretty-printed? Perhaps we would need a new widget :format spec,
like %v, but which pretty-prints?

Another possibility would be to let users themselves use `C-M-q' to
pretty-print a Lisp sexp field. We could perhaps provide other Emacs-Lisp
mode features (e.g. TAB indenting, highlight matching parens) as well within
a sexp editable field - it's much easier to edit Lisp when you have such
tools available.

Yes, you can always copy the value to *scratch* or some Emacs-Lisp buffer
and edit it there, then copy it back. But it would be better if you could
just edit it locally, or at least see it pretty-printed. There's not much
sense in showing a complex Lisp sexp without pretty-printing it.

Another possibility would be to show a link instead of the sexp, when the
sexp is more than, say, 30 chars long. When you followed the link, you would
access the sexp for editing in an Emacs-Lisp buffer. Some key sequence (e.g.
`C-c') in that buffer would copy the edited sexp back to the Customize
field. This might be the easiest approach - use a pop-up editing buffer when
the sexp is non-trivial.

Better: instead of adding a link, just let the `Show Value' button pop up
the Emacs-Lisp buffer for editing.

I don't know widgets, so I'm not sure what's really practicable in terms of
widget UI or what would be needed in terms of implementation, but I think
pretty-printing, at least, would improve Customize interaction considerably
for Lisp sexp fields.

Anyone have any ideas along these lines? Anyone want to work on it?

                 reply	other threads:[~2007-12-08 19:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=DHEEKFAFJEFOJHLCFPFDEELHCCAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).