From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Richard Stallman 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 19:18:30 -0400 Message-ID: References: <25d8d72022b571db5291@heytings.org> <87h7e2xsl5.fsf@gmail.com> <25d8d72022e1ea7ed022@heytings.org> <87fstl7lzw.fsf@web.de> <87a6jt7ilx.fsf@web.de> <87fstlzlaq.fsf@gmail.com> <20211001070242.GC16352@tuxteam.de> Reply-To: rms@gnu.org Content-Type: text/plain; charset=Utf-8 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14122"; mail-complaints-to="usenet@ciao.gmane.io" Cc: tomas@tuxteam.de, joaotavora@gmail.com, emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Oct 03 01:19:32 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 1mWoHz-0003VU-Fd for ged-emacs-devel@m.gmane-mx.org; Sun, 03 Oct 2021 01:19:31 +0200 Original-Received: from localhost ([::1]:44678 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWoHy-0000R3-FE for ged-emacs-devel@m.gmane-mx.org; Sat, 02 Oct 2021 19:19:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWoH2-0007M1-Hb for emacs-devel@gnu.org; Sat, 02 Oct 2021 19:18:32 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:35812) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWoH2-0004mF-0R; Sat, 02 Oct 2021 19:18:32 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1mWoH0-0000tI-O8; Sat, 02 Oct 2021 19:18:30 -0400 In-Reply-To: (message from Dmitry Gutov on Fri, 1 Oct 2021 18:48:27 +0300) 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:276089 Archived-At: [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] We have two kinds of uses for shorthands. * Creating longer real names to avoid collisions. In this kind of case the package that you load creates shorthands for itself, which rename its symbols to longer names that won't conflict. This is what we will do with s.el. * Creating shorter names for convenience. In this kind of case, one Lisp file would create shorthand prefixes for code in other files. These prefixes might really be shorter than the symbols' documented name. People who had the second case in mind suggested name conventions for the shorthand prefixes. Suppose we use ":" as the end of a prefix. Suppose you want to search for calls to find-outer-otter-create-otter. If there is a call to foo:create-otter in a file wehack.el, it would be possible to look at wehack.el and see if it defines `foo:' as a shorthand for `find-outer-otter-'. If so, that is a call to find-outer-otter-create-otter. The hard part is to determine which strings to actually grep for. There are various ways to do it. Here's one: Assume the convention that the shorthand substitute always ends in `-'. So grep for `:otter', `:create-otter', `:outer-create-otter', and so on. When you find any of them, you can check whether that file defines a shortcut that would supply what's missing to generate `find-outer-otter-create-otter'. For instance, if it defines `walrus:' as a shorthand for `find-outer', then removing `find-outer' from the start of `find-outer-otter-create-otter', you see that a reference to that symbol using that shorthand would be `walrus:otter-create-otter'. If the file contains that, it is a hit. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org)