From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: [ELPA] New package: xr Date: Wed, 27 Feb 2019 17:22:16 +0100 Message-ID: <23E9F007-5B84-45C6-9933-5A1220058CAA@acm.org> References: <875zt5feys.fsf@web.de> Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="260605"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs-devel To: Michael Heerdegen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 27 17:25:23 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gz21K-0015ZQ-Kw for ged-emacs-devel@m.gmane.org; Wed, 27 Feb 2019 17:25:22 +0100 Original-Received: from localhost ([127.0.0.1]:46872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gz21J-0003R0-N6 for ged-emacs-devel@m.gmane.org; Wed, 27 Feb 2019 11:25:21 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38114) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gz1ym-0002MM-50 for emacs-devel@gnu.org; Wed, 27 Feb 2019 11:22:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gz1yf-00035e-Qp for emacs-devel@gnu.org; Wed, 27 Feb 2019 11:22:40 -0500 Original-Received: from mail176c50.megamailservers.eu ([91.136.10.186]:55802 helo=mail37c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gz1yU-0002mP-5q for emacs-devel@gnu.org; Wed, 27 Feb 2019 11:22:33 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1551284538; bh=DnTh9RaZtcog7uWMxS9WmDwhmYdB7wEZudsl0XxMDHo=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=OYMB1fLoi6WWP7QoFTDtg3ycEFwI3kB9t3qRokmZIwgVeaBXA2qcjOJQcb2O90zA4 Xxmo6WT4W0vd1jC/vkshjPLvmwW1y8ATvvYfJMo2Lenj/It3q87SordqfFj5uOM9KP 4X13JXnKLJuZaIahkIyIKQ/3CzgufcJYLJip3lnU= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.0.4] (c83-251-8-17.bredband.comhem.se [83.251.8.17]) (authenticated bits=0) by mail37c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id x1RGMGSY000484; Wed, 27 Feb 2019 16:22:18 +0000 In-Reply-To: <875zt5feys.fsf@web.de> X-Mailer: Apple Mail (2.3445.102.3) X-CTCH-RefID: str=0001.0A0B020D.5C76B93A.003D, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=J+uEEjvS c=1 sm=1 tr=0 a=NAHmi3I8mP0S/Y8gRKeQyA==:117 a=NAHmi3I8mP0S/Y8gRKeQyA==:17 a=kj9zAlcOel0A:10 a=yZ9VffeFh4KJnpWWg_8A:9 a=CjuIK1q_8ugA:10 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 91.136.10.186 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:233659 Archived-At: 27 feb. 2019 kl. 16.06 skrev Michael Heerdegen = : >=20 > Would it be possible to define a variable to control what kind of > operators `xr--postfix' chooses? Currently the verbose names are > hardcoded, and even if there is no perfectly nice solution, it would = be > good if there was some way to control this. I'm not sure if there are > other places besides `xr--postfix' where such a variable would be to > consulted. The identifiers chosen by xr will never suit the taste of everyone, but = I couldn't make up my mind about what to do about it. I'd be interested = in hearing what other people think. One way would be to add an optional translation alist to xr: (xr "a*.?" '((zero-or-more . 0+) (nonl . not-newline))) =3D> (seq (0+ "a") (opt not-newline)) but this could be done almost as easily by post-processing the resulting = list tree, maybe like this: (defun rename-rx (substitution-alist rx) "Rename all identifiers in RX according to SUBSTITUTION-ALIST." (cond ((symbolp rx) (alist-get rx substitution-alist rx)) ((consp rx) ;; Translate the first element of each list even if not a symbol, ;; to allow translation of ? and ?? (space and ?). (cons (alist-get (car rx) substitution-alist (car rx)) (mapcar (lambda (elem) (rename-rx substitution-alist elem)) (cdr rx)))) (t rx))) Post-processing is more generally powerful since it can do structural = replacement and not mere symbol replacement. A customisable setting would also work, but I prefer keeping xr purely = functional.