aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2015-08-16 11:11:37 +0300
committerAlex Kost <alezost@gmail.com>2015-08-30 18:26:01 +0300
commitad0f31f6a514d29b2f734069d5c3b2a7a6cd2a82 (patch)
treeddf98304a2428174d56c415c05d420ebd6b70e8e
parent009d6388e6ba83d903c9e3756daa71251ca1b8e6 (diff)
downloadpatches-ad0f31f6a514d29b2f734069d5c3b2a7a6cd2a82.tar
patches-ad0f31f6a514d29b2f734069d5c3b2a7a6cd2a82.tar.gz
emacs: Add utils to copy guix command.
* emacs/guix-utils.el (guix-copy-as-kill, guix-copy-command-as-kill): New functions.
-rw-r--r--emacs/guix-utils.el12
1 files changed, 12 insertions, 0 deletions
diff --git a/emacs/guix-utils.el b/emacs/guix-utils.el
index 68cad8878d..3157f6359b 100644
--- a/emacs/guix-utils.el
+++ b/emacs/guix-utils.el
@@ -163,6 +163,18 @@ This function is similar to `shell-quote-argument', but less strict."
(let ((args (mapcar #'guix-shell-quote-argument args)))
(guix-concat-strings (cons "guix" args) " ")))
+(defun guix-copy-as-kill (string &optional no-message?)
+ "Put STRING into `kill-ring'.
+If NO-MESSAGE? is non-nil, do not display a message about it."
+ (kill-new string)
+ (unless no-message?
+ (message "'%s' has been added to kill ring." string)))
+
+(defun guix-copy-command-as-kill (args &optional no-message?)
+ "Put 'guix ARGS ...' string into `kill-ring'.
+See also `guix-copy-as-kill'."
+ (guix-copy-as-kill (guix-command-string args) no-message?))
+
(defun guix-completing-read-multiple (prompt table &optional predicate
require-match initial-input
hist def inherit-input-method)