Subject: mailing-list for TeXmacs Users
List archive
From : Benno Dielmann <address@hidden>- To: address@hidden
- Subject: Re: Double space after period?
- Date: Tue, 25 Feb 2003 19:25:58 +0100
| > OpenOffice.org Writer has a setting to have it ignore extra spacebar
| > presses -- when that's on, if you push space twice, only the first one
| > is input. Perhaps this is a good solution for TeXmacs as well, then
| > make shift-space (or whatever) insert the explicit extra space?
|
| You may use the following script in your my-init-texmacs.scm:
|
| ------------------------------------------------------------
| (define (string-space-at? s i) (== #\space (string-ref s i)))
| (define (tree-leaf? t) (== "" (tree-get-label t)))
| (define (tree-func? t s) (== s (tree-get-label t)))
| (define (near-space?/leaf t1 i)
| (let ((s (tree->object t1)))
| (or (and (< 0 i)
| (string-space-at? s (1- i)))
| (and (< i (string-length s))
| (string-space-at? s i)))))
|
| (define (near-space?/after p1)
| (and-let* ((t2 (tm-subtree (cDr p1)))
| ((tree-func? t2 "concat"))
| (i (cAr p1))
| ((< (1+ i) (tree-arity t2)))
| (next-t (tree-ref t2 (1+ i)))
| ((tree-leaf? next-t))
| ((string-space-at? (tree->string next-t) 0)))))
|
| (define (near-space?)
| (let* ((p (the-path))
| (p1 (cDr p))
| (i (cAr p))
| (t1 (tm-subtree p1)))
| (cond ((tree-leaf? t1) (near-space?/leaf t1 i))
| ((== i 1) (near-space?/after p1))
| (else #f))))
|
| (define (smart-space)
| (if (not (near-space?)) (insert-string " ")))
| (kbd-map in-text? ("space" (smart-space)))
| ------------------------------------------------------------
|
| Note: These scripts use the new syntax for keymap definition
| introduced in TeXmacs-1.0.1.4.
If I understood it correctly, this little script means to prevent more than
one successive spaces being entered. This would be very nice-to-have, so I
added it to my my-init-texmacs.scm. The result was not being able to enter
spaces any more, even after some letter (using the TeXmacs-1.0.1.6-1.i386.rpm
from the TeXmacs website)! Only Shift-Space works.
Is there anything I did wrong?
By the way, as it is the first time I post to this mailing list, let me
express my huge excitement about TeXmacs! Despite its name ;-), it's a
fantastic piece of software!.
Cheers,
Benno Dielmann.
- Re: Double space after period?, david, 02/24/2003
- Re: Double space after period?, Benno Dielmann, 02/25/2003
- Re: Double space after period?, david, 02/26/2003
- Re: Double space after period?, Benno Dielmann, 02/26/2003
- Re: Double space after period?, david, 02/26/2003
- Re: Double space after period?, Benno Dielmann, 02/27/2003
- Re: Double space after period?, david, 02/26/2003
- Re: Double space after period?, Benno Dielmann, 02/26/2003
- Re: Double space after period?, david, 02/26/2003
- Re: Double space after period?, Benno Dielmann, 02/25/2003
Archive powered by MHonArc 2.6.19.