From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ruijie Yu via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Re: Scanning parenthesis in string/comment Date: Mon, 23 Jan 2023 09:49:08 +0800 Message-ID: References: <497B6D44-1C2D-4C45-9B6B-6719D49B4A69@gmail.com> Reply-To: Ruijie Yu Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10419"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.8.13; emacs 29.0.60 Cc: help-gnu-emacs@gnu.org To: Yuan Fu Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 23 02:54:27 2023 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pJm2V-0002bV-7n for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 23 Jan 2023 02:54:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pJm1l-0001AP-3Q; Sun, 22 Jan 2023 20:53:41 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJm1j-0001A9-41 for help-gnu-emacs@gnu.org; Sun, 22 Jan 2023 20:53:39 -0500 Original-Received: from netyu.xyz ([152.44.41.246] helo=mail.netyu.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJm1h-0006OF-Fz for help-gnu-emacs@gnu.org; Sun, 22 Jan 2023 20:53:38 -0500 Original-Received: from fw.net.yu.netyu.xyz ( [223.94.109.149]) by netyu.xyz (OpenSMTPD) with ESMTPSA id 0779ec3a (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 23 Jan 2023 01:53:29 +0000 (UTC) In-reply-to: <497B6D44-1C2D-4C45-9B6B-6719D49B4A69@gmail.com> Received-SPF: pass client-ip=152.44.41.246; envelope-from=ruijie@netyu.xyz; helo=mail.netyu.xyz X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FROM_SUSPICIOUS_NTLD=0.499, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:142507 Archived-At: Yuan Fu writes: > I=E2=80=99m writing an expand-region-like function, which expands region = by logical entities, like word-at-point, list-at-point, etc. Say I have thi= s string > > "Filter out invalid regions in REGIONS regarding ORIG. > ORIG is the current position. Each region is (BEG . END).=E2=80=9D > > 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-l= ist > 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