2014-09-17 13:52:08 +00:00
|
|
|
|
;;; guix-base.el --- Common definitions -*- lexical-binding: t -*-
|
2014-08-27 12:44:17 +00:00
|
|
|
|
|
2016-01-04 16:11:30 +00:00
|
|
|
|
;; Copyright © 2014, 2015, 2016 Alex Kost <alezost@gmail.com>
|
2014-08-27 12:44:17 +00:00
|
|
|
|
|
|
|
|
|
;; This file is part of GNU Guix.
|
|
|
|
|
|
|
|
|
|
;; GNU Guix is free software; you can redistribute it and/or modify
|
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
;; GNU Guix is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;; This file provides some base and common definitions for guix.el
|
|
|
|
|
;; package.
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(require 'cl-lib)
|
|
|
|
|
(require 'guix-backend)
|
2015-07-23 07:10:47 +00:00
|
|
|
|
(require 'guix-guile)
|
emacs: Reorganize package/generation UI code.
Move the code for packages/generations interface from "guix-info.el",
"guix-list.el", "guix-base.el" and "guix.el" to "guix-ui-package.el" and
"guix-ui-generation.el".
* emacs/guix-base.el (guix-package-entry->name-specification)
(guix-package-entries->name-specifications)
(guix-package-id-and-output-by-output-id)
(guix-package-installed-outputs, guix-process-package-actions)
(guix-package-list-type, guix-package-info-type)
(guix-continue-package-operation-p, guix-get-package-strings)
(guix-insert-package-strings): Move to "guix-ui-package.el".
(guix-generation-packages-buffer-name-function, guix-output-name-width)
(guix-generation-packages-update-buffer, guix-generation-packages)
(guix-generation-packages-buffer-name-default)
(guix-generation-packages-buffer-name-long)
(guix-generation-packages-buffer-name, guix-generation-packages-buffer)
(guix-generation-insert-packages, guix-generation-insert-package)
(guix-profile-generation-manifest-file, guix-delete-generations)
(guix-profile-generation-packages-buffer, guix-switch-to-generation):
Move to "guix-ui-generation.el".
* emacs/guix-info.el (guix-package-location, guix-package-name)
(guix-package-source, guix-package-info-source)
(guix-package-info-heading, guix-package-info-license)
(guix-package-info-name, guix-package-info-name-button)
(guix-package-info-version, guix-package-info-location)
(guix-package-info-synopsis, guix-package-info-description)
(guix-package-info-obsolete, guix-package-info-installed-outputs)
(guix-package-info-uninstalled-outputs)
(guix-package-info-insert-heading)
(guix-package-info-define-insert-inputs)
(guix-package-info-obsolete-string)
(guix-package-info-insert-obsolete-text)
(guix-package-info-insert-non-unique-text)
(guix-package-info-insert-outputs, guix-package-info-insert-output)
(guix-package-info-insert-action-button)
(guix-package-info-auto-find-source)
(guix-package-info-auto-download-source)
(guix-package-info-download-buffer, guix-package-info-show-source)
(guix-package-info-download-source, guix-package-info-insert-source)
(guix-package-info-redisplay-after-download)
(guix-output-info-insert-version, guix-output-info-insert-output):
Move to "guix-ui-package.el".
(guix-generation-info-number, guix-generation-info-current)
(guix-generation-not-current, guix-generation-info-insert-number)
(guix-generation-info-insert-current): Move to "guix-ui-generation.el".
* emacs/guix-list.el (guix-package-list-generation-marking-enabled)
(guix-package-list-installed, guix-package-list-obsolete)
(guix-package-list-get-name, guix-package-list-get-installed-outputs)
(guix-package-list-marking-check, guix-package-list-mark-outputs)
(guix-package-list-mark-install, guix-package-list-mark-delete)
(guix-package-list-mark-upgrade, guix-package-list-mark-upgrades)
(guix-list-mark-package-upgrades, guix-list-execute-package-actions)
(guix-package-list-execute, guix-package-list-make-action)
(guix-package-list-edit, guix-output-list-mark-install)
(guix-output-list-mark-delete, guix-output-list-mark-upgrade)
(guix-output-list-mark-upgrades, guix-output-list-make-action)
(guix-output-list-describe, guix-output-list-edit): Move to
"guix-ui-package.el".
(guix-generation-list-get-current, guix-generation-list-switch)
(guix-generation-list-generations-to-compare)
(guix-generation-list-compare, guix-generation-list-show-packages)
(guix-generation-list-show-added-packages)
(guix-generation-list-show-removed-packages)
(guix-generation-list-diff, guix-generation-list-diff-manifests)
(guix-generation-list-ediff, guix-generation-list-ediff-manifests)
(guix-generation-list-diff-packages)
(guix-generation-list-ediff-packages)
(guix-generation-list-mark-delete, guix-generation-list-execute): Move
to "guix-ui-generation.el".
* emacs/guix.el: Remove.
(guix, guix-faces, guix-edit): Move to "guix-base.el".
(guix-list-single-package, guix-search-params, guix-search-history)
(guix-get-show-packages, guix-search-by-name, guix-search-by-regexp)
(guix-installed-packages, guix-obsolete-packages)
(guix-all-available-packages, guix-newest-available-packages): Move
to "guix-ui-package.el".
(guix-get-show-generations, guix-generations, guix-last-generations)
(guix-generations-by-time): Move to "guix-ui-generation.el".
* emacs.am (ELFILES): Remove "guix.el". Add "guix-ui-package.el" and
"guix-ui-generation.el".
* doc/emacs.texi (Emacs Appearance): Adjust accordingly.
2015-12-09 11:44:34 +00:00
|
|
|
|
(require 'guix-read)
|
2014-08-27 12:44:17 +00:00
|
|
|
|
(require 'guix-utils)
|
emacs: Generalize buffer naming.
* emacs/guix-base.el (guix-buffer-name): New procedure.
(guix-buffer-define-interface): Make ':buffer-name' a required keyword.
(guix-update-after-operation, guix-buffer-name-function)
(guix-buffer-name-simple, guix-buffer-name-default, guix-buffer-name)
(guix-buffer-p, guix-buffers, guix-update-buffer)
(guix-update-buffers-maybe-after-operation): Adjust, move and rename to...
* emacs/guix-ui.el (guix-ui-update-after-operation)
(guix-ui-buffer-name-function, guix-ui-buffer-name-simple)
(guix-ui-buffer-name-default, guix-ui-buffer-name)
(guix-ui-buffer?, guix-ui-buffers, guix-ui-update-buffer)
(guix-ui-update-buffers-after-operation): ... this.
(guix-ui-define-interface): Generate
'guix-ENTRY-TYPE-BUFFER-TYPE-buffer-name' procedure and pass it as
':buffer-name' argument.
(guix-ui): New custom group.
* emacs/guix-info.el: Specify ':buffer-name' for the defined interfaces.
* emacs/guix-list.el: Likewise.
* doc/emacs.texi (Emacs Appearance): Adjust accordingly.
2015-11-23 13:41:58 +00:00
|
|
|
|
(require 'guix-ui)
|
2014-08-27 12:44:17 +00:00
|
|
|
|
|
emacs: Reorganize package/generation UI code.
Move the code for packages/generations interface from "guix-info.el",
"guix-list.el", "guix-base.el" and "guix.el" to "guix-ui-package.el" and
"guix-ui-generation.el".
* emacs/guix-base.el (guix-package-entry->name-specification)
(guix-package-entries->name-specifications)
(guix-package-id-and-output-by-output-id)
(guix-package-installed-outputs, guix-process-package-actions)
(guix-package-list-type, guix-package-info-type)
(guix-continue-package-operation-p, guix-get-package-strings)
(guix-insert-package-strings): Move to "guix-ui-package.el".
(guix-generation-packages-buffer-name-function, guix-output-name-width)
(guix-generation-packages-update-buffer, guix-generation-packages)
(guix-generation-packages-buffer-name-default)
(guix-generation-packages-buffer-name-long)
(guix-generation-packages-buffer-name, guix-generation-packages-buffer)
(guix-generation-insert-packages, guix-generation-insert-package)
(guix-profile-generation-manifest-file, guix-delete-generations)
(guix-profile-generation-packages-buffer, guix-switch-to-generation):
Move to "guix-ui-generation.el".
* emacs/guix-info.el (guix-package-location, guix-package-name)
(guix-package-source, guix-package-info-source)
(guix-package-info-heading, guix-package-info-license)
(guix-package-info-name, guix-package-info-name-button)
(guix-package-info-version, guix-package-info-location)
(guix-package-info-synopsis, guix-package-info-description)
(guix-package-info-obsolete, guix-package-info-installed-outputs)
(guix-package-info-uninstalled-outputs)
(guix-package-info-insert-heading)
(guix-package-info-define-insert-inputs)
(guix-package-info-obsolete-string)
(guix-package-info-insert-obsolete-text)
(guix-package-info-insert-non-unique-text)
(guix-package-info-insert-outputs, guix-package-info-insert-output)
(guix-package-info-insert-action-button)
(guix-package-info-auto-find-source)
(guix-package-info-auto-download-source)
(guix-package-info-download-buffer, guix-package-info-show-source)
(guix-package-info-download-source, guix-package-info-insert-source)
(guix-package-info-redisplay-after-download)
(guix-output-info-insert-version, guix-output-info-insert-output):
Move to "guix-ui-package.el".
(guix-generation-info-number, guix-generation-info-current)
(guix-generation-not-current, guix-generation-info-insert-number)
(guix-generation-info-insert-current): Move to "guix-ui-generation.el".
* emacs/guix-list.el (guix-package-list-generation-marking-enabled)
(guix-package-list-installed, guix-package-list-obsolete)
(guix-package-list-get-name, guix-package-list-get-installed-outputs)
(guix-package-list-marking-check, guix-package-list-mark-outputs)
(guix-package-list-mark-install, guix-package-list-mark-delete)
(guix-package-list-mark-upgrade, guix-package-list-mark-upgrades)
(guix-list-mark-package-upgrades, guix-list-execute-package-actions)
(guix-package-list-execute, guix-package-list-make-action)
(guix-package-list-edit, guix-output-list-mark-install)
(guix-output-list-mark-delete, guix-output-list-mark-upgrade)
(guix-output-list-mark-upgrades, guix-output-list-make-action)
(guix-output-list-describe, guix-output-list-edit): Move to
"guix-ui-package.el".
(guix-generation-list-get-current, guix-generation-list-switch)
(guix-generation-list-generations-to-compare)
(guix-generation-list-compare, guix-generation-list-show-packages)
(guix-generation-list-show-added-packages)
(guix-generation-list-show-removed-packages)
(guix-generation-list-diff, guix-generation-list-diff-manifests)
(guix-generation-list-ediff, guix-generation-list-ediff-manifests)
(guix-generation-list-diff-packages)
(guix-generation-list-ediff-packages)
(guix-generation-list-mark-delete, guix-generation-list-execute): Move
to "guix-ui-generation.el".
* emacs/guix.el: Remove.
(guix, guix-faces, guix-edit): Move to "guix-base.el".
(guix-list-single-package, guix-search-params, guix-search-history)
(guix-get-show-packages, guix-search-by-name, guix-search-by-regexp)
(guix-installed-packages, guix-obsolete-packages)
(guix-all-available-packages, guix-newest-available-packages): Move
to "guix-ui-package.el".
(guix-get-show-generations, guix-generations, guix-last-generations)
(guix-generations-by-time): Move to "guix-ui-generation.el".
* emacs.am (ELFILES): Remove "guix.el". Add "guix-ui-package.el" and
"guix-ui-generation.el".
* doc/emacs.texi (Emacs Appearance): Adjust accordingly.
2015-12-09 11:44:34 +00:00
|
|
|
|
(defgroup guix nil
|
|
|
|
|
"Settings for Guix package manager and friends."
|
|
|
|
|
:prefix "guix-"
|
|
|
|
|
:group 'external)
|
|
|
|
|
|
|
|
|
|
(defgroup guix-faces nil
|
|
|
|
|
"Guix faces."
|
|
|
|
|
:group 'guix
|
|
|
|
|
:group 'faces)
|
2014-08-27 12:44:17 +00:00
|
|
|
|
|
2015-11-18 08:36:27 +00:00
|
|
|
|
(defun guix-package-name-specification (name version &optional output)
|
2014-08-27 12:44:17 +00:00
|
|
|
|
"Return Guix package specification by its NAME, VERSION and OUTPUT."
|
|
|
|
|
(concat name "-" version
|
|
|
|
|
(when output (concat ":" output))))
|
|
|
|
|
|
|
|
|
|
|
emacs: Reorganize package/generation UI code.
Move the code for packages/generations interface from "guix-info.el",
"guix-list.el", "guix-base.el" and "guix.el" to "guix-ui-package.el" and
"guix-ui-generation.el".
* emacs/guix-base.el (guix-package-entry->name-specification)
(guix-package-entries->name-specifications)
(guix-package-id-and-output-by-output-id)
(guix-package-installed-outputs, guix-process-package-actions)
(guix-package-list-type, guix-package-info-type)
(guix-continue-package-operation-p, guix-get-package-strings)
(guix-insert-package-strings): Move to "guix-ui-package.el".
(guix-generation-packages-buffer-name-function, guix-output-name-width)
(guix-generation-packages-update-buffer, guix-generation-packages)
(guix-generation-packages-buffer-name-default)
(guix-generation-packages-buffer-name-long)
(guix-generation-packages-buffer-name, guix-generation-packages-buffer)
(guix-generation-insert-packages, guix-generation-insert-package)
(guix-profile-generation-manifest-file, guix-delete-generations)
(guix-profile-generation-packages-buffer, guix-switch-to-generation):
Move to "guix-ui-generation.el".
* emacs/guix-info.el (guix-package-location, guix-package-name)
(guix-package-source, guix-package-info-source)
(guix-package-info-heading, guix-package-info-license)
(guix-package-info-name, guix-package-info-name-button)
(guix-package-info-version, guix-package-info-location)
(guix-package-info-synopsis, guix-package-info-description)
(guix-package-info-obsolete, guix-package-info-installed-outputs)
(guix-package-info-uninstalled-outputs)
(guix-package-info-insert-heading)
(guix-package-info-define-insert-inputs)
(guix-package-info-obsolete-string)
(guix-package-info-insert-obsolete-text)
(guix-package-info-insert-non-unique-text)
(guix-package-info-insert-outputs, guix-package-info-insert-output)
(guix-package-info-insert-action-button)
(guix-package-info-auto-find-source)
(guix-package-info-auto-download-source)
(guix-package-info-download-buffer, guix-package-info-show-source)
(guix-package-info-download-source, guix-package-info-insert-source)
(guix-package-info-redisplay-after-download)
(guix-output-info-insert-version, guix-output-info-insert-output):
Move to "guix-ui-package.el".
(guix-generation-info-number, guix-generation-info-current)
(guix-generation-not-current, guix-generation-info-insert-number)
(guix-generation-info-insert-current): Move to "guix-ui-generation.el".
* emacs/guix-list.el (guix-package-list-generation-marking-enabled)
(guix-package-list-installed, guix-package-list-obsolete)
(guix-package-list-get-name, guix-package-list-get-installed-outputs)
(guix-package-list-marking-check, guix-package-list-mark-outputs)
(guix-package-list-mark-install, guix-package-list-mark-delete)
(guix-package-list-mark-upgrade, guix-package-list-mark-upgrades)
(guix-list-mark-package-upgrades, guix-list-execute-package-actions)
(guix-package-list-execute, guix-package-list-make-action)
(guix-package-list-edit, guix-output-list-mark-install)
(guix-output-list-mark-delete, guix-output-list-mark-upgrade)
(guix-output-list-mark-upgrades, guix-output-list-make-action)
(guix-output-list-describe, guix-output-list-edit): Move to
"guix-ui-package.el".
(guix-generation-list-get-current, guix-generation-list-switch)
(guix-generation-list-generations-to-compare)
(guix-generation-list-compare, guix-generation-list-show-packages)
(guix-generation-list-show-added-packages)
(guix-generation-list-show-removed-packages)
(guix-generation-list-diff, guix-generation-list-diff-manifests)
(guix-generation-list-ediff, guix-generation-list-ediff-manifests)
(guix-generation-list-diff-packages)
(guix-generation-list-ediff-packages)
(guix-generation-list-mark-delete, guix-generation-list-execute): Move
to "guix-ui-generation.el".
* emacs/guix.el: Remove.
(guix, guix-faces, guix-edit): Move to "guix-base.el".
(guix-list-single-package, guix-search-params, guix-search-history)
(guix-get-show-packages, guix-search-by-name, guix-search-by-regexp)
(guix-installed-packages, guix-obsolete-packages)
(guix-all-available-packages, guix-newest-available-packages): Move
to "guix-ui-package.el".
(guix-get-show-generations, guix-generations, guix-last-generations)
(guix-generations-by-time): Move to "guix-ui-generation.el".
* emacs.am (ELFILES): Remove "guix.el". Add "guix-ui-package.el" and
"guix-ui-generation.el".
* doc/emacs.texi (Emacs Appearance): Adjust accordingly.
2015-12-09 11:44:34 +00:00
|
|
|
|
;;; Location of packages, profiles and manifests
|
2014-08-27 12:44:17 +00:00
|
|
|
|
|
|
|
|
|
(defvar guix-directory nil
|
|
|
|
|
"Default Guix directory.
|
|
|
|
|
If it is not set by a user, it is set after starting Guile REPL.
|
|
|
|
|
This directory is used to define location of the packages.")
|
|
|
|
|
|
|
|
|
|
(defun guix-set-directory ()
|
|
|
|
|
"Set `guix-directory' if needed."
|
|
|
|
|
(or guix-directory
|
|
|
|
|
(setq guix-directory
|
|
|
|
|
(guix-eval-read "%guix-dir"))))
|
|
|
|
|
|
|
|
|
|
(add-hook 'guix-after-start-repl-hook 'guix-set-directory)
|
|
|
|
|
|
|
|
|
|
(defun guix-find-location (location)
|
|
|
|
|
"Go to LOCATION of a package.
|
|
|
|
|
LOCATION is a string of the form:
|
|
|
|
|
|
|
|
|
|
\"PATH:LINE:COLUMN\"
|
|
|
|
|
|
|
|
|
|
If PATH is relative, it is considered to be relative to
|
|
|
|
|
`guix-directory'."
|
|
|
|
|
(cl-multiple-value-bind (path line col)
|
|
|
|
|
(split-string location ":")
|
|
|
|
|
(let ((file (expand-file-name path guix-directory))
|
|
|
|
|
(line (string-to-number line))
|
|
|
|
|
(col (string-to-number col)))
|
|
|
|
|
(find-file file)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(forward-line (- line 1))
|
|
|
|
|
(move-to-column col)
|
|
|
|
|
(recenter 1))))
|
|
|
|
|
|
2015-08-17 09:05:05 +00:00
|
|
|
|
(defun guix-package-location (id-or-name)
|
|
|
|
|
"Return location of a package with ID-OR-NAME.
|
|
|
|
|
For the meaning of location, see `guix-find-location'."
|
|
|
|
|
(guix-eval-read (guix-make-guile-expression
|
|
|
|
|
'package-location-string id-or-name)))
|
2015-06-19 18:57:04 +00:00
|
|
|
|
|
emacs: Add interface for comparing generations.
Suggested by Ludovic Courtès.
* doc/emacs.texi (Emacs List buffer): Document new key bindings.
* emacs/guix-base.el (guix-generation-packages-buffer-name-function,
guix-generation-packages-update-buffer, guix-output-name-width): New
variables.
(guix-generation-file, guix-manifest-file, guix-generation-packages,
guix-generation-packages-buffer-name-default,
guix-generation-packages-buffer-name-long,
guix-generation-packages-buffer-name, guix-generation-packages-buffer,
guix-generation-insert-package, guix-generation-insert-packages,
guix-profile-generation-manifest-file,
guix-profile-generation-packages-buffer): New procedures.
* emacs/guix-list.el: Add key bindings for comparing generations.
(guix-generation-list-generations-to-compare,
guix-generation-list-show-added-packages,
guix-generation-list-show-removed-packages, guix-generation-list-compare,
guix-generation-list-ediff-manifests, guix-generation-list-diff-manifests,
guix-generation-list-ediff-packages, guix-generation-list-diff-packages,
guix-generation-list-ediff, guix-generation-list-diff): New procedures.
* emacs/guix-messages.el (guix-messages): Add 'generation-diff' search type.
(guix-message-outputs-by-diff): New procedure.
* emacs/guix-utils.el (guix-diff-switches): New variable.
(guix-diff): New procedure.
* emacs/guix-main.scm (package/output-sexps): Handle 'generation-diff' search
type.
(manifest-entry->package-specification,
manifest-entries->package-specifications, generation-package-specifications,
generation-package-specifications+paths, generation-difference): New
procedures.
2014-11-02 10:58:21 +00:00
|
|
|
|
(defun guix-generation-file (profile generation)
|
|
|
|
|
"Return the file name of a PROFILE's GENERATION."
|
|
|
|
|
(format "%s-%s-link" profile generation))
|
|
|
|
|
|
2016-01-04 16:11:30 +00:00
|
|
|
|
(defun guix-packages-profile (profile &optional generation system?)
|
|
|
|
|
"Return a directory where packages are installed for the
|
|
|
|
|
PROFILE's GENERATION.
|
|
|
|
|
|
|
|
|
|
If SYSTEM? is non-nil, then PROFILE is considered to be a system
|
|
|
|
|
profile. Unlike usual profiles, for a system profile, packages
|
|
|
|
|
are placed in 'profile' subdirectory."
|
|
|
|
|
(let ((profile (if generation
|
|
|
|
|
(guix-generation-file profile generation)
|
|
|
|
|
profile)))
|
|
|
|
|
(if system?
|
|
|
|
|
(expand-file-name "profile" profile)
|
|
|
|
|
profile)))
|
|
|
|
|
|
|
|
|
|
(defun guix-manifest-file (profile &optional generation system?)
|
emacs: Add interface for comparing generations.
Suggested by Ludovic Courtès.
* doc/emacs.texi (Emacs List buffer): Document new key bindings.
* emacs/guix-base.el (guix-generation-packages-buffer-name-function,
guix-generation-packages-update-buffer, guix-output-name-width): New
variables.
(guix-generation-file, guix-manifest-file, guix-generation-packages,
guix-generation-packages-buffer-name-default,
guix-generation-packages-buffer-name-long,
guix-generation-packages-buffer-name, guix-generation-packages-buffer,
guix-generation-insert-package, guix-generation-insert-packages,
guix-profile-generation-manifest-file,
guix-profile-generation-packages-buffer): New procedures.
* emacs/guix-list.el: Add key bindings for comparing generations.
(guix-generation-list-generations-to-compare,
guix-generation-list-show-added-packages,
guix-generation-list-show-removed-packages, guix-generation-list-compare,
guix-generation-list-ediff-manifests, guix-generation-list-diff-manifests,
guix-generation-list-ediff-packages, guix-generation-list-diff-packages,
guix-generation-list-ediff, guix-generation-list-diff): New procedures.
* emacs/guix-messages.el (guix-messages): Add 'generation-diff' search type.
(guix-message-outputs-by-diff): New procedure.
* emacs/guix-utils.el (guix-diff-switches): New variable.
(guix-diff): New procedure.
* emacs/guix-main.scm (package/output-sexps): Handle 'generation-diff' search
type.
(manifest-entry->package-specification,
manifest-entries->package-specifications, generation-package-specifications,
generation-package-specifications+paths, generation-difference): New
procedures.
2014-11-02 10:58:21 +00:00
|
|
|
|
"Return the file name of a PROFILE's manifest.
|
2016-01-04 16:11:30 +00:00
|
|
|
|
See `guix-packages-profile'."
|
emacs: Add interface for comparing generations.
Suggested by Ludovic Courtès.
* doc/emacs.texi (Emacs List buffer): Document new key bindings.
* emacs/guix-base.el (guix-generation-packages-buffer-name-function,
guix-generation-packages-update-buffer, guix-output-name-width): New
variables.
(guix-generation-file, guix-manifest-file, guix-generation-packages,
guix-generation-packages-buffer-name-default,
guix-generation-packages-buffer-name-long,
guix-generation-packages-buffer-name, guix-generation-packages-buffer,
guix-generation-insert-package, guix-generation-insert-packages,
guix-profile-generation-manifest-file,
guix-profile-generation-packages-buffer): New procedures.
* emacs/guix-list.el: Add key bindings for comparing generations.
(guix-generation-list-generations-to-compare,
guix-generation-list-show-added-packages,
guix-generation-list-show-removed-packages, guix-generation-list-compare,
guix-generation-list-ediff-manifests, guix-generation-list-diff-manifests,
guix-generation-list-ediff-packages, guix-generation-list-diff-packages,
guix-generation-list-ediff, guix-generation-list-diff): New procedures.
* emacs/guix-messages.el (guix-messages): Add 'generation-diff' search type.
(guix-message-outputs-by-diff): New procedure.
* emacs/guix-utils.el (guix-diff-switches): New variable.
(guix-diff): New procedure.
* emacs/guix-main.scm (package/output-sexps): Handle 'generation-diff' search
type.
(manifest-entry->package-specification,
manifest-entries->package-specifications, generation-package-specifications,
generation-package-specifications+paths, generation-difference): New
procedures.
2014-11-02 10:58:21 +00:00
|
|
|
|
(expand-file-name "manifest"
|
2016-01-04 16:11:30 +00:00
|
|
|
|
(guix-packages-profile profile generation system?)))
|
emacs: Add interface for comparing generations.
Suggested by Ludovic Courtès.
* doc/emacs.texi (Emacs List buffer): Document new key bindings.
* emacs/guix-base.el (guix-generation-packages-buffer-name-function,
guix-generation-packages-update-buffer, guix-output-name-width): New
variables.
(guix-generation-file, guix-manifest-file, guix-generation-packages,
guix-generation-packages-buffer-name-default,
guix-generation-packages-buffer-name-long,
guix-generation-packages-buffer-name, guix-generation-packages-buffer,
guix-generation-insert-package, guix-generation-insert-packages,
guix-profile-generation-manifest-file,
guix-profile-generation-packages-buffer): New procedures.
* emacs/guix-list.el: Add key bindings for comparing generations.
(guix-generation-list-generations-to-compare,
guix-generation-list-show-added-packages,
guix-generation-list-show-removed-packages, guix-generation-list-compare,
guix-generation-list-ediff-manifests, guix-generation-list-diff-manifests,
guix-generation-list-ediff-packages, guix-generation-list-diff-packages,
guix-generation-list-ediff, guix-generation-list-diff): New procedures.
* emacs/guix-messages.el (guix-messages): Add 'generation-diff' search type.
(guix-message-outputs-by-diff): New procedure.
* emacs/guix-utils.el (guix-diff-switches): New variable.
(guix-diff): New procedure.
* emacs/guix-main.scm (package/output-sexps): Handle 'generation-diff' search
type.
(manifest-entry->package-specification,
manifest-entries->package-specifications, generation-package-specifications,
generation-package-specifications+paths, generation-difference): New
procedures.
2014-11-02 10:58:21 +00:00
|
|
|
|
|
emacs: Reorganize package/generation UI code.
Move the code for packages/generations interface from "guix-info.el",
"guix-list.el", "guix-base.el" and "guix.el" to "guix-ui-package.el" and
"guix-ui-generation.el".
* emacs/guix-base.el (guix-package-entry->name-specification)
(guix-package-entries->name-specifications)
(guix-package-id-and-output-by-output-id)
(guix-package-installed-outputs, guix-process-package-actions)
(guix-package-list-type, guix-package-info-type)
(guix-continue-package-operation-p, guix-get-package-strings)
(guix-insert-package-strings): Move to "guix-ui-package.el".
(guix-generation-packages-buffer-name-function, guix-output-name-width)
(guix-generation-packages-update-buffer, guix-generation-packages)
(guix-generation-packages-buffer-name-default)
(guix-generation-packages-buffer-name-long)
(guix-generation-packages-buffer-name, guix-generation-packages-buffer)
(guix-generation-insert-packages, guix-generation-insert-package)
(guix-profile-generation-manifest-file, guix-delete-generations)
(guix-profile-generation-packages-buffer, guix-switch-to-generation):
Move to "guix-ui-generation.el".
* emacs/guix-info.el (guix-package-location, guix-package-name)
(guix-package-source, guix-package-info-source)
(guix-package-info-heading, guix-package-info-license)
(guix-package-info-name, guix-package-info-name-button)
(guix-package-info-version, guix-package-info-location)
(guix-package-info-synopsis, guix-package-info-description)
(guix-package-info-obsolete, guix-package-info-installed-outputs)
(guix-package-info-uninstalled-outputs)
(guix-package-info-insert-heading)
(guix-package-info-define-insert-inputs)
(guix-package-info-obsolete-string)
(guix-package-info-insert-obsolete-text)
(guix-package-info-insert-non-unique-text)
(guix-package-info-insert-outputs, guix-package-info-insert-output)
(guix-package-info-insert-action-button)
(guix-package-info-auto-find-source)
(guix-package-info-auto-download-source)
(guix-package-info-download-buffer, guix-package-info-show-source)
(guix-package-info-download-source, guix-package-info-insert-source)
(guix-package-info-redisplay-after-download)
(guix-output-info-insert-version, guix-output-info-insert-output):
Move to "guix-ui-package.el".
(guix-generation-info-number, guix-generation-info-current)
(guix-generation-not-current, guix-generation-info-insert-number)
(guix-generation-info-insert-current): Move to "guix-ui-generation.el".
* emacs/guix-list.el (guix-package-list-generation-marking-enabled)
(guix-package-list-installed, guix-package-list-obsolete)
(guix-package-list-get-name, guix-package-list-get-installed-outputs)
(guix-package-list-marking-check, guix-package-list-mark-outputs)
(guix-package-list-mark-install, guix-package-list-mark-delete)
(guix-package-list-mark-upgrade, guix-package-list-mark-upgrades)
(guix-list-mark-package-upgrades, guix-list-execute-package-actions)
(guix-package-list-execute, guix-package-list-make-action)
(guix-package-list-edit, guix-output-list-mark-install)
(guix-output-list-mark-delete, guix-output-list-mark-upgrade)
(guix-output-list-mark-upgrades, guix-output-list-make-action)
(guix-output-list-describe, guix-output-list-edit): Move to
"guix-ui-package.el".
(guix-generation-list-get-current, guix-generation-list-switch)
(guix-generation-list-generations-to-compare)
(guix-generation-list-compare, guix-generation-list-show-packages)
(guix-generation-list-show-added-packages)
(guix-generation-list-show-removed-packages)
(guix-generation-list-diff, guix-generation-list-diff-manifests)
(guix-generation-list-ediff, guix-generation-list-ediff-manifests)
(guix-generation-list-diff-packages)
(guix-generation-list-ediff-packages)
(guix-generation-list-mark-delete, guix-generation-list-execute): Move
to "guix-ui-generation.el".
* emacs/guix.el: Remove.
(guix, guix-faces, guix-edit): Move to "guix-base.el".
(guix-list-single-package, guix-search-params, guix-search-history)
(guix-get-show-packages, guix-search-by-name, guix-search-by-regexp)
(guix-installed-packages, guix-obsolete-packages)
(guix-all-available-packages, guix-newest-available-packages): Move
to "guix-ui-package.el".
(guix-get-show-generations, guix-generations, guix-last-generations)
(guix-generations-by-time): Move to "guix-ui-generation.el".
* emacs.am (ELFILES): Remove "guix.el". Add "guix-ui-package.el" and
"guix-ui-generation.el".
* doc/emacs.texi (Emacs Appearance): Adjust accordingly.
2015-12-09 11:44:34 +00:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun guix-edit (id-or-name)
|
|
|
|
|
"Edit (go to location of) package with ID-OR-NAME."
|
|
|
|
|
(interactive (list (guix-read-package-name)))
|
|
|
|
|
(let ((loc (guix-package-location id-or-name)))
|
|
|
|
|
(if loc
|
|
|
|
|
(guix-find-location loc)
|
|
|
|
|
(message "Couldn't find package location."))))
|
emacs: Add interface for comparing generations.
Suggested by Ludovic Courtès.
* doc/emacs.texi (Emacs List buffer): Document new key bindings.
* emacs/guix-base.el (guix-generation-packages-buffer-name-function,
guix-generation-packages-update-buffer, guix-output-name-width): New
variables.
(guix-generation-file, guix-manifest-file, guix-generation-packages,
guix-generation-packages-buffer-name-default,
guix-generation-packages-buffer-name-long,
guix-generation-packages-buffer-name, guix-generation-packages-buffer,
guix-generation-insert-package, guix-generation-insert-packages,
guix-profile-generation-manifest-file,
guix-profile-generation-packages-buffer): New procedures.
* emacs/guix-list.el: Add key bindings for comparing generations.
(guix-generation-list-generations-to-compare,
guix-generation-list-show-added-packages,
guix-generation-list-show-removed-packages, guix-generation-list-compare,
guix-generation-list-ediff-manifests, guix-generation-list-diff-manifests,
guix-generation-list-ediff-packages, guix-generation-list-diff-packages,
guix-generation-list-ediff, guix-generation-list-diff): New procedures.
* emacs/guix-messages.el (guix-messages): Add 'generation-diff' search type.
(guix-message-outputs-by-diff): New procedure.
* emacs/guix-utils.el (guix-diff-switches): New variable.
(guix-diff): New procedure.
* emacs/guix-main.scm (package/output-sexps): Handle 'generation-diff' search
type.
(manifest-entry->package-specification,
manifest-entries->package-specifications, generation-package-specifications,
generation-package-specifications+paths, generation-difference): New
procedures.
2014-11-02 10:58:21 +00:00
|
|
|
|
|
2014-08-27 12:44:17 +00:00
|
|
|
|
|
|
|
|
|
;;; Actions on packages and generations
|
|
|
|
|
|
emacs: Add support for modifying options during operation confirmation.
* emacs/guix-base.el (guix-operation-option-key): New face.
(guix-operation-option-true-string, guix-operation-option-false-string,
guix-operation-option-separator, guix-operation-options): New variables.
(guix-operation-option-by-key, guix-operation-option-key,
guix-operation-option-name, guix-operation-option-variable,
guix-operation-option-value, guix-operation-option-string-value,
guix-operation-prompt, guix-operation-set-mode-line): New procedures.
(guix-continue-package-operation-p): Use 'guix-operation-prompt'.
2014-10-02 18:31:18 +00:00
|
|
|
|
(defface guix-operation-option-key
|
|
|
|
|
'((t :inherit font-lock-warning-face))
|
|
|
|
|
"Face used for the keys of operation options."
|
2015-09-14 20:32:53 +00:00
|
|
|
|
:group 'guix-faces)
|
emacs: Add support for modifying options during operation confirmation.
* emacs/guix-base.el (guix-operation-option-key): New face.
(guix-operation-option-true-string, guix-operation-option-false-string,
guix-operation-option-separator, guix-operation-options): New variables.
(guix-operation-option-by-key, guix-operation-option-key,
guix-operation-option-name, guix-operation-option-variable,
guix-operation-option-value, guix-operation-option-string-value,
guix-operation-prompt, guix-operation-set-mode-line): New procedures.
(guix-continue-package-operation-p): Use 'guix-operation-prompt'.
2014-10-02 18:31:18 +00:00
|
|
|
|
|
2014-08-27 12:44:17 +00:00
|
|
|
|
(defcustom guix-operation-confirm t
|
|
|
|
|
"If nil, do not prompt to confirm an operation."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'guix)
|
|
|
|
|
|
|
|
|
|
(defcustom guix-use-substitutes t
|
|
|
|
|
"If non-nil, use substitutes for the Guix packages."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'guix)
|
|
|
|
|
|
|
|
|
|
(defvar guix-dry-run nil
|
|
|
|
|
"If non-nil, do not perform the real actions, just simulate.")
|
|
|
|
|
|
|
|
|
|
(defvar guix-temp-buffer-name " *Guix temp*"
|
|
|
|
|
"Name of a buffer used for displaying info before executing operation.")
|
|
|
|
|
|
emacs: Add support for modifying options during operation confirmation.
* emacs/guix-base.el (guix-operation-option-key): New face.
(guix-operation-option-true-string, guix-operation-option-false-string,
guix-operation-option-separator, guix-operation-options): New variables.
(guix-operation-option-by-key, guix-operation-option-key,
guix-operation-option-name, guix-operation-option-variable,
guix-operation-option-value, guix-operation-option-string-value,
guix-operation-prompt, guix-operation-set-mode-line): New procedures.
(guix-continue-package-operation-p): Use 'guix-operation-prompt'.
2014-10-02 18:31:18 +00:00
|
|
|
|
(defvar guix-operation-option-true-string "yes"
|
|
|
|
|
"String displayed in the mode-line when operation option is t.")
|
|
|
|
|
|
|
|
|
|
(defvar guix-operation-option-false-string "no "
|
|
|
|
|
"String displayed in the mode-line when operation option is nil.")
|
|
|
|
|
|
|
|
|
|
(defvar guix-operation-option-separator " | "
|
|
|
|
|
"String used in the mode-line to separate operation options.")
|
|
|
|
|
|
|
|
|
|
(defvar guix-operation-options
|
|
|
|
|
'((?s "substitutes" guix-use-substitutes)
|
|
|
|
|
(?d "dry-run" guix-dry-run))
|
|
|
|
|
"List of available operation options.
|
|
|
|
|
Each element of the list has a form:
|
|
|
|
|
|
|
|
|
|
(KEY NAME VARIABLE)
|
|
|
|
|
|
|
|
|
|
KEY is a character that may be pressed during confirmation to
|
|
|
|
|
toggle the option.
|
|
|
|
|
NAME is a string displayed in the mode-line.
|
|
|
|
|
VARIABLE is a name of an option variable.")
|
|
|
|
|
|
|
|
|
|
(defun guix-operation-option-by-key (key)
|
|
|
|
|
"Return operation option by KEY (character)."
|
|
|
|
|
(assq key guix-operation-options))
|
|
|
|
|
|
|
|
|
|
(defun guix-operation-option-key (option)
|
|
|
|
|
"Return key (character) of the operation OPTION."
|
|
|
|
|
(car option))
|
|
|
|
|
|
|
|
|
|
(defun guix-operation-option-name (option)
|
|
|
|
|
"Return name of the operation OPTION."
|
|
|
|
|
(nth 1 option))
|
|
|
|
|
|
|
|
|
|
(defun guix-operation-option-variable (option)
|
|
|
|
|
"Return name of the variable of the operation OPTION."
|
|
|
|
|
(nth 2 option))
|
|
|
|
|
|
|
|
|
|
(defun guix-operation-option-value (option)
|
|
|
|
|
"Return boolean value of the operation OPTION."
|
|
|
|
|
(symbol-value (guix-operation-option-variable option)))
|
|
|
|
|
|
|
|
|
|
(defun guix-operation-option-string-value (option)
|
|
|
|
|
"Convert boolean value of the operation OPTION to string and return it."
|
|
|
|
|
(if (guix-operation-option-value option)
|
|
|
|
|
guix-operation-option-true-string
|
|
|
|
|
guix-operation-option-false-string))
|
|
|
|
|
|
emacs: Add "Source" field to 'guix-info' buffers.
Suggested by Ludovic Courtès.
* emacs/guix-info.el (guix-info-insert-methods, guix-info-displayed-params):
Add 'source' parameter.
(guix-package-info-source): New face.
(guix-package-source): New button type.
(guix-package-info-auto-find-source, guix-package-info-auto-download-source,
guix-package-info-download-buffer): New variables.
(guix-package-info-show-source, guix-package-info-insert-source-url,
guix-package-info-insert-source, guix-package-info-download-source,
guix-package-info-redisplay-after-download): New procedures.
* emacs/guix-base.el (guix-param-titles): Add 'source' parameter.
(guix-operation-prompt): Add 'prompt' argument.
(guix-after-source-download-hook): New variable.
(guix-package-source-path, guix-package-source-build-derivation): New
procedures.
* emacs/guix-main.scm (%package-param-alist): Add 'source' parameter.
(package-source-names, package-source-derivation->store-path,
package-source-path, package-source-build-derivation): New procedures.
2014-11-09 08:03:39 +00:00
|
|
|
|
(defun guix-operation-prompt (&optional prompt)
|
2014-11-09 08:00:35 +00:00
|
|
|
|
"Prompt a user for continuing the current operation.
|
emacs: Add "Source" field to 'guix-info' buffers.
Suggested by Ludovic Courtès.
* emacs/guix-info.el (guix-info-insert-methods, guix-info-displayed-params):
Add 'source' parameter.
(guix-package-info-source): New face.
(guix-package-source): New button type.
(guix-package-info-auto-find-source, guix-package-info-auto-download-source,
guix-package-info-download-buffer): New variables.
(guix-package-info-show-source, guix-package-info-insert-source-url,
guix-package-info-insert-source, guix-package-info-download-source,
guix-package-info-redisplay-after-download): New procedures.
* emacs/guix-base.el (guix-param-titles): Add 'source' parameter.
(guix-operation-prompt): Add 'prompt' argument.
(guix-after-source-download-hook): New variable.
(guix-package-source-path, guix-package-source-build-derivation): New
procedures.
* emacs/guix-main.scm (%package-param-alist): Add 'source' parameter.
(package-source-names, package-source-derivation->store-path,
package-source-path, package-source-build-derivation): New procedures.
2014-11-09 08:03:39 +00:00
|
|
|
|
Return non-nil, if the operation should be continued; nil otherwise.
|
|
|
|
|
Ask a user with PROMPT for continuing an operation."
|
emacs: Add support for modifying options during operation confirmation.
* emacs/guix-base.el (guix-operation-option-key): New face.
(guix-operation-option-true-string, guix-operation-option-false-string,
guix-operation-option-separator, guix-operation-options): New variables.
(guix-operation-option-by-key, guix-operation-option-key,
guix-operation-option-name, guix-operation-option-variable,
guix-operation-option-value, guix-operation-option-string-value,
guix-operation-prompt, guix-operation-set-mode-line): New procedures.
(guix-continue-package-operation-p): Use 'guix-operation-prompt'.
2014-10-02 18:31:18 +00:00
|
|
|
|
(let* ((option-keys (mapcar #'guix-operation-option-key
|
|
|
|
|
guix-operation-options))
|
|
|
|
|
(keys (append '(?y ?n) option-keys))
|
emacs: Add "Source" field to 'guix-info' buffers.
Suggested by Ludovic Courtès.
* emacs/guix-info.el (guix-info-insert-methods, guix-info-displayed-params):
Add 'source' parameter.
(guix-package-info-source): New face.
(guix-package-source): New button type.
(guix-package-info-auto-find-source, guix-package-info-auto-download-source,
guix-package-info-download-buffer): New variables.
(guix-package-info-show-source, guix-package-info-insert-source-url,
guix-package-info-insert-source, guix-package-info-download-source,
guix-package-info-redisplay-after-download): New procedures.
* emacs/guix-base.el (guix-param-titles): Add 'source' parameter.
(guix-operation-prompt): Add 'prompt' argument.
(guix-after-source-download-hook): New variable.
(guix-package-source-path, guix-package-source-build-derivation): New
procedures.
* emacs/guix-main.scm (%package-param-alist): Add 'source' parameter.
(package-source-names, package-source-derivation->store-path,
package-source-path, package-source-build-derivation): New procedures.
2014-11-09 08:03:39 +00:00
|
|
|
|
(prompt (concat (propertize (or prompt "Continue operation?")
|
emacs: Add support for modifying options during operation confirmation.
* emacs/guix-base.el (guix-operation-option-key): New face.
(guix-operation-option-true-string, guix-operation-option-false-string,
guix-operation-option-separator, guix-operation-options): New variables.
(guix-operation-option-by-key, guix-operation-option-key,
guix-operation-option-name, guix-operation-option-variable,
guix-operation-option-value, guix-operation-option-string-value,
guix-operation-prompt, guix-operation-set-mode-line): New procedures.
(guix-continue-package-operation-p): Use 'guix-operation-prompt'.
2014-10-02 18:31:18 +00:00
|
|
|
|
'face 'minibuffer-prompt)
|
|
|
|
|
" ("
|
|
|
|
|
(mapconcat
|
|
|
|
|
(lambda (key)
|
|
|
|
|
(propertize (string key)
|
|
|
|
|
'face 'guix-operation-option-key))
|
|
|
|
|
keys
|
|
|
|
|
", ")
|
|
|
|
|
") ")))
|
2014-11-09 08:00:35 +00:00
|
|
|
|
(let ((mode-line mode-line-format))
|
|
|
|
|
(prog1 (guix-operation-prompt-1 prompt keys)
|
|
|
|
|
(setq mode-line-format mode-line)
|
|
|
|
|
;; Clear the minibuffer after prompting.
|
|
|
|
|
(message "")))))
|
emacs: Add support for modifying options during operation confirmation.
* emacs/guix-base.el (guix-operation-option-key): New face.
(guix-operation-option-true-string, guix-operation-option-false-string,
guix-operation-option-separator, guix-operation-options): New variables.
(guix-operation-option-by-key, guix-operation-option-key,
guix-operation-option-name, guix-operation-option-variable,
guix-operation-option-value, guix-operation-option-string-value,
guix-operation-prompt, guix-operation-set-mode-line): New procedures.
(guix-continue-package-operation-p): Use 'guix-operation-prompt'.
2014-10-02 18:31:18 +00:00
|
|
|
|
|
|
|
|
|
(defun guix-operation-prompt-1 (prompt keys)
|
|
|
|
|
"This function is internal for `guix-operation-prompt'."
|
|
|
|
|
(guix-operation-set-mode-line)
|
|
|
|
|
(let ((key (read-char-choice prompt (cons ?\C-g keys) t)))
|
|
|
|
|
(cl-case key
|
|
|
|
|
(?y t)
|
|
|
|
|
((?n ?\C-g) nil)
|
|
|
|
|
(t (let* ((option (guix-operation-option-by-key key))
|
|
|
|
|
(var (guix-operation-option-variable option)))
|
|
|
|
|
(set var (not (symbol-value var)))
|
|
|
|
|
(guix-operation-prompt-1 prompt keys))))))
|
|
|
|
|
|
|
|
|
|
(defun guix-operation-set-mode-line ()
|
|
|
|
|
"Display operation options in the mode-line of the current buffer."
|
|
|
|
|
(setq mode-line-format
|
|
|
|
|
(concat (propertize " Options: "
|
|
|
|
|
'face 'mode-line-buffer-id)
|
|
|
|
|
(mapconcat
|
|
|
|
|
(lambda (option)
|
|
|
|
|
(let ((key (guix-operation-option-key option))
|
|
|
|
|
(name (guix-operation-option-name option))
|
|
|
|
|
(val (guix-operation-option-string-value option)))
|
|
|
|
|
(concat name
|
|
|
|
|
" ("
|
|
|
|
|
(propertize (string key)
|
|
|
|
|
'face 'guix-operation-option-key)
|
|
|
|
|
"): " val)))
|
|
|
|
|
guix-operation-options
|
|
|
|
|
guix-operation-option-separator)))
|
|
|
|
|
(force-mode-line-update))
|
|
|
|
|
|
emacs: Add "Source" field to 'guix-info' buffers.
Suggested by Ludovic Courtès.
* emacs/guix-info.el (guix-info-insert-methods, guix-info-displayed-params):
Add 'source' parameter.
(guix-package-info-source): New face.
(guix-package-source): New button type.
(guix-package-info-auto-find-source, guix-package-info-auto-download-source,
guix-package-info-download-buffer): New variables.
(guix-package-info-show-source, guix-package-info-insert-source-url,
guix-package-info-insert-source, guix-package-info-download-source,
guix-package-info-redisplay-after-download): New procedures.
* emacs/guix-base.el (guix-param-titles): Add 'source' parameter.
(guix-operation-prompt): Add 'prompt' argument.
(guix-after-source-download-hook): New variable.
(guix-package-source-path, guix-package-source-build-derivation): New
procedures.
* emacs/guix-main.scm (%package-param-alist): Add 'source' parameter.
(package-source-names, package-source-derivation->store-path,
package-source-path, package-source-build-derivation): New procedures.
2014-11-09 08:03:39 +00:00
|
|
|
|
(defun guix-package-source-path (package-id)
|
|
|
|
|
"Return a store file path to a source of a package PACKAGE-ID."
|
|
|
|
|
(message "Calculating the source derivation ...")
|
|
|
|
|
(guix-eval-read
|
|
|
|
|
(guix-make-guile-expression
|
|
|
|
|
'package-source-path package-id)))
|
|
|
|
|
|
|
|
|
|
(defvar guix-after-source-download-hook nil
|
|
|
|
|
"Hook run after successful performing a 'source-download' operation.")
|
|
|
|
|
|
|
|
|
|
(defun guix-package-source-build-derivation (package-id &optional prompt)
|
|
|
|
|
"Build source derivation of a package PACKAGE-ID.
|
|
|
|
|
Ask a user with PROMPT for continuing an operation."
|
|
|
|
|
(when (or (not guix-operation-confirm)
|
|
|
|
|
(guix-operation-prompt (or prompt
|
|
|
|
|
"Build the source derivation?")))
|
|
|
|
|
(guix-eval-in-repl
|
|
|
|
|
(guix-make-guile-expression
|
|
|
|
|
'package-source-build-derivation
|
|
|
|
|
package-id
|
|
|
|
|
:use-substitutes? (or guix-use-substitutes 'f)
|
|
|
|
|
:dry-run? (or guix-dry-run 'f))
|
|
|
|
|
nil 'source-download)))
|
|
|
|
|
|
2015-05-27 17:33:42 +00:00
|
|
|
|
;;;###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
|
emacs: Generalize buffer interface.
Extract the code for defining buffer interface from "guix-base.el",
generalize it and move to "guix-buffer.el".
* emacs.am (ELFILES): Add "emacs/guix-buffer.el".
* emacs/guix-base.el (guix-profile, guix-entries, guix-buffer-type)
(guix-entry-type, guix-search-type, guix-search-vals, guix-set-vars)
(guix-get-symbol, guix-show-entries, guix-get-show-entries)
(guix-set-buffer, guix-history-call, guix-make-history-item)
(guix-get-params-for-receiving): Remove.
(guix-switch-to-buffer): Rename to 'guix-buffer-display' and move to
"guix-buffer.el".
(guix-get-entries): Rename to 'guix-ui-get-entries' and move to
"guix-ui.el".
(guix-buffer-data, guix-buffer-value, guix-buffer-param-title)
(guix-buffer-name, guix-buffer-history-size)
(guix-buffer-revert-confirm?, guix-buffer-map, guix-buffer-revert)
(guix-buffer-after-redisplay-hook, guix-buffer-redisplay)
(guix-buffer-redisplay-goto-button): Move to...
* emacs/guix-buffer.el: ... here. New file.
(guix-buffer-item): New variable.
(guix-buffer-with-item, guix-buffer-with-current-item)
(guix-buffer-define-current-item-accessor)
(guix-buffer-define-current-item-accessors)
(guix-buffer-define-current-args-accessor)
(guix-buffer-define-current-args-accessors): New macros.
(guix-buffer-get-entries, guix-buffer-mode-enable)
(guix-buffer-mode-initialize, guix-buffer-insert-entries)
(guix-buffer-show-entries-default, guix-buffer-show-entries)
(guix-buffer-message, guix-buffer-history-item, guix-buffer-set)
(guix-buffer-display-entries-current)
(guix-buffer-get-display-entries-current)
(guix-buffer-display-entries, guix-buffer-get-display-entries): New
procedures.
* emacs/guix-info.el: Adjust for the procedures renaming.
(guix-info-define-interface): Add ':show-entries-function' keyword.
* emacs/guix-list.el: Likewise.
* emacs/guix-ui.el (guix-ui-define-interface): Generate
'guix-ENTRY-TYPE-BUFFER-TYPE-get-entries' procedure based on
'guix-ui-get-entries'.
* emacs/guix.el (guix-get-show-packages, guix-get-show-generations):
Adjust for the procedures renaming.
2015-12-02 12:24:07 +00:00
|
|
|
|
(let* ((current-profile (guix-ui-current-profile))
|
2015-05-27 17:33:42 +00:00
|
|
|
|
(profile (if current-prefix-arg
|
|
|
|
|
(guix-profile-prompt)
|
emacs: Generalize buffer interface.
Extract the code for defining buffer interface from "guix-base.el",
generalize it and move to "guix-buffer.el".
* emacs.am (ELFILES): Add "emacs/guix-buffer.el".
* emacs/guix-base.el (guix-profile, guix-entries, guix-buffer-type)
(guix-entry-type, guix-search-type, guix-search-vals, guix-set-vars)
(guix-get-symbol, guix-show-entries, guix-get-show-entries)
(guix-set-buffer, guix-history-call, guix-make-history-item)
(guix-get-params-for-receiving): Remove.
(guix-switch-to-buffer): Rename to 'guix-buffer-display' and move to
"guix-buffer.el".
(guix-get-entries): Rename to 'guix-ui-get-entries' and move to
"guix-ui.el".
(guix-buffer-data, guix-buffer-value, guix-buffer-param-title)
(guix-buffer-name, guix-buffer-history-size)
(guix-buffer-revert-confirm?, guix-buffer-map, guix-buffer-revert)
(guix-buffer-after-redisplay-hook, guix-buffer-redisplay)
(guix-buffer-redisplay-goto-button): Move to...
* emacs/guix-buffer.el: ... here. New file.
(guix-buffer-item): New variable.
(guix-buffer-with-item, guix-buffer-with-current-item)
(guix-buffer-define-current-item-accessor)
(guix-buffer-define-current-item-accessors)
(guix-buffer-define-current-args-accessor)
(guix-buffer-define-current-args-accessors): New macros.
(guix-buffer-get-entries, guix-buffer-mode-enable)
(guix-buffer-mode-initialize, guix-buffer-insert-entries)
(guix-buffer-show-entries-default, guix-buffer-show-entries)
(guix-buffer-message, guix-buffer-history-item, guix-buffer-set)
(guix-buffer-display-entries-current)
(guix-buffer-get-display-entries-current)
(guix-buffer-display-entries, guix-buffer-get-display-entries): New
procedures.
* emacs/guix-info.el: Adjust for the procedures renaming.
(guix-info-define-interface): Add ':show-entries-function' keyword.
* emacs/guix-list.el: Likewise.
* emacs/guix-ui.el (guix-ui-define-interface): Generate
'guix-ENTRY-TYPE-BUFFER-TYPE-get-entries' procedure based on
'guix-ui-get-entries'.
* emacs/guix.el (guix-get-show-packages, guix-get-show-generations):
Adjust for the procedures renaming.
2015-12-02 12:24:07 +00:00
|
|
|
|
(or current-profile guix-current-profile)))
|
2015-05-27 17:33:42 +00:00
|
|
|
|
(file (read-file-name "File with manifest: "))
|
emacs: Generalize buffer interface.
Extract the code for defining buffer interface from "guix-base.el",
generalize it and move to "guix-buffer.el".
* emacs.am (ELFILES): Add "emacs/guix-buffer.el".
* emacs/guix-base.el (guix-profile, guix-entries, guix-buffer-type)
(guix-entry-type, guix-search-type, guix-search-vals, guix-set-vars)
(guix-get-symbol, guix-show-entries, guix-get-show-entries)
(guix-set-buffer, guix-history-call, guix-make-history-item)
(guix-get-params-for-receiving): Remove.
(guix-switch-to-buffer): Rename to 'guix-buffer-display' and move to
"guix-buffer.el".
(guix-get-entries): Rename to 'guix-ui-get-entries' and move to
"guix-ui.el".
(guix-buffer-data, guix-buffer-value, guix-buffer-param-title)
(guix-buffer-name, guix-buffer-history-size)
(guix-buffer-revert-confirm?, guix-buffer-map, guix-buffer-revert)
(guix-buffer-after-redisplay-hook, guix-buffer-redisplay)
(guix-buffer-redisplay-goto-button): Move to...
* emacs/guix-buffer.el: ... here. New file.
(guix-buffer-item): New variable.
(guix-buffer-with-item, guix-buffer-with-current-item)
(guix-buffer-define-current-item-accessor)
(guix-buffer-define-current-item-accessors)
(guix-buffer-define-current-args-accessor)
(guix-buffer-define-current-args-accessors): New macros.
(guix-buffer-get-entries, guix-buffer-mode-enable)
(guix-buffer-mode-initialize, guix-buffer-insert-entries)
(guix-buffer-show-entries-default, guix-buffer-show-entries)
(guix-buffer-message, guix-buffer-history-item, guix-buffer-set)
(guix-buffer-display-entries-current)
(guix-buffer-get-display-entries-current)
(guix-buffer-display-entries, guix-buffer-get-display-entries): New
procedures.
* emacs/guix-info.el: Adjust for the procedures renaming.
(guix-info-define-interface): Add ':show-entries-function' keyword.
* emacs/guix-list.el: Likewise.
* emacs/guix-ui.el (guix-ui-define-interface): Generate
'guix-ENTRY-TYPE-BUFFER-TYPE-get-entries' procedure based on
'guix-ui-get-entries'.
* emacs/guix.el (guix-get-show-packages, guix-get-show-generations):
Adjust for the procedures renaming.
2015-12-02 12:24:07 +00:00
|
|
|
|
(buffer (and current-profile (current-buffer))))
|
2015-05-27 17:33:42 +00:00
|
|
|
|
(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
|
2015-11-25 10:25:00 +00:00
|
|
|
|
'guix-command
|
|
|
|
|
"package"
|
|
|
|
|
(concat "--profile=" (expand-file-name profile))
|
|
|
|
|
(concat "--manifest=" (expand-file-name file)))
|
2015-05-27 17:33:42 +00:00
|
|
|
|
operation-buffer)))
|
|
|
|
|
|
2015-08-13 07:51:31 +00:00
|
|
|
|
|
|
|
|
|
;;; Executing guix commands
|
|
|
|
|
|
2015-08-16 10:55:25 +00:00
|
|
|
|
(defcustom guix-run-in-shell-function #'guix-run-in-shell
|
|
|
|
|
"Function used to run guix command.
|
|
|
|
|
The function is called with a single argument - a command line string."
|
|
|
|
|
:type '(choice (function-item guix-run-in-shell)
|
|
|
|
|
(function-item guix-run-in-eshell)
|
|
|
|
|
(function :tag "Other function"))
|
|
|
|
|
:group 'guix)
|
|
|
|
|
|
|
|
|
|
(defcustom guix-shell-buffer-name "*shell*"
|
|
|
|
|
"Default name of a shell buffer used for running guix commands."
|
|
|
|
|
:type 'string
|
|
|
|
|
:group 'guix)
|
|
|
|
|
|
|
|
|
|
(declare-function comint-send-input "comint" t)
|
|
|
|
|
|
|
|
|
|
(defun guix-run-in-shell (string)
|
|
|
|
|
"Run command line STRING in `guix-shell-buffer-name' buffer."
|
|
|
|
|
(shell guix-shell-buffer-name)
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(insert string)
|
|
|
|
|
(comint-send-input))
|
|
|
|
|
|
|
|
|
|
(declare-function eshell-send-input "esh-mode" t)
|
|
|
|
|
|
|
|
|
|
(defun guix-run-in-eshell (string)
|
|
|
|
|
"Run command line STRING in eshell buffer."
|
|
|
|
|
(eshell)
|
|
|
|
|
(goto-char (point-max))
|
|
|
|
|
(insert string)
|
|
|
|
|
(eshell-send-input))
|
|
|
|
|
|
|
|
|
|
(defun guix-run-command-in-shell (args)
|
|
|
|
|
"Execute 'guix ARGS ...' command in a shell buffer."
|
|
|
|
|
(funcall guix-run-in-shell-function
|
|
|
|
|
(guix-command-string args)))
|
|
|
|
|
|
2015-08-13 07:51:31 +00:00
|
|
|
|
(defun guix-run-command-in-repl (args)
|
|
|
|
|
"Execute 'guix ARGS ...' command in Guix REPL."
|
|
|
|
|
(guix-eval-in-repl
|
|
|
|
|
(apply #'guix-make-guile-expression
|
|
|
|
|
'guix-command args)))
|
|
|
|
|
|
|
|
|
|
(defun guix-command-output (args)
|
|
|
|
|
"Return string with 'guix ARGS ...' output."
|
2015-09-13 18:34:23 +00:00
|
|
|
|
(cl-multiple-value-bind (output error)
|
|
|
|
|
(guix-eval (apply #'guix-make-guile-expression
|
|
|
|
|
'guix-command-output args))
|
|
|
|
|
;; Remove trailing new space from the error string.
|
|
|
|
|
(message (replace-regexp-in-string "\n\\'" "" (read error)))
|
|
|
|
|
(read output)))
|
2015-08-13 07:51:31 +00:00
|
|
|
|
|
|
|
|
|
(defun guix-help-string (&optional commands)
|
|
|
|
|
"Return string with 'guix COMMANDS ... --help' output."
|
|
|
|
|
(guix-eval-read
|
|
|
|
|
(apply #'guix-make-guile-expression
|
|
|
|
|
'help-string commands)))
|
|
|
|
|
|
2014-10-21 07:48:28 +00:00
|
|
|
|
|
|
|
|
|
;;; Pull
|
|
|
|
|
|
|
|
|
|
(defcustom guix-update-after-pull t
|
|
|
|
|
"If non-nil, update Guix buffers after performing \\[guix-pull]."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'guix)
|
|
|
|
|
|
|
|
|
|
(defvar guix-after-pull-hook
|
|
|
|
|
'(guix-restart-repl-after-pull guix-update-buffers-maybe-after-pull)
|
|
|
|
|
"Hook run after successful performing `guix-pull' operation.")
|
|
|
|
|
|
|
|
|
|
(defun guix-restart-repl-after-pull ()
|
|
|
|
|
"Restart Guix REPL after `guix-pull' operation."
|
|
|
|
|
(guix-repl-exit)
|
|
|
|
|
(guix-start-process-maybe
|
|
|
|
|
"Restarting Guix REPL after pull operation ..."))
|
|
|
|
|
|
|
|
|
|
(defun guix-update-buffers-maybe-after-pull ()
|
|
|
|
|
"Update buffers depending on `guix-update-after-pull'."
|
|
|
|
|
(when guix-update-after-pull
|
emacs: Generalize buffer naming.
* emacs/guix-base.el (guix-buffer-name): New procedure.
(guix-buffer-define-interface): Make ':buffer-name' a required keyword.
(guix-update-after-operation, guix-buffer-name-function)
(guix-buffer-name-simple, guix-buffer-name-default, guix-buffer-name)
(guix-buffer-p, guix-buffers, guix-update-buffer)
(guix-update-buffers-maybe-after-operation): Adjust, move and rename to...
* emacs/guix-ui.el (guix-ui-update-after-operation)
(guix-ui-buffer-name-function, guix-ui-buffer-name-simple)
(guix-ui-buffer-name-default, guix-ui-buffer-name)
(guix-ui-buffer?, guix-ui-buffers, guix-ui-update-buffer)
(guix-ui-update-buffers-after-operation): ... this.
(guix-ui-define-interface): Generate
'guix-ENTRY-TYPE-BUFFER-TYPE-buffer-name' procedure and pass it as
':buffer-name' argument.
(guix-ui): New custom group.
* emacs/guix-info.el: Specify ':buffer-name' for the defined interfaces.
* emacs/guix-list.el: Likewise.
* doc/emacs.texi (Emacs Appearance): Adjust accordingly.
2015-11-23 13:41:58 +00:00
|
|
|
|
(mapc #'guix-ui-update-buffer
|
2014-10-21 07:48:28 +00:00
|
|
|
|
;; No need to update "generation" buffers.
|
emacs: Generalize buffer naming.
* emacs/guix-base.el (guix-buffer-name): New procedure.
(guix-buffer-define-interface): Make ':buffer-name' a required keyword.
(guix-update-after-operation, guix-buffer-name-function)
(guix-buffer-name-simple, guix-buffer-name-default, guix-buffer-name)
(guix-buffer-p, guix-buffers, guix-update-buffer)
(guix-update-buffers-maybe-after-operation): Adjust, move and rename to...
* emacs/guix-ui.el (guix-ui-update-after-operation)
(guix-ui-buffer-name-function, guix-ui-buffer-name-simple)
(guix-ui-buffer-name-default, guix-ui-buffer-name)
(guix-ui-buffer?, guix-ui-buffers, guix-ui-update-buffer)
(guix-ui-update-buffers-after-operation): ... this.
(guix-ui-define-interface): Generate
'guix-ENTRY-TYPE-BUFFER-TYPE-buffer-name' procedure and pass it as
':buffer-name' argument.
(guix-ui): New custom group.
* emacs/guix-info.el: Specify ':buffer-name' for the defined interfaces.
* emacs/guix-list.el: Likewise.
* doc/emacs.texi (Emacs Appearance): Adjust accordingly.
2015-11-23 13:41:58 +00:00
|
|
|
|
(guix-ui-buffers '(guix-package-list-mode
|
|
|
|
|
guix-package-info-mode
|
|
|
|
|
guix-output-list-mode
|
|
|
|
|
guix-output-info-mode)))
|
2014-10-21 07:48:28 +00:00
|
|
|
|
(message "Guix buffers have been updated.")))
|
|
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun guix-pull (&optional verbose)
|
|
|
|
|
"Run Guix pull operation.
|
|
|
|
|
If VERBOSE is non-nil (with prefix argument), produce verbose output."
|
2015-11-25 10:29:36 +00:00
|
|
|
|
(interactive "P")
|
2014-10-21 07:48:28 +00:00
|
|
|
|
(let ((args (and verbose '("--verbose"))))
|
|
|
|
|
(guix-eval-in-repl
|
2015-11-25 10:29:36 +00:00
|
|
|
|
(apply #'guix-make-guile-expression
|
|
|
|
|
'guix-command "pull" args)
|
2014-10-21 07:48:28 +00:00
|
|
|
|
nil 'pull)))
|
|
|
|
|
|
2014-08-27 12:44:17 +00:00
|
|
|
|
(provide 'guix-base)
|
|
|
|
|
|
|
|
|
|
;;; guix-base.el ends here
|