unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: Ruijie Yu <ruijie@netyu.xyz>, 63480@debbugs.gnu.org
Subject: bug#63480: 30.0.50; [BUG] unimplemented logic regarding read-symbol-shorthands
Date: Wed, 6 Sep 2023 15:02:31 +0100	[thread overview]
Message-ID: <CALDnm53Jbxj38buWQ+wFS7o7vJWBs7RVsnrEdCc_mfAZU0goGw@mail.gmail.com> (raw)
In-Reply-To: <CADwFkmmwt776XF0Fz-yfakP4L4MMDSb38N=F=h6d-heME_7MjQ@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 993 bytes --]

On Wed, Sep 6, 2023, 12:03 Stefan Kangas <stefankangas@gmail.com> wrote:

> João, could you take a look at the below bug?
>
> It seems to be related to the shorthands feature, and your package
> breadcrumb.
>

The bug report for breadcrumb in itself is no longer relevant since that
code isn't there anymore.  This is a duplicate of

   https://github.com/joaotavora/breadcrumb/issues/3

which has already been solved.  I updated the autoloads to use
longhand versions already a couple of months ago.

I'll leave it to you if this issue can be closed or not.

Anyway, the problem with shorthands and autoloads remains.
The GitHub user 'dickmao' proposed a patch there, which I
didn't test, but I attach here.

My idea for an alternative patch would be for the "autoload
extractor" (which I'm not familiar with) to see the shorthand
autoload but place it in longhand form in the generated
autoloads file.  I don't have a patch for that idea,
unfortunately.

João

[-- Attachment #1.2: Type: text/html, Size: 2889 bytes --]

[-- Attachment #2: patch (1).txt --]
[-- Type: text/plain, Size: 4406 bytes --]

From 8a5275afa57160f7b7a9d71af2342c06e0c0d652 Mon Sep 17 00:00:00 2001
From: dickmao <none>
Date: Fri, 12 May 2023 21:44:47 -0400
Subject: [PATCH] propagate shorthands to autoloads

---
 lisp/emacs-lisp/generate-lisp-file.el |  7 +++++--
 lisp/emacs-lisp/loaddefs-gen.el       | 15 ++++++++++-----
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/lisp/emacs-lisp/generate-lisp-file.el b/lisp/emacs-lisp/generate-lisp-file.el
index c6148003a5e..6d1e5292871 100644
--- a/lisp/emacs-lisp/generate-lisp-file.el
+++ b/lisp/emacs-lisp/generate-lisp-file.el
@@ -63,7 +63,8 @@ generate-lisp-file-heading
 
 (cl-defun generate-lisp-file-trailer (file &key version inhibit-provide
                                       (coding 'utf-8-emacs-unix) autoloads
-                                      compile provide inhibit-native-compile)
+                                      compile provide inhibit-native-compile
+                                      shorthands)
   "Insert a standard trailer for FILE.
 By default, this trailer inhibits version control, byte
 compilation, updating autoloads, and uses a `utf-8-emacs-unix'
@@ -81,7 +82,7 @@ generate-lisp-file-trailer
 If `standard-output' is bound to a buffer, insert in that buffer.
 If no, insert at point in the current buffer.
 
-If INHITBIT-NATIVE-COMPILE is non-nil, add a cookie to inhibit
+If INHIBIT-NATIVE-COMPILE is non-nil, add a cookie to inhibit
 native compilation.  (By default, a file will be native-compiled
 if it's also byte-compiled)."
   (with-current-buffer (if (bufferp standard-output)
@@ -110,6 +111,8 @@ generate-lisp-file-trailer
                       (if (eq coding t)
                           'utf-8-emacs-unix
                         coding))))
+    (when shorthands
+      (insert (format ";; read-symbol-shorthands: %S\n" shorthands)))
     (insert
      ";; End:\n\n"
      ";;; " (file-name-nondirectory file) " ends here\n")))
diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el
index 8fafb458438..f437a952606 100644
--- a/lisp/emacs-lisp/loaddefs-gen.el
+++ b/lisp/emacs-lisp/loaddefs-gen.el
@@ -494,7 +494,7 @@ loaddefs-generate--compute-prefixes
             (push name prefs)))))
     (loaddefs-generate--make-prefixes prefs load-name)))
 
-(defun loaddefs-generate--rubric (file &optional type feature compile)
+(defun loaddefs-generate--rubric (file &optional type feature compile shorthands)
   "Return a string giving the appropriate autoload rubric for FILE.
 TYPE (default \"autoloads\") is a string stating the type of
 information contained in FILE.  TYPE \"package\" acts like the default,
@@ -520,7 +520,8 @@ loaddefs-generate--rubric
        file :provide (and (stringp feature) feature)
        :compile compile
        :inhibit-native-compile t
-       :inhibit-provide (not feature))
+       :inhibit-provide (not feature)
+       :shorthands shorthands)
       (buffer-string))))
 
 ;;;###autoload
@@ -565,7 +566,7 @@ loaddefs-generate
                                                   t files-re))
 			       (if (consp dir) dir (list dir)))))
          (updating (and (file-exists-p output-file) (not generate-full)))
-         (defs nil))
+         defs shorthands)
 
     ;; Allow the excluded files to be relative.
     (setq excluded-files
@@ -594,7 +595,11 @@ loaddefs-generate
             (when (or package-data (not excluded))
               (setq defs (nconc (loaddefs-generate--parse-file
                                  file output-file package-data)
-                                defs))))))
+                                defs)
+                    shorthands (nconc (with-temp-buffer
+                                        (save-excursion (insert-file-contents file))
+                                        (hack-read-symbol-shorthands))
+                                      shorthands))))))
       (progress-reporter-done progress))
 
     ;; First group per output file.
@@ -606,7 +611,7 @@ loaddefs-generate
           (if (and updating (file-exists-p loaddefs-file))
               (insert-file-contents loaddefs-file)
             (insert (loaddefs-generate--rubric
-                     loaddefs-file nil t include-package-version))
+                     loaddefs-file nil t include-package-version shorthands))
             (search-backward "\f")
             (when extra-data
               (insert extra-data)
-- 
2.38.1


  reply	other threads:[~2023-09-06 14:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-13  5:27 bug#63480: 30.0.50; [BUG] unimplemented logic regarding read-symbol-shorthands Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-13  5:37 ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-06 11:03 ` Stefan Kangas
2023-09-06 14:02   ` João Távora [this message]
2023-09-06 20:17     ` Stefan Kangas
2023-11-29  7:45       ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-29  8:12         ` João Távora
2024-04-18 20:01           ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-18 20:24             ` João Távora
2024-04-18 20:52               ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-11-23 21:38 ` Joseph Turner via Bug reports for GNU Emacs, the Swiss army knife of text editors

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=CALDnm53Jbxj38buWQ+wFS7o7vJWBs7RVsnrEdCc_mfAZU0goGw@mail.gmail.com \
    --to=joaotavora@gmail.com \
    --cc=63480@debbugs.gnu.org \
    --cc=ruijie@netyu.xyz \
    --cc=stefankangas@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).