1 ;;; guix-external.el --- External programs -*- lexical-binding: t -*-
3 ;; Copyright © 2015 Alex Kost <alezost@gmail.com>
5 ;; This file is part of GNU Guix.
7 ;; GNU Guix is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation, either version 3 of the License, or
10 ;; (at your option) any later version.
12 ;; GNU Guix is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
22 ;; This file provides auxiliary code for running external programs.
27 (require 'guix-config
)
29 (defgroup guix-external nil
30 "Settings for external programs."
33 (defcustom guix-guile-program guix-config-guile-program
34 "Name of the 'guile' executable used for Guix REPL.
35 May be either a string (the name of the executable) or a list of
40 Where ARGS is a list of arguments to the guile program."
42 :group
'guix-external
)
44 (defcustom guix-dot-program
45 (if (file-name-absolute-p guix-config-dot-program
)
46 guix-config-dot-program
47 (executable-find "dot"))
48 "Name of the 'dot' executable."
50 :group
'guix-external
)
52 (defcustom guix-dot-default-arguments
54 "Default arguments for 'dot' program."
55 :type
'(repeat string
)
56 :group
'guix-external
)
58 (defcustom guix-dot-file-name-function
#'guix-png-file-name
59 "Function used to define a file name of a temporary 'dot' file.
60 The function is called without arguments."
61 :type
'(choice (function-item guix-png-file-name
)
62 (function :tag
"Other function"))
63 :group
'guix-external
)
65 (defun guix-dot-arguments (output-file &rest args
)
66 "Return a list of dot arguments for writing a graph into OUTPUT-FILE.
67 If ARGS is nil, use `guix-dot-default-arguments'."
69 (error (concat "Couldn't find 'dot'.\n"
70 "Set guix-dot-program to a proper value")))
71 (cl-list* guix-dot-program
72 (concat "-o" output-file
)
73 (or args guix-dot-default-arguments
)))
75 (defun guix-dot-file-name ()
76 "Call `guix-dot-file-name-function'."
77 (funcall guix-dot-file-name-function
))
79 (defun guix-png-file-name ()
80 "Return '.png' file name in the `temporary-file-directory'."
81 (concat (make-temp-name
82 (concat (file-name-as-directory temporary-file-directory
)
86 (provide 'guix-external
)
88 ;;; guix-external.el ends here