unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Ruijie Yu via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: Yuan Fu <casouri@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Scanning parenthesis in string/comment
Date: Mon, 23 Jan 2023 09:49:08 +0800	[thread overview]
Message-ID: <sdva62af247.fsf@fw.net.yu> (raw)
In-Reply-To: <497B6D44-1C2D-4C45-9B6B-6719D49B4A69@gmail.com>


Yuan Fu <casouri@gmail.com> writes:

> I’m writing an expand-region-like function, which expands region by logical entities, like word-at-point, list-at-point, etc. Say I have this string
>
> "Filter out invalid regions in REGIONS regarding ORIG.
> ORIG is the current position. Each region is (BEG . END).”
>
> And point is at the opening parenthesis, how do I detect this balanced
> parenthesis pair and expand the region over it? syntax-pass and forward-list
> only works with lists outside of strings and comments, IIUC.
>
> Yuan

Based on what I remember reading from the relevant info pages and
docstrings, is it possible that you start a new syntax scan that starts
*at point* and ends *before the ending quotes*?  IIUC the function
`parse-partial-sexp' might be what you should look into next.

Best,


RY



  reply	other threads:[~2023-01-23  1:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-22 17:15 Scanning parenthesis in string/comment Yuan Fu
2023-01-23  1:49 ` Ruijie Yu via Users list for the GNU Emacs text editor [this message]
2023-01-23 19:24   ` Yuan Fu
2023-01-23  8:10 ` Jean Louis

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=sdva62af247.fsf@fw.net.yu \
    --to=help-gnu-emacs@gnu.org \
    --cc=casouri@gmail.com \
    --cc=ruijie@netyu.xyz \
    /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).