unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex Kost <alezost@gmail.com>
To: guix-devel@gnu.org
Subject: [PATCH 1/4] emacs: Add 'guix-devel-with-definition'.
Date: Fri,  2 Oct 2015 16:04:03 +0300	[thread overview]
Message-ID: <1443791046-1015-2-git-send-email-alezost@gmail.com> (raw)
In-Reply-To: <1443791046-1015-1-git-send-email-alezost@gmail.com>

* emacs/guix-devel.el (guix-devel-with-definition): New macro.
  (guix-devel-build-package-definition): Use it.
  (guix-devel-font-lock-keywords): New variable.
---
 emacs/guix-devel.el | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/emacs/guix-devel.el b/emacs/guix-devel.el
index 8a6fc1e..ee7629f 100644
--- a/emacs/guix-devel.el
+++ b/emacs/guix-devel.el
@@ -88,12 +88,21 @@ Interactively, use the module defined by the current scheme file."
       (guix-devel-setup-repl repl)
       (push process guix-devel-repl-processes))))
 
+(defmacro guix-devel-with-definition (def-var &rest body)
+  "Run BODY with the current guile definition bound to DEF-VAR.
+Bind DEF-VAR variable to the name of the current top-level
+definition, setup the current REPL, use the current module, and
+run BODY."
+  (declare (indent 1) (debug (symbolp body)))
+  `(let ((,def-var (guix-guile-current-definition)))
+     (guix-devel-setup-repl-maybe)
+     (guix-devel-use-modules (guix-guile-current-module))
+     ,@body))
+
 (defun guix-devel-build-package-definition ()
   "Build a package defined by the current top-level variable definition."
   (interactive)
-  (let ((def (guix-guile-current-definition)))
-    (guix-devel-setup-repl-maybe)
-    (guix-devel-use-modules (guix-guile-current-module))
+  (guix-devel-with-definition def
     (when (or (not guix-operation-confirm)
               (guix-operation-prompt (format "Build '%s'?" def)))
       (guix-geiser-eval-in-repl
@@ -184,6 +193,13 @@ bindings:
   (when guix-devel-activate-mode
     (guix-devel-mode)))
 
+\f
+(defvar guix-devel-font-lock-keywords
+  (eval-when-compile
+    `((,(rx "(" (group "guix-devel-with-definition") symbol-end) . 1))))
+
+(font-lock-add-keywords 'emacs-lisp-mode guix-devel-font-lock-keywords)
+
 (provide 'guix-devel)
 
 ;;; guix-devel.el ends here
-- 
2.5.0

  reply	other threads:[~2015-10-02 13:04 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-02 13:04 emacs: devel: Add lint/download commands Alex Kost
2015-10-02 13:04 ` Alex Kost [this message]
2015-10-03 20:31   ` [PATCH 1/4] emacs: Add 'guix-devel-with-definition' Ludovic Courtès
2015-10-02 13:04 ` [PATCH 2/4] emacs: Add 'guix-devel-download-package-source' Alex Kost
2015-10-03 20:35   ` Ludovic Courtès
2015-10-04 13:39     ` Alex Kost
2015-10-04 16:57       ` Ludovic Courtès
2015-10-04 18:28         ` Alex Kost
2015-10-05 15:55           ` Ludovic Courtès
2015-10-06 15:11             ` Alex Kost
2015-10-07  2:07               ` Checking signatures on source tarballs Mark H Weaver
2015-10-07  3:18                 ` Christopher Allan Webber
2015-10-07  8:29                 ` Andreas Enge
2015-10-07 12:06                 ` Ludovic Courtès
2015-10-07 14:09                   ` Mark H Weaver
2015-10-07 18:05                     ` Leo Famulari
2015-10-07 20:59                     ` Ludovic Courtès
2015-10-08 11:44                       ` Ludovic Courtès
2015-10-12  8:37                         ` Brandon Invergo
2015-10-12  9:18                           ` [bug-gsrc] " Brandon Invergo
2015-10-12 16:38                             ` Ludovic Courtès
2015-10-12 21:26                               ` Brandon Invergo
2015-10-12 21:34                                 ` Ludovic Courtès
2015-10-12 22:06                                   ` Brandon Invergo
2015-10-13  9:47                                     ` Ludovic Courtès
2015-10-12 16:39                           ` Ludovic Courtès
2016-02-22  4:20                             ` Christopher Allan Webber
2015-10-10  7:22                       ` Alex Vong
2015-10-10 17:03                       ` Mark H Weaver
2015-10-11 17:44                         ` Ludovic Courtès
2015-10-14  5:33                       ` Rastus Vernon
2015-10-15 13:33                         ` Mark H Weaver
2015-10-07 17:45                 ` Alex Kost
2015-10-07 12:23               ` [PATCH 2/4] emacs: Add 'guix-devel-download-package-source' Ludovic Courtès
2015-10-07 17:25                 ` Alex Kost
2015-10-07 19:15                   ` Ian Denhardt
2015-10-09 12:14                     ` Alex Kost
2015-10-07 22:10                   ` Ludovic Courtès
2015-10-08 11:27                     ` Alex Kost
2015-10-08 11:46                       ` Ludovic Courtès
2015-10-09 12:08                         ` Alex Kost
2015-10-09 12:17                           ` Ludovic Courtès
2015-10-09 14:00                         ` [PATCH] emacs: Add 'guix-devel-build-package-source' Alex Kost
2015-10-11 18:33                           ` Ludovic Courtès
2015-10-08 14:43                       ` [PATCH 2/4] emacs: Add 'guix-devel-download-package-source' Christopher Allan Webber
2015-10-08 15:03                         ` Ludovic Courtès
2015-10-02 13:04 ` [PATCH 3/4] lint: Export 'run-checkers' Alex Kost
2015-10-03 20:36   ` Ludovic Courtès
2015-10-02 13:04 ` [PATCH 4/4] emacs: Add 'guix-devel-lint-package' Alex Kost
2015-10-03 20:44   ` 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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=1443791046-1015-2-git-send-email-alezost@gmail.com \
    --to=alezost@gmail.com \
    --cc=guix-devel@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 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).