2015-11-20 09:38:31 +00:00
|
|
|
|
;;; guix-ui.el --- Common code for Guix package management interface -*- lexical-binding: t -*-
|
|
|
|
|
|
|
|
|
|
;; Copyright © 2014, 2015 Alex Kost <alezost@gmail.com>
|
|
|
|
|
|
|
|
|
|
;; 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 general code for 'list'/'info' interfaces for
|
|
|
|
|
;; packages and generations.
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(require 'cl-lib)
|
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-backend)
|
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
|
|
|
|
(require 'guix-buffer)
|
|
|
|
|
(require 'guix-guile)
|
2015-11-20 09:38:31 +00:00
|
|
|
|
(require 'guix-utils)
|
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
|
|
|
|
(require 'guix-messages)
|
2015-11-20 09:38:31 +00:00
|
|
|
|
|
2015-12-18 08:19:12 +00:00
|
|
|
|
(guix-define-groups ui
|
|
|
|
|
:group-doc "\
|
|
|
|
|
Settings for 'ui' (Guix package management) 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
|
|
|
|
This group includes settings for displaying packages, outputs and
|
2015-12-18 08:19:12 +00:00
|
|
|
|
generations in 'list' and 'info' 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
|
|
|
|
|
2015-11-21 09:25:19 +00:00
|
|
|
|
(defvar guix-ui-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(define-key map (kbd "M") 'guix-apply-manifest)
|
|
|
|
|
(define-key map (kbd "C-c C-z") 'guix-switch-to-repl)
|
|
|
|
|
map)
|
|
|
|
|
"Parent keymap for Guix package/generation buffers.")
|
|
|
|
|
|
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
|
|
|
|
(guix-buffer-define-current-args-accessors
|
|
|
|
|
"guix-ui-current" "profile" "search-type" "search-values")
|
|
|
|
|
|
2015-12-18 08:34:48 +00:00
|
|
|
|
(defun guix-ui-read-profile ()
|
|
|
|
|
"Return `guix-current-profile' or prompt for it.
|
|
|
|
|
This function is intended for using in `interactive' forms."
|
|
|
|
|
(if current-prefix-arg
|
|
|
|
|
(guix-profile-prompt)
|
|
|
|
|
guix-current-profile))
|
|
|
|
|
|
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
|
|
|
|
(defun guix-ui-get-entries (profile entry-type search-type search-values
|
|
|
|
|
&optional params)
|
|
|
|
|
"Receive ENTRY-TYPE entries for PROFILE.
|
|
|
|
|
Call an appropriate scheme procedure and return a list of entries.
|
|
|
|
|
|
|
|
|
|
ENTRY-TYPE should be one of the following symbols: `package',
|
|
|
|
|
`output' or `generation'.
|
|
|
|
|
|
|
|
|
|
SEARCH-TYPE may be one of the following symbols:
|
|
|
|
|
|
|
|
|
|
- If ENTRY-TYPE is `package' or `output': `id', `name', `regexp',
|
|
|
|
|
`all-available', `newest-available', `installed', `obsolete',
|
|
|
|
|
`generation'.
|
|
|
|
|
|
|
|
|
|
- If ENTRY-TYPE is `generation': `id', `last', `all', `time'.
|
|
|
|
|
|
|
|
|
|
PARAMS is a list of parameters for receiving. If nil, get data
|
|
|
|
|
with all available parameters."
|
|
|
|
|
(guix-eval-read
|
|
|
|
|
(guix-make-guile-expression
|
|
|
|
|
'entries
|
|
|
|
|
profile params entry-type search-type search-values)))
|
|
|
|
|
|
2015-11-20 09:38:31 +00:00
|
|
|
|
(defun guix-ui-list-describe (ids)
|
|
|
|
|
"Describe 'ui' entries with IDS (list of identifiers)."
|
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
|
|
|
|
(guix-buffer-get-display-entries
|
|
|
|
|
'info (guix-buffer-current-entry-type)
|
|
|
|
|
(cl-list* (guix-ui-current-profile) 'id ids)
|
|
|
|
|
'add))
|
2015-11-20 09:38:31 +00:00
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
;;; Buffers and auto updating
|
|
|
|
|
|
|
|
|
|
(defcustom guix-ui-update-after-operation 'current
|
|
|
|
|
"Define what kind of data to update after executing an operation.
|
|
|
|
|
|
|
|
|
|
After successful executing an operation in the Guix REPL (for
|
|
|
|
|
example after installing a package), the data in Guix buffers
|
|
|
|
|
will or will not be automatically updated depending on a value of
|
|
|
|
|
this variable.
|
|
|
|
|
|
|
|
|
|
If nil, update nothing (do not revert any buffer).
|
|
|
|
|
If `current', update the buffer from which an operation was performed.
|
|
|
|
|
If `all', update all Guix buffers (not recommended)."
|
|
|
|
|
:type '(choice (const :tag "Do nothing" nil)
|
|
|
|
|
(const :tag "Update operation buffer" current)
|
|
|
|
|
(const :tag "Update all Guix buffers" all))
|
|
|
|
|
:group 'guix-ui)
|
|
|
|
|
|
|
|
|
|
(defcustom guix-ui-buffer-name-function
|
|
|
|
|
#'guix-ui-buffer-name-default
|
|
|
|
|
"Function used to define a name of a Guix buffer.
|
|
|
|
|
The function is called with 2 arguments: BASE-NAME and PROFILE."
|
|
|
|
|
:type '(choice (function-item guix-ui-buffer-name-default)
|
|
|
|
|
(function-item guix-ui-buffer-name-simple)
|
|
|
|
|
(function :tag "Other function"))
|
|
|
|
|
:group 'guix-ui)
|
|
|
|
|
|
|
|
|
|
(defun guix-ui-buffer-name-simple (base-name &rest _)
|
|
|
|
|
"Return BASE-NAME."
|
|
|
|
|
base-name)
|
|
|
|
|
|
|
|
|
|
;; TODO separate '*...*' logic from the real profile appending. Also add
|
|
|
|
|
;; another function to return '*Guix ...: /full/path/to/profile*' name.
|
|
|
|
|
(defun guix-ui-buffer-name-default (base-name profile)
|
|
|
|
|
"Return buffer name by appending BASE-NAME and PROFILE's base file name."
|
|
|
|
|
(let ((profile-name (file-name-base (directory-file-name profile)))
|
|
|
|
|
(re (rx string-start
|
|
|
|
|
(group (? "*"))
|
|
|
|
|
(group (*? any))
|
|
|
|
|
(group (? "*"))
|
|
|
|
|
string-end)))
|
|
|
|
|
(or (string-match re base-name)
|
|
|
|
|
(error "Unexpected error in defining guix buffer name"))
|
|
|
|
|
(let ((first* (match-string 1 base-name))
|
|
|
|
|
(name-body (match-string 2 base-name))
|
|
|
|
|
(last* (match-string 3 base-name)))
|
|
|
|
|
;; Handle the case when buffer name is wrapped by '*'.
|
|
|
|
|
(if (and (string= "*" first*)
|
|
|
|
|
(string= "*" last*))
|
|
|
|
|
(concat "*" name-body ": " profile-name "*")
|
|
|
|
|
(concat base-name ": " profile-name)))))
|
|
|
|
|
|
|
|
|
|
(defun guix-ui-buffer-name (base-name profile)
|
|
|
|
|
"Return Guix buffer name based on BASE-NAME and profile.
|
|
|
|
|
See `guix-ui-buffer-name-function' for details."
|
|
|
|
|
(funcall guix-ui-buffer-name-function
|
|
|
|
|
base-name profile))
|
|
|
|
|
|
|
|
|
|
(defun guix-ui-buffer? (&optional buffer modes)
|
|
|
|
|
"Return non-nil if BUFFER mode is derived from any of the MODES.
|
|
|
|
|
If BUFFER is nil, check current buffer.
|
|
|
|
|
If MODES is nil, use `guix-list-mode' and `guix-info-mode'."
|
|
|
|
|
(with-current-buffer (or buffer (current-buffer))
|
|
|
|
|
(apply #'derived-mode-p
|
|
|
|
|
(or modes '(guix-list-mode guix-info-mode)))))
|
|
|
|
|
|
|
|
|
|
(defun guix-ui-buffers (&optional modes)
|
|
|
|
|
"Return a list of all buffers with major modes derived from MODES.
|
|
|
|
|
If MODES is nil, return list of all Guix 'list' and 'info' buffers."
|
|
|
|
|
(cl-remove-if-not (lambda (buf)
|
|
|
|
|
(guix-ui-buffer? buf modes))
|
|
|
|
|
(buffer-list)))
|
|
|
|
|
|
|
|
|
|
(defun guix-ui-update-buffer (buffer)
|
|
|
|
|
"Update data in a 'list' or 'info' BUFFER."
|
|
|
|
|
(with-current-buffer buffer
|
|
|
|
|
(guix-buffer-revert nil t)))
|
|
|
|
|
|
|
|
|
|
(defun guix-ui-update-buffers-after-operation ()
|
|
|
|
|
"Update buffers after Guix operation if needed.
|
|
|
|
|
See `guix-ui-update-after-operation' for details."
|
|
|
|
|
(let ((to-update
|
|
|
|
|
(and guix-operation-buffer
|
|
|
|
|
(cl-case guix-ui-update-after-operation
|
|
|
|
|
(current (and (buffer-live-p guix-operation-buffer)
|
|
|
|
|
(guix-ui-buffer? guix-operation-buffer)
|
|
|
|
|
(list guix-operation-buffer)))
|
|
|
|
|
(all (guix-ui-buffers))))))
|
|
|
|
|
(setq guix-operation-buffer nil)
|
|
|
|
|
(mapc #'guix-ui-update-buffer to-update)))
|
|
|
|
|
|
|
|
|
|
(add-hook 'guix-after-repl-operation-hook
|
|
|
|
|
'guix-ui-update-buffers-after-operation)
|
|
|
|
|
|
2015-11-20 09:38:31 +00:00
|
|
|
|
|
|
|
|
|
;;; Interface definers
|
|
|
|
|
|
2015-12-18 08:19:12 +00:00
|
|
|
|
(defmacro guix-ui-define-entry-type (entry-type &rest args)
|
|
|
|
|
"Define general code for ENTRY-TYPE.
|
|
|
|
|
Remaining arguments (ARGS) should have a form [KEYWORD VALUE] ...
|
|
|
|
|
|
|
|
|
|
The rest keyword arguments are passed to
|
|
|
|
|
`guix-define-entry-type' macro."
|
|
|
|
|
(declare (indent 1))
|
|
|
|
|
`(guix-define-entry-type ,entry-type
|
|
|
|
|
:parent-group guix-ui
|
|
|
|
|
:parent-faces-group guix-ui-faces
|
|
|
|
|
,@args))
|
|
|
|
|
|
2015-11-20 09:38:31 +00:00
|
|
|
|
(defmacro guix-ui-define-interface (buffer-type entry-type &rest args)
|
|
|
|
|
"Define BUFFER-TYPE interface for displaying ENTRY-TYPE entries.
|
|
|
|
|
Remaining arguments (ARGS) should have a form [KEYWORD VALUE] ...
|
|
|
|
|
In the following description TYPE means ENTRY-TYPE-BUFFER-TYPE.
|
|
|
|
|
|
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
|
|
|
|
Required keywords:
|
|
|
|
|
|
|
|
|
|
- `:buffer-name' - base part of a buffer name. It is used in a
|
|
|
|
|
generated `guix-TYPE-buffer-name' function; see
|
|
|
|
|
`guix-ui-buffer-name' for details.
|
|
|
|
|
|
2015-11-20 09:38:31 +00:00
|
|
|
|
Optional keywords:
|
|
|
|
|
|
|
|
|
|
- `:required' - default value of the generated
|
|
|
|
|
`guix-TYPE-required-params' variable.
|
|
|
|
|
|
|
|
|
|
The rest keyword arguments are passed to
|
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
|
|
|
|
`guix-BUFFER-TYPE-define-interface' macro.
|
|
|
|
|
|
|
|
|
|
Along with the mentioned definitions, this macro also defines:
|
|
|
|
|
|
|
|
|
|
- `guix-TYPE-mode-map' - keymap based on `guix-ui-map' and
|
|
|
|
|
`guix-BUFFER-TYPE-mode-map'.
|
|
|
|
|
|
|
|
|
|
- `guix-TYPE-get-entries' - a wrapper around `guix-ui-get-entries'.
|
|
|
|
|
|
|
|
|
|
- `guix-TYPE-message' - a wrapper around `guix-result-message'."
|
2015-11-20 09:38:31 +00:00
|
|
|
|
(declare (indent 2))
|
|
|
|
|
(let* ((entry-type-str (symbol-name entry-type))
|
|
|
|
|
(buffer-type-str (symbol-name buffer-type))
|
|
|
|
|
(prefix (concat "guix-" entry-type-str "-"
|
|
|
|
|
buffer-type-str))
|
2015-11-21 09:25:19 +00:00
|
|
|
|
(mode-str (concat prefix "-mode"))
|
|
|
|
|
(mode-map (intern (concat mode-str "-map")))
|
|
|
|
|
(parent-map (intern (format "guix-%s-mode-map"
|
|
|
|
|
buffer-type-str)))
|
2015-11-20 09:38:31 +00:00
|
|
|
|
(required-var (intern (concat prefix "-required-params")))
|
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
|
|
|
|
(buffer-name-fun (intern (concat prefix "-buffer-name")))
|
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
|
|
|
|
(get-fun (intern (concat prefix "-get-entries")))
|
|
|
|
|
(message-fun (intern (concat prefix "-message")))
|
|
|
|
|
(displayed-fun (intern (format "guix-%s-displayed-params"
|
|
|
|
|
buffer-type-str)))
|
2015-11-20 09:38:31 +00:00
|
|
|
|
(definer (intern (format "guix-%s-define-interface"
|
|
|
|
|
buffer-type-str))))
|
|
|
|
|
(guix-keyword-args-let args
|
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
|
|
|
|
((buffer-name-val :buffer-name)
|
|
|
|
|
(required-val :required ''(id)))
|
2015-11-20 09:38:31 +00:00
|
|
|
|
`(progn
|
2015-11-21 09:25:19 +00:00
|
|
|
|
(defvar ,mode-map
|
|
|
|
|
(let ((map (make-sparse-keymap)))
|
|
|
|
|
(set-keymap-parent
|
|
|
|
|
map (make-composed-keymap ,parent-map guix-ui-map))
|
|
|
|
|
map)
|
|
|
|
|
,(format "Keymap for `%s' buffers." mode-str))
|
|
|
|
|
|
2015-11-20 09:38:31 +00:00
|
|
|
|
(defvar ,required-var ,required-val
|
|
|
|
|
,(format "\
|
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
|
|
|
|
List of the required '%s' parameters.
|
|
|
|
|
These parameters are received by `%S'
|
|
|
|
|
along with the displayed parameters.
|
|
|
|
|
|
|
|
|
|
Do not remove `id' from this list as it is required for
|
|
|
|
|
identifying an entry."
|
|
|
|
|
entry-type-str get-fun))
|
2015-11-20 09:38:31 +00:00
|
|
|
|
|
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
|
|
|
|
(defun ,buffer-name-fun (profile &rest _)
|
|
|
|
|
,(format "\
|
|
|
|
|
Return a name of '%s' buffer for displaying '%s' entries.
|
|
|
|
|
See `guix-ui-buffer-name' for details."
|
|
|
|
|
buffer-type-str entry-type-str)
|
|
|
|
|
(guix-ui-buffer-name ,buffer-name-val profile))
|
|
|
|
|
|
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
|
|
|
|
(defun ,get-fun (profile search-type &rest search-values)
|
|
|
|
|
,(format "\
|
|
|
|
|
Receive '%s' entries for displaying them in '%s' buffer.
|
|
|
|
|
See `guix-ui-get-entries' for details."
|
|
|
|
|
entry-type-str buffer-type-str)
|
|
|
|
|
(guix-ui-get-entries
|
|
|
|
|
profile ',entry-type search-type search-values
|
|
|
|
|
(cl-union ,required-var
|
|
|
|
|
(,displayed-fun ',entry-type))))
|
|
|
|
|
|
|
|
|
|
(defun ,message-fun (entries profile search-type
|
|
|
|
|
&rest search-values)
|
|
|
|
|
,(format "\
|
|
|
|
|
Display a message after showing '%s' entries."
|
|
|
|
|
entry-type-str)
|
|
|
|
|
(guix-result-message
|
|
|
|
|
profile entries ',entry-type search-type search-values))
|
|
|
|
|
|
2015-11-20 09:38:31 +00:00
|
|
|
|
(,definer ,entry-type
|
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
|
|
|
|
:get-entries-function ',get-fun
|
|
|
|
|
:message-function ',message-fun
|
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
|
|
|
|
:buffer-name ',buffer-name-fun
|
2015-11-20 09:38:31 +00:00
|
|
|
|
,@%foreign-args)))))
|
|
|
|
|
|
|
|
|
|
(defmacro guix-ui-info-define-interface (entry-type &rest args)
|
|
|
|
|
"Define 'info' interface for displaying ENTRY-TYPE entries.
|
|
|
|
|
See `guix-ui-define-interface'."
|
|
|
|
|
(declare (indent 1))
|
|
|
|
|
`(guix-ui-define-interface info ,entry-type
|
|
|
|
|
,@args))
|
|
|
|
|
|
|
|
|
|
(defmacro guix-ui-list-define-interface (entry-type &rest args)
|
|
|
|
|
"Define 'list' interface for displaying ENTRY-TYPE entries.
|
|
|
|
|
Remaining arguments (ARGS) should have a form [KEYWORD VALUE] ...
|
|
|
|
|
|
|
|
|
|
Optional keywords:
|
|
|
|
|
|
|
|
|
|
- `:describe-function' - default value of the generated
|
|
|
|
|
`guix-ENTRY-TYPE-list-describe-function' variable (if not
|
|
|
|
|
specified, use `guix-ui-list-describe').
|
|
|
|
|
|
|
|
|
|
The rest keyword arguments are passed to
|
|
|
|
|
`guix-ui-define-interface' macro."
|
|
|
|
|
(declare (indent 1))
|
|
|
|
|
(guix-keyword-args-let args
|
|
|
|
|
((describe-val :describe-function))
|
|
|
|
|
`(guix-ui-define-interface list ,entry-type
|
|
|
|
|
:describe-function ,(or describe-val ''guix-ui-list-describe)
|
|
|
|
|
,@args)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defvar guix-ui-font-lock-keywords
|
|
|
|
|
(eval-when-compile
|
2015-12-18 08:19:12 +00:00
|
|
|
|
`((,(rx "(" (group (or "guix-ui-define-entry-type"
|
|
|
|
|
"guix-ui-define-interface"
|
2015-11-20 09:38:31 +00:00
|
|
|
|
"guix-ui-info-define-interface"
|
|
|
|
|
"guix-ui-list-define-interface"))
|
|
|
|
|
symbol-end)
|
|
|
|
|
. 1))))
|
|
|
|
|
|
|
|
|
|
(font-lock-add-keywords 'emacs-lisp-mode guix-ui-font-lock-keywords)
|
|
|
|
|
|
|
|
|
|
(provide 'guix-ui)
|
|
|
|
|
|
|
|
|
|
;;; guix-ui.el ends here
|