unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#23692: 25.1.50; Package.el gets confused if file has no autoloads (could be a bug in update-directory-autoloads)
@ 2016-06-03 22:03 Clément Pit--Claudel
  2016-06-03 22:50 ` Glenn Morris
  0 siblings, 1 reply; 11+ messages in thread
From: Clément Pit--Claudel @ 2016-06-03 22:03 UTC (permalink / raw)
  To: 23692


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

When the a single-package file has no autoloads, the call to update-directory-autoloads leaves the generated autoload files modified, but unsaved. This causes package.el to prompt the user about killing a modified file.

Small repro: paste the following in *scratch* and run package-install-from-buffer.


;;; test-package.el --- blah

;; Author: Me
;; Version: 1.0

(provide 'test-package)
;;; test-package.el ends here


This will show the following message: "Buffer test-package-autoloads.el modified; kill anyway? (yes or no)"

The problem happens when package.el reaches the following bit:

(defun package-generate-autoloads (name pkg-dir)
  (let* (...)
    ...
    (let ((buf (find-buffer-visiting generated-autoload-file)))
      (when buf (kill-buffer buf))) ;; <-- HERE
    ...))

The particular path that leads to an error condition is the following: inside of update-directory-autoloads, we see this:

      ;; Don't modify the file if its content has not been changed, so `make'
      ;; dependencies don't trigger unnecessarily.
      (when changed
        (let ((version-control 'never))
          (save-buffer)))

The flag `changed` is only set to `t` if files autoloads are found. However, file without autoloads also get added to the generated autoloads file:

    ;;;### (autoloads nil nil (some file names here) (0 0 0
    ;;;;;;  0))

I'm not sure which part of this is a bug: package.el assuming that update-directory-autoloads always saves the file after modifying it (which seems false), or update-directory-autoloads not saving the file. In any case, it's probably a misfeature that package.el prompts the user about killing a modified autoloads file as part of the installation process.

Thanks!
Clément.

In GNU Emacs 25.1.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
 of 2016-05-28 built on clem-w50-mint
Repository revision: 8377f2ed8aad863d6c59987b7b53fbceee46881e
Windowing system distributor 'The X.Org Foundation', version 11.0.11501000
System Description:	Linux Mint 17.3 Rosa


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-10-11 20:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-03 22:03 bug#23692: 25.1.50; Package.el gets confused if file has no autoloads (could be a bug in update-directory-autoloads) Clément Pit--Claudel
2016-06-03 22:50 ` Glenn Morris
2016-06-04  4:34   ` Clément Pit--Claudel
2016-06-06 17:24   ` Glenn Morris
2016-06-09  1:47     ` Stefan Monnier
2016-06-13 18:33       ` Glenn Morris
2016-06-14  0:40         ` Stefan Monnier
2016-10-10  9:56           ` Eli Zaretskii
2016-10-11 19:56             ` Stefan Monnier
2016-10-11 20:54               ` Eli Zaretskii
2016-06-13 22:17       ` Clément Pit--Claudel

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).