From: Alex Kost <alezost@gmail.com>
To: Federico Beffa <beffa@ieee.org>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: emacs packages
Date: Wed, 17 Jun 2015 21:21:20 +0300 [thread overview]
Message-ID: <871thatcv3.fsf@gmail.com> (raw)
In-Reply-To: <CAKrPhPMcWaO=AnnSg0h97PUr18ONcMGS2ugRmf76Ny=fUWnV0g@mail.gmail.com> (Federico Beffa's message of "Wed, 17 Jun 2015 09:42:44 +0200")
Federico Beffa (2015-06-17 10:42 +0300) wrote:
> On Tue, Jun 16, 2015 at 6:00 PM, Ludovic Courtès <ludo@gnu.org> wrote:
[...]
>>> To make those packages automatically available in Emacs without the
>>> need for any code in the user '.emacs' file, I would suggest to
>>> include in our Emacs package site initialization file some custom code
>>> (to activate our ELPA emacs packages) such as the one in the attached
>>> 'guix-elpa.el' file.
>>
>> guix.el already takes care of that (info "(guix) Emacs Initial Setup"),
>> so that should be enough.
>
> Unfortunately this doesn't work without modification. The reason is
> that I follow the emacs package.el strategy to install each ELPA
> package in it's own sub-directory. Specifically, I'm installing each
> package into ".../site-lisp/guix.d/PACKAGE-NAME-VERSION/". The code
> in 'guix.el', however, doesn't look in sub-directories below the
> profile's '.../site-lisp'.
>
> Another needed detail is the fact that some package's autoload file
> (e.g., the one used by AUCTeX) includes a (require 'XXX) statement,
Ouch, what nasty things people do!
> where XXX is a library file provided by the same package. For this to
> work, I need to add the directory with the '.el' files to 'load-path'
> before loading the autoload file. Then, some package's autoload file
> add themselves to the 'load-path'. Therefore we need to remove the
> double entry.
I think double entry will do no harm, so I'm not sure if it's worth
removing.
> This is (part of) the code that I adapted from Emacs package.el to do that:
>
> (defun guix-package-load-all (dir)
> "Activate all packages below DIR. (Adapted from Emacs
> 'package-activate-1' in 'package.el'.)"
> (when (file-directory-p dir)
> (dolist (subdir (directory-files dir))
> (let ((pkg-dir (expand-file-name subdir dir)))
> (when (file-directory-p pkg-dir)
> (let* ((pkg-desc (guix-package-load-descriptor pkg-dir))
> (name (guix-package-desc-name pkg-desc))
> (pkg-file (expand-file-name
> (format "%s-autoloads.el" name) pkg-dir)))
> (when (file-exists-p pkg-file)
> ;; For some packages to be properly loaded (e.g.,
> ;; AUCTeX), they must be on the load-path. However,
> ;; some packages add themselves to the load-path. Hence
> ;; the check to avoid duplications.
> (push pkg-dir load-path)
> (let ((old-lp load-path))
> (with-demoted-errors (load pkg-file nil t))
> (unless (eq old-lp load-path)
> (setq load-path old-lp))))))))))
>
> The reason for using separate sub-directory is to avoid name clashes
> (README, ...). Would be nice to adapt the code in guix.el to look into
> subdirectories as well.
The code for loading "…-autoloads.el" files is placed in
"guix-emacs.el", so perhaps it would be enough to adjust:
- 'guix-emacs-find-autoloads' to make it look at subdirs;
- 'guix-emacs-load-autoloads' to add the subdir to 'load-path' before
loading "…-autoloads.el".
--------
You are working on a big feature (thank you very much for that!), so
what about making "wip-emacs" (or whatever) branch for a more convenient
working on it?
--
Alex
next prev parent reply other threads:[~2015-06-17 18:21 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-15 10:20 emacs packages Federico Beffa
2015-06-15 10:45 ` Mathieu Lirzin
2015-06-16 16:00 ` Ludovic Courtès
2015-06-16 16:21 ` Pjotr Prins
2015-06-17 7:42 ` Federico Beffa
2015-06-17 18:21 ` Alex Kost [this message]
2015-06-18 18:32 ` Federico Beffa
2015-06-19 9:56 ` Alex Kost
2015-06-19 12:13 ` Ludovic Courtès
2015-06-19 16:06 ` Federico Beffa
2015-06-21 21:12 ` Ludovic Courtès
2015-06-22 7:30 ` Federico Beffa
2015-06-22 19:43 ` Ludovic Courtès
2015-06-23 6:48 ` Federico Beffa
2015-06-23 12:47 ` Ludovic Courtès
2015-06-16 16:24 ` Mark H Weaver
2015-06-16 19:31 ` Federico Beffa
2015-06-17 18:42 ` Mark H Weaver
2015-06-17 20:00 ` Alex Kost
2015-06-18 18:24 ` Federico Beffa
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=871thatcv3.fsf@gmail.com \
--to=alezost@gmail.com \
--cc=beffa@ieee.org \
--cc=guix-devel@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/guix.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.