emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Autoloads and subdirectories


From: Clément Pit--Claudel
Subject: Re: Autoloads and subdirectories
Date: Sat, 28 May 2016 01:13:40 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0

On 2016-05-28 01:00, Robert Weiner wrote:
> You missed my message and solution for this 5 days back, so I have
> included the solution here. 

Indeed, I did miss it! Thanks for sharing it.

> Just replace this one function in package.el in the lisp/emacs-lisp/
> subdirectory of your emacs installation. No one had any comments on
> it surprisingly. I have added the patch file here as well. Let me
> know how it goes for you.

It looks like a neat patch. Small question: why do you only accept directories 
that start with a letter? The regular expression that you pass to directory 
files seems rather restrictive.

That being said, this is no really the kind of answers that I'm looking for: 
applying this patch would fix the problem for future version of Emacs, but I'd 
like to support current versions of Emacs too, and the upcoming release as well.

Ideally, I'd love a solution that works with current Emacsen, and that won't be 
broken by future upstream fixes. One such solution is to statically generate my 
autoloads (using code similar to the one you posted) and ship these as part of 
my package, while adding an autoloaded form to a new file in my content 
directory that just loads the additional autoloads file that I ship. This isn't 
very pretty, though.

Thanks for your help!
Clément.

> (defun package-generate-autoloads (name pkg-dir)
>   (let* ((auto-name (format "%s-autoloads.el" name))
>          ;;(ignore-name (concat name "-pkg.el"))
>          (generated-autoload-file (expand-file-name auto-name pkg-dir))
>          ;; Silence `autoload-generate-file-autoloads'.
>          (noninteractive inhibit-message)
>          (backup-inhibited t)
>          (version-control 'never))
>     (package-autoload-ensure-default-file generated-autoload-file)
>     (apply #'update-directory-autoloads pkg-dir
>   (delq nil (mapcar (lambda (f) (and (file-directory-p f)
>      (not (file-symlink-p f))
>      f))
>     (directory-files pkg-dir t "[a-zA-Z].*" nil))))
>     (let ((buf (find-buffer-visiting generated-autoload-file)))
>       (when buf (kill-buffer buf)))
>     auto-name))
> 
> -------
> *** package-orig.el2016-05-28 00:54:25.000000000 -0400
> --- package.el2016-05-28 00:54:25.000000000 -0400
> ***************
> *** 916,928 ****
>            (backup-inhibited t)
>            (version-control 'never))
>       (package-autoload-ensure-default-file generated-autoload-file)
> !     (update-directory-autoloads pkg-dir)
>       (let ((buf (find-buffer-visiting generated-autoload-file)))
>         (when buf (kill-buffer buf)))
>       auto-name))
>   
>   (defun package--make-autoloads-and-stuff (pkg-desc pkg-dir)
>    "Generate autoloads, description file, etc.. for PKG-DESC installed at 
> PKG-DIR."
>     (package-generate-autoloads (package-desc-name pkg-desc) pkg-dir)
>     (let ((desc-file (expand-file-name (package--description-file pkg-dir)
>                                        pkg-dir)))
> --- 911,927 ----
>            (backup-inhibited t)
>            (version-control 'never))
>       (package-autoload-ensure-default-file generated-autoload-file)
> !     (apply #'update-directory-autoloads pkg-dir
> !   (delq nil (mapcar (lambda (f) (and (file-directory-p f)
> !      (not (file-symlink-p f))
> !      f))
> !     (directory-files pkg-dir t "[a-zA-Z].*" nil))))
>       (let ((buf (find-buffer-visiting generated-autoload-file)))
>         (when buf (kill-buffer buf)))
>       auto-name))
>   
>   (defun package--make-autoloads-and-stuff (pkg-desc pkg-dir)
>    "Generate autoloads, description file, etc. for PKG-DESC installed at 
> PKG-DIR."
>     (package-generate-autoloads (package-desc-name pkg-desc) pkg-dir)
>     (let ((desc-file (expand-file-name (package--description-file pkg-dir)
>                                        pkg-dir)))
> ***************
> 
> 

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]