From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#68818: [PATCH] lisp/emacs-lisp/inline.el: Autoload public macros Date: Tue, 30 Jan 2024 13:21:51 +0000 Message-ID: <871q9zvtw0.fsf@localhost> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8046"; mail-complaints-to="usenet@ciao.gmane.io" To: 68818@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 30 14:20:28 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 1rUo2O-0001tJ-Fa for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 30 Jan 2024 14:20:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUo2F-00042S-Q9; Tue, 30 Jan 2024 08:20:21 -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 1rUo1p-0003zp-2Z for bug-gnu-emacs@gnu.org; Tue, 30 Jan 2024 08:19:54 -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 1rUo1o-00039c-PT for bug-gnu-emacs@gnu.org; Tue, 30 Jan 2024 08:19:52 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rUo1x-0003Zi-LH for bug-gnu-emacs@gnu.org; Tue, 30 Jan 2024 08:20:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 30 Jan 2024 13:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 68818 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.170662074813634 (code B ref -1); Tue, 30 Jan 2024 13:20:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Jan 2024 13:19:08 +0000 Original-Received: from localhost ([127.0.0.1]:34582 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUo15-0003Xp-VX for submit@debbugs.gnu.org; Tue, 30 Jan 2024 08:19:08 -0500 Original-Received: from lists.gnu.org ([2001:470:142::17]:39860) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rUo14-0003X6-5S for submit@debbugs.gnu.org; Tue, 30 Jan 2024 08:19:06 -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 1rUo0d-0003HK-4b for bug-gnu-emacs@gnu.org; Tue, 30 Jan 2024 08:18:47 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rUo0P-0002ut-Gl for bug-gnu-emacs@gnu.org; Tue, 30 Jan 2024 08:18:28 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 779E9240028 for ; Tue, 30 Jan 2024 14:18:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1706620701; bh=CnoRpNX/v5VbNzf22VryaLpAzwBkT+JiTTaQeE4bUwU=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=IaWB2PwpZc9xOjj048gfPSSc+vudc2HRLj/t/1Wi7ov/Q5PiQkE+8I+SDMQEZusIq ye8IuO2j5tpT4w34ypPbZPFKVMBisIcKRh4nh4+vYe9LOMVQUk0PFGzzIStWn9xJa+ m5/8DcV7ae+ORtY/byIGmB29mc1E6u/TM8O4ZMLZF22BXLaa1dnq5UkuZlxG242ruD tyRuGvaHfvW1GLnT5/zx9gtiuylMwKnWP+Ha/TjnnRGY7NZhddecLcm/Xl2PoyYQkx oytw/osL56Gub/nFW31os01LmuQP06HWDTMdo6RbhydwWi0Y3aWtS8p8w0lfBiLuz5 umA69lNheSIjQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TPQhr4m7hz6tsb for ; Tue, 30 Jan 2024 14:18:20 +0100 (CET) Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:279176 Archived-At: --=-=-= Content-Type: text/plain Tags: patch Hello, 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)))))) with emacs -Q, indenting the file will yield different results with and without executing (require 'inline). With the patch, indentation becomes consistent. In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.39, cairo version 1.18.0) of 2024-01-28 built on localhost Repository revision: 5e9ef5d65aea4c278bb58cfc84ea22e7983385da Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101010 System Description: Gentoo Linux Configured using: 'configure JAVAC=/etc/java-config-2/current-system-vm/bin/javac' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-lisp-emacs-lisp-inline.el-Autoload-public-macros.patch >From c6f64171998a00c017e9dae5d7c96ad6d277adb5 Mon Sep 17 00:00:00 2001 Message-ID: From: Ihor Radchenko Date: Tue, 30 Jan 2024 14:18:23 +0100 Subject: [PATCH] lisp/emacs-lisp/inline.el: Autoload public macros * lisp/emacs-lisp/inline.el (inline-quote): (inline-const-p): (inline-const-val): (inline-error): (inline-letevals): Autoload macros that may appear inside `define-inline'. This is necessary to load the indentation rules when Elisp code that uses `define-inline' is edited. --- lisp/emacs-lisp/inline.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lisp/emacs-lisp/inline.el b/lisp/emacs-lisp/inline.el index c774296084e..af841c0458d 100644 --- a/lisp/emacs-lisp/inline.el +++ b/lisp/emacs-lisp/inline.el @@ -69,21 +69,25 @@ (require 'macroexp) +;;;###autoload (defmacro inline-quote (_exp) "Similar to backquote, but quotes code and only accepts , and not ,@." (declare (debug (backquote-form))) (error "inline-quote can only be used within define-inline")) +;;;###autoload (defmacro inline-const-p (_exp) "Return non-nil if the value of EXP is already known." (declare (debug t)) (error "inline-const-p can only be used within define-inline")) +;;;###autoload (defmacro inline-const-val (_exp) "Return the value of EXP." (declare (debug t)) (error "inline-const-val can only be used within define-inline")) +;;;###autoload (defmacro inline-error (_format &rest _args) "Signal an error." (declare (debug t)) @@ -100,6 +104,7 @@ inline--letlisteval ;; inline-letevals, so signal the error in terms of the user's code. (error "inline-letevals can only be used within define-inline")) +;;;###autoload (defmacro inline-letevals (vars &rest body) "Make sure the expressions in VARS are evaluated. VARS should be a list of elements of the form (VAR EXP) or just VAR, in case -- 2.43.0 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--