unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: <tomas@tuxteam.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Finding and fixing the missing brackets for tcl script with Emacs.
Date: Thu, 14 Jan 2021 12:22:06 +0100	[thread overview]
Message-ID: <20210114112206.GB17831@tuxteam.de> (raw)
In-Reply-To: <CAGP6POKAig+mfwHTeBpX5F_5Z4K=WCqAkKEux9CzVex42AFW9w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1158 bytes --]

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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2021-01-14 11:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-14 10:30 Finding and fixing the missing brackets for tcl script with Emacs Hongyi Zhao
2021-01-14 11:22 ` tomas [this message]
2021-01-14 13:34   ` Hongyi Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210114112206.GB17831@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).