[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: window with text
- To: "Steve Casner" <Steve_Casner@qmgate.arc.nasa.gov>
- Subject: Re: window with text
- From: "Andre Koehorst" <Andre_Koehorst@riks.nl>
- Date: 30 Aug 1994 09:49:48 U
- Cc: "info-mcl" <info-mcl@cambridge.apple.com>
Reply to: RE>window with text
> i need a window with a vertical scroll bar that simply displays the
contents
> of a text file (no edits allowed). The window has to do text wrap at word
> boundaries. What's the best object to start with that minimizes the
> re-writing I'll have to do? fred-window (file interface included but no
word
> wrap)? text-edit-dialog-item (no file interface or scrollers)? If there's
a
> near solution in some archive I have missed, I'd certainly take that.
On the upgrade CD there is a file called fill-paragraph.lisp (#P"MCL 2.0.1
CD:User Contributed Code:Fred (editor) utilities:fill-paragraph.lisp") which
might help you. You'll get emacs-like paragraph filling for fred-windows.
Must be in the cambridge archives somewhere but i can't tell you where
because our company is not on the net (just connected to a mailserver that we
phone every half hour or so). Here is the header of the file:
;;; -*- Package: CL-USER -*-
;;; Fill paragraph (m-Q)
;;; Version 1/27/93
;;; Please report bugs and improvements to Carl Gay (cgay@cs.uoregon.edu).
;;; Feel free to do whatever you want with this code.
;;; Change Log:
;;; 1/25/93 Released to unsuspecting users. CGay
;;; 1/27/93 Removed use of #. which was blowing out during compile-file.
;;; The code in this file implements emacs-like text filling (a la m-Q)
;;;
;;; The main commands and their default key bindings are:
;;;
;;; ED-FILL-PARAGRAPH (m-Q) -
;;; Fill the "paragraph" surrounding the cursor. A paragraph is defined as
;;; the current Lisp comment, if the cursor is in a Lisp comment, or
;;; otherwise an attempt is made to heuristicate the text paragraph
;;; surrounding the cursor. See the function paragraph-bounds for more
;;; details. With a numeric arg, fills the region. If *fill-justification*
;;; is non-NIL this will do justification at the same time.
;;;
;;; ED-SET-FILL-COLUMN (c-X f) -
;;; Set the fill column to the current cursor column. With c-U, set it to
;;; *default-fill-column* (below). With a numeric argument, set it to that
;;; argument.
;;;
;;; ED-SET-FILL-PREFIX (c-X .) -
;;; Set *fill-prefix* to the text preceding the cursor on the current line.
;;; If the cursor is at the beginning of the line, cancel the fill prefix.
;;;
;;; ED-JUSTIFY-PARAGRAPH (c-X j) -
;;; Justify the current paragraph. Still has some major bugs, be ye
forewarned.
;;;
;;; *FILL-COLUMN* -
;;; A number specifying the column past which text should not extend.
;;;
;;; *DEFAULT-FILL-COLUMN* -
;;; The value of *fill-column* is restored from this when ed-set-fill-column
;;; is invoked with a c-U argument.
;;;
;;; *FILL-PREFIX* -
;;; A string, NIL or a function. The default is NIL. See
;;; lisp-comment-fill-prefix for an example of the kind of function
;;; required.
;;;
;;; *FILL-JUSTIFICATION* -
;;; Type of text justification to do. NIL (the default, meaning don't
;;; justify at all) or :LEFT, :RIGHT, :CENTER or :FULL, with the "obvious"
;;; meanings. :full seems to work well. I didn't test the others much, and
;;; thought about just deleting them...
;;;
;;; *AUTO-FILL-ENABLED* -
;;; Whether or not to automatically fill at the end of a line during normal
;;; typing. t, nil, or :lisp-comments. Mostly tested with :lisp-comments.
;;;
;;; *FILL-SENTENCE-DELIMITERS* -
;;; A list of characters after which two spaces (instead of one) should be
;;; inserted. The default is '(#\. #\? #\!). Some people may want to add
;;; colon (:) to this list.
;;;
;;; To do:
;;; - Make justify-paragraph undoable.
;;; - If an error occurs during fill, restore buffer to original state (Undo)
;;; when the user aborts.
;;; - Make deletion of empty comment lines, e.g. ";;; <CR>", optional. This
;;; could probably be done best by modifying fill-prefix-region-bounds.
Default to no
;;; deletion.
;;; - Make regularizing the spacing between words optional.
;;; - Make fill redoable.
;;; - Allow filling at other chars besides whitespace (e.g., at hyphens)
;;;
;;; Bugs:
;;; - Justification code is still screwy. :center justification in
;;; particular. If invoked on the same paragraph several times in a row the
;;; paragraph keeps moving to the right. :-) Low priority. Who's gonna use
;;; this anyway?
;;; - Doesn't always deal with fonts correctly. (see calls to buffer-insert)
;;; - Probably lots of others I can't remember right now.
;;; - Some of the global vars should be on a per-buffer basis. e.g., buffer
;;; properties. In particular *auto-fill-enabled*.
;;; Search for +++ to find things that need fixing.