unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* long lines of lisp code
@ 2004-02-27 12:01 Joe Corneli
  2004-02-27 12:25 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Corneli @ 2004-02-27 12:01 UTC (permalink / raw)


OK, here is a doozy of a question.  I am working with some lisp code
that wasn't written by me, and it has lots of long lines that run
off the page.  Is there a function that will adjust the text so that
the lines are all 85 characters or less long and that will preserve
the meaning of the code (including comments) and follow lisp
indentation?  It sounds like a pretty demanding request, but I
thought I might as well put the question out there.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: long lines of lisp code
  2004-02-27 12:01 long lines of lisp code Joe Corneli
@ 2004-02-27 12:25 ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2004-02-27 12:25 UTC (permalink / raw)


> From: Joe Corneli <jcorneli@math.utexas.edu>
> Date: Fri, 27 Feb 2004 06:01:41 -0600
> 
> OK, here is a doozy of a question.  I am working with some lisp code
> that wasn't written by me, and it has lots of long lines that run
> off the page.  Is there a function that will adjust the text so that
> the lines are all 85 characters or less long and that will preserve
> the meaning of the code (including comments) and follow lisp
> indentation?

Move the cursor somewhere inside that code block and type "M-q".  Did
that do what you wanted?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: long lines of lisp code
       [not found] <200402271238.i1RCcN118280@dell3.ma.utexas.edu>
@ 2004-02-27 18:50 ` Joe Corneli
  0 siblings, 0 replies; 3+ messages in thread
From: Joe Corneli @ 2004-02-27 18:50 UTC (permalink / raw)


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*.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-02-27 18:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-27 12:01 long lines of lisp code Joe Corneli
2004-02-27 12:25 ` Eli Zaretskii
     [not found] <200402271238.i1RCcN118280@dell3.ma.utexas.edu>
2004-02-27 18:50 ` Joe Corneli

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).