Skip to Content.
Sympa Menu

texmacs-users - Re: [TeXmacs] Space vs enter

Subject: mailing-list for TeXmacs Users

List archive

Re: [TeXmacs] Space vs enter


Chronological Thread 
  • From: Henri Lesourd <address@hidden>
  • To: Bas Spitters <address@hidden>
  • Cc: address@hidden, Joris van der Hoeven <address@hidden>
  • Subject: Re: [TeXmacs] Space vs enter
  • Date: Wed, 25 Oct 2006 17:14:33 +0200

Bas Spitters wrote:

On Monday 23 October 2006 09:47, Joris van der Hoeven wrote:

On Mon, Oct 23, 2006 at 09:26:51AM +0200, Bas Spitters wrote:

On Sunday 22 October 2006 23:15, Joris van der Hoeven wrote:

On Sun, Oct 22, 2006 at 10:35:00AM +0200, spitters wrote:

I often find myself typing \forall<space> instead of \forall<enter>.
Would it be possible to make texmacs recognize the first variant too?
I.e. to activate a command by <space> too, not only by <enter>.

Well, the *-kbd.scm files. You may also do a grep for "space" and/or
"return".


I now have:
(kbd-map
("space" (if (inside? 'hybrid) (kbd-return) (insert " ")))
)

in my-init-texmacs.scm
Which does what I want!

However, I had to manually remove:
("space" " ")
From:
/usr/share/texmacs/TeXmacs/progs/math/math-kbd.scm
and
/usr/share/texmacs/TeXmacs/progs/generic/generic-kbd.scm

Which I think is strange. Shouldn't the user defined keyboard maps override the system wide ones?


This is a long lasting-problem, for which a standard solution
has probably been implemented now (I don't remember exactly
what it is, but it has been discussed on the mailing list some
months ago).


Another possible solution is to insert the following
hacky chunk of code into your my-init-texmacs.scm :
<<
; Permanent key mappings
(define-public kbd-map-old kbd-map)
(define kbd-map-looping #f)
(define-public-macro (kbd-map . l)
`(begin
(kbd-map-old . ,l)
(if (not kbd-map-looping)
(begin
(set! kbd-map-looping #t)
(always-key-mappings)
(set! kbd-map-looping #f)))))

(define (always-key-mappings) (lambda () #t))
(define always-key-mappings0 always-key-mappings)

(define keyboard-extend-forever-nb 0)
(define-macro (keyboard-extend-forever . body)
(define akm0 "")
(define akm1 "")
(set! akm0 (string->symbol (string-append "always-key-mappings"
(number->string keyboard-extend-forever-nb))))
(set! keyboard-extend-forever-nb (+ keyboard-extend-forever-nb 1))
(set! akm1 (string->symbol (string-append "always-key-mappings"
(number->string keyboard-extend-forever-nb))))
`(begin
(define-public (,akm1)
,(cons 'kbd-map body)
(,akm0))
(set! always-key-mappings ,akm1)))
>>

, and then you can use :
<<
(keyboard-extend-forever
("z" (display "Hello\n"))
......................................
(<KEY> <ACTION>)
..................................
)
>>

, whether it is in your my-init-texmacs.scm or elsewhere.


Best, Henri




Archive powered by MHonArc 2.6.19.

Top of Page