[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Texmacs-dev] Some additions
From: |
Nix N. Nix |
Subject: |
[Texmacs-dev] Some additions |
Date: |
08 Apr 2003 11:51:44 -0600 |
Hi!
Over the past 3 weeks, while you guys were busy, I was brooding over a
few things. Now, since you seem to be back in the swing of all things
TeXmacs, I'd like to see what you think of them. For example:
I)
(kbd-map in-math?
("C-_" (make-below))
("C-^" (make-above))
("M-A-~" (make-wide-under "~"))
("M-A-^" (make-wide-under "^"))
("M-A-B" (make-wide-under "<bar>"))
("M-A-V" (make-wide-under "<vect>"))
("M-A-C" (make-wide-under "<check>"))
("M-A-U" (make-wide-under "<breve>"))
("M-A-'" (make-wide-under "<acute>"))
("M-A-`" (make-wide-under "<grave>"))
("M-A-." (make-wide-under "<dot>"))
("M-A-\"" (make-wide-under "<ddot>")))
Would there be any major problems adding these keyboard bindings ? For
the longest time there has been a lack of symmetry between make-wide
bindings and make-wide-under bindings. I use both, so this would really
help. I currently have these in my my-init-texmacs.scm, but I don't see
why these couldn't be added to kbd-math.scm . I don't know how to use
all those wildcards you have created for the various bindings (like
"math" and "math:greek" and "table" and the likes), so I don't really
know how to make a patch of it.
II)
(define (make-brackets left right)
(if (selection-active-normal?)
(begin (cut "primary") (make-large-left left) (paste "primary")
(let* ((pos (tm-position-new)) (old (tm-position-get pos)))
(make-large-right right)
(tm-go-to old)
(tm-position-delete pos)))
(begin (make-large-left left)
(let* ((pos (tm-position-new)) (old (tm-position-get pos)))
(make-large-right right)
(tm-go-to old)
(tm-position-delete pos)))))
This is a hack. It allows one to create matching brackets. My impetus
for doing this is that when you write, say |a/b| by doing:
A-| A-f a <down> b A-|
followed by a conversion to LaTeX, the absolute value bars do not get
stretched. Why ? Because they do not form a matching \left| \right|
pair. Instead, they are just stand-alone large delimiters. My code
above would make sure that this never happens. However, it /is/ a hack,
and here are the problems with it:
- Programmatically placing the cursor between the brackets only works if
this code is executed when the cursor is inside a (concat ...), i.e.,
M-F2 $ (make-brackets "(" ")")
doesn't place the cursor between the brackets, whereas
M-F2 $ a (make-brackets "(" ")")
does.
- Cutting to primary is a hack. I was unable to find Scheme that deals
with manipulations of selections, other than the cut and paste
function. I have talked to David about this (see our thread from
around 2003-03-23). He said we could probably create some selection
accessors.
There is at least one person who was really happy to see this hack
(Álvaro Tejero Cantero). See his message from 2003-03-21.
Also, (make-brackets ...) would be a perfect candidate for additional
useful keyboard bindings:
(kbd-map in-math?
("C-(" (make-brackets "(" ")"))
("C-)" (make-brackets "(" ")"))
("C-[" (make-brackets "[" "]"))
("C-]" (make-brackets "[" "]"))
("C-{" (make-brackets "{" "}"))
("C-}" (make-brackets "{" "}"))
("C-<" (make-brackets "langle" "rangle"))
("C->" (make-brackets "langle" "rangle"))
("C-|" (make-brackets "|" "|"))
("C-:" (make-brackets "||" "||"))
("M-C->" (make-brackets "|" "rangle")) ;; "ket"
("M-C-<" (make-brackets "langle" "|")) ;; "bra"
I also have a question:
How can I override existing keyboard bindings ? In earlier versions of
TeXmacs, I could define a keyboard binding in my-init-texmacs.scm that
was the same as the one for, say, (make-expand-arg "matrix"), and mine
would override it with some other function. This no longer works. Is
there something special I have to do in order to overwrite keyboard
bindings ?
Thank you for your attention. I will go grab TeXmacs 1.0.1.9 now.
- [Texmacs-dev] Some additions,
Nix N. Nix <=