all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alex Kost <alezost@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] gnu: guix: Set 'guix-dot-program' emacs variable.
Date: Fri, 16 Oct 2015 21:21:50 +0300	[thread overview]
Message-ID: <87twpqy8qp.fsf@gmail.com> (raw)
In-Reply-To: <87si5buswd.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Fri, 16 Oct 2015 10:20:02 +0200")

[-- 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


  reply	other threads:[~2015-10-16 18:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87twpqy8qp.fsf@gmail.com \
    --to=alezost@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.