summary refs log tree commit diff
path: root/emacs/guix-guile.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-07-24 18:33:14 +0300
committerAlex Kost <alezost@gmail.com>2015-09-23 13:36:37 +0300
commit187f80c6c542bc65486ef600aa3af96f7173f4fa (patch)
tree8a894bb9b8c5a0ea9dc0e044ee755288cbe7991e /emacs/guix-guile.el
parent6f05a24df305fc6b79695dd111ec5ff5464ea63e (diff)
downloadguix-187f80c6c542bc65486ef600aa3af96f7173f4fa.tar.gz
emacs: Add development utils.
* emacs/guix-guile.el (guix-guile-current-module): New function.
* emacs/guix-devel.el: New file.
* emacs.am (ELFILES): Add it.
* doc/emacs.texi (Emacs Development): New node.
  (Emacs Interface): Add it.
* doc/contributing.texi (The Perfect Setup): Mention it.
* doc/guix.texi (Top): Add it.
* emacs/guix-init.el: Add 'guix-devel-activate-mode-maybe' to
  'scheme-mode-hook'.
Diffstat (limited to 'emacs/guix-guile.el')
-rw-r--r--emacs/guix-guile.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/emacs/guix-guile.el b/emacs/guix-guile.el
index cff9bd4e9b..c21d27fca2 100644
--- a/emacs/guix-guile.el
+++ b/emacs/guix-guile.el
@@ -24,6 +24,19 @@
 
 ;;; Code:
 
+(require 'geiser-guile)
+
+(defun guix-guile-current-module ()
+  "Return a string with the current guile module.
+Return nil, if current buffer does not define a module."
+  ;; Modified version of `geiser-guile--get-module'.
+  (save-excursion
+    (geiser-syntax--pop-to-top)
+    (when (or (re-search-backward geiser-guile--module-re nil t)
+              (looking-at geiser-guile--library-re)
+              (re-search-forward geiser-guile--module-re nil t))
+      (match-string-no-properties 1))))
+
 (defun guix-guile-make-call-expression (proc &rest args)
   "Return \"(PROC ARGS ...)\" string.
 PROC and ARGS should be strings."