[climacs-devel] paredit.lisp, regularization of motion commands, and more
Troels Henriksen
athas at sigkill.dk
Wed Jun 7 13:25:27 UTC 2006
Troels Henriksen <athas at sigkill.dk> writes:
> I like these ideas and have begun experimenting with them in my
> Climacs tree.
It works nicely so far, but I have run into a few issues that seem to
require refactoring of some parts of Climacs. Here is my analysis:
buffer.lisp implements the buffer protocol which is suitable for our
needs. It provides a basic interface to the buffer implementation and
has no concept of syntaxes, hence, higher-level facilities (indeed,
almost any directly user-oriented functionality) should be implemented
elsewhere.
base.lisp is built on top of the buffer protocol and currently
provides more high-level facilities, such as moving the mark by line,
word, and so forth. However, base.lisp does not have the concept of a
syntax either, meaning that functions such as FORWARD-WORD can not be
(simply) implemented based on what a given syntax considers a
word. Also, base.lisp is used be syntax.lisp to implement the syntax
facilities, so making base.lisp understand syntaxes would probably be
a bit of a kludge. Hence, I propose making base.lisp provide nothing
but simple facilities that are not dependent on subjective terms such
as "word", but instead rely on final definitions such as "line",
"buffer" and "object", all of which are cast in stone by the buffer
protocol. Well, almost. I believe that base.lisp should not export any
functions that move the mark or change the contents of the buffer, but
only functions that can be used to query marks and buffers for
information - for example END-OF-LINE-P, DO-BUFFER-REGION,
END-OF-BUFFER-P, etc. I suggest moving the functions that move the
mark to a file and package ("motion.lisp") that implements Taylor
Campbell's framework for defining motion functions, and which
understands the concept of a syntax, thereby permitting the
implementation of functions such as FORWARD-WORD to use the definition
of a word specified by a given syntax. The functions that modify the
buffer contents should be moved to a file and package ("editing.lisp")
that understands the concept of a syntax, like
motion.lisp. editing.lisp should probably be implemented using the
facilities defined in motion.lisp.
syntax.lisp will also require a bit of modification - the definitions
of the FORWARD-FOO functions should be moved to motion.lisp, and a
number of generic predicates (WORD-CONSTITUENT-P, WHITESPACEP, etc)
should be provided instead; a building block for implementing
syntax-aware motion- and editing-functions.
Any comments?
--
\ Troels "Athas" Henriksen
/\ - Insert witty signature
More information about the climacs-devel
mailing list