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 short defense of shorthands.el (but CL packages are still better) Date: Mon, 07 Nov 2022 02:44:02 -0500 Message-ID: References: <87leoqfbrh.fsf@gmail.com> 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="29069"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, emacs-devel@gnu.org To: =?iso-8859-1?Q?Jo=C3=A3o_T=C3=A1vora?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 07 08:45:30 2022 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 1orwp0-0007LY-4E for ged-emacs-devel@m.gmane-mx.org; Mon, 07 Nov 2022 08:45:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1orwnd-0006bu-77; Mon, 07 Nov 2022 02:44:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1orwnb-0006ZD-76 for emacs-devel@gnu.org; Mon, 07 Nov 2022 02:44:03 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1orwna-0002II-Tp; Mon, 07 Nov 2022 02:44:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=Q/lyhyJO5p/iq0luZEk2QgLeLhSSfKQc42aGddvNCCs=; b=hgiqz/zCVd8h QCQVKwKPn2K2yI89zztAVdldcP1n5UyctaCFRkPPyU2OuYfOBdw58mjMqXCOTR1UZoF2M8s1F9h72 Kbv0ZYGhVMAR6Stn1YS9+6fYyDLIEZ8JTFtCAEJM6bugZhCgpxJpMdmgaV2C3d0kwjL+Rx63uRvLC 7mdLVL34jmGORf89ChfNs8OmEyHixVWXY83yrIR55MayieFexNqQgv1XT0fL5wh1AErwHXbgLLGQ2 E7ZUjTd8YMcs1nFVRr+XK9uhspEgOD+PYciAZEQXXcYEqI6m42UB9ry6vLgXXRayF0r2TjJslPINJ 1/41j/iKksasG8b/IoQurQ==; Original-Received: from rms by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1orwna-000388-Ih; Mon, 07 Nov 2022 02:44:02 -0500 In-Reply-To: <87leoqfbrh.fsf@gmail.com> (message from =?iso-8859-1?Q?Jo=C3?= =?iso-8859-1?Q?=A3o_T=C3=A1vora?= on Sat, 05 Nov 2022 01:09:06 +0000) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:299278 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. ]]] > As you know, he underlying interned symbol is xenomorph-foo, and that's > the symbol that the at-point documentation system ElDoc shows you in the > echo area, and that's what shows up C-h f. I've never used ElDoc and I don't know what it does. Maybe you're right about C-h f, but you have not specified the scenario fully. What does the user actually type, to invoke it? Perhaps the user type C-h f x-foo RET, after seeing `x-foo' in the code and gets the answer that it doesn't exist. That would be an unhelpful result. So maybe each file's shorthands, as actually used when it was loaded, should be remembered in an alist, so that C-h f and friends can look them up and DTRT. As for the grep shortcoming, it can't be addressed by changing the code of grep. But I have an idea for how coding conventions can do it. We can identify the usual scenarios in which shorthands affect grepping, and write dummy definitions to deal with them. For instance, in the file string.el, we can have dummy definitions for all the renamings that it does. ;;; (defalias 'string-foo 's-foo) ;; in s.el ;;; (defalias 'string-bar 's-bar) ;; in s.el Grepping for string-foo will find that line, which will tell you to look at s.el and find s-foo. We could conceivably make the commands for finding that grep hit understand that and go straight to the right line in s.el. In the case of doing something like CL packages, where the shorthands look like ("frobnicate" . "frob:frobnicate") and ("scramble" . "frob:scramble"), we may not need to do anything. If you see a call to `frobnicate' and grep for `frobnicate', you will find the definition of `frob:frobnicate', as well as perhaps a few other functions named frobnicate in various other packages. You will need to study the code to see which of those functions is actually used in the program you are studying. I think the same grep issue will occur with actual CL packages, or anything that mimics them. Shorthands are neither better nor worse in this case. -- 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)