texmacs-dev
[Top][All Lists]
Advanced

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

Patch (Re: [Texmacs-dev] Once again: automatic quoting)


From: Norbert Nemec
Subject: Patch (Re: [Texmacs-dev] Once again: automatic quoting)
Date: Sat, 15 Oct 2005 17:53:35 +0200
User-agent: Mozilla Thunderbird 1.0.7 (X11/20051013)

Hi there,

I finally sat down, chewed through documentation and managed to fix the
problem. See the attached patch against 1.0.5.10.

My impression: the TeXmacs code and documentation has improved greatly
since I last tried to hack something. However - Scheme still is one of
the most uncomfortable languages that I've worked on. No wonder TeXmacs
has such a little group of active contributors. :-(

Greetings,
Norbert



Joris van der Hoeven wrote:

>On Tue, Oct 11, 2005 at 10:33:41AM +0200, Norbert Nemec wrote:
>  
>
>>sorry to bring this up once again. I think, it exists as a bug-report
>>somewhere, but I'm not sure about it:
>>
>>In 1.0.5.10, the automatic quotes still use a bad algorithm that gets in
>>the way quite often: It works fine when typing down a whole paragraph,
>>but when you edit inside a paragraph later to add quotes, the algorithm
>>does bogus: it seems to check for the character at the end of the
>>paragraph instead of the actual cursor position.
>>
>>A better algorithm (I believe, this is, what is used in most
>>text-processors as well) would be to just check the one character
>>preceding the inserted quote. Is it one of (<whitespace>,
>><paragraph-beginning>, "(", "[", "{"), you should get opening quotes,
>>otherwise closing quotes.
>>
>>Furthermore, automatic quotes should be deactivated inside verbatim
>>environments and there should be a \" key-sequence to produce a regular
>>(ascii) quote.
>>
>>Sorry, I would have liked to send a patch for this, but when I tried, I
>>found that it would have needed more knowledge about the internals of
>>TeXmacs than I have at the moment.
>>    
>>
>
>If you are willing to hack a bit, then look at the routine close-quotes?
>in progs/utils/edit/auto-close.scm. The verbatim like stuff could be dealt
>with using contextual overloading, as explained in
>
>       Help -> Scheme extensions -> Overview of the scheme extension language
>       Section 5
>
>In the other sections, you will find most other things you might want
>to know in order to hack.
>
>I agree that more attention should be paid to the keyboard in verbatim mode
>(really prog mode, I think). Currently, there is still some confusion about
>different verbatim like tags, prog mode, verbatim language, etc.
>After all, maybe I should fix all that, when I will have time...
>
>Best wishes, Joris
>
>
>_______________________________________________
>Texmacs-dev mailing list
>address@hidden
>http://lists.gnu.org/mailman/listinfo/texmacs-dev
>
>
>  
>

diff -rN -u 
old-TeXmacs-1.0.5.10-static-gnu-linux/progs/utils/edit/auto-close.scm 
new-TeXmacs-1.0.5.10-static-gnu-linux/progs/utils/edit/auto-close.scm
--- old-TeXmacs-1.0.5.10-static-gnu-linux/progs/utils/edit/auto-close.scm       
2005-10-09 21:38:00.000000000 +0200
+++ new-TeXmacs-1.0.5.10-static-gnu-linux/progs/utils/edit/auto-close.scm       
2005-10-15 17:46:21.000000000 +0200
@@ -39,7 +39,17 @@
   (let* ((p (cursor-path))
         (t (tree->stree (path->tree (cDr p)))))
     (if (string? t)
-       (not (or (== t "") (string-ends? t " ")))
+       (and
+           (!= t "")
+           (!= (cAr p) 0)
+           (case (string-ref t (- (cAr p) 1))
+               ((#\space) #f)
+               ((#\() #f)
+               ((#\[) #f)
+               ((#\{) #f)
+               (else #t)
+           )
+       )
        (> (cAr p) 0))))
 
 (define (open-quotes lan)


reply via email to

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