diff options
author | Alex Kost <alezost@gmail.com> | 2015-12-11 12:36:56 +0300 |
---|---|---|
committer | Alex Kost <alezost@gmail.com> | 2016-01-02 17:25:35 +0300 |
commit | dc690c445e4b483e6ce2a88f6c23dd19685057cc (patch) | |
tree | aa0197892cc941057a87d63d97c6f341db92cdc3 | |
parent | ddf6948b2204fbb453df9bc2ade48454d3d6ee12 (diff) | |
download | gnu-guix-dc690c445e4b483e6ce2a88f6c23dd19685057cc.tar gnu-guix-dc690c445e4b483e6ce2a88f6c23dd19685057cc.tar.gz |
emacs: Return nil instead of "" in completing readers.
* emacs/guix-utils.el (guix-completing-read): New procedure.
(guix-define-readers): Use it.
-rw-r--r-- | emacs/guix-utils.el | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/emacs/guix-utils.el b/emacs/guix-utils.el index 4f5c69ca4d..98a408f875 100644 --- a/emacs/guix-utils.el +++ b/emacs/guix-utils.el @@ -214,6 +214,15 @@ If NO-MESSAGE? is non-nil, do not display a message about it." See also `guix-copy-as-kill'." (guix-copy-as-kill (guix-command-string args) no-message?)) +(defun guix-completing-read (prompt table &optional predicate + require-match initial-input + hist def inherit-input-method) + "Same as `completing-read' but return nil instead of an empty string." + (let ((res (completing-read prompt table predicate + require-match initial-input + hist def inherit-input-method))) + (unless (string= "" res) res))) + (defun guix-completing-read-multiple (prompt table &optional predicate require-match initial-input hist def inherit-input-method) @@ -460,7 +469,7 @@ keywords are available: `(defvar ,completions-var nil)) ,(when single-reader - `(guix-define-reader ,single-reader completing-read + `(guix-define-reader ,single-reader guix-completing-read ,completions ,single-prompt)) ,(when multiple-reader |