texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Texmacs-dev] Re: [TeXmacs] Capitalisation, exchange


From: Henri Lesourd
Subject: [Texmacs-dev] Re: [TeXmacs] Capitalisation, exchange
Date: Thu, 20 Sep 2007 13:34:37 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030821

Jeremy Henty wrote:

When using any editor other than emacs I really miss shortcuts for:
 * Uppercasing, lowercasing and capitalising words.
 * Exchanging adjacent letters/words.

Does TeXmacs (or any popular packages for it) do this?  If not, would
it be easy to write a package?  I'm an experienced programmer, but new
to TeXmacs internals.  If this would be a straightforward project I'd
like to give it a go, but tips would be welcome.

Yes, it should be easy. Have a look at :
http://lists.gnu.org/archive/html/texmacs-dev/2007-05/msg00091.html


For a basic example, as well as for a summarization of the TeXmacs
tree API. The only missing function in the message above is:
[[
(cursor-tree) -> TREE
]]

, which gives you the position of the cursor in a tree. Another
function you will need probably is a function to get the parent
of a tree :
[[
(define (tree-up1 t)
 (with p (tree->path t)
    (if (> (length p) 2)
        (path->tree (cDr p))
        #f)))
]]


As soon as you know that TeXmacs documents are internally
represented as trees, and that you can read the trees around
the position of the cursor, swapping the appropriate two
trees should be straightforward. You will also need to take
into account the particular case where you want to exchange
two words inside a leaf of the tree, thus you'll have to resort
to Scheme string processing routines for this.


Another important routine is :
[[
(go-to PATH) -> VOID
]]

To move the cursor at one particular position in the document.


Any other questions welcomed.

Best, Henri





reply via email to

[Prev in Thread] Current Thread [Next in Thread]