From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#68818: [PATCH] lisp/emacs-lisp/inline.el: Autoload public macros Date: Tue, 30 Jan 2024 09:30:36 -0500 Message-ID: References: <871q9zvtw0.fsf@localhost> <86cyti3ob3.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17016"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Ihor Radchenko , 68818@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 30 15:31:14 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1rUp8r-0004ES-Fq for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 30 Jan 2024 15:31:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUp8Y-0004nz-PM; Tue, 30 Jan 2024 09:30:54 -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 1rUp8X-0004nQ-9R for bug-gnu-emacs@gnu.org; Tue, 30 Jan 2024 09:30:53 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rUp8W-0001xi-VN for bug-gnu-emacs@gnu.org; Tue, 30 Jan 2024 09:30:53 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rUp8f-0005m2-JS for bug-gnu-emacs@gnu.org; Tue, 30 Jan 2024 09:31:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 30 Jan 2024 14:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68818 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 68818-submit@debbugs.gnu.org id=B68818.170662505622180 (code B ref 68818); Tue, 30 Jan 2024 14:31:01 +0000 Original-Received: (at 68818) by debbugs.gnu.org; 30 Jan 2024 14:30:56 +0000 Original-Received: from localhost ([127.0.0.1]:34720 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUp8Z-0005lg-GP for submit@debbugs.gnu.org; Tue, 30 Jan 2024 09:30:55 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:45038) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUp8X-0005lR-VM for 68818@debbugs.gnu.org; Tue, 30 Jan 2024 09:30:54 -0500 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 8CA3A4412EA; Tue, 30 Jan 2024 09:30:38 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1706625037; bh=Y/KuTSZsMxYIvydyxDjgts1dWapbFxVztGA2gHQ/O1E=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=W35JKyw4mBAxgTCCdfo12xoP26+6s27g0FnH/xc42oBHjh2AgyBKSII8IZ39TCLeO xmGBTSKKVC8Gkt9ToEEFfQ69cJ0nJiw2hny4ab0kJ62238iKrqyqSLjWqIzKDZW45N rluCBWfPhiQAaq2leKBo9k8CrUig2GGlwvSczMNKh6b92hWexw+nhWDUqW3FvjcF7+ g5GNoE7Dj08CGoKKKWSU7TMCHa+prR9sUDDo7g5DPWdZ10lBSW0iEJoQ9i643gefPf KPw0BluvX3B/Q3fcgFfmyhQ6l/o0EDoral6O0dd2/VEnhVqTpRZxytVRmjQCLbb4AM NPu6TOrBF78/w== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 228054412DF; Tue, 30 Jan 2024 09:30:37 -0500 (EST) Original-Received: from pastel (104-222-119-131.cpe.teksavvy.com [104.222.119.131]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E6E291204F5; Tue, 30 Jan 2024 09:30:36 -0500 (EST) In-Reply-To: <86cyti3ob3.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 30 Jan 2024 16:09:52 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:279185 Archived-At: >> This patch solves annoying problem with `define-inline' forms not being >> indented correctly unless inline.el is explicitly loaded. >> >> For illustration, try to open the following foo.el file: >> >> (define-inline org-element-type-p (node types) >> "Return non-nil when NODE type is one of TYPES. >> TYPES can be a type symbol or a list of symbols." >> (if (inline-const-p types) >> (if (listp (inline-const-val types)) >> (inline-quote (memq (org-element-type ,node t) ,types)) >> (inline-quote (eq (org-element-type ,node t) ,types))) >> (inline-letevals (node types) >> (inline-quote >> (if (listp ,types) >> (memq (org-element-type ,node t) ,types) >> (eq (org-element-type ,node t) ,types)))))) [ Side note: IIRC the above can be simplified as: (define-inline org-element-type-p (node types) "Return non-nil when NODE type is one of TYPES. TYPES can be a type symbol or a list of symbols." (inline-letevals (node types) (if (listp (inline-const-val types)) (inline-quote (memq (org-element-type ,node t) ,types)) (inline-quote (eq (org-element-type ,node t) ,types))))) ] >> with emacs -Q, indenting the file will yield different results with and >> without executing (require 'inline). >> With the patch, indentation becomes consistent. > Hmm, I wonder whether there's a less heavy-handed approach to this. Agreed. Also, I think this problem is not specific to `define-inline`. Maybe the indentation code should try and (auto)load the macros it encounters. Stefan