From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Noam Postavsky <npostavs@gmail.com>
Cc: 39823@debbugs.gnu.org, rms@gnu.org
Subject: bug#39823: 26.3; update-directory-autoloads regression from Emacs 26 to Emacs 27
Date: Mon, 22 Jun 2020 00:10:04 -0400 [thread overview]
Message-ID: <87mu4vn3kz.fsf@gmail.com> (raw)
In-Reply-To: <868sir8y85.fsf@gmail.com> (Noam Postavsky's message of "Sun, 19 Apr 2020 08:19:06 -0400")
[-- Attachment #1: Type: text/plain, Size: 726 bytes --]
Hello Noam,
Noam Postavsky <npostavs@gmail.com> writes:
> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
>> (defun update-directory-autoloads (&rest dirs)
>>
>> I don't see how &key can be combined with &rest without potentially
>> causing problems.
>
> You can check if the first arg is a keyword like
> :generated-autoload-file (which can't be a directory, since it's not a
> string), and if it is, then handle the second arg specially.
I've given this idea a try with the attached patch. For some reason I
can't seem to simply eval the definition to test it (Debugger
entered--Lisp error: (void-function byte-compile-info-string). I'm
rebuilding Emacs with the change right now.
Consider it untested for now.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-autoload.el-Add-a-keyword-argument-to-update-di.patch --]
[-- Type: text/x-patch, Size: 3800 bytes --]
From 227fea1c404783b93540a1ca2c4c838f9c86ebba Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sun, 21 Jun 2020 23:09:53 -0400
Subject: [PATCH] lisp: autoload.el: Add a keyword argument to
update-directory-autoloads.
This provides a way to explicitly specify the GENERATED-AUTOLOAD-FILE
file name to use for the generated autoload definitions, which is more
convenient when using lexical scoping. Previously, the user had to
use dynamic scoping and bind the variable before calling
`update-directory-autoloads'. This was discussed in
<https://bugs.gnu.org/39823>.
* lisp/emacs-lisp/autoload.el (update-directory-autoloads): Define the
procedure using cl-defun, and add a :generated-autoload-file keyword
argument. Update doc. Honor :generated-autoload-file keyword
argument, and remove it and its associated value from DIRS, if
present.
---
lisp/emacs-lisp/autoload.el | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index ede4edcd57..423cc67e99 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -32,6 +32,8 @@
(require 'lisp-mode) ;for `doc-string-elt' properties.
(require 'lisp-mnt)
+(require 'seq)
+
(eval-when-compile (require 'cl-lib))
(defvar generated-autoload-file nil
@@ -1023,7 +1025,10 @@ removes any prior now out-of-date autoload entries."
(delete-region begin (point)))
;;;###autoload
-(defun update-directory-autoloads (&rest dirs)
+(cl-defun update-directory-autoloads (&rest dirs
+ &key (generated-autoload-file
+ generated-autoload-file)
+ &allow-other-keys)
"Update autoload definitions for Lisp files in the directories DIRS.
In an interactive call, you must give one argument, the name of a
single directory. In a call from Lisp, you can supply multiple
@@ -1035,11 +1040,26 @@ directory or directories specified.
In an interactive call, prompt for a default output file for the
autoload definitions, and temporarily bind the variable
`generated-autoload-file' to this value. When called from Lisp,
-use the existing value of `generated-autoload-file'. If any Lisp
-file binds `generated-autoload-file' as a file-local variable,
-write its autoloads into the specified file instead."
+use the existing value of `generated-autoload-file'.
+Alternatively, `generated-autoload-file' can also be provided
+using a Common Lisp style keyword ':generated-autoload-file'
+argument. If any Lisp file binds `generated-autoload-file' as a
+file-local variable, write its autoloads into the specified file
+instead."
(interactive "DUpdate autoloads from directory: ")
- (let* ((files-re (let ((tmp nil))
+ (let* (;; Honor the :generated-autoload-file keyword argument.
+ (generated-autoload-file-arg (seq-position
+ dirs ':generated-autoload-file))
+ (generated-autoload-file (if generated-autoload-file-arg
+ (elt dirs
+ (1+ generated-autoload-file-arg))
+ generated-autoload-file))
+ ;; Cleanup dirs from such keyword argument, if any.
+ (dirs (if generated-autoload-file-arg
+ (delete generated-autoload-file
+ (delete ':generated-autoload-file dirs))
+ dirs))
+ (files-re (let ((tmp nil))
(dolist (suf (get-load-suffixes))
;; We don't use module-file-suffix below because
;; we don't want to depend on whether Emacs was
--
2.26.2
[-- Attachment #3: Type: text/plain, Size: 19 bytes --]
Thank you!
Maxim
next prev parent reply other threads:[~2020-06-22 4:10 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-28 15:11 bug#39823: 26.3; update-directory-autoloads regression from Emacs 26 to Emacs 27 Maxim Cournoyer
2020-03-13 0:43 ` Noam Postavsky
2020-03-13 8:30 ` Eli Zaretskii
2020-03-14 2:06 ` Maxim Cournoyer
2020-03-13 23:01 ` Michael Heerdegen
2020-03-14 2:03 ` Maxim Cournoyer
2020-03-17 11:48 ` Noam Postavsky
2020-03-14 3:34 ` Richard Stallman
2020-03-17 2:16 ` Maxim Cournoyer
2020-03-19 1:46 ` Richard Stallman
2020-04-08 3:55 ` Maxim Cournoyer
2020-04-08 6:31 ` Eli Zaretskii
2020-04-08 16:41 ` Maxim Cournoyer
2020-04-08 19:09 ` Eli Zaretskii
2020-04-19 3:13 ` Maxim Cournoyer
2020-04-19 12:19 ` Noam Postavsky
2020-06-22 4:10 ` Maxim Cournoyer [this message]
2020-06-22 15:07 ` Noam Postavsky
2020-06-23 20:42 ` Maxim Cournoyer
2020-09-30 15:23 ` Lars Ingebrigtsen
2020-10-01 17:20 ` Lars Ingebrigtsen
2020-10-01 17:54 ` Eli Zaretskii
2020-10-01 18:06 ` Lars Ingebrigtsen
2020-10-02 2:36 ` Lars Ingebrigtsen
2020-10-02 17:54 ` Maxim Cournoyer
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=87mu4vn3kz.fsf@gmail.com \
--to=maxim.cournoyer@gmail.com \
--cc=39823@debbugs.gnu.org \
--cc=npostavs@gmail.com \
--cc=rms@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.