all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: 68818@debbugs.gnu.org
Subject: bug#68818: [PATCH] lisp/emacs-lisp/inline.el: Autoload public macros
Date: Tue, 30 Jan 2024 13:21:51 +0000	[thread overview]
Message-ID: <871q9zvtw0.fsf@localhost> (raw)

[-- Attachment #1: Type: text/plain, Size: 1315 bytes --]

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'


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-emacs-lisp-inline.el-Autoload-public-macros.patch --]
[-- Type: text/patch, Size: 1967 bytes --]

From c6f64171998a00c017e9dae5d7c96ad6d277adb5 Mon Sep 17 00:00:00 2001
Message-ID: <c6f64171998a00c017e9dae5d7c96ad6d277adb5.1706620775.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
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


[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

             reply	other threads:[~2024-01-30 13:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-30 13:21 Ihor Radchenko [this message]
2024-01-30 14:09 ` bug#68818: [PATCH] lisp/emacs-lisp/inline.el: Autoload public macros Eli Zaretskii
2024-01-30 14:30   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-30 16:24     ` Ihor Radchenko
2024-01-30 18:11       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-30 19:03         ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871q9zvtw0.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=68818@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.