help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Finding and fixing the missing brackets for tcl script with Emacs.


From: tomas
Subject: Re: Finding and fixing the missing brackets for tcl script with Emacs.
Date: Thu, 14 Jan 2021 12:22:06 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Jan 14, 2021 at 06:30:20PM +0800, Hongyi Zhao wrote:
> See the following TCL script snippet:
> 
> ---
> set sendcmds [lmap l [split [string trim $sendcmds] \n] {
> if {[regexp {^\s*#} $l} continue
> string trim $l
> }]
> ---
> 
> In the above code snippets, two close brackets are missed. But finding
> and fixing this sort of error manually is indeed a tedious and
> laborious job. Can Emacs help me find the right spot and fix the
> problem quickly for this scenario?

I'm assuming you use Tcl mode.

I don't know what kind of help you expect. There are several
possibilities. Among them, I use paren minor mode (enable it
with M-x "show-paren-mode"), which highlights matching parens
and shows you another colour when there is a mismatch.

This can't be perfect, especially in a language like Tcl (I
don't know whether paren-mode "sees through comments", as
the Tcl parser does -- an uncommon choice :)

There is a whole section in the Emacs manual dedicated to
this:

  "26.4.3 Matching Parentheses"

or, on the Internet

  https://www.gnu.org/software/emacs/manual/html_node/emacs/Matching.html

Cheers
 - t

Attachment: signature.asc
Description: Digital signature


reply via email to

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