Re: Howto run guix.el correctly?

2014-12-02 Thread Ludovic Courtès
Alex Kost alez...@gmail.com skribis:

 Ludovic Courtès (2014-12-01 15:49 +0300) wrote:

 Alex Kost alez...@gmail.com skribis:

 [...]
 Thanks, I have created wip-emacs-packages branch: the elisp code is
 ready, so now I'm going to walk through existing emacs packages in order
 to add “…-autoloads.el” to each one.

 I just browsed it, and it looks good so far.

 OK, I think I finished it.  I tried to describe the new feature in the
 manual.  Should it be improved somehow?

It looks good to me, nothing to add.

 Also I think it would be better to squash all those “gnu: emacs: Add
 ...-autoloads.el.” into a single commit.  WDYT?

Either way is fine with me; do as seems best to you.

 And after that I believe all that may go to master.

Agreed.

 I was just thinking: if we want to take over the Emacs world, we need an
 ELPA importer for ‘guix import’.  (In case you were wondering what to do
 next.  ;-))

 Sorry, I'm not interested in it :-(

No problem, maybe someone else, who knows?  :-)

Thank you!

Ludo’.



Re: Howto run guix.el correctly?

2014-12-02 Thread Alex Kost
Ludovic Courtès (2014-12-02 11:39 +0300) wrote:

 Alex Kost alez...@gmail.com skribis:

 Ludovic Courtès (2014-12-01 15:49 +0300) wrote:

 Alex Kost alez...@gmail.com skribis:

 [...]
 Thanks, I have created wip-emacs-packages branch: the elisp code is
 ready, so now I'm going to walk through existing emacs packages in order
 to add “…-autoloads.el” to each one.

 I just browsed it, and it looks good so far.

 OK, I think I finished it.  I tried to describe the new feature in the
 manual.  Should it be improved somehow?

 It looks good to me, nothing to add.

 Also I think it would be better to squash all those “gnu: emacs: Add
 ...-autoloads.el.” into a single commit.  WDYT?

 Either way is fine with me; do as seems best to you.

OK, I squashed them up; it looks cleaner for me this way.

 And after that I believe all that may go to master.

 Agreed.

Thanks, done.

-- 
Alex



Re: Howto run guix.el correctly?

2014-12-01 Thread Alex Kost
Ludovic Courtès (2014-11-27 01:41 +0300) wrote:

 Alex Kost alez...@gmail.com skribis:

[...]
 Actually, since it’s going to be used in most packages, what about
 adding an ‘install-autoloads’ procedure in (guix build emacs-utils)?
 So the above would become

   (alist-cons-after
'install 'post-install
(lambda* (#:key outputs #:allow-other-keys)
  (install-autoloads (assoc-ref outputs out)))
%standard-phases)

 OK.

 Or better yet, (guix build emacs-utils) could provide
 %standard-emacs-phases.

 WDYT?

 The problem is that I don't understand what these %standard-emacs-phases
 should be,

 (define %standard-emacs-phases
   (alist-cons-after
'install 'post-install
(lambda* (#:key outputs #:allow-other-keys)
  (install-autoloads (assoc-ref outputs out)))
%standard-phases))

Sorry, I didn't get how it would work.  I realized that I don't
understand how there could be a generalized ‘install-autoloads’
procedure as it should do different things for different packages.

 that's why I wanted to do it step-by-step.  I don't see general
 patterns right now.  Some packages would require just making a link as
 with geiser, other packages require generating autoloads and maybe
 some others require additional steps.  What about making
 wip-emacs-packages branch and to put the appropriate changes there
 for now?

 Sure!

Thanks, I have created wip-emacs-packages branch: the elisp code is
ready, so now I'm going to walk through existing emacs packages in order
to add “…-autoloads.el” to each one.

-- 
Alex



Re: Howto run guix.el correctly?

2014-12-01 Thread Federico Beffa
l...@gnu.org (Ludovic Courtès) writes:

 Alex Kost alez...@gmail.com skribis:

 Ludovic Courtès (2014-11-27 01:41 +0300) wrote:

 [...]

 The problem is that I don't understand what these %standard-emacs-phases
 should be,

 (define %standard-emacs-phases
   (alist-cons-after
'install 'post-install
(lambda* (#:key outputs #:allow-other-keys)
  (install-autoloads (assoc-ref outputs out)))
%standard-phases))

 Sorry, I didn't get how it would work.  I realized that I don't
 understand how there could be a generalized ‘install-autoloads’
 procedure as it should do different things for different packages.


AFAIU the initialization of each package is already defined inside each
package by the author. The way emacs's packaging infrastructure works
goes along the lines (see (elisp) Packaging Basics):

* At installation:

  - Search every Lisp file in the content directory for autoload magic
comments (*note Autoload::).  These autoload definitions are saved
to a file named `NAME-autoloads.el' in the package's content
directory.

  - Byte-compiles every Lisp file in the package.

  - Add the package's content directory to `load-path', and evaluates
the autoload definitions in `NAME-autoloads.el'.

* At startup:

  - Emacs scans for a predefined directory for NAME-autoloads.el files
and evaluates them ('package-initialize' function). We could maybe
exploit 'after-init-hook' or something something similar.

Regards,
Fede



Re: Howto run guix.el correctly?

2014-11-26 Thread Ludovic Courtès
Alex Kost alez...@gmail.com skribis:

 As I wrote at
 http://lists.gnu.org/archive/html/guix-devel/2014-08/msg00165.html, I
 see the only way to achieve that:

 - to modify emacs package recipes so that they will provide some files
   with all required initial configuration (and to name such file
   …-autoloads.el, for example);

‘FOO-autoloads.el’ is the most common convention, right?

 - to modify “guix-init.el” so that (require 'guix-init) will load those
   autoloads files;

 - to write some elisp code for auto-loading …-autoloads.el on the fly
   — i.e., to make it possible to install an Emacs package using
   guix.el and to use M-x package-command immediately.

Yep, that sounds good.

 So if it's acceptable, what about modifying the current recipes
 step-by-step.  With geiser it's easy: as geiser-install.el provides
 all required setup (including autoloads for M-x … commands),
 geiser-autoloads.el may just be a symlink to geiser-install.el.  I'm
 attaching the patch for that.

Yes.

 +(arguments
 + '(#:phases (alist-cons-after
 + 'install 'post-install
 + (lambda* (#:key outputs #:allow-other-keys)
 +   (symlink geiser-install.el
 +(string-append (assoc-ref outputs out)
 +   /share/emacs/site-lisp/
 +   geiser-autoloads.el)))
 + %standard-phases)))

This particular instance won’t work because it’s called from
$top_builddir.

Actually, since it’s going to be used in most packages, what about
adding an ‘install-autoloads’ procedure in (guix build emacs-utils)?
So the above would become

  (alist-cons-after
   'install 'post-install
   (lambda* (#:key outputs #:allow-other-keys)
 (install-autoloads (assoc-ref outputs out)))
   %standard-phases)

Or better yet, (guix build emacs-utils) could provide
%standard-emacs-phases.

WDYT?

Thanks,
Ludo’.



Re: Howto run guix.el correctly?

2014-11-26 Thread Alex Kost
Adam Pribyl (2014-11-23 00:04 +0300) wrote:

 On Sat, 22 Nov 2014, Alex Kost wrote:

 Adam Pribyl (2014-11-22 01:28 +0300) wrote:

 I have folloed the instruction in
 http://www.gnu.org/software/guix/manual/guix.html#Emacs-Interface
 to get the emacs interface for guix, but there is something missing
 probably.

 Installation of emacs and geiser was OK, I changed the path to guix.el
 (there is no /usr/share/ in my guix installation, I had to find guix.el
 in the /gnu/store), after that I can start emacs and M-x guix-... but
 every action says Cannot open load file: no such file or directory
 geiser-mode.

 If you mean you did (add-to-list 'load-path /gnu/store/...), then it's
 definitely not right.

 There should probably be also the geiser path in the emacs init file or
 something?

 I assume you use a Guix (or GNU or whatever it should be called)
 system.  I must admit I have not tried it yet, and all I know about
 setting guix.el there I learnt from a chat with davexunit on #guix
 today.

 So I think the following should be added to your emacs config:

 - Add dirs with guix.el and geiser to load-path (I'm absolutely
  not sure about the correctness of the paths, so double check please):

  (add-to-list 'load-path 
 /run/current-system/profile/share/emacs/site-lisp/)
  (add-to-list 'load-path ~/.guix-profile/share/emacs/site-lisp)

 - Initial setup of geiser:

  (require 'geiser-install)

 - Initial setup of guix:

  (require 'guix-init)

 Right, I am testing it under GNU system (USB installed image with guix
 0.8). Thanks for the point regarding geiser. This is now my ~/.emacs

 (add-to-list 'load-path
 /gnu/store/ysh4fvnxr0p8xrphcikivpafgvf6g18m-guix-0.8/share/emacs/site-lisp/)
 (add-to-list 'load-path ~/.guix-profile/share/emacs/site-lisp)
 (require 'geiser-install)
 (require 'guix-init)

 Reason for the /gnu/store path is, that guix.el is a part of guix and I
 did not found it in any profile. I've added my profile path, where the
 geiser is (as it is installed by this user), but the /run/current-system
 has no share/emacs at all. I do not know why.

Did you check the right path?  It's
/run/current-system/profile/share/emacs..., not
/run/current-system/share/emacs/...

 While I got further, it is still somewhat confused as invoking
 guix-all-available-packages results in error in process sentinel: Text
 is read-only
 No prompt found!

Thanks Adam and David for reporting.  You encouraged me to install the
system (at last).  So the problem was that a default directory with guix
scheme files was not added to the %load-path (it is fixed with commit
cbbc877).  As a workaround you may perform guix pull – after that the
REPL should start without errors.

So to recap, to make guix.el work in the current system one should do
the following:

1. guix pull to populate ~/.config/guix/latest  (this step will not
   be required for the future releases)

2. Install geiser: guix package -i geiser

3. Setup geiser  (hopefully this step will not be required soon)
   Put in your emacs config:

   (add-to-list 'load-path ~/.guix-profile/share/emacs/site-lisp)
   (require 'geiser-install)

4. Setup guix.el.  Put in your emacs config:

   (add-to-list 'load-path path-to-a-directory-with-guix.el)
   (require 'guix-init)

I appreciate if someone confirm that the above works (or doesn't work :-)).

-- 
Alex



Re: Howto run guix.el correctly?

2014-11-26 Thread Alex Kost
Ludovic Courtès (2014-11-26 19:23 +0300) wrote:

 Alex Kost alez...@gmail.com skribis:

 As I wrote at
 http://lists.gnu.org/archive/html/guix-devel/2014-08/msg00165.html, I
 see the only way to achieve that:

 - to modify emacs package recipes so that they will provide some files
   with all required initial configuration (and to name such file
   …-autoloads.el, for example);

 ‘FOO-autoloads.el’ is the most common convention, right?

I think there is no any convention on this, but emacs package system
generates “foo-autoloads.el” indeed.

 - to modify “guix-init.el” so that (require 'guix-init) will load those
   autoloads files;

 - to write some elisp code for auto-loading …-autoloads.el on the fly
   — i.e., to make it possible to install an Emacs package using
   guix.el and to use M-x package-command immediately.

 Yep, that sounds good.

 So if it's acceptable, what about modifying the current recipes
 step-by-step.  With geiser it's easy: as geiser-install.el provides
 all required setup (including autoloads for M-x … commands),
 geiser-autoloads.el may just be a symlink to geiser-install.el.  I'm
 attaching the patch for that.

 Yes.

 +(arguments
 + '(#:phases (alist-cons-after
 + 'install 'post-install
 + (lambda* (#:key outputs #:allow-other-keys)
 +   (symlink geiser-install.el
 +(string-append (assoc-ref outputs out)
 +   /share/emacs/site-lisp/
 +   geiser-autoloads.el)))
 + %standard-phases)))

 This particular instance won’t work because it’s called from
 $top_builddir.

Sorry I didn't understand why it wouldn't work.  I tried it and it worked
as I expected: a proper geiser-autoloads.el symlink was created.

 Actually, since it’s going to be used in most packages, what about
 adding an ‘install-autoloads’ procedure in (guix build emacs-utils)?
 So the above would become

   (alist-cons-after
'install 'post-install
(lambda* (#:key outputs #:allow-other-keys)
  (install-autoloads (assoc-ref outputs out)))
%standard-phases)

OK.

 Or better yet, (guix build emacs-utils) could provide
 %standard-emacs-phases.

 WDYT?

The problem is that I don't understand what these %standard-emacs-phases
should be, that's why I wanted to do it step-by-step.  I don't see
general patterns right now.  Some packages would require just making a
link as with geiser, other packages require generating autoloads and
maybe some others require additional steps.  What about making
wip-emacs-packages branch and to put the appropriate changes there for
now?

-- 
Alex



Re: Howto run guix.el correctly?

2014-11-26 Thread Ludovic Courtès
Alex Kost alez...@gmail.com skribis:

 Ludovic Courtès (2014-11-26 19:23 +0300) wrote:

[...]

 +(arguments
 + '(#:phases (alist-cons-after
 + 'install 'post-install
 + (lambda* (#:key outputs #:allow-other-keys)
 +   (symlink geiser-install.el
 +(string-append (assoc-ref outputs out)
 +   /share/emacs/site-lisp/
 +   geiser-autoloads.el)))
 + %standard-phases)))

 This particular instance won’t work because it’s called from
 $top_builddir.

 Sorry I didn't understand why it wouldn't work.  I tried it and it worked
 as I expected: a proper geiser-autoloads.el symlink was created.

Oh indeed, I misunderstood the code above, sorry.

 Actually, since it’s going to be used in most packages, what about
 adding an ‘install-autoloads’ procedure in (guix build emacs-utils)?
 So the above would become

   (alist-cons-after
'install 'post-install
(lambda* (#:key outputs #:allow-other-keys)
  (install-autoloads (assoc-ref outputs out)))
%standard-phases)

 OK.

 Or better yet, (guix build emacs-utils) could provide
 %standard-emacs-phases.

 WDYT?

 The problem is that I don't understand what these %standard-emacs-phases
 should be,

(define %standard-emacs-phases
  (alist-cons-after
   'install 'post-install
   (lambda* (#:key outputs #:allow-other-keys)
 (install-autoloads (assoc-ref outputs out)))
   %standard-phases))

 that's why I wanted to do it step-by-step.  I don't see general
 patterns right now.  Some packages would require just making a link as
 with geiser, other packages require generating autoloads and maybe
 some others require additional steps.  What about making
 wip-emacs-packages branch and to put the appropriate changes there
 for now?

Sure!

Thank you,
Ludo’.



Re: Howto run guix.el correctly?

2014-11-25 Thread Alex Kost
Ludovic Courtès (2014-11-24 23:42 +0300) wrote:

 Alex Kost alez...@gmail.com skribis:

 No need to fiddle with ‘geiser-scheme-dir’: it should be set properly if
 you have ‘(require 'geiser-install)’ in your emacs config.

 Oops, indeed, PEBKAC: I was just unaware of ‘geiser-install’, and
 everything was fine when I used Geiser from ELPA because that happens
 automagically.

Yes, that's the point: if you install Emacs packages using the Emacs
package system, everything should work out of the box.  If a package is
installed manually or with some distro's package manager, a user needs
to figure out what he should put in his config to complete the
installation.

 It would be nice if guix.el somehow had that works-out-of-the-box
 property when installing Emacs extensions.  :-)

As I wrote at
http://lists.gnu.org/archive/html/guix-devel/2014-08/msg00165.html, I
see the only way to achieve that:

- to modify emacs package recipes so that they will provide some files
  with all required initial configuration (and to name such file
  …-autoloads.el, for example);

- to modify “guix-init.el” so that (require 'guix-init) will load those
  autoloads files;

- to write some elisp code for auto-loading …-autoloads.el on the fly
  — i.e., to make it possible to install an Emacs package using
  guix.el and to use M-x package-command immediately.

So if it's acceptable, what about modifying the current recipes
step-by-step.  With geiser it's easy: as geiser-install.el provides
all required setup (including autoloads for M-x … commands),
geiser-autoloads.el may just be a symlink to geiser-install.el.  I'm
attaching the patch for that.

I'm going to send patch(es) for the elisp code later.

From 49faffe688c53e9d9197ac9e07511ba0de501840 Mon Sep 17 00:00:00 2001
From: Alex Kost alez...@gmail.com
Date: Tue, 25 Nov 2014 16:50:11 +0300
Subject: [PATCH] gnu: emacs: Add geiser-autoloads.el.

* gnu/packages/emacs.scm (geiser): Add 'post-install' phase for creating
  geiser-autoloads.el.
---
 gnu/packages/emacs.scm | 9 +
 1 file changed, 9 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 119c613..bde707d 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -135,6 +135,15 @@ editor (without an X toolkit) )
  (sha256
   (base32 1mrk0bzqcpfhsw6635qznn47nzfy9ps7wrhkpymswdfpw5mdsry5
 (build-system gnu-build-system)
+(arguments
+ '(#:phases (alist-cons-after
+ 'install 'post-install
+ (lambda* (#:key outputs #:allow-other-keys)
+   (symlink geiser-install.el
+(string-append (assoc-ref outputs out)
+   /share/emacs/site-lisp/
+   geiser-autoloads.el)))
+ %standard-phases)))
 (inputs `((guile ,guile-2.0)
   (emacs ,emacs)))
 (home-page http://nongnu.org/geiser/;)
-- 
2.1.3



Re: Howto run guix.el correctly?

2014-11-22 Thread Alex Kost
Adam Pribyl (2014-11-22 01:28 +0300) wrote:

 I have folloed the instruction in
 http://www.gnu.org/software/guix/manual/guix.html#Emacs-Interface
 to get the emacs interface for guix, but there is something missing
 probably.

 Installation of emacs and geiser was OK, I changed the path to guix.el
 (there is no /usr/share/ in my guix installation, I had to find guix.el
 in the /gnu/store), after that I can start emacs and M-x guix-... but
 every action says Cannot open load file: no such file or directory
 geiser-mode.

 There should probably be also the geiser path in the emacs init file or
 something?

Apparently a directory with geiser is not in your `load-path' variable,
so (require 'geiser-mode) fails.

Did you install geiser with guix?  If so, you probably need to add
~/.guix-profile/share/emacs/site-lisp to `load-path'.

-- 
Alex



Re: Howto run guix.el correctly?

2014-11-22 Thread Ludovic Courtès
Alex Kost alez...@gmail.com skribis:

 Did you install geiser with guix?  If so, you probably need to add
 ~/.guix-profile/share/emacs/site-lisp to `load-path'.

Yes, and also something like:

  (setq-default geiser-guile-load-path (list geiser-scheme-dir))

We should find a way to make things work out of the box.

Ludo’.



Re: Howto run guix.el correctly?

2014-11-22 Thread Alex Kost
Ludovic Courtès (2014-11-22 13:52 +0300) wrote:

 Alex Kost alez...@gmail.com skribis:

 Did you install geiser with guix?  If so, you probably need to add
 ~/.guix-profile/share/emacs/site-lisp to `load-path'.

 Yes, and also something like:

   (setq-default geiser-guile-load-path (list geiser-scheme-dir))

Is it really needed?  Geiser should respect ‘geiser-scheme-dir’ by
default.

 We should find a way to make things work out of the box.

These lines may just be added to “guix-init.el.in”.

-- 
Alex



Re: Howto run guix.el correctly?

2014-11-22 Thread Alex Kost
Adam Pribyl (2014-11-22 01:28 +0300) wrote:

 I have folloed the instruction in
 http://www.gnu.org/software/guix/manual/guix.html#Emacs-Interface
 to get the emacs interface for guix, but there is something missing
 probably.

 Installation of emacs and geiser was OK, I changed the path to guix.el
 (there is no /usr/share/ in my guix installation, I had to find guix.el
 in the /gnu/store), after that I can start emacs and M-x guix-... but
 every action says Cannot open load file: no such file or directory
 geiser-mode.

If you mean you did (add-to-list 'load-path /gnu/store/...), then it's
definitely not right.

 There should probably be also the geiser path in the emacs init file or
 something?

I assume you use a Guix (or GNU or whatever it should be called)
system.  I must admit I have not tried it yet, and all I know about
setting guix.el there I learnt from a chat with davexunit on #guix
today.

So I think the following should be added to your emacs config:

- Add dirs with guix.el and geiser to load-path (I'm absolutely
  not sure about the correctness of the paths, so double check please):

  (add-to-list 'load-path /run/current-system/profile/share/emacs/site-lisp/)
  (add-to-list 'load-path ~/.guix-profile/share/emacs/site-lisp)

- Initial setup of geiser:

  (require 'geiser-install)

- Initial setup of guix:

  (require 'guix-init)

-- 
Alex



Re: Howto run guix.el correctly?

2014-11-22 Thread David Thompson
Adam Pribyl pri...@lowlevel.cz writes:

 (add-to-list 'load-path 
 /gnu/store/ysh4fvnxr0p8xrphcikivpafgvf6g18m-guix-0.8/share/emacs/site-lisp/)
 (add-to-list 'load-path ~/.guix-profile/share/emacs/site-lisp)
 (require 'geiser-install)
 (require 'guix-init)

 Reason for the /gnu/store path is, that guix.el is a part of guix and I 
 did not found it in any profile. I've added my profile path, where the 
 geiser is (as it is installed by this user), but the /run/current-system 
 has no share/emacs at all. I do not know why.

 While I got further, it is still somewhat confused as invoking 
 guix-all-available-packages results in 
 error in process sentinel: Text is read-only
 No prompt found!

I am experiencing the exact same issue.  If you check *Guix REPL*,
you'll see that compiling 'guix-main.scm' fails for some reason.  Not
sure why.  I gave up on it for now.

-- 
David Thompson
Web Developer - Free Software Foundation - http://fsf.org
GPG Key: 0FF1D807
Support the FSF: https://fsf.org/donate



Re: Howto run guix.el correctly?

2014-11-22 Thread Ludovic Courtès
David Thompson dthomps...@worcester.edu skribis:

 I am experiencing the exact same issue.  If you check *Guix REPL*,
 you'll see that compiling 'guix-main.scm' fails for some reason.  Not
 sure why.  I gave up on it for now.

Can you try ,bt and ,error in there?

Most likely, either Geiser’s or Guix’s Scheme modules are not in the
search path when the REPL is started.  I had to fiddle with
‘geiser-scheme-dir’ and ‘geiser-guile-load-path’.

Ludo’.



Re: Howto run guix.el correctly?

2014-11-22 Thread Alex Kost
Ludovic Courtès (2014-11-23 01:17 +0300) wrote:

 David Thompson dthomps...@worcester.edu skribis:

 I am experiencing the exact same issue.  If you check *Guix REPL*,
 you'll see that compiling 'guix-main.scm' fails for some reason.  Not
 sure why.  I gave up on it for now.

 Can you try ,bt and ,error in there?

IIUC the REPL is dead, so what can be done is sending the full contents
of *Guix REPL* buffer here so we could look at it.

 Most likely, either Geiser’s or Guix’s Scheme modules are not in the
 search path when the REPL is started.  I had to fiddle with
 ‘geiser-scheme-dir’ and ‘geiser-guile-load-path’.

No need to fiddle with ‘geiser-scheme-dir’: it should be set properly if
you have ‘(require 'geiser-install)’ in your emacs config.

Also you made a commit for ‘geiser-guile-load-path’ (a1ca1b7) after the
release, so fiddling with this var will not take any effect.

David wrote on #guix that he has ~/.guile file with some additional
settings.  AFAICT it is loaded only if ‘geiser-guile-load-init-file-p’
was set to a non-nil value.

-- 
Alex