unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: guix: Set 'guix-dot-program' emacs variable.
@ 2015-10-15 19:48 Alex Kost
  2015-10-16  8:20 ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Kost @ 2015-10-15 19:48 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 142 bytes --]

What about modifying ‘guix’ package to make various "View graph" actions
in "M-x guix" work by default (without installing graphviz)?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-guix-Set-guix-dot-program-emacs-variable.patch --]
[-- Type: text/x-patch, Size: 2840 bytes --]

From fb077a89b89bb255b464fa21d4f1e715f86239bf Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Thu, 15 Oct 2015 20:57:20 +0300
Subject: [PATCH] gnu: guix: Set 'guix-dot-program' emacs variable.

* gnu/packages/package-management.scm (guix-devel)[arguments]: Add
  'patch-exec-paths' phase to set 'guix-dot-program' emacs variable.
---
 gnu/packages/package-management.scm | 37 +++++++++++++++++++++++++------------
 1 file changed, 25 insertions(+), 12 deletions(-)

diff --git a/gnu/packages/package-management.scm b/gnu/packages/package-management.scm
index 8fbe5b3..08a72c5 100644
--- a/gnu/packages/package-management.scm
+++ b/gnu/packages/package-management.scm
@@ -189,18 +189,31 @@ the Nix package manager.")
                   "1zgjj5knpz3qbbqdjm4yh436bzfgasc6p0k3xnx58hfjd88mdsga"))
                 (file-name (string-append "guix-" version "-checkout"))))
       (arguments
-       (substitute-keyword-arguments (package-arguments guix-0.8.3)
-         ((#:phases phases)
-          `(modify-phases ,phases
-             (add-after
-              'unpack 'bootstrap
-              (lambda _
-                ;; Make sure 'msgmerge' can modify the PO files.
-                (for-each (lambda (po)
-                            (chmod po #o666))
-                          (find-files "." "\\.po$"))
-
-                (zero? (system* "sh" "bootstrap"))))))))
+       (let ((args `(#:modules ((guix build gnu-build-system)
+                                (guix build utils)
+                                (guix build emacs-utils))
+                     #:imported-modules (,@%gnu-build-system-modules
+                                         (guix build emacs-utils))
+                     ,@(package-arguments guix-0.8.3))))
+         (substitute-keyword-arguments args
+           ((#:phases phases)
+            `(modify-phases ,phases
+               (add-after 'unpack 'bootstrap
+                 (lambda _
+                   ;; Make sure 'msgmerge' can modify the PO files.
+                   (for-each (lambda (po)
+                               (chmod po #o666))
+                             (find-files "." "\\.po$"))
+                   (zero? (system* "sh" "bootstrap"))))
+               (add-before 'build 'patch-exec-paths
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   (let ((graphviz (assoc-ref inputs "graphviz"))
+                         (file "emacs/guix-external.el"))
+                     (chmod file #o644)
+                     (emacs-substitute-variables file
+                       ("guix-dot-program" (string-append graphviz
+                                                          "/bin/dot")))
+                     #t))))))))
       (native-inputs
        `(("autoconf" ,(autoconf-wrapper))
          ("automake" ,automake)
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] gnu: guix: Set 'guix-dot-program' emacs variable.
  2015-10-15 19:48 [PATCH] gnu: guix: Set 'guix-dot-program' emacs variable Alex Kost
@ 2015-10-16  8:20 ` Ludovic Courtès
  2015-10-16 18:21   ` Alex Kost
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2015-10-16  8:20 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> What about modifying ‘guix’ package to make various "View graph" actions
> in "M-x guix" work by default (without installing graphviz)?

I would rather change Guix itself: What about adding ‘guix-dot-program’
to guix-config.el.in, set to "@DOT_USER_PROGRAM@" (which doesn’t exist
yet)?

We can’t use @DOT@ because currently it is set to something like:

  DOT='${SHELL} /home/ludo/src/guix/build-aux/missing dot'

So we need an AC_PATH_PROG for dot that defines the ‘DOT_USER_PROGRAM’
substitution variable.

Does that make sense?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] gnu: guix: Set 'guix-dot-program' emacs variable.
  2015-10-16  8:20 ` Ludovic Courtès
@ 2015-10-16 18:21   ` Alex Kost
  2015-10-17 13:34     ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Kost @ 2015-10-16 18:21 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1271 bytes --]

Ludovic Courtès (2015-10-16 11:20 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> What about modifying ‘guix’ package to make various "View graph" actions
>> in "M-x guix" work by default (without installing graphviz)?
>
> I would rather change Guix itself: What about adding ‘guix-dot-program’
> to guix-config.el.in, set to "@DOT_USER_PROGRAM@" (which doesn’t exist
> yet)?

Great idea!  However I think instead of moving ‘guix-dot-program’ to
"guix-config.el.in", it is better to move ‘guix-guile-program’ to
"guix-external.el" instead (explained below).

> We can’t use @DOT@ because currently it is set to something like:
>
>   DOT='${SHELL} /home/ludo/src/guix/build-aux/missing dot'

Yes, that's why I didn't use @DOT@, and decided to modify the ‘guix’
package instead.

> So we need an AC_PATH_PROG for dot that defines the ‘DOT_USER_PROGRAM’
> substitution variable.
>
> Does that make sense?

Yes, this is great!  I didn't think to go this way, thanks!

Along with the patch for this change, I'm also attaching a patch to
"improve" guix-config.el: to make all its constants begin with
"guix-config-" prefix and to use them in the real variables that may be
modified by a user.  WDYT?


[-- Attachment #2: 0001-build-Set-DOT_USER_PROGRAM-for-Emacs-interface.patch --]
[-- Type: text/x-patch, Size: 2371 bytes --]

From dd793147718cb18766268c8aad50d24b88ffe6b6 Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Fri, 16 Oct 2015 20:34:32 +0300
Subject: [PATCH 1/2] build: Set DOT_USER_PROGRAM for Emacs interface.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Suggested by Ludovic Courtès <ludo@gnu.org>.

* configure.ac: Set DOT_USER_PROGRAM variable.
* emacs/guix-config.el.in (guix-config-dot-program): New constant.
* emacs/guix-external.el (guix-dot-program): Use it.
---
 configure.ac            | 1 +
 emacs/guix-config.el.in | 4 ++++
 emacs/guix-external.el  | 7 ++++++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index bb3d947..74683fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -206,6 +206,7 @@ AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
 AC_CONFIG_FILES([test-env],     [chmod +x test-env])
 
 dnl Emacs interface.
+AC_PATH_PROG([DOT_USER_PROGRAM], [dot])
 AM_PATH_LISPDIR
 AM_CONDITIONAL([HAVE_EMACS], [test "x$EMACS" != "xno"])
 
diff --git a/emacs/guix-config.el.in b/emacs/guix-config.el.in
index 16434ce..b7020de 100644
--- a/emacs/guix-config.el.in
+++ b/emacs/guix-config.el.in
@@ -1,6 +1,7 @@
 ;;; guix-config.el --- Compile-time configuration of Guix.
 
 ;; Copyright © 2015 Mathieu Lirzin <mthl@openmailbox.org>
+;; Copyright © 2015 Alex Kost <alezost@gmail.com>
 
 ;; This file is part of GNU Guix.
 
@@ -35,6 +36,9 @@ strings of the form:
 
 Where ARGS is a list of arguments to the guile program.")
 
+(defconst guix-config-dot-program "@DOT_USER_PROGRAM@"
+  "Name of the 'dot' executable defined at the configure time.")
+
 (provide 'guix-config)
 
 ;;; guix-config.el ends here
diff --git a/emacs/guix-external.el b/emacs/guix-external.el
index d233473..ce83589 100644
--- a/emacs/guix-external.el
+++ b/emacs/guix-external.el
@@ -23,11 +23,16 @@
 
 ;;; Code:
 
+(require 'guix-config)
+
 (defgroup guix-external nil
   "Settings for external programs."
   :group 'guix)
 
-(defcustom guix-dot-program (executable-find "dot")
+(defcustom guix-dot-program
+  (if (string= "" guix-config-dot-program)
+      (executable-find "dot")
+    guix-config-dot-program)
   "Name of the 'dot' executable."
   :type 'string
   :group 'guix-external)
-- 
2.5.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-emacs-config-Use-emacs-config-prefix-for-constants.patch --]
[-- Type: text/x-patch, Size: 3535 bytes --]

From be9e01b3c2d6ca9f47c5bdac38effe7a7bb707dc Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Fri, 16 Oct 2015 20:48:24 +0300
Subject: [PATCH 2/2] emacs: config: Use "emacs-config-" prefix for constants.

* emacs/guix-config.el.in (guix-emacs-interface-directory,
  guix-state-directory): Rename to ...
  (guix-config-emacs-interface-directory, guix-config-state-directory):
  ...this.
  (guix-config-guile-program): New constant.
  (guix-guile-program): Move to ...
* emacs/guix-external.el (guix-guile-program): ...here.  Make it a
  'defcustom'.
* emacs/guix-profiles.el (guix-default-profile): Use
  'guix-config-state-directory'.
* emacs/guix-backend.el (guix-load-path): Use
  'guix-config-emacs-interface-directory'.
---
 emacs/guix-backend.el   |  3 ++-
 emacs/guix-config.el.in | 14 ++++----------
 emacs/guix-external.el  | 11 +++++++++++
 emacs/guix-profiles.el  |  2 +-
 4 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/emacs/guix-backend.el b/emacs/guix-backend.el
index 412d648..e7c158b 100644
--- a/emacs/guix-backend.el
+++ b/emacs/guix-backend.el
@@ -56,9 +56,10 @@
 (require 'geiser-guile)
 (require 'guix-geiser)
 (require 'guix-config)
+(require 'guix-external)
 (require 'guix-emacs)
 
-(defvar guix-load-path guix-emacs-interface-directory
+(defvar guix-load-path guix-config-emacs-interface-directory
   "Directory with scheme files for \"guix.el\" package.")
 
 (defvar guix-helper-file
diff --git a/emacs/guix-config.el.in b/emacs/guix-config.el.in
index b7020de..a02b362 100644
--- a/emacs/guix-config.el.in
+++ b/emacs/guix-config.el.in
@@ -20,21 +20,15 @@
 
 ;;; Code:
 
-(defconst guix-emacs-interface-directory
+(defconst guix-config-emacs-interface-directory
   (replace-regexp-in-string "${prefix}" "@prefix@" "@emacsuidir@"))
 
-(defconst guix-state-directory
+(defconst guix-config-state-directory
   ;; This must match `NIX_STATE_DIR' as defined in `daemon.am'.
   (or (getenv "NIX_STATE_DIR") "@guix_localstatedir@/guix"))
 
-(defvar guix-guile-program "@GUILE@"
-  "Name of the guile executable used for Guix REPL.
-May be either a string (the name of the executable) or a list of
-strings of the form:
-
-  (NAME . ARGS)
-
-Where ARGS is a list of arguments to the guile program.")
+(defconst guix-config-guile-program "@GUILE@"
+  "Name of the 'guile' executable defined at the configure time.")
 
 (defconst guix-config-dot-program "@DOT_USER_PROGRAM@"
   "Name of the 'dot' executable defined at the configure time.")
diff --git a/emacs/guix-external.el b/emacs/guix-external.el
index ce83589..0af52c3 100644
--- a/emacs/guix-external.el
+++ b/emacs/guix-external.el
@@ -29,6 +29,17 @@
   "Settings for external programs."
   :group 'guix)
 
+(defcustom guix-guile-program guix-config-guile-program
+  "Name of the 'guile' executable used for Guix REPL.
+May be either a string (the name of the executable) or a list of
+strings of the form:
+
+  (NAME . ARGS)
+
+Where ARGS is a list of arguments to the guile program."
+  :type 'string
+  :group 'guix-external)
+
 (defcustom guix-dot-program
   (if (string= "" guix-config-dot-program)
       (executable-find "dot")
diff --git a/emacs/guix-profiles.el b/emacs/guix-profiles.el
index 1a41745..2c19368 100644
--- a/emacs/guix-profiles.el
+++ b/emacs/guix-profiles.el
@@ -26,7 +26,7 @@
   "User profile.")
 
 (defvar guix-default-profile
-  (concat guix-state-directory
+  (concat guix-config-state-directory
           "/profiles/per-user/"
           (getenv "USER")
           "/guix-profile")
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] gnu: guix: Set 'guix-dot-program' emacs variable.
  2015-10-16 18:21   ` Alex Kost
@ 2015-10-17 13:34     ` Ludovic Courtès
  2015-10-17 15:46       ` Alex Kost
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2015-10-17 13:34 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> From dd793147718cb18766268c8aad50d24b88ffe6b6 Mon Sep 17 00:00:00 2001
> From: Alex Kost <alezost@gmail.com>
> Date: Fri, 16 Oct 2015 20:34:32 +0300
> Subject: [PATCH 1/2] build: Set DOT_USER_PROGRAM for Emacs interface.
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> Suggested by Ludovic Courtès <ludo@gnu.org>.
>
> * configure.ac: Set DOT_USER_PROGRAM variable.
> * emacs/guix-config.el.in (guix-config-dot-program): New constant.
> * emacs/guix-external.el (guix-dot-program): Use it.

[...]

> +(defconst guix-config-dot-program "@DOT_USER_PROGRAM@"
> +  "Name of the 'dot' executable defined at the configure time.")

“at configure time”

The docstring should mention that it can be the empty string.
Alternately, ‘configure’ could set DOT_USER_PROGRAM to “dot” when it’s
not found, which I think is ever preferable.  WDYT?

> +(defcustom guix-dot-program
> +  (if (string= "" guix-config-dot-program)
> +      (executable-find "dot")
> +    guix-config-dot-program)

Thus here we’d be checking whether ‘guix-config-dot-program’ is an
absolute file name.

> From be9e01b3c2d6ca9f47c5bdac38effe7a7bb707dc Mon Sep 17 00:00:00 2001
> From: Alex Kost <alezost@gmail.com>
> Date: Fri, 16 Oct 2015 20:48:24 +0300
> Subject: [PATCH 2/2] emacs: config: Use "emacs-config-" prefix for constants.
>
> * emacs/guix-config.el.in (guix-emacs-interface-directory,
>   guix-state-directory): Rename to ...
>   (guix-config-emacs-interface-directory, guix-config-state-directory):
>   ...this.
>   (guix-config-guile-program): New constant.
>   (guix-guile-program): Move to ...
> * emacs/guix-external.el (guix-guile-program): ...here.  Make it a
>   'defcustom'.
> * emacs/guix-profiles.el (guix-default-profile): Use
>   'guix-config-state-directory'.
> * emacs/guix-backend.el (guix-load-path): Use
>   'guix-config-emacs-interface-directory'.

OK!

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] gnu: guix: Set 'guix-dot-program' emacs variable.
  2015-10-17 13:34     ` Ludovic Courtès
@ 2015-10-17 15:46       ` Alex Kost
  2015-10-18 16:50         ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Kost @ 2015-10-17 15:46 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès (2015-10-17 16:34 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> From dd793147718cb18766268c8aad50d24b88ffe6b6 Mon Sep 17 00:00:00 2001
>> From: Alex Kost <alezost@gmail.com>
>> Date: Fri, 16 Oct 2015 20:34:32 +0300
>> Subject: [PATCH 1/2] build: Set DOT_USER_PROGRAM for Emacs interface.
>> MIME-Version: 1.0
>> Content-Type: text/plain; charset=UTF-8
>> Content-Transfer-Encoding: 8bit
>>
>> Suggested by Ludovic Courtès <ludo@gnu.org>.
>>
>> * configure.ac: Set DOT_USER_PROGRAM variable.
>> * emacs/guix-config.el.in (guix-config-dot-program): New constant.
>> * emacs/guix-external.el (guix-dot-program): Use it.
>
> [...]
>
>> +(defconst guix-config-dot-program "@DOT_USER_PROGRAM@"
>> +  "Name of the 'dot' executable defined at the configure time.")
>
> “at configure time”

Thanks.

> The docstring should mention that it can be the empty string.
> Alternately, ‘configure’ could set DOT_USER_PROGRAM to “dot” when it’s
> not found, which I think is ever preferable.  WDYT?

IMO an empty string is preferable (explained below), so I would like to
leave it like this (with an improved docstring as you pointed), if you
don't mind.

>> +(defcustom guix-dot-program
>> +  (if (string= "" guix-config-dot-program)
>> +      (executable-find "dot")
>> +    guix-config-dot-program)
>
> Thus here we’d be checking whether ‘guix-config-dot-program’ is an
> absolute file name.

I think (executable-find "dot") is more reliable than just "dot" which
may not exist.  So if there is no "dot" program, then ‘guix-dot-program’
variable will be set to nil.  And once "dot" will be needed, a user will
get a useful (I hope) emacs error that "dot" is missing (it is handled
by ‘guix-dot-arguments’ function).  While with just "dot" as you
suggest, there will be some unpleasant error in Guix REPL (it will
happen in ‘pipe-guix-output’ proc in “emacs/guix-main.scm”).

-- 
Alex

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] gnu: guix: Set 'guix-dot-program' emacs variable.
  2015-10-17 15:46       ` Alex Kost
@ 2015-10-18 16:50         ` Ludovic Courtès
  2015-10-19 14:49           ` Alex Kost
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2015-10-18 16:50 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> Ludovic Courtès (2015-10-17 16:34 +0300) wrote:

[...]

>> The docstring should mention that it can be the empty string.
>> Alternately, ‘configure’ could set DOT_USER_PROGRAM to “dot” when it’s
>> not found, which I think is ever preferable.  WDYT?
>
> IMO an empty string is preferable (explained below), so I would like to
> leave it like this (with an improved docstring as you pointed), if you
> don't mind.
>
>>> +(defcustom guix-dot-program
>>> +  (if (string= "" guix-config-dot-program)
>>> +      (executable-find "dot")
>>> +    guix-config-dot-program)
>>
>> Thus here we’d be checking whether ‘guix-config-dot-program’ is an
>> absolute file name.
>
> I think (executable-find "dot") is more reliable than just "dot" which
> may not exist.

Agreed!  I was just saying that an empty string is odd, and that setting
it to ‘dot’ would be aesthetically more pleasing.

So the only different is that the above would become:

  (defcustom guix-dot-program
    (if (absolute-file-name-p guix-config-dot-program)
         guix-config-dot-program
      (executable-find "dot")))

Does it make sense?

Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] gnu: guix: Set 'guix-dot-program' emacs variable.
  2015-10-18 16:50         ` Ludovic Courtès
@ 2015-10-19 14:49           ` Alex Kost
  2015-10-19 15:41             ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Alex Kost @ 2015-10-19 14:49 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1475 bytes --]

Ludovic Courtès (2015-10-18 19:50 +0300) wrote:

> Alex Kost <alezost@gmail.com> skribis:
>
>> Ludovic Courtès (2015-10-17 16:34 +0300) wrote:
>
> [...]
>
>>> The docstring should mention that it can be the empty string.
>>> Alternately, ‘configure’ could set DOT_USER_PROGRAM to “dot” when it’s
>>> not found, which I think is ever preferable.  WDYT?
>>
>> IMO an empty string is preferable (explained below), so I would like to
>> leave it like this (with an improved docstring as you pointed), if you
>> don't mind.
>>
>>>> +(defcustom guix-dot-program
>>>> +  (if (string= "" guix-config-dot-program)
>>>> +      (executable-find "dot")
>>>> +    guix-config-dot-program)
>>>
>>> Thus here we’d be checking whether ‘guix-config-dot-program’ is an
>>> absolute file name.
>>
>> I think (executable-find "dot") is more reliable than just "dot" which
>> may not exist.
>
> Agreed!  I was just saying that an empty string is odd, and that setting
> it to ‘dot’ would be aesthetically more pleasing.

Not for me, but OK.

> So the only different is that the above would become:
>
>   (defcustom guix-dot-program
>     (if (absolute-file-name-p guix-config-dot-program)
>          guix-config-dot-program
>       (executable-find "dot")))
>
> Does it make sense?

Yes, now I see what you mean.  I still prefer an empty string, but I
don't mind the variant you suggest.  The updated patch is attached,
thanks!


[-- Attachment #2: 0001-build-Set-DOT_USER_PROGRAM-for-Emacs-interface.patch --]
[-- Type: text/x-patch, Size: 2380 bytes --]

From 0cc7c8d44b88e7df9a0f443d8939c6b8ac14232e Mon Sep 17 00:00:00 2001
From: Alex Kost <alezost@gmail.com>
Date: Fri, 16 Oct 2015 20:34:32 +0300
Subject: [PATCH] build: Set DOT_USER_PROGRAM for Emacs interface.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Suggested by Ludovic Courtès <ludo@gnu.org>.

* configure.ac: Set DOT_USER_PROGRAM variable.
* emacs/guix-config.el.in (guix-config-dot-program): New constant.
* emacs/guix-external.el (guix-dot-program): Use it.
---
 configure.ac            | 1 +
 emacs/guix-config.el.in | 4 ++++
 emacs/guix-external.el  | 7 ++++++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index bb3d947..00e7c7b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -206,6 +206,7 @@ AC_CONFIG_FILES([pre-inst-env], [chmod +x pre-inst-env])
 AC_CONFIG_FILES([test-env],     [chmod +x test-env])
 
 dnl Emacs interface.
+AC_PATH_PROG([DOT_USER_PROGRAM], [dot], [dot])
 AM_PATH_LISPDIR
 AM_CONDITIONAL([HAVE_EMACS], [test "x$EMACS" != "xno"])
 
diff --git a/emacs/guix-config.el.in b/emacs/guix-config.el.in
index 16434ce..c7affb8 100644
--- a/emacs/guix-config.el.in
+++ b/emacs/guix-config.el.in
@@ -1,6 +1,7 @@
 ;;; guix-config.el --- Compile-time configuration of Guix.
 
 ;; Copyright © 2015 Mathieu Lirzin <mthl@openmailbox.org>
+;; Copyright © 2015 Alex Kost <alezost@gmail.com>
 
 ;; This file is part of GNU Guix.
 
@@ -35,6 +36,9 @@ strings of the form:
 
 Where ARGS is a list of arguments to the guile program.")
 
+(defconst guix-config-dot-program "@DOT_USER_PROGRAM@"
+  "Name of the 'dot' executable defined at configure time.")
+
 (provide 'guix-config)
 
 ;;; guix-config.el ends here
diff --git a/emacs/guix-external.el b/emacs/guix-external.el
index 580676e..cf4bd26 100644
--- a/emacs/guix-external.el
+++ b/emacs/guix-external.el
@@ -23,11 +23,16 @@
 
 ;;; Code:
 
+(require 'guix-config)
+
 (defgroup guix-external nil
   "Settings for external programs."
   :group 'guix)
 
-(defcustom guix-dot-program (executable-find "dot")
+(defcustom guix-dot-program
+  (if (file-name-absolute-p guix-config-dot-program)
+      guix-config-dot-program
+    (executable-find "dot"))
   "Name of the 'dot' executable."
   :type 'string
   :group 'guix-external)
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] gnu: guix: Set 'guix-dot-program' emacs variable.
  2015-10-19 14:49           ` Alex Kost
@ 2015-10-19 15:41             ` Ludovic Courtès
  0 siblings, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2015-10-19 15:41 UTC (permalink / raw)
  To: Alex Kost; +Cc: guix-devel

Alex Kost <alezost@gmail.com> skribis:

> From 0cc7c8d44b88e7df9a0f443d8939c6b8ac14232e Mon Sep 17 00:00:00 2001
> From: Alex Kost <alezost@gmail.com>
> Date: Fri, 16 Oct 2015 20:34:32 +0300
> Subject: [PATCH] build: Set DOT_USER_PROGRAM for Emacs interface.
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> Suggested by Ludovic Courtès <ludo@gnu.org>.
>
> * configure.ac: Set DOT_USER_PROGRAM variable.
> * emacs/guix-config.el.in (guix-config-dot-program): New constant.
> * emacs/guix-external.el (guix-dot-program): Use it.

OK, thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-10-19 15:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-15 19:48 [PATCH] gnu: guix: Set 'guix-dot-program' emacs variable Alex Kost
2015-10-16  8:20 ` Ludovic Courtès
2015-10-16 18:21   ` Alex Kost
2015-10-17 13:34     ` Ludovic Courtès
2015-10-17 15:46       ` Alex Kost
2015-10-18 16:50         ` Ludovic Courtès
2015-10-19 14:49           ` Alex Kost
2015-10-19 15:41             ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).