2016-12-21 11:32:38 +01:00
|
|
|
|
;;; guix-about.el --- Various info about Guix and Emacs-Guix -*- lexical-binding: t -*-
|
2016-11-01 21:08:06 +01:00
|
|
|
|
|
2019-11-21 17:18:53 +01:00
|
|
|
|
;; Copyright © 2016–2017, 2019 Alex Kost <alezost@gmail.com>
|
2016-11-01 21:08:06 +01:00
|
|
|
|
|
|
|
|
|
;; This file is part of Emacs-Guix.
|
|
|
|
|
|
|
|
|
|
;; Emacs-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.
|
|
|
|
|
;;
|
|
|
|
|
;; Emacs-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 Emacs-Guix. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
|
|
;; This file provides the code to display various info about Guix (e.g., its
|
2017-01-11 10:29:10 +01:00
|
|
|
|
;; version) and Emacs-Guix.
|
2016-11-01 21:08:06 +01:00
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
2016-12-06 21:07:13 +01:00
|
|
|
|
(require 'bui)
|
2016-12-15 14:57:56 +01:00
|
|
|
|
(require 'guix nil t)
|
2017-01-11 10:29:10 +01:00
|
|
|
|
(require 'guix-help)
|
2016-12-06 21:07:13 +01:00
|
|
|
|
(require 'guix-utils)
|
2016-11-01 21:08:06 +01:00
|
|
|
|
(require 'guix-config)
|
|
|
|
|
|
2016-11-26 22:17:18 +01:00
|
|
|
|
(declare-function guix-eval-read "guix-repl" (str))
|
|
|
|
|
|
2016-11-01 21:08:06 +01:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun guix-version ()
|
2016-11-26 22:17:18 +01:00
|
|
|
|
"Display Emacs-Guix and Guix versions in the echo area."
|
2016-11-01 21:08:06 +01:00
|
|
|
|
(interactive)
|
2016-11-26 22:17:18 +01:00
|
|
|
|
(require 'guix-repl)
|
|
|
|
|
(message "%s %s\n%s %s"
|
|
|
|
|
(guix-eval-read "(@ (guix config) %guix-package-name)")
|
|
|
|
|
(guix-eval-read "(@ (guix config) %guix-version)")
|
|
|
|
|
guix-config-name
|
|
|
|
|
guix-config-version))
|
2016-11-01 21:08:06 +01:00
|
|
|
|
|
2016-12-20 21:33:53 +01:00
|
|
|
|
|
|
|
|
|
;;; "About" buffer
|
|
|
|
|
|
|
|
|
|
(defcustom guix-about-buffer-name "*Guix About*"
|
|
|
|
|
"Buffer name for '\\[guix-about]'."
|
|
|
|
|
:type 'string
|
2017-01-11 10:29:10 +01:00
|
|
|
|
:group 'guix)
|
2016-12-20 21:33:53 +01:00
|
|
|
|
|
|
|
|
|
(defvar guix-about-specifications
|
|
|
|
|
`("GNU Guix: "
|
|
|
|
|
:link ("https://www.gnu.org/software/guix/"
|
|
|
|
|
,(lambda (button)
|
|
|
|
|
(browse-url (button-label button))))
|
|
|
|
|
"\nEmacs-Guix: "
|
2018-06-17 16:27:08 +02:00
|
|
|
|
:link ("https://emacs-guix.gitlab.io/website/"
|
2016-12-20 21:33:53 +01:00
|
|
|
|
,(lambda (button)
|
|
|
|
|
(browse-url (button-label button))))
|
|
|
|
|
"\n\n"
|
|
|
|
|
:link ("GNU Guix Manual"
|
|
|
|
|
,(lambda (_button) (info "(guix)")))
|
|
|
|
|
"\n"
|
|
|
|
|
:link ("Emacs Guix Manual"
|
|
|
|
|
,(lambda (_button) (info "(emacs-guix)")))
|
|
|
|
|
"\n"
|
|
|
|
|
"\nAvailable commands: "
|
|
|
|
|
:link ("M-x guix-help"
|
|
|
|
|
,(lambda (_button) (guix-help)))
|
|
|
|
|
"\nGuix and Emacs-Guix versions: "
|
|
|
|
|
:link ("M-x guix-version"
|
|
|
|
|
,(lambda (_button) (guix-version)))
|
|
|
|
|
|
|
|
|
|
"\n")
|
|
|
|
|
"Text to show with '\\[guix-about]' command.
|
|
|
|
|
This is not really a text, it is a list of arguments passed to
|
|
|
|
|
`fancy-splash-insert'.")
|
|
|
|
|
|
|
|
|
|
(defun guix-logo-file ()
|
2021-01-12 11:45:01 +01:00
|
|
|
|
"Return the file name of the Guix logo image.
|
|
|
|
|
Return nil if the image cannot be found."
|
2016-12-21 19:36:46 +01:00
|
|
|
|
(when guix-image-directory
|
2021-01-12 11:45:01 +01:00
|
|
|
|
(expand-file-name "guix-logo.svg" guix-image-directory)))
|
2016-12-20 21:33:53 +01:00
|
|
|
|
|
2019-11-21 17:18:53 +01:00
|
|
|
|
;; Guix builds Emacs-Guix with 'emacs-minimal' package which does not
|
|
|
|
|
;; support many things including image stuff. This leads to a
|
|
|
|
|
;; (harmless) warning about missing `image-size' function during ELC
|
|
|
|
|
;; compilation. The following line hides this useless warning.
|
|
|
|
|
(declare-function image-size "image.c")
|
|
|
|
|
|
2016-12-20 21:33:53 +01:00
|
|
|
|
(defun guix-insert-logo ()
|
|
|
|
|
"Insert Guix(SD) logo into the current buffer."
|
|
|
|
|
(when (display-images-p)
|
2016-12-21 19:36:46 +01:00
|
|
|
|
(let* ((file (guix-logo-file))
|
|
|
|
|
(image (and file (create-image file))))
|
2016-12-20 21:33:53 +01:00
|
|
|
|
(when image
|
|
|
|
|
(let ((width (car (image-size image))))
|
|
|
|
|
(when (> (window-width) width)
|
|
|
|
|
;; Center the image in the window.
|
|
|
|
|
(insert (propertize
|
|
|
|
|
" " 'display
|
|
|
|
|
`(space :align-to (+ center (-0.5 . ,image)))))
|
|
|
|
|
(insert-image image)
|
|
|
|
|
(bui-newline)))))))
|
|
|
|
|
|
|
|
|
|
(defun guix-about-insert-content ()
|
|
|
|
|
"Insert Emacs-Guix 'about' info into the current buffer."
|
2016-12-21 11:32:38 +01:00
|
|
|
|
(guix-insert-logo)
|
2016-12-21 12:12:11 +01:00
|
|
|
|
(apply #'fancy-splash-insert guix-about-specifications)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(forward-line 3))
|
2016-12-20 21:33:53 +01:00
|
|
|
|
|
2017-01-07 21:07:02 +01:00
|
|
|
|
(defun guix-about-show ()
|
|
|
|
|
"Display 'About' buffer with fancy Guix logo if available.
|
|
|
|
|
Unlike `guix-about', this command always recreates
|
|
|
|
|
`guix-about-buffer-name' buffer."
|
2016-12-20 21:33:53 +01:00
|
|
|
|
(interactive)
|
2016-12-21 11:32:38 +01:00
|
|
|
|
(guix-help-display-buffer guix-about-buffer-name
|
|
|
|
|
#'guix-about-insert-content))
|
2016-12-20 21:33:53 +01:00
|
|
|
|
|
2017-01-07 21:07:02 +01:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun guix-about ()
|
|
|
|
|
"Display 'About' buffer with fancy Guix logo if available.
|
|
|
|
|
Switch to `guix-about-buffer-name' buffer if it already exists."
|
|
|
|
|
(interactive)
|
|
|
|
|
(guix-switch-to-buffer-or-funcall
|
|
|
|
|
guix-about-buffer-name #'guix-about-show))
|
|
|
|
|
|
2016-11-01 21:08:06 +01:00
|
|
|
|
(provide 'guix-about)
|
|
|
|
|
|
|
|
|
|
;;; guix-about.el ends here
|