emacs: Display message if license not found.

* emacs/guix-ui-license.el (guix-license-message): New procedure.
(guix-license-info-message-function): Use it.
(guix-license-list-message-function): Likewise.
This commit is contained in:
Alex Kost 2016-04-15 21:43:13 +03:00
parent 27986d7b19
commit 8934c3b60f
1 changed files with 11 additions and 0 deletions

View File

@ -44,12 +44,22 @@ SEARCH-TYPE may be one of the following symbols: `all', `id', `name'."
(apply #'guix-list-get-display-entries (apply #'guix-list-get-display-entries
'license search-type args)) 'license search-type args))
(defun guix-license-message (entries search-type &rest args)
"Display a message after showing license ENTRIES."
;; Some objects in (guix licenses) module are procedures (e.g.,
;; 'non-copyleft' or 'x11-style'). Such licenses cannot be "described".
(when (null entries)
(if (cdr args)
(message "Unknown licenses.")
(message "Unknown license."))))
;;; License 'info' ;;; License 'info'
(guix-info-define-interface license (guix-info-define-interface license
:buffer-name "*Guix License Info*" :buffer-name "*Guix License Info*"
:get-entries-function 'guix-license-get-entries :get-entries-function 'guix-license-get-entries
:message-function 'guix-license-message
:format '((name ignore (simple guix-info-heading)) :format '((name ignore (simple guix-info-heading))
ignore ignore
guix-license-insert-packages-button guix-license-insert-packages-button
@ -86,6 +96,7 @@ SEARCH-TYPE may be one of the following symbols: `all', `id', `name'."
:buffer-name "*Guix Licenses*" :buffer-name "*Guix Licenses*"
:get-entries-function 'guix-license-get-entries :get-entries-function 'guix-license-get-entries
:describe-function 'guix-license-list-describe :describe-function 'guix-license-list-describe
:message-function 'guix-license-message
:format '((name nil 40 t) :format '((name nil 40 t)
(url guix-list-get-url 50 t)) (url guix-list-get-url 50 t))
:titles '((name . "License")) :titles '((name . "License"))