From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: non word abbrevs Date: Mon, 01 Nov 2021 13:58:02 -0400 Message-ID: References: <2F7AC7B8-48AA-4BF3-B5AA-A4141F248109@traduction-libre.org> <4097001A-F60D-4712-B828-EA778BFCF56E@traduction-libre.org> 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="15711"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Jean-Christophe Helary Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 01 21:09:45 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 1mhdcm-0003se-O5 for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 01 Nov 2021 21:09:44 +0100 Original-Received: from localhost ([::1]:58650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mhdcl-0006FZ-JX for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 01 Nov 2021 16:09:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38230) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhbZQ-0001Bo-NX for help-gnu-emacs@gnu.org; Mon, 01 Nov 2021 13:58:09 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:28756) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhbZO-0000pg-2F for help-gnu-emacs@gnu.org; Mon, 01 Nov 2021 13:58:07 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 0A3111003B4; Mon, 1 Nov 2021 13:58:05 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 8CE01100135; Mon, 1 Nov 2021 13:58:03 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1635789483; bh=3amBHIX6ZIwc9JdVReTMl2HVleny2Ub/Jx/ChOepvp0=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=QZwdwcH59vc7O2iVL1G9CzmBf49mXGMx4uqetnXKDK7ojy9pjMGdoc8fub3xSRWXH aWBHURySbkbUh3weezVI04G9Cn9lsFG1IWIyIzTC/g5wJrrjnG8nZQ86tqdVbQWDGT Aa82bmhzBfQ2u5T3eUto2OqG7sy1F8yyMGJ0NLepNNgWTAwqnZPcFu2mylX1Xe9OZS RtZfk9mj934b8s1qcxHMa6mxFVVV0XfyZnTW60NGMEirXuWBBisVXASG+d6DmLSWf7 +owzwwUH5keoxuiTy5enLQKmAGulVJcla1NBrE89NLetYr/GGliuvk7B1WjOZJYLVS R/0l0yBam4XQA== Original-Received: from alfajor (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 81FCB120304; Mon, 1 Nov 2021 13:58:03 -0400 (EDT) In-Reply-To: (Jean-Christophe Helary's message of "Mon, 1 Nov 2021 22:17:28 +0900") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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.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" Xref: news.gmane.io gmane.emacs.help:134298 Archived-At: >> Try something like: "[^<>=3D-]\\([<>=3D-]+\\)" >> [ Yes, this shortest match business is a PITA. ] > > My abbrevs are arrows composed of < or > at the tips and - or =3D with > a minimum of 2 characters and a max of 3: > > =E2=86=92 =E2=87=92 > =E2=86=90 =E2=87=90 > =E2=86=94 =E2=87=94 > > In a different world, I'd try [<>=3D-]{2,3} > > Is that what you mean ? No, the [^<>=3D-] is the important part: it tells Emacs to keep looking (going backward) for a longer match. If you use "[<>=3D-]\\{2,3\\}" (which does exist in our beloved ELisp world), then Emacs's regexp matcher will go as follows: - Let's say we're in a line with "<=3D> hello", with point just after the "= >". - The regexp search will first try to match (backward) ">" against the regexp, which will fail. - It will then try to match "=3D>" against the regexp, which will succeed. - At this point it stops and fails to notice that the regexp would also have matched "<=3D>", so you won't get the abbrev expansion you wanted. -- Stefan