[climacs-devel] Some small patches
Rudi Schlatte
rudi at constantly.at
Wed Jan 5 12:23:41 UTC 2005
Hi,
Just to mingle with the cool kids, I've superficially browsed the
climacs code. I must say it was an enjoyable read, very clean and
with good naming and structure. I append some proposed fixes for
things that caught my eye; since I haven't even downloaded the code
locally, it's in the form of whole, modified functions, for which I
apologize.
Cheers, Rudi
1) buffer.lisp: buffer-sequence conses unnecessarily, since the length
of
the result vector is known; the following (untested) might be
better. As before, the case of offset1 > offset2 returns a
zero-length vector, but this is more apparent in the code now.
(defmethod buffer-sequence ((buffer standard-buffer) offset1 offset2)
;; untested, for illustration purposes only
(assert (<= 0 offset1 (size buffer)) ()
(make-condition 'no-such-offset :offset offset1))
(assert (<= 0 offset2 (size buffer)) ()
(make-condition 'no-such-offset :offset offset2))
(if (< offset1 offset2)
(let ((result (make-array (list (- offset2 offset1)))))
(loop for offset from offset1 below offset2
for i upfrom 0
do (setf (svref result i) (buffer-object buffer offset)))
result)
(make-array '(0))))
2) gui.lisp could use a method
(defmethod frame-standard-output ((frame climacs))
(get-frame-pane frame 'int))
(if the minibuffer is indeed the standard-output, of course), so that
the function display-message can display to *standard-output* instead
of *standard-input*.
3) Also, in gui.lisp, initialize-instance shouldn't unconditionally
clobber the syntax:
(defmethod initialize-instance :after ((pane climacs-pane) &rest args)
(declare (ignore args))
(with-slots (buffer point syntax mark) pane
(when (null point)
(setf point (make-instance 'standard-right-sticky-mark
:buffer buffer)))
(when (null mark)
(setf mark (make-instance 'standard-right-sticky-mark
:buffer buffer)))
(when (null syntax)
(setf syntax (make-instance 'texinfo-syntax :pane pane)))))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <https://mailman.common-lisp.net/pipermail/climacs-devel/attachments/20050105/0ab14a1a/attachment.sig>
More information about the climacs-devel
mailing list