Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

magithub-label-read-labels doesn't explain itself #347

Open
gavinrogers opened this issue Jul 11, 2018 · 2 comments
Open

magithub-label-read-labels doesn't explain itself #347

gavinrogers opened this issue Jul 11, 2018 · 2 comments
Labels
enhancement idea for a new feature or refinement of existing functionality

Comments

@gavinrogers
Copy link

(defun magithub-label-read-labels (prompt &optional default)

As a user, I can't seem to figure out how to exit this loop.

  1. Could someone please tell me
  2. I'll create a PR with a prompt that documents how to "Continue" after you've selected what labels you wish.
@vermiculus
Copy link
Owner

You need to provide a value of 'empty-string' to exit. Under Ivy, it's C-M-j.

magithub/magithub-core.el

Lines 811 to 825 in c2ba802

(defun magithub--completing-read-multiple
(prompt collection &optional format-function predicate require-match default)
"Using PROMPT, get a list of elements in COLLECTION.
This function continues until all candidates have been entered or
until the user enters a value of \"\". Duplicate entries are not
allowed."
(let ((this t) (coll (copy-tree collection)) ret)
(while (and collection this)
(setq this (magithub--completing-read
prompt coll format-function
predicate require-match default))
(when this
(push this ret)
(setq coll (delete this coll))))
ret))

magithub/magithub-core.el

Lines 795 to 809 in c2ba802

(defun magithub--completing-read
(prompt collection &optional format-function predicate require-match default initial-input)
"Using PROMPT, get a list of elements in COLLECTION.
This function continues until all candidates have been entered or
until the user enters a value of \"\". Duplicate entries are not
allowed."
(let* ((format-function (or format-function (lambda (o) (format "%S" o))))
(collection (if (functionp predicate) (-filter predicate collection) collection))
(collection (magithub--zip collection format-function nil)))
(cdr (assoc-string
(completing-read prompt collection nil require-match
(or initial-input
(and default
(funcall format-function default))))
collection))))

It is in the documentation of the function, but I can see it being useful in the prompt. The only concern is wrapping.

@gavinrogers
Copy link
Author

With helm it's C - for anyone else's benefit. I'll come around to a PR when I have time

@vermiculus vermiculus added the enhancement idea for a new feature or refinement of existing functionality label Sep 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement idea for a new feature or refinement of existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants