[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/23: emacs: Add utils to make symbol and string for guix command.
From: |
Alex Kost |
Subject: |
05/23: emacs: Add utils to make symbol and string for guix command. |
Date: |
Sun, 30 Aug 2015 15:28:11 +0000 |
alezost pushed a commit to branch master
in repository guix.
commit 009d6388e6ba83d903c9e3756daa71251ca1b8e6
Author: Alex Kost <address@hidden>
Date: Sun Aug 16 11:09:39 2015 +0300
emacs: Add utils to make symbol and string for guix command.
* emacs/guix-utils.el (guix-shell-quote-argument, guix-command-symbol,
guix-command-string): New functions.
---
emacs/guix-utils.el | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/emacs/guix-utils.el b/emacs/guix-utils.el
index df6636c..68cad88 100644
--- a/emacs/guix-utils.el
+++ b/emacs/guix-utils.el
@@ -144,6 +144,25 @@ add both to the end and to the beginning."
(t
(concat separator str separator)))))
+(defun guix-shell-quote-argument (argument)
+ "Quote shell command ARGUMENT.
+This function is similar to `shell-quote-argument', but less strict."
+ (if (equal argument "")
+ "''"
+ (replace-regexp-in-string
+ "\n" "'\n'"
+ (replace-regexp-in-string
+ (rx (not (any alnum "-=,./\n"))) "\\\\\\&" argument))))
+
+(defun guix-command-symbol (&optional args)
+ "Return symbol by concatenating 'guix' and ARGS (strings)."
+ (intern (guix-concat-strings (cons "guix" args) "-")))
+
+(defun guix-command-string (&optional args)
+ "Return 'guix ARGS ...' string with quoted shell arguments."
+ (let ((args (mapcar #'guix-shell-quote-argument args)))
+ (guix-concat-strings (cons "guix" args) " ")))
+
(defun guix-completing-read-multiple (prompt table &optional predicate
require-match initial-input
hist def inherit-input-method)
- branch master updated (600233b -> eb097f3), Alex Kost, 2015/08/30
- 02/23: emacs: Add 'guix-prettify' to 'guix' custom group., Alex Kost, 2015/08/30
- 01/23: emacs: Remove leftover internal variable., Alex Kost, 2015/08/30
- 03/23: emacs: Add and use 'guix-while-search'., Alex Kost, 2015/08/30
- 04/23: emacs: Add and use 'guix-concat-strings'., Alex Kost, 2015/08/30
- 05/23: emacs: Add utils to make symbol and string for guix command.,
Alex Kost <=
- 09/23: guix lint: Export checkers and <lint-checker> accessors., Alex Kost, 2015/08/30
- 06/23: emacs: Add utils to copy guix command., Alex Kost, 2015/08/30
- 08/23: emacs: Add 'guix-memoized-defalias' macro., Alex Kost, 2015/08/30
- 07/23: emacs: Add 'guix-any'., Alex Kost, 2015/08/30
- 10/23: emacs: Add 'guix-lint-checker-names'., Alex Kost, 2015/08/30
- 17/23: ui: Add 'run-guix'., Alex Kost, 2015/08/30
- 11/23: guix graph: Export node types and <node-type> accessors., Alex Kost, 2015/08/30
- 12/23: emacs: Add 'guix-graph-type-names'., Alex Kost, 2015/08/30
- 18/23: emacs: Add code to run guix command in REPL., Alex Kost, 2015/08/30
- 15/23: emacs: Add minibuffer readers., Alex Kost, 2015/08/30