Skip to Content.
Sympa Menu

texmacs-users - Re: [TeXmacs] Capitalisation, exchange

Subject: mailing-list for TeXmacs Users

List archive

Re: [TeXmacs] Capitalisation, exchange


Chronological Thread 
  • From: Henri Lesourd <address@hidden>
  • To: Jeremy Henty <address@hidden>
  • Cc: address@hidden, address@hidden
  • Subject: Re: [TeXmacs] Capitalisation, exchange
  • Date: Thu, 20 Sep 2007 13:34:37 +0200

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




Archive powered by MHonArc 2.6.19.

Top of Page