all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH 2/2] emacs: Add 'guix-apply-manifest'.
@ 2015-05-27 17:52 Alex Kost
  2015-05-29 11:52 ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Kost @ 2015-05-27 17:52 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 230 bytes --]

With this patch, it will be possible to use "M" key in any *Guix …*
buffer to apply a manifest from file.

Many thanks to David for a great "--manifest" feature and for the idea
of this patch (I read the #guix log :-) ).


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-emacs-Add-guix-apply-manifest.patch --]
[-- Type: text/x-diff, Size: 2797 bytes --]

From d6822d5e0b982afb46aadb7d3b83e3453fd37c98 Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Wed, 27 May 2015 20:33:42 +0300
Subject: [PATCH 2/2] emacs: Add 'guix-apply-manifest'.

* emacs/guix-base.el (guix-apply-manifest): New command.
  Bind it to "M" key.
* doc/emacs.texi (Emacs General info): Document it.
---
 doc/emacs.texi     |  5 +++++
 emacs/guix-base.el | 27 +++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/doc/emacs.texi b/doc/emacs.texi
index 9678570..6c1b255 100644
--- a/doc/emacs.texi
+++ b/doc/emacs.texi
@@ -183,6 +183,11 @@ packages/generations and redisplay it.
 @item R
 Redisplay current buffer (without updating information).
 
+@item M
+Apply manifest to the current profile or to a specified profile, if
+prefix argument is used.  This has the same meaning as @code{--manifest}
+option (@pxref{Invoking guix package}).
+
 @item C-c C-z
 Go to the Guix REPL (@pxref{The REPL,,, geiser, Geiser User Manual}).
 
diff --git a/emacs/guix-base.el b/emacs/guix-base.el
index 5129c87..851ee89 100644
--- a/emacs/guix-base.el
+++ b/emacs/guix-base.el
@@ -439,6 +439,7 @@ following keywords are available:
          (define-key map (kbd "r") 'guix-history-forward)
          (define-key map (kbd "g") 'revert-buffer)
          (define-key map (kbd "R") 'guix-redisplay-buffer)
+         (define-key map (kbd "M") 'guix-apply-manifest)
          (define-key map (kbd "C-c C-z") 'guix-switch-to-repl)))))
 
 (put 'guix-define-buffer-type 'lisp-indent-function 'defun)
@@ -1022,6 +1023,32 @@ Ask a user with PROMPT for continuing an operation."
       :dry-run? (or guix-dry-run 'f))
      nil 'source-download)))
 
+;;;###autoload
+(defun guix-apply-manifest (profile file &optional operation-buffer)
+  "Apply manifest from FILE to PROFILE.
+This function has the same meaning as 'guix package --manifest' command.
+See Info node `(guix) Invoking guix package' for details.
+
+Interactively, use the current profile and prompt for manifest
+FILE.  With a prefix argument, also prompt for PROFILE."
+  (interactive
+   (let* ((default-profile (or guix-profile guix-current-profile))
+          (profile (if current-prefix-arg
+                       (guix-profile-prompt)
+                     default-profile))
+          (file (read-file-name "File with manifest: "))
+          (buffer (and guix-profile (current-buffer))))
+     (list profile file buffer)))
+  (when (or (not guix-operation-confirm)
+            (y-or-n-p (format "Apply manifest from '%s' to profile '%s'? "
+                              file profile)))
+    (guix-eval-in-repl
+     (guix-make-guile-expression
+      'guix-package
+      (concat "--profile=" profile)
+      (concat "--manifest=" file))
+     operation-buffer)))
+
 \f
 ;;; Pull
 
-- 
2.4.0


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

* Re: [PATCH 2/2] emacs: Add 'guix-apply-manifest'.
  2015-05-27 17:52 [PATCH 2/2] emacs: Add 'guix-apply-manifest' Alex Kost
@ 2015-05-29 11:52 ` Ludovic Courtès
  2015-05-29 18:24   ` Alex Kost
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2015-05-29 11:52 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> With this patch, it will be possible to use "M" key in any *Guix …*
> buffer to apply a manifest from file.

Excellent!

> Many thanks to David for a great "--manifest" feature and for the idea
> of this patch (I read the #guix log :-) ).

Ah ah, we only need to mention our wishes for the Emacs UI, and the next
day a patch comes in.  This is ideal!  :-)

> From d6822d5e0b982afb46aadb7d3b83e3453fd37c98 Mon Sep 17 00:00:00 2001
> From: Alex Kost <alezost@gmail.com>
> Date: Wed, 27 May 2015 20:33:42 +0300
> Subject: [PATCH 2/2] emacs: Add 'guix-apply-manifest'.
>
> * emacs/guix-base.el (guix-apply-manifest): New command.
>   Bind it to "M" key.
> * doc/emacs.texi (Emacs General info): Document it.

OK!

Ludo’.

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

* Re: [PATCH 2/2] emacs: Add 'guix-apply-manifest'.
  2015-05-29 11:52 ` Ludovic Courtès
@ 2015-05-29 18:24   ` Alex Kost
  2015-05-29 18:59     ` Thompson, David
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Kost @ 2015-05-29 18:24 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2015-05-29 14:52 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> With this patch, it will be possible to use "M" key in any *Guix …*
>> buffer to apply a manifest from file.
>
> Excellent!
>
>> Many thanks to David for a great "--manifest" feature and for the idea
>> of this patch (I read the #guix log :-) ).
>
> Ah ah, we only need to mention our wishes for the Emacs UI, and the next
> day a patch comes in.  This is ideal!  :-)

Not really :-)  I remember about a wish of integrating "guix.el" with
"guix environment" but it's still just a wish.

>> From d6822d5e0b982afb46aadb7d3b83e3453fd37c98 Mon Sep 17 00:00:00 2001
>> From: Alex Kost <alezost@gmail.com>
>> Date: Wed, 27 May 2015 20:33:42 +0300
>> Subject: [PATCH 2/2] emacs: Add 'guix-apply-manifest'.
>>
>> * emacs/guix-base.el (guix-apply-manifest): New command.
>>   Bind it to "M" key.
>> * doc/emacs.texi (Emacs General info): Document it.
>
> OK!

Thanks for reviewing the patches!

-- 
Alex

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

* Re: [PATCH 2/2] emacs: Add 'guix-apply-manifest'.
  2015-05-29 18:24   ` Alex Kost
@ 2015-05-29 18:59     ` Thompson, David
  2015-05-29 20:22       ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Thompson, David @ 2015-05-29 18:59 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

On Fri, May 29, 2015 at 2:24 PM, Alex Kost <alezost@gmail.com> wrote:
> Ludovic Courtès (2015-05-29 14:52 +0300) wrote:
>
>> Alex Kost <alezost@gmail.com> skribis:
>>
>>> Many thanks to David for a great "--manifest" feature and for the idea
>>> of this patch (I read the #guix log :-) ).
>>
>> Ah ah, we only need to mention our wishes for the Emacs UI, and the next
>> day a patch comes in.  This is ideal!  :-)
>
> Not really :-)  I remember about a wish of integrating "guix.el" with
> "guix environment" but it's still just a wish.

I've been wishing for that more and more lately, so that I could spawn
Guile REPLs with Geiser that are using the correct environment.  Chop
chop! ;)

-Dave

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

* Re: [PATCH 2/2] emacs: Add 'guix-apply-manifest'.
  2015-05-29 18:59     ` Thompson, David
@ 2015-05-29 20:22       ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2015-05-29 20:22 UTC (permalink / raw)
  To: Thompson, David; +Cc: guix-devel, Alex Kost

"Thompson, David" <dthompson2@worcester.edu> skribis:

> On Fri, May 29, 2015 at 2:24 PM, Alex Kost <alezost@gmail.com> wrote:
>> Ludovic Courtès (2015-05-29 14:52 +0300) wrote:
>>
>>> Alex Kost <alezost@gmail.com> skribis:
>>>
>>>> Many thanks to David for a great "--manifest" feature and for the idea
>>>> of this patch (I read the #guix log :-) ).
>>>
>>> Ah ah, we only need to mention our wishes for the Emacs UI, and the next
>>> day a patch comes in.  This is ideal!  :-)
>>
>> Not really :-)  I remember about a wish of integrating "guix.el" with
>> "guix environment" but it's still just a wish.
>
> I've been wishing for that more and more lately, so that I could spawn
> Guile REPLs with Geiser that are using the correct environment.  Chop
> chop! ;)

Oh that’s right!  I often find myself doing

  M-x compile cd /foobar ; guix environment foobar -E 'some long command'

and that’s not as convenient as it could be.

Wishfully,
Ludo’.  :-)

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

end of thread, other threads:[~2015-05-29 20:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-27 17:52 [PATCH 2/2] emacs: Add 'guix-apply-manifest' Alex Kost
2015-05-29 11:52 ` Ludovic Courtès
2015-05-29 18:24   ` Alex Kost
2015-05-29 18:59     ` Thompson, David
2015-05-29 20:22       ` Ludovic Courtès

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.