From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Help sought understanding shorthands wrt modules/packages Date: Thu, 03 Nov 2022 10:46:53 +0200 Message-ID: <83cza48lxe.fsf@gnu.org> References: <25a8a3a6-81c8-3fbc-434d-fb1b24ae1d62@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2319"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: rms@gnu.org, Andrea Corallo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 03 09:48:01 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 1oqVtI-0000QP-Mb for ged-emacs-devel@m.gmane-mx.org; Thu, 03 Nov 2022 09:48:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oqVsU-0005fJ-50; Thu, 03 Nov 2022 04:47:10 -0400 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 1oqVsS-0005el-4R for emacs-devel@gnu.org; Thu, 03 Nov 2022 04:47:08 -0400 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 1oqVsN-0003rQ-Hb; Thu, 03 Nov 2022 04:47:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=PpXOmjEMJEJhOzhBdjz7MmhXUwE6osxLKPIyDM+fJqY=; b=iKVBlZejKf2S mP96wF9qrfK0yl/lbD0eoOywKyBJ1EauFH+WtaLicAmq2KFvzEXB4kbSudgLkaTpe8IWIjY5XayF2 DD0jIXFl+Gxy8a8SJzV5Nv6s/oTUO5p4jKQkFcLbxCmxrijtuVe25s0PBUc3tNMw7ajpE6BaMhmz9 +2GdgV94sNMWnFlFjWqFKNF2KOKTBdY+LD99tCz9KogQaaXPiBNXP6U7rMTWdDExyFuGba7qYq8Hl MlbttW8SjocdH6BENl6xvwUlL2CZx+VCs8a5qi4vYMT6LrvTIlf+kzxFMn6LnQ6wxbkczYOzT+WBX n5dfiCNWTJYwcCS6Wb95Pw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oqVsL-0004dd-V8; Thu, 03 Nov 2022 04:47:02 -0400 In-Reply-To: (message from Richard Stallman on Wed, 02 Nov 2022 23:17:19 -0400) 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: , Original-Sender: "Emacs-devel" Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:299066 Archived-At: > From: Richard Stallman > Date: Wed, 02 Nov 2022 23:17:19 -0400 > > I just wrote changes which ought to provide the missing > functionality in the shorthands feature. It adds an argument to Fload > which specifies additional shorthands to apply to that file. > See below. > > I have made it compile but I have not had a chance yet to test running > it. I hope to find a chance to do that soon. Please do test it, but in any case please don't install before the emacs-29 release branch is cut. This change is significant enough to not risk it for the upcoming release of Emacs 29. > -DEFUN ("load", Fload, Sload, 1, 5, 0, > +DEFUN ("load", Fload, Sload, 1, 6, 0, > doc: /* Execute a file of Lisp code named FILE. > First try FILE with `.elc' appended, then try with `.el', then try > with a system-dependent suffix of dynamic modules (see `load-suffixes'), > @@ -1206,6 +1206,13 @@ When searching suffixes, this function normally stops at the first > one that exists. If the option `load-prefer-newer' is non-nil, > however, it tries all suffixes, and uses whichever file is the newest. > > +ADD-SHORTHANDS specifies a list of additional shorthands (symbol > +renamings) to perform when loading this file, > +in addition to those specified in the file itself. > +Normally you should call `load-with-shorthands' to specify this, > +rather than calling `load' with nil for all args > +except for FILE and ADD-SHORTHANDS. > + > Loading a file records its definitions, and its `provide' and > `require' calls, in an element of `load-history' whose > car is the file name loaded. See `load-history'. This needs a NEWS entry and a suitable change in the ELisp manual. > #ifdef HAVE_NATIVE_COMP > loadhist_initialize (hist_file_name); > + /* ??? Does this require fixing for shorthands? */ > Fnative_elisp_load (found, Qnil); > build_load_history (hist_file_name, true); Andrea, can you please comment on the above question? > + DEFVAR_LISP ("read-symbol-added-shorthands", Vread_symbol_added_shorthands, > + doc: /* Alist of symbol-name shorthands added by `load'. > +This variable's value comes from the ADDED-SHORTHANDS argument to `load'. > +See Info node `(elisp)Shorthands' for more details. */); > + Vread_symbol_added_shorthands = Qnil; This variable should be documented in the ELisp manual and mentioned in the NEWS entry. Thanks. P.S. It would be good to add tests for this new feature; see the test suite we have in tests/.