emacs-devel
[Top][All Lists]
Advanced

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

Re: Insert character pairs


From: Johan Bockgård
Subject: Re: Insert character pairs
Date: Tue, 04 May 2004 17:57:21 +0200
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.2 (usg-unix-v)

Juri Linkov <address@hidden> writes:

> And while on this topic, another suggestion is to add a prefix
> argument to the command C-M-q (`indent-sexp') which currently has no
> prefix argument. This can be similar to M-q (`fill-paragraph') whose
> prefix argument adds a special meaning to justify paragraphs. C-M-q
> without prefix will work exactly as it currently works, but with a
> prefix will pretty-print the list after point. This is relevant only
> for emacs-lisp-mode and buffers in lisp-interaction-mode like the
> *scratch* buffer.

[...]

> +(defun indent-or-pp-sexp (&optional arg)
> +  "Indent each line of the list or, with argument, pretty-printify the list."
> +  (interactive "P")
> +  (if arg
> +      (let* (p (str (pp-to-string (save-excursion
> +                                    (prog1 (read (current-buffer))
                                                ^
But this would also lead to all comments being removed , right?

> +                                      (setq p (point)))))))
> +        (delete-region (point) p)
> +        (save-excursion (insert str)))
> +    (indent-sexp)))

-- 
Johan Bockgård





reply via email to

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