* [PATCH 0/3] emacs: Few improvements.
@ 2016-02-13 19:04 Alex Kost
2016-02-13 19:04 ` [PATCH 1/3] emacs: Add 'M-x guix-installed-{user/system}-packages' Alex Kost
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Alex Kost @ 2016-02-13 19:04 UTC (permalink / raw)
To: guix-devel
A couple of fixes/improvements discovered in bug reports opened by myglc2.
Patches:
[PATCH 1/3] emacs: Add 'M-x guix-installed-{user/system}-packages'.
As proposed at <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22600#21>.
[PATCH 2/3] emacs: Set 'guix-buffer-item' before displaying entries.
This is a required change for the next patch.
[PATCH 3/3] emacs: Do not allow to modify system profiles.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/3] emacs: Add 'M-x guix-installed-{user/system}-packages'.
2016-02-13 19:04 [PATCH 0/3] emacs: Few improvements Alex Kost
@ 2016-02-13 19:04 ` Alex Kost
2016-02-21 22:03 ` Ludovic Courtès
2016-02-13 19:04 ` [PATCH 2/3] emacs: Set 'guix-buffer-item' before displaying entries Alex Kost
2016-02-13 19:04 ` [PATCH 3/3] emacs: Do not allow to modify system profiles Alex Kost
2 siblings, 1 reply; 10+ messages in thread
From: Alex Kost @ 2016-02-13 19:04 UTC (permalink / raw)
To: guix-devel
* emacs/guix-ui-package.el (guix-installed-user-packages)
(guix-installed-system-packages): New commands.
* doc/emacs.texi (Emacs Commands): Document them.
---
doc/emacs.texi | 8 +++++++-
emacs/guix-ui-package.el | 13 +++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/doc/emacs.texi b/doc/emacs.texi
index dbe59f0..27f5365 100644
--- a/doc/emacs.texi
+++ b/doc/emacs.texi
@@ -150,7 +150,13 @@ Commands for displaying packages:
Display all/newest available packages.
@item M-x guix-installed-packages
-Display all installed packages.
+@itemx M-x guix-installed-user-packages
+@itemx M-x guix-installed-system-packages
+Display installed packages. As described above, @kbd{M-x
+guix-installed-packages} uses an arbitrary profile that you can specify,
+while the other commands display packages installed in 2 special
+profiles: @file{~/.guix-profile} and @file{/run/current-system/profile}
+(only on GuixSD).
@item M-x guix-obsolete-packages
Display obsolete packages (the packages that are installed in a profile
diff --git a/emacs/guix-ui-package.el b/emacs/guix-ui-package.el
index ff10a1e..78d2c40 100644
--- a/emacs/guix-ui-package.el
+++ b/emacs/guix-ui-package.el
@@ -982,6 +982,19 @@ Interactively with prefix, prompt for PROFILE."
(guix-package-get-display profile 'installed))
;;;###autoload
+(defun guix-installed-user-packages ()
+ "Display information about Guix packages installed in a user profile."
+ (interactive)
+ (guix-installed-packages guix-user-profile))
+
+;;;###autoload
+(defun guix-installed-system-packages ()
+ "Display information about Guix packages installed in a system profile."
+ (interactive)
+ (guix-installed-packages
+ (guix-packages-profile guix-system-profile nil t)))
+
+;;;###autoload
(defun guix-obsolete-packages (&optional profile)
"Display information about obsolete Guix packages.
If PROFILE is nil, use `guix-current-profile'.
--
2.6.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/3] emacs: Set 'guix-buffer-item' before displaying entries.
2016-02-13 19:04 [PATCH 0/3] emacs: Few improvements Alex Kost
2016-02-13 19:04 ` [PATCH 1/3] emacs: Add 'M-x guix-installed-{user/system}-packages' Alex Kost
@ 2016-02-13 19:04 ` Alex Kost
2016-02-21 22:06 ` Ludovic Courtès
2016-02-13 19:04 ` [PATCH 3/3] emacs: Do not allow to modify system profiles Alex Kost
2 siblings, 1 reply; 10+ messages in thread
From: Alex Kost @ 2016-02-13 19:04 UTC (permalink / raw)
To: guix-devel
* emacs/guix-buffer.el (guix-buffer-set): Set 'guix-buffer-item' early,
so that it can be used during displaying entries. For example, this
allows to use a value of the current guix profile when package entries
are inserted in a "List" or "Info" buffer.
---
emacs/guix-buffer.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/emacs/guix-buffer.el b/emacs/guix-buffer.el
index af76e63..873540b 100644
--- a/emacs/guix-buffer.el
+++ b/emacs/guix-buffer.el
@@ -241,8 +241,8 @@ HISTORY should be one of the following:
`replace' - replace the current history item."
(guix-buffer-with-item buffer-item
(when %entries
- (guix-buffer-show-entries %entries %buffer-type %entry-type)
(setq guix-buffer-item buffer-item)
+ (guix-buffer-show-entries %entries %buffer-type %entry-type)
(when history
(funcall (cl-ecase history
(add #'guix-history-add)
--
2.6.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] emacs: Do not allow to modify system profiles.
2016-02-13 19:04 [PATCH 0/3] emacs: Few improvements Alex Kost
2016-02-13 19:04 ` [PATCH 1/3] emacs: Add 'M-x guix-installed-{user/system}-packages' Alex Kost
2016-02-13 19:04 ` [PATCH 2/3] emacs: Set 'guix-buffer-item' before displaying entries Alex Kost
@ 2016-02-13 19:04 ` Alex Kost
2016-02-21 22:07 ` Ludovic Courtès
2 siblings, 1 reply; 10+ messages in thread
From: Alex Kost @ 2016-02-13 19:04 UTC (permalink / raw)
To: guix-devel
Fixes <http://bugs.gnu.org/22607>.
Reported by myglc2 <myglc2@gmail.com>.
Remove possibilities to install/delete packages to/from a system profile
both for "Package List" and "Package Info" buffers.
* emacs/guix-profiles.el (guix-system-profile-regexp): New variable.
(guix-system-profile?): New procedure.
* emacs/guix-ui-package.el (guix-package-info-insert-output): Do not
display "Install"/"Delete" button for a system profile.
(guix-package-assert-non-system-profile): New procedure.
(guix-package-execute-actions): Use it.
---
emacs/guix-profiles.el | 8 ++++++++
emacs/guix-ui-package.el | 27 ++++++++++++++++++++++-----
2 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/emacs/guix-profiles.el b/emacs/guix-profiles.el
index 43ad1d4..12cf46d 100644
--- a/emacs/guix-profiles.el
+++ b/emacs/guix-profiles.el
@@ -40,6 +40,14 @@
(defvar guix-current-profile guix-default-profile
"Current profile.")
+(defvar guix-system-profile-regexp
+ (concat "\\`" (regexp-quote guix-system-profile))
+ "Regexp matching system profiles.")
+
+(defun guix-system-profile? (profile)
+ "Return non-nil, if PROFILE is a system one."
+ (string-match-p guix-system-profile-regexp profile))
+
(defun guix-profile-prompt (&optional default)
"Prompt for profile and return it.
Use DEFAULT as a start directory. If it is nil, use
diff --git a/emacs/guix-ui-package.el b/emacs/guix-ui-package.el
index 78d2c40..c92108b 100644
--- a/emacs/guix-ui-package.el
+++ b/emacs/guix-ui-package.el
@@ -454,17 +454,22 @@ current OUTPUT is installed (if there is such output in
(string= (guix-entry-value entry 'output)
output))
installed))
- (action-type (if installed-entry 'delete 'install)))
+ (action-type (if installed-entry 'delete 'install))
+ (profile (guix-ui-current-profile)))
(guix-info-insert-indent)
(guix-format-insert output
(if installed-entry
'guix-package-info-installed-outputs
'guix-package-info-uninstalled-outputs)
guix-package-info-output-format)
- (guix-package-info-insert-action-button action-type entry output)
- (when obsolete
- (guix-info-insert-indent)
- (guix-package-info-insert-action-button 'upgrade entry output))
+ ;; Do not allow to install/delete anything to/from a system profile,
+ ;; so add action buttons only for non-system profiles.
+ (when (and profile
+ (not (guix-system-profile? profile)))
+ (guix-package-info-insert-action-button action-type entry output)
+ (when obsolete
+ (guix-info-insert-indent)
+ (guix-package-info-insert-action-button 'upgrade entry output)))
(insert "\n")
(when installed-entry
(guix-info-insert-entry installed-entry 'installed-output 2))))
@@ -723,10 +728,22 @@ take an entry as argument."
'upgrade nil
(guix-package-installed-outputs entry)))))
+(defun guix-package-assert-non-system-profile ()
+ "Verify that the current profile is not a system one.
+The current profile is the one used by the current buffer."
+ (let ((profile (guix-ui-current-profile)))
+ (and profile
+ (guix-system-profile? profile)
+ (user-error "Packages cannot be installed or removed to/from \
+profile '%s'.
+Use 'guix system reconfigure' shell command to modify a system profile."
+ profile))))
+
(defun guix-package-execute-actions (fun)
"Perform actions on the marked packages.
Use FUN to define actions suitable for `guix-process-package-actions'.
FUN should take action-type as argument."
+ (guix-package-assert-non-system-profile)
(let ((actions (delq nil
(mapcar fun '(install delete upgrade)))))
(if actions
--
2.6.3
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] emacs: Add 'M-x guix-installed-{user/system}-packages'.
2016-02-13 19:04 ` [PATCH 1/3] emacs: Add 'M-x guix-installed-{user/system}-packages' Alex Kost
@ 2016-02-21 22:03 ` Ludovic Courtès
0 siblings, 0 replies; 10+ messages in thread
From: Ludovic Courtès @ 2016-02-21 22:03 UTC (permalink / raw)
To: Alex Kost; +Cc: guix-devel
Alex Kost <alezost@gmail.com> skribis:
> * emacs/guix-ui-package.el (guix-installed-user-packages)
> (guix-installed-system-packages): New commands.
> * doc/emacs.texi (Emacs Commands): Document them.
LGTM!
Ludo'.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] emacs: Set 'guix-buffer-item' before displaying entries.
2016-02-13 19:04 ` [PATCH 2/3] emacs: Set 'guix-buffer-item' before displaying entries Alex Kost
@ 2016-02-21 22:06 ` Ludovic Courtès
2016-02-22 19:48 ` Alex Kost
0 siblings, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2016-02-21 22:06 UTC (permalink / raw)
To: Alex Kost; +Cc: guix-devel
Alex Kost <alezost@gmail.com> skribis:
> * emacs/guix-buffer.el (guix-buffer-set): Set 'guix-buffer-item' early,
> so that it can be used during displaying entries. For example, this
> allows to use a value of the current guix profile when package entries
> are inserted in a "List" or "Info" buffer.
I don’t fully grasp the details but I trust you. :-)
Could you move the explanation as a comment in the code?
Grammar nitpicking: “allow NOUN to use bla”, like “allows us to use a
value.” :-)
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] emacs: Do not allow to modify system profiles.
2016-02-13 19:04 ` [PATCH 3/3] emacs: Do not allow to modify system profiles Alex Kost
@ 2016-02-21 22:07 ` Ludovic Courtès
2016-02-23 10:55 ` Pjotr Prins
0 siblings, 1 reply; 10+ messages in thread
From: Ludovic Courtès @ 2016-02-21 22:07 UTC (permalink / raw)
To: Alex Kost; +Cc: guix-devel
Alex Kost <alezost@gmail.com> skribis:
> Fixes <http://bugs.gnu.org/22607>.
> Reported by myglc2 <myglc2@gmail.com>.
>
> Remove possibilities to install/delete packages to/from a system profile
> both for "Package List" and "Package Info" buffers.
>
> * emacs/guix-profiles.el (guix-system-profile-regexp): New variable.
> (guix-system-profile?): New procedure.
> * emacs/guix-ui-package.el (guix-package-info-insert-output): Do not
> display "Install"/"Delete" button for a system profile.
> (guix-package-assert-non-system-profile): New procedure.
> (guix-package-execute-actions): Use it.
Good idea. LGTM, thank you!
Ludo’.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] emacs: Set 'guix-buffer-item' before displaying entries.
2016-02-21 22:06 ` Ludovic Courtès
@ 2016-02-22 19:48 ` Alex Kost
0 siblings, 0 replies; 10+ messages in thread
From: Alex Kost @ 2016-02-22 19:48 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Ludovic Courtès (2016-02-22 01:06 +0300) wrote:
> Alex Kost <alezost@gmail.com> skribis:
>
>> * emacs/guix-buffer.el (guix-buffer-set): Set 'guix-buffer-item' early,
>> so that it can be used during displaying entries. For example, this
>> allows to use a value of the current guix profile when package entries
>> are inserted in a "List" or "Info" buffer.
>
> I don’t fully grasp the details but I trust you. :-)
Thanks, this one-line change should be harmless :)
> Could you move the explanation as a comment in the code?
OK, I added some explanation to the code.
> Grammar nitpicking: “allow NOUN to use bla”, like “allows us to use a
> value.” :-)
Thanks! I didn't know this fact.
I've pushed this patchset, thanks for the comments!
--
Alex
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] emacs: Do not allow to modify system profiles.
2016-02-21 22:07 ` Ludovic Courtès
@ 2016-02-23 10:55 ` Pjotr Prins
2016-02-24 16:52 ` Alex Kost
0 siblings, 1 reply; 10+ messages in thread
From: Pjotr Prins @ 2016-02-23 10:55 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel, Alex Kost
On Sun, Feb 21, 2016 at 11:07:15PM +0100, Ludovic Courtès wrote:
> Alex Kost <alezost@gmail.com> skribis:
>
> > Fixes <http://bugs.gnu.org/22607>.
> > Reported by myglc2 <myglc2@gmail.com>.
> >
> > Remove possibilities to install/delete packages to/from a system profile
> > both for "Package List" and "Package Info" buffers.
> >
> > * emacs/guix-profiles.el (guix-system-profile-regexp): New variable.
> > (guix-system-profile?): New procedure.
> > * emacs/guix-ui-package.el (guix-package-info-insert-output): Do not
> > display "Install"/"Delete" button for a system profile.
> > (guix-package-assert-non-system-profile): New procedure.
> > (guix-package-execute-actions): Use it.
>
> Good idea. LGTM, thank you!
>
> Ludo’.
Can some of you share their .emacs config file? I am especially
interested in the guix hacks. Do you pick up the load-path
dynamically? What packages are in your list?
Thanks,
Pj.
--
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] emacs: Do not allow to modify system profiles.
2016-02-23 10:55 ` Pjotr Prins
@ 2016-02-24 16:52 ` Alex Kost
0 siblings, 0 replies; 10+ messages in thread
From: Alex Kost @ 2016-02-24 16:52 UTC (permalink / raw)
To: Pjotr Prins; +Cc: guix-devel
Pjotr Prins (2016-02-23 13:55 +0300) wrote:
> Can some of you share their .emacs config file? I am especially
> interested in the guix hacks. Do you pick up the load-path
> dynamically? What packages are in your list?
My ".emacs" can be found at <https://github.com/alezost/emacs-config>.
Not sure if it could be useful for anyone but me though. I don't have
any particular guix hacks, except maybe that I install Emacs packages in
a separate guix profile.
I don't understand what you mean by "pick up the load-path dynamically".
I use about 60 emacs packages, but only 9 of them are managed by Guix;
for installing/upgrading the rest I use Quelpa¹ right now. Eventually
I'll move to Guix completely to manage my emacs packages; I just have
not taken the time to add guix recipes for them.
¹ https://github.com/quelpa/quelpa
--
Alex
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-02-24 16:52 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-13 19:04 [PATCH 0/3] emacs: Few improvements Alex Kost
2016-02-13 19:04 ` [PATCH 1/3] emacs: Add 'M-x guix-installed-{user/system}-packages' Alex Kost
2016-02-21 22:03 ` Ludovic Courtès
2016-02-13 19:04 ` [PATCH 2/3] emacs: Set 'guix-buffer-item' before displaying entries Alex Kost
2016-02-21 22:06 ` Ludovic Courtès
2016-02-22 19:48 ` Alex Kost
2016-02-13 19:04 ` [PATCH 3/3] emacs: Do not allow to modify system profiles Alex Kost
2016-02-21 22:07 ` Ludovic Courtès
2016-02-23 10:55 ` Pjotr Prins
2016-02-24 16:52 ` Alex Kost
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.