* pretty-print sexps in Customize
@ 2007-12-08 19:04 Drew Adams
0 siblings, 0 replies; only message in thread
From: Drew Adams @ 2007-12-08 19:04 UTC (permalink / raw)
To: Emacs-Devel
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?
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-12-08 19:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-08 19:04 pretty-print sexps in Customize Drew Adams
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.