Skip to Content.
Sympa Menu

texmacs-users - Re: integration with RCS/regexp procedures?

Subject: mailing-list for TeXmacs Users

List archive

Re: integration with RCS/regexp procedures?


Chronological Thread 
  • From: address@hidden
  • To: Daniel Andor <address@hidden>
  • Cc: address@hidden
  • Subject: Re: integration with RCS/regexp procedures?
  • Date: Wed, 19 Feb 2003 00:51:30 +0100

On Thu, Feb 13, 2003 at 12:40:26PM +0000, Daniel Andor wrote:
> Hi,
>
> I've searched the list but find no mention of this topic, so here goes.
>
> I'm trying to implement a rudimentary integration with RCS, so I can
> version
> control my texmacs documents. This involves adding a few menu points to do
> check-in/out etc, and some way of storing the $Id$ etc variables in the
> text
> file, which I like to see in my documents.

That is a completely great idea!

Sadly, there is a long way to go before this can work satifactorily.


> Has anyone worked on integrating RCS/CVS before?

No, AFAIK.


> So I have a few related questions:
>
> 1) Emacs has a nice way of opening a small multi-line buffer for you to
> type
> your log text into. Is there a way to do this in texmacs?

You could draw inspiration from that home-made hack of mine:

(define second cadr)
(define (get-all-buffer-names)
(map (lambda (x) (second (second x))) buffer-menu))
(define (buffer-exists? name)
(in? name (get-all-buffer-names)))
(define (my-new-buffer name . opt)
(new-buffer)
(set-name-buffer name)
(if (in? ':verbatim opt) (init-env "language" "verbatim")))
(define (switch-to-buffer-new name . opt)
(if (buffer-exists? name)
(switch-to-buffer name)
(apply my-new-buffer (cons name opt))))
(define (vc-get-log proc)
(switch-to-buffer-new "*vc log*")
(set! log-edit-callback proc))
(define (in-vc-log?) (== (get-name-buffer) "*vc log*"))
(define log-edit-callback #f)
(define (log-edit-done)
(let ((proc log-edit-callback)
(text (tree->verbatim (the-buffer))))
(set! log-edit-callback #f)
(kill-buffer)
(if proc (proc text))))
(kbd-map in-vc-log?
("C-c C-c" (log-edit-done)))

Be aware that the scripting layer of TeXmacs is currently under
reorganization. So it may become easier to do that in the future. Also
this code may not work in future releases.


> 2) I need to shell escape the log text argument. To do this I wanted to use
> the (regexp-substitute/global ...) procdeures from guile, but they don't
> seem
> to exist in texmacs! OTOH, (make-regexp ..) does work, so I don't
> understand. Which guile procedures are or aren't available, in general?

In general, anything should work. Please be more specific.


> 3) My idea was to use a variable to store the $Id$ tag, and then this
> variable
> can be accessed at other points in the document. I use (make-assign
> "RCSID"
> "$Id$") to insert the assignment into the document when you click on the
> appropriate menu item.

A very useful and little used (undocumented?) feature is the initial
environment. That is the collection of metadata (they do not appear on
screen) which is used to remember things like the language and the
preamble mode of a document.

It is stored in the <initial>/<collection> thingy at the end of the
document on disk. It can be modified with

init-env: string var, string val -> nil

and accessed with

get-init-env: string var -> string

and also a few related low-level primitives working on trees.

From inside the document, the initial environment values are accessed
like any other variable.


> But there isn't a (make-value ...), so I'm using
> (make-active "value" 1) and then (insert-string "RCSID") to insert that in.
>
> Is this the correct way? I couldn't find any documentation.

When you want to insert stuff, the do-anything function is

insert-object: list obj -> nil

and its relative, insert-object-go-to (you may grep the distribution
for examples).

In your case you may do: (insert-object '(value "RCSID"))


> 4) The $Id$ tag can grow quite long, and it needs to be on a single line
> for
> RCS to recognise it correctly. So I need to prevent the possibility of line
> breaks in the source file, which texmacs automatically adds when saving. Is
> there a way to keep a chunk of text on one line? I was thinking verbatim,
> in
> which case how do I add a verbatim tag? (make-active "verbatim" ...)?

Verbatim has nothing to do with how the document is written to disk.
Actually I do not think there is any way to prevent line breaking in
texmacs file format.

I suggest you use more specific RCS tags instead.

PS: such a technical discussion should rather be in texmacs-dev. Joris
want texmacs-users to stay reasonably low-traffic and focused on
general interest discussions.

--
David Allouche | GNU TeXmacs -- Writing is a pleasure
Free software engineer | http://www.texmacs.org
http://ddaa.net | http://alqua.com/tmresources
address@hidden | address@hidden
TeXmacs is NOT a LaTeX front-end and is unrelated to emacs.



Archive powered by MHonArc 2.6.19.

Top of Page