help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: long lines of lisp code


From: Joe Corneli
Subject: Re: long lines of lisp code
Date: Fri, 27 Feb 2004 12:50:23 -0600

Well the reason I was resisting using M-q is that it has to be done
intelligently to avoid messing up formatting of comments (it does
"preserve comments", so it matches the specifications I sent).  

Here is an example that clarifies what I'm actually looking
for. Here is a long comment (this is GPL code from the KM lisp
package):

;;; May 2001 - revise this: (undo <checkpoint-id>) will undo right back to 
<checkpoint-id> (if it exists)
;;; Returns NIL if no undo possible, <checkpoint-id> if so.
;;; If checkpoint-id = nil, then just undo to the last checkpoint.
;;; [1] When called from a program, need to do this. When called from KM> 
prompt, this is done automatically anyway
;;;     by (reset-inference-engine)
;;; [2] With *internal-logging*, the done flags ARE on the history trace and so 
undo0 will undo them. This is better
;;;     than undoing absolutely everything.


Pressing M-q in the first line results in this:

;;; May 2001 - revise this: (undo <checkpoint-id>) will undo right
;;; back to <checkpoint-id> (if it exists) Returns NIL if no undo
;;; possible, <checkpoint-id> if so.  If checkpoint-id = nil, then
;;; just undo to the last checkpoint.  [1] When called from a
;;; program, need to do this. When called from KM> prompt, this is
;;; done automatically anyway by (reset-inference-engine) [2] With
;;; *internal-logging*, the done flags ARE on the history trace and
;;; so undo0 will undo them. This is better than undoing absolutely
;;; everything.

This is the sort of formatting I was able to come up with working
"by program".

On the other hand, if I press M-q in the line following the line
that contains the [1], then in the line following the line that
contains the [2], then introducing a gap between the line that
contains `undo to the last checkpoint' and the line that contains
the [1] and pressing M-q somewhere in the first block of code,
results in this:

;;; May 2001 - revise this: (undo <checkpoint-id>) will undo right
;;; back to <checkpoint-id> (if it exists) Returns NIL if no undo
;;; possible, <checkpoint-id> if so.  If checkpoint-id = nil, then
;;; just undo to the last checkpoint.
;;; [1] When called from a program, need to do this. When called
;;;     from KM> prompt, this is done automatically anyway by
;;;     (reset-inference-engine)
;;; [2] With *internal-logging*, the done flags ARE on the history
;;;     trace and so undo0 will undo them. This is better than
;;;     undoing absolutely everything.

This looks so much better than the first attempt above, I wonder if
such beautiful formatting could ever be done automatically by a
computer *satirical grin*.




reply via email to

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