From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Maxim Cournoyer Newsgroups: gmane.emacs.bugs Subject: bug#39823: 26.3; update-directory-autoloads regression from Emacs 26 to Emacs 27 Date: Mon, 22 Jun 2020 00:10:04 -0400 Message-ID: <87mu4vn3kz.fsf@gmail.com> References: <87zhd2lpad.fsf@gmail.com> <87o8t16q5e.fsf@gmail.com> <87y2rz4tgb.fsf@gmail.com> <87blo2k4wp.fsf@gmail.com> <83369eqyij.fsf@gnu.org> <87wo6qhqvd.fsf@gmail.com> <835ze9pzfq.fsf@gnu.org> <87mu78jhgz.fsf@gmail.com> <868sir8y85.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="42453"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) Cc: 39823@debbugs.gnu.org, rms@gnu.org To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 22 06:11:12 2020 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 1jnDna-000Azt-J4 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Jun 2020 06:11:10 +0200 Original-Received: from localhost ([::1]:34950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnDnY-000707-V7 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Jun 2020 00:11:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43258) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnDnS-0006zo-8r for bug-gnu-emacs@gnu.org; Mon, 22 Jun 2020 00:11:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49720) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jnDnR-0005fJ-VN for bug-gnu-emacs@gnu.org; Mon, 22 Jun 2020 00:11:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jnDnR-0007jU-Py for bug-gnu-emacs@gnu.org; Mon, 22 Jun 2020 00:11:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Jun 2020 04:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39823 X-GNU-PR-Package: emacs Original-Received: via spool by 39823-submit@debbugs.gnu.org id=B39823.159279902629683 (code B ref 39823); Mon, 22 Jun 2020 04:11:01 +0000 Original-Received: (at 39823) by debbugs.gnu.org; 22 Jun 2020 04:10:26 +0000 Original-Received: from localhost ([127.0.0.1]:33033 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jnDmr-0007ig-Nk for submit@debbugs.gnu.org; Mon, 22 Jun 2020 00:10:26 -0400 Original-Received: from mail-qk1-f194.google.com ([209.85.222.194]:46226) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jnDmm-0007iM-Ls for 39823@debbugs.gnu.org; Mon, 22 Jun 2020 00:10:24 -0400 Original-Received: by mail-qk1-f194.google.com with SMTP id r22so12873767qke.13 for <39823@debbugs.gnu.org>; Sun, 21 Jun 2020 21:10:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=AA39I/Riz+ZKOTZts4PNrG1UTE0SrATuRq4kAp8DLDA=; b=TPx93A50mf9MCwjScjA6H4R4mqPlHFH9B3LVDD2Lp7M+D9shFqVD9KYYcDtlcOeesf oknDZ0PsbmQQSesvM7t3SsI/r6eJeRS3MDC1rwEcrwzKAaZn6Jvl0zsqmT+GMMuMxvTV D2e1WPRSUHZQcxYeRSELEn9kYoLcRE4zPbbd0+qiCA3yV9GcZAFgQo88GkJL8uZXMZGx xZKxKY0oqQqbZZ9a57U2zR6gQctnpfl02JkBRuvI4zWdv9pPBgKgiN+JihUc2Kfg5BTo URHECKvbF+tSrFofU31rhCwScmWQY4wyla2309rSxdudGl/0pt0ODA5ESusRISncdM4n e6ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=AA39I/Riz+ZKOTZts4PNrG1UTE0SrATuRq4kAp8DLDA=; b=I1HniPlI5qDMYMD7SGDMA0jUtej6gpq/uvwKA5kqWadtr1iE2j0P0rcxhNgFynAXeZ nVwIBoyiKmGDIxS6zsQefse4PVLtGFIuTPzMnXlXdvcXy8QIKdgspkQUgcRXAYQlEDcx nmEsVPqSlaCIrF6as46LSr5sMZUhWYPlkI9cT6oj9qgKjEntwJkQfey+lXod9ntppcL4 LEUP2WTbP0VVYkq8Tt/tUmF399ErKulAJovIMJvkD4aaY+JPmLhZZGhviV7dmqwihWt6 29ntUOlp/uVMflW1dbiJCwX9iGNqn3VptSSTZ51cM8OFd8oWrzSm0Br1iUcluEu0o5bg 980Q== X-Gm-Message-State: AOAM533+p0oS3oYqm2A9JVIQTk3egmwb/9fmjYea9bn1hMr0TqK97iwl IPMcyEpg6bq5XPXzJ9hF4LM= X-Google-Smtp-Source: ABdhPJwKdgb8z/Zi7qYQGHrdITM16PURZh2DcNqLjG9LGKPHL7f9S/BxCRaz+ET6illSToAvIaAzug== X-Received: by 2002:a37:e509:: with SMTP id e9mr4357519qkg.367.1592799014922; Sun, 21 Jun 2020 21:10:14 -0700 (PDT) Original-Received: from hurd (dsl-151-141.b2b2c.ca. [66.158.151.141]) by smtp.gmail.com with ESMTPSA id z3sm12423803qkl.111.2020.06.21.21.10.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jun 2020 21:10:13 -0700 (PDT) In-Reply-To: <868sir8y85.fsf@gmail.com> (Noam Postavsky's message of "Sun, 19 Apr 2020 08:19:06 -0400") 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" Xref: news.gmane.io gmane.emacs.bugs:182270 Archived-At: --=-=-= Content-Type: text/plain Hello Noam, Noam Postavsky writes: > Maxim Cournoyer 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. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-lisp-autoload.el-Add-a-keyword-argument-to-update-di.patch >From 227fea1c404783b93540a1ca2c4c838f9c86ebba Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer 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 . * 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 --=-=-= Content-Type: text/plain Thank you! Maxim --=-=-=--