From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thibaut Verron Newsgroups: gmane.emacs.help Subject: Re: How to make `forward-sexp` handle other balanced character-pairs such as < and > or << and >> in erlang-mode or others? Date: Mon, 27 Sep 2021 23:14:30 +0200 Message-ID: References: Reply-To: thibaut.verron@gmail.com 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="30559"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: Pierre Rouleau Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 27 23:15:50 2021 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 1mUxyW-0007oI-Le for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 27 Sep 2021 23:15:48 +0200 Original-Received: from localhost ([::1]:36900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mUxyU-0004Pm-NM for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 27 Sep 2021 17:15:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUxxU-0004NS-Qy for help-gnu-emacs@gnu.org; Mon, 27 Sep 2021 17:14:44 -0400 Original-Received: from mail-yb1-xb2a.google.com ([2607:f8b0:4864:20::b2a]:39446) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mUxxT-0003pT-DO for help-gnu-emacs@gnu.org; Mon, 27 Sep 2021 17:14:44 -0400 Original-Received: by mail-yb1-xb2a.google.com with SMTP id 71so1163791ybe.6 for ; Mon, 27 Sep 2021 14:14:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=IlLP8R0R2eU9AdHijhbgVujFNsJl4vzblMzl8ZC05wo=; b=aQU1o2/f0mFZ38XEwrocqF+G2V73LxWY++biCz7KAPgMqN2hlYIE8wZ3EdZ8JIBVv/ 6uKONahWiRjnEGmKJJ/IpxKL3+KSo0Jkpx+I4tgER0ZDBOCkH4jEUl1EPc2m9VRw5of1 aFbrcHosmXN+cWvqWPHwpLH1pbXRqPh82igmZ29y2rHxXToj8T0RMjX8Gc66P21Xof4c yYnYTw+abzmQsVXQ+Cj+HFylbrLixPMMsbIlEfOnyo+zqFTCY+AtnDE1xCPtnHmH89kU Ug7qCYcdD9bHrNvEhDDt9qfAnldgrxOy58iCJbLSMD5Y0GVloiwXaIQC/XwmKQrcbxqu BpAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=IlLP8R0R2eU9AdHijhbgVujFNsJl4vzblMzl8ZC05wo=; b=gpO+aQtugnyOlK57aKhfT/7plOYJrh2WZZSmBmjfo4v6NjQQdC5Hw57XLS9bGKZH/1 5FHvWo9wYWUM7zx7eGbgI5OKkzTZ5RQmPxUPn1CVgldVwn735LAJ3CU1hOyJJehRn9n6 4foCNrc9aVdrGsCOXm62dhSLnoKNsMw7Xl0BLPePLzpDjo2Uzvk7ZVSuIcDjI+XrASPk tsGnAEmlarf9Ypib7Re5s411o7mOxgOuqN/YRbsH6wSEvfNjTxXb8ydYEYhGaPqkWmqn vBhrXQnJgcczyBsBJfrzLR8D/wGoaVgG7t76F4YLc7eXTjO55fRX9rD9D3wV50H4jF7i jfkg== X-Gm-Message-State: AOAM533WuGyRX3IKttLlJOTcGyL2YxTopykW7JMuDEo42ZIGuH5MNPWb aggmS6Te9W2CMu27QrPLKfwJo4+F8zYRzSPGvpn9T2JMcmQ/aRKa X-Google-Smtp-Source: ABdhPJxzlhS15xpvk80pGf+xZY0A4wbc9+0g8ZOFAjGqwxU3vFtB3WM4iXicAGid2SA5h+7Jls+LEscGb4w26mDNNr8= X-Received: by 2002:a25:b003:: with SMTP id q3mr2584896ybf.55.1632777281631; Mon, 27 Sep 2021 14:14:41 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::b2a; envelope-from=thibaut.verron@gmail.com; helo=mail-yb1-xb2a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.help:133302 Archived-At: Hi, Adding the characters to the syntax table is the canonical answer. Maybe erlang-mode sets forward-sexp-function? This is typically done to enhance the sexp movement beyond simple parentheses, for instance for modes using SMIE. If you (setq forward-sexp-function nil), does forward-sexp do what you want= ? Best wishes, Thibaut Le lun. 27 sept. 2021 =C3=A0 22:54, Pierre Rouleau = a =C3=A9crit : > > Hi, > > I am trying to find an easy and efficient way to modify the behaviour of > `forward-sexp` to handle > balanced pairs of characters not normally supported by it, such as balanc= ed > `<` and `>` and > balanced `<<` and `>>`. > > My specific case is to enhance the support of Erlang but I believe it cou= ld > apply to a lot of scenarios. > > The implementation of `forward-sexp` allows the use of a > `forward-sexp-function` which means I > could implement such a function. > > However I was hoping to find a variable that the C-implemented `scan-sexp= ` > could use to define > the matching pair but have not succeeded so far. > It would seem the easiest and most efficient way of implementing such > handling of balanced pairs > would be done there. > > I also tried to modify the syntax table the erlang-mode uses but although > it matches all sorts of > Unicode character pairs, I can't get forward-sexp to work with ?< and ?>. > > Is there a variable one can use to augment or modify the behaviour of > `scan-sexp`? > > Or is forward-sexp meant to be limited to lisp-like syntaxes and I have t= o > use another method > (like SMIE or writing my own forward-sexp-function)? > > Thanks! > -- > /Pierre