From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.devel Subject: Re: A read-based grep-like for symbols (el-search?) (was Do shorthands break basic tooling (tags, grep, etc)? (was Re: Shorthands have landed on master)) Date: Sat, 02 Oct 2021 15:01:59 +0000 Message-ID: <6969a83a7447c1963410@heytings.org> References: <87h7e2xsl5.fsf@gmail.com> <25d8d72022e1ea7ed022@heytings.org> <87fstl7lzw.fsf@web.de> <87a6jt7ilx.fsf@web.de> <87fstlzlaq.fsf@gmail.com> <20211001070242.GC16352@tuxteam.de> <1dd5e2c1f42bce50dc26@heytings.org> <6969a83a74f7bebe69f2@heytings.org> <6969a83a74b57d3d7839@heytings.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3951"; mail-complaints-to="usenet@ciao.gmane.io" Cc: tomas@tuxteam.de, emacs-devel@gnu.org, Dmitry Gutov To: =?UTF-8?Q?Jo=C3=A3o_T=C3=A1vora?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Oct 02 17:03:43 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mWgYA-0000sV-Q0 for ged-emacs-devel@m.gmane-mx.org; Sat, 02 Oct 2021 17:03:43 +0200 Original-Received: from localhost ([::1]:36742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWgY9-0001o4-JB for ged-emacs-devel@m.gmane-mx.org; Sat, 02 Oct 2021 11:03:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51882) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWgWc-00080k-Ds for emacs-devel@gnu.org; Sat, 02 Oct 2021 11:02:06 -0400 Original-Received: from heytings.org ([95.142.160.155]:33582) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWgWa-0005d6-DG for emacs-devel@gnu.org; Sat, 02 Oct 2021 11:02:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20210101; t=1633186919; bh=EFoCdm3cD0mAP/mc+GwXaNMcFSiZ2k8xbu73HHoT+BU=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=C2ufZ5oK8PRJH1B8LkErT15nvTKeK9D//mtutds9vDbjBq4jsPYaAhtFWOSXlXBH+ TkYNwktNAR0TYEPSRfIq5m2BaJMfHGDpka11VRsyqeDVhyP+1JJ2M7cnF+L78ioQfD 0zNgT1CROJgDfNqYXO5W3Fv4/AAIN9AZ5a8htqU6o3O1xX3XaViu2ut18NpTYu0qU1 HrKAwl/YAw8NUGYd26+ToKvYy/6zaVq36ihKuccqQ7GarP30tUdc5KDinLz0XLX/LW LJ74xBWVNRsTkJhuL5TThi/lCnHCPkwzvFiNERREsJiMakNGOP/NKFAQyJ1BiLWJ4Y tJ718bOlgXnKw== In-Reply-To: Received-SPF: pass client-ip=95.142.160.155; envelope-from=gregory@heytings.org; helo=heytings.org 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:276068 Archived-At: > > Then WTFG, watch the fine gif? Can you find out in the top message? Hope > you can. The answer is there in front of your eyes. Watch it well. This > constant email flood a true DOS so I'm sorry I can't be your personal > tutor on the matter here. > I'm certainly not asking for a tutor, no, and no, the answer is not "in front of my eyes". Because your "fine gif" doesn't show what "magnars-string" is. I'm going to assume that it's the "s.el" library, at the end of which you added the following local variable: ;; elisp-shorthands: (("s-" . "magnars-string-")) and in which you replaced (provide 's) by (provide 'magnars-string). Now, I agree with you what you said in an earlier post: "Language design never has been held back by the particular assumptions of a search tool, popular and ubiquitous as it may be." To which I would add that language design should not be influenced by particular choices of libraries, popular and ubiquitous as they may be. A handful Elisp libraries have decided (for good reasons, but against the common practice so far) to use a short prefix for their functions. That doesn't seem a sufficient reason to design namespaces in Elisp in such a way that these particular libraries need to be changed as little as possible. (And they have to be changed more than you apparently think: if I do the above and do C-h f magnars-string-presence RET, the docstring says "Return S if it's `s-present?', otherwise return nil.". Of course `s-present?' is not considered as a symbol in the *Help* buffer, and C-h o s-present? RET does not work.) If supporting these few libraries is a requirement, a better approach would be to introduce a particular and temporary exception for them, something like: diff --git a/src/lread.c b/src/lread.c index af0a799459..44e94b9604 100644 --- a/src/lread.c +++ b/src/lread.c @@ -4657,6 +4657,10 @@ oblookup_considering_shorthand (Lisp_Object obarray, const char *in, Lisp_Object lh_prefix = XCDR (pair); if (!STRINGP (sh_prefix) || !STRINGP (lh_prefix)) continue; + if (strlen (SSDATA (sh_prefix)) < 3) + sh_prefix = concat2 (sh_prefix, build_string ("-")); + else + sh_prefix = concat2 (sh_prefix, build_string ("::")); ptrdiff_t sh_prefix_size = SBYTES (sh_prefix); /* Compare the prefix of the transformation pair to the symbol Such short prefixes would raise a warning in Emacs 30, and an error in Emacs 32.