[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/srht 0e0d56a77b 17/27: srth: srht-read-with-annotaion:
From: |
ELPA Syncer |
Subject: |
[elpa] externals/srht 0e0d56a77b 17/27: srth: srht-read-with-annotaion: Fix. |
Date: |
Tue, 17 May 2022 22:58:00 -0400 (EDT) |
branch: externals/srht
commit 0e0d56a77b2fe2fe40993f920c36c0ff64bcbd68
Author: Aleksandr Vityazev <avityazev@posteo.org>
Commit: Aleksandr Vityazev <avityazev@posteo.org>
srth: srht-read-with-annotaion: Fix.
* lisp/srht: Fix srht-read-with-annotaion, update doc strings.
* lisp/srht-paste: Update srht-paste--sha according to the fix.
---
lisp/srht-git.el | 2 +-
lisp/srht-paste.el | 6 ++++--
lisp/srht.el | 31 +++++++++++++++++--------------
3 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/lisp/srht-git.el b/lisp/srht-git.el
index 905e3fe375..990474c183 100644
--- a/lisp/srht-git.el
+++ b/lisp/srht-git.el
@@ -163,7 +163,7 @@ is assumed."
(seq-map (pcase-lambda ((map (:created c)
(:visibility v)
(:name n)))
- (list n c v n))
+ (list n c v))
(plist-get (or srht-git-repos
(setq srht-git-repos
(srht-retrive (srht-git-repos))))
diff --git a/lisp/srht-paste.el b/lisp/srht-paste.el
index b3ef3f7354..1ee4bff9f6 100644
--- a/lisp/srht-paste.el
+++ b/lisp/srht-paste.el
@@ -71,8 +71,10 @@ CONTENTS must be a UTF-8 encoded string; binary files are
not allowed."
(defun srht-paste--sha ()
"Read a FILENAME in the minibuffer, with completion and return SHA."
- (srht-read-with-annotaion "Select paste: "
- (srht-paste--candidates) #'srht-paste--annot))
+ (let ((cand (srht-paste--candidates)))
+ (car (last (assoc (srht-read-with-annotaion
+ "Select paste: " cand #'srht-paste--annot)
+ cand)))))
(defun srht-paste (&optional sha &rest details)
"Create, retrieve or delete a paste.
diff --git a/lisp/srht.el b/lisp/srht.el
index 775bcb02a6..0737f4527d 100644
--- a/lisp/srht.el
+++ b/lisp/srht.el
@@ -160,19 +160,22 @@ contain the body at all. FORM is optional."
"Create an API request with ARGS using the DELETE method."
(srht--make-crud-request 'delete args))
-(defun srht-read-with-annotaion (prompt candidates annot-function)
- "TODO: doc"
+(defun srht-read-with-annotaion (prompt collection annot-function)
+ "Read a string in the minibuffer, with completion.
+PROMPT is a string to prompt with; normally it ends in a colon and a space.
+COLLECTION can be a list of strings, an alist or a hash table.
+ANNOT-FUNCTION the value should be a function for “annotating” completions.
+The function should take one argument, STRING, which is a possible completion."
(declare (indent 1))
- (let* ((p candidates)
- (table
- (lambda (string pred action)
- (if (eq action 'metadata)
- `(metadata
- (annotation-function . ,annot-function)
- (cycle-sort-function . identity)
- (display-sort-function . identity))
- (complete-with-action action p string pred)))))
- (car (last (assoc (completing-read prompt table) p)))))
+ (let ((table
+ (lambda (string pred action)
+ (if (eq action 'metadata)
+ `(metadata
+ (annotation-function . ,annot-function)
+ (cycle-sort-function . identity)
+ (display-sort-function . identity))
+ (complete-with-action action collection string pred)))))
+ (completing-read prompt table)))
(defalias 'srht-file-name-concat
(if (fboundp 'file-name-concat)
@@ -191,8 +194,8 @@ contain the body at all. FORM is optional."
(cdr components)))))))
(defun srht-kill-link (service name resource)
- "TODO: update.
-Make URL constructed from NAME and SHA the latest kill in the kill ring."
+ "Make URL the latest kill in the kill ring.
+Constructed from SERVICE, NAME and RESOURCE."
(kill-new (srht-file-name-concat (srht--make-uri service nil nil) name
resource))
(message "URL in kill-ring"))
- [elpa] externals/srht 7b3792ac75 12/27: Eldev: use the path from the store for plz., (continued)
- [elpa] externals/srht 7b3792ac75 12/27: Eldev: use the path from the store for plz., ELPA Syncer, 2022/05/17
- [elpa] externals/srht 81519fed59 15/27: Add git service bindings., ELPA Syncer, 2022/05/17
- [elpa] externals/srht a99a8e4bd1 19/27: srht-git--repo-name-read: Add doc string., ELPA Syncer, 2022/05/17
- [elpa] externals/srht 9dd0d15e4a 20/27: srht-git-repo-update: Fix., ELPA Syncer, 2022/05/17
- [elpa] externals/srht 0e53961bbc 27/27: srht-read-with-annotaion: Add category arg., ELPA Syncer, 2022/05/17
- [elpa] externals/srht 0b37b7225f 24/27: Add support for pagination., ELPA Syncer, 2022/05/17
- [elpa] externals/srht f3cd7c5639 10/27: Set eldev-project-main-file., ELPA Syncer, 2022/05/17
- [elpa] externals/srht 87ab3099b0 13/27: build: Add emacs-plz to packages., ELPA Syncer, 2022/05/17
- [elpa] externals/srht 6f87acb901 16/27: Add commands to create, update and delete git repo., ELPA Syncer, 2022/05/17
- [elpa] externals/srht a3088beb18 18/27: srht-git-repo-update: Set initial inputs., ELPA Syncer, 2022/05/17
- [elpa] externals/srht 0e0d56a77b 17/27: srth: srht-read-with-annotaion: Fix.,
ELPA Syncer <=
- [elpa] externals/srht e464826002 23/27: Clean up the code, enhance README, update headers for ELPA., ELPA Syncer, 2022/05/17
- [elpa] externals/srht 764350e334 26/27: Fix test., ELPA Syncer, 2022/05/17
- [elpa] externals/srht d6393e8c31 11/27: Eldev: add load-path., ELPA Syncer, 2022/05/17
- [elpa] externals/srht 0175b45ac1 14/27: external: Expunge., ELPA Syncer, 2022/05/17
- [elpa] externals/srht 50ad7d35bc 25/27: Update README., ELPA Syncer, 2022/05/17