Deutsch   English   Français   Italiano  
<671109ba$0$709$14726298@news.sunsite.dk>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!3.eu.feeder.erje.net!feeder.erje.net!usenet.goja.nl.eu.org!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail
Date: Thu, 17 Oct 2024 08:57:30 -0400
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: VI* on VMS
Newsgroups: comp.os.vms
References: <87zfn4p2ul.fsf@lucy.meyer21c.net> <vep4bs$2cblv$1@dont-email.me>
 <vep554$26n$1@reader1.panix.com> <vep5j4$2cbm0$1@dont-email.me>
 <vep5m3$hal$1@reader1.panix.com> <67101c74$0$716$14726298@news.sunsite.dk>
 <vepeji$274a1$1@dont-email.me> <ver0dk$2ohfg$1@dont-email.me>
 <ver1c8$2ns6d$2@dont-email.me>
Content-Language: en-US
From: =?UTF-8?Q?Arne_Vajh=C3=B8j?= <arne@vajhoej.dk>
In-Reply-To: <ver1c8$2ns6d$2@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 179
Message-ID: <671109ba$0$709$14726298@news.sunsite.dk>
Organization: SunSITE.dk - Supporting Open source
NNTP-Posting-Host: 7d390e15.news.sunsite.dk
X-Trace: 1729169851 news.sunsite.dk 709 arne@vajhoej.dk/68.14.27.188:65229
X-Complaints-To: staff@sunsite.dk
Bytes: 6810

On 10/17/2024 8:53 AM, Arne Vajhøj wrote:
> On 10/17/2024 8:37 AM, Simon Clubley wrote:
>>> What is wrong with eve/tpu? or even LSE?
>>
>> However, when it comes to emacs, it does a _lot_ that EVE does not do.
>> For one simple but very important example, you have brace matching in
>> emacs so you can easily check the closing brace matches the correct
>> opening brace.
> 
> EVE does not have that out of the box.
> 
> But then EVE has relative little out of the box.
> 
> You can add it.
> 
> Either DIY or grab a copy of Kenneth Faitfield's
> EVE_MATCH_DELIMITORS.
> 
> I am afraid there are no online archive of INFO-TPU, but
> the most valuable pieces will have survived somewhere
> (I got the above).

Here it is.

Arne

!++
!   This procedure highlights (in BOLD, REVERSE video) matching pairs
!   of delimitors, the first of which is taken to be the character at
!   the current cursor position.  Highlighting is turned off by invoking
!   this procedure with the cursor positioned on a non-delimitor character.
!   Subsequent invocations turn off the highlighting on previously matched
!   pairs, as well.
!
!   This procedure uses the global marker variables khf$x_match1_position,
!   khf$x_match2_position, khf$x_match3_position, and khf$x_match4_position.
!
! Author/Date:          K.H. Fairfield,         16-Jan-1988
!
!--
Procedure Eve_Match_Delimitors
!         --------------------
Local saved_mark,       ! mark current position
       first_char,       ! first character of matching pair
       last_char,        ! second character of matching pair
       direction,        ! search direction
       n;                ! character position in khf$kt_left_delims or
                         ! khf$kt_right_delims string.


     On_Error
         [TPU$_CONTROLC]:
             Eve$Learn_Abort;
             Eve$$Restore_Position (saved_mark);
         [OTHERWISE]:
             Eve$$Restore_Position (saved_mark);
     Endon_Error;


     saved_mark := Mark (NONE);

!+
!  Make an early return here if the current position is the same
!  position as the last previously marked delimitor.
!-
     If khf$x_match1_position <> 0 Then
         If saved_mark = khf$x_match1_position Then

             khf$x_match1_position:= 0;
             khf$x_match2_position:= 0;
             khf$x_match3_position:= 0;
             khf$x_match4_position:= 0;
             Return (TRUE);

         Endif;
     Endif;

     first_char := CURRENT_CHARACTER;

     n := Index (khf$kt_left_delims, first_char);

     If n > 0 Then
         last_char := Substr (khf$kt_right_delims, n, 1);
         direction := FORWARD;
     Else
         n := Index (khf$kt_right_delims, first_char);

         If n > 0 Then
             last_char := Substr (khf$kt_left_delims, n, 1);
             direction := REVERSE;
         Else
!+
!  Current_Character was not a delimitor.  If highlighting is on, turn it
!  off, else issue an error message.
!-
             If khf$x_match1_position = 0 Then
                 Eve$message ("The current character, " + first_char +
                          ", is not a valid delimitor to match.");
             Endif;
             khf$x_match1_position:= 0;
             khf$x_match2_position:= 0;
             khf$x_match3_position:= 0;
             khf$x_match4_position:= 0;
             Return (FALSE);
         Endif;
     Endif;

     khf$x_match1_position:= Mark (BOLD);
     khf$x_match2_position:= Mark (REVERSE);

     If Khf_Find_Match (first_char, last_char, direction) = 1 Then
         khf$x_match3_position:= Mark (BOLD);
         khf$x_match4_position:= Mark (REVERSE);
         Update (CURRENT_WINDOW);
         Position (khf$x_match1_position);
         Return (TRUE);
     Else
         Position (khf$x_match1_position);
         khf$x_match1_position:= 0;
         khf$x_match2_position:= 0;
         khf$x_match3_position:= 0;
         khf$x_match4_position:= 0;
         Eve$message (" Could not find the matching " + last_char +
                  " character for the current character, " + first_char);
         Return (FALSE);
     Endif;


EndProcedure;           ! Eve_Match_Delimitors


!++
!   The following procedure does the actually search for the matching
!   delimitor character.  A recursive algorithm is used so that intervening
!   pairs of matched delimitors are not mistakenly selected as the match.
!
! Input Parameters:
!
!       first       the delimitor character whose mate is being sought
!
!       last        the matching delimitor character
!
!       direction   the direction to search.  If first_char is a right-
!                   delimitor, the search direction is FORWARD,
!                   otherwise it is REVERSE.
!
! Author/Date:          K.H. Fairfield,         16-Jan-1988
!-

Procedure Khf_Find_Match (first, last, direction)
!         --------------
Local this_patt, this_range;

     this_patt := first + last;
     Loop
         If direction = FORWARD Then
             Move_Horizontal (1);
         Else
             Move_Horizontal (-1);
         Endif;
         this_range := Search_Quietly (Any (this_patt), direction);
         If this_range <> 0
         Then
             Position (this_range);
         Else
             Return (0);
         Endif;
         If CURRENT_CHARACTER = last Then
             Return (1);
         Else
             If Khf_Find_Match (first, last, direction) = 0 Then
                 Return (0);
             Endif;
         Endif;
     Endloop;

========== REMAINDER OF ARTICLE TRUNCATED ==========