aboutsummaryrefslogtreecommitdiff
path: root/emacs/guix-utils.el
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-08-12 15:44:22 +0300
committerAlex Kost <alezost@gmail.com>2015-08-30 18:26:01 +0300
commit1ce96dd9271445133b920cff81bbb44085a5fe7c (patch)
tree2c7dd2d6fb247954c728af2a53f26fbbd2a8c7c1 /emacs/guix-utils.el
parentc10521e97679c35a40926084e049445cc5053254 (diff)
downloadpatches-1ce96dd9271445133b920cff81bbb44085a5fe7c.tar
patches-1ce96dd9271445133b920cff81bbb44085a5fe7c.tar.gz
emacs: Add and use 'guix-concat-strings'.
* emacs/guix-utils.el (guix-concat-strings): New function. * emacs/guix-pcomplete.el (guix-pcomplete-short-options): Use it. * emacs/guix-base.el (guix-get-package-strings): Likewise.
Diffstat (limited to 'emacs/guix-utils.el')
-rw-r--r--emacs/guix-utils.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/emacs/guix-utils.el b/emacs/guix-utils.el
index 8a0673a3a0..df6636c139 100644
--- a/emacs/guix-utils.el
+++ b/emacs/guix-utils.el
@@ -128,6 +128,22 @@ split it into several short lines."
(fill-region (point-min) (point-max)))
(buffer-string)))
+(defun guix-concat-strings (strings separator &optional location)
+ "Return new string by concatenating STRINGS with SEPARATOR.
+If LOCATION is a symbol `head', add another SEPARATOR to the
+beginning of the returned string; if `tail' - add SEPARATOR to
+the end of the string; if nil, do not add SEPARATOR; otherwise
+add both to the end and to the beginning."
+ (let ((str (mapconcat #'identity strings separator)))
+ (cond ((null location)
+ str)
+ ((eq location 'head)
+ (concat separator str))
+ ((eq location 'tail)
+ (concat str separator))
+ (t
+ (concat separator str separator)))))
+
(defun guix-completing-read-multiple (prompt table &optional predicate
require-match initial-input
hist def inherit-input-method)