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.
26 (require 'guix-config
)
28 (defgroup guix-external nil
29 "Settings for external programs."
32 (defcustom guix-guile-program guix-config-guile-program
33 "Name of the 'guile' executable used for Guix REPL.
34 May be either a string (the name of the executable) or a list of
39 Where ARGS is a list of arguments to the guile program."
41 :group
'guix-external
)
43 (defcustom guix-dot-program
44 (if (file-name-absolute-p guix-config-dot-program
)
45 guix-config-dot-program
46 (executable-find "dot"))
47 "Name of the 'dot' executable."
49 :group
'guix-external
)
51 (defcustom guix-dot-default-arguments
53 "Default arguments for 'dot' program."
54 :type
'(repeat string
)
55 :group
'guix-external
)
57 (defcustom guix-dot-file-name-function
#'guix-png-file-name
58 "Function used to define a file name of a temporary 'dot' file.
59 The function is called without arguments."
60 :type
'(choice (function-item guix-png-file-name
)
61 (function :tag
"Other function"))
62 :group
'guix-external
)
64 (defun guix-dot-arguments (output-file &rest args
)
65 "Return a list of dot arguments for writing a graph into OUTPUT-FILE.
66 If ARGS is nil, use `guix-dot-default-arguments'."
68 (error (concat "Couldn't find 'dot'.\n"
69 "Set guix-dot-program to a proper value")))
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