[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/srht 0e53961bbc 27/27: srht-read-with-annotaion: Add ca
From: |
ELPA Syncer |
Subject: |
[elpa] externals/srht 0e53961bbc 27/27: srht-read-with-annotaion: Add category arg. |
Date: |
Tue, 17 May 2022 22:58:01 -0400 (EDT) |
branch: externals/srht
commit 0e53961bbc997ec00317b1fd143e5e1336bd8754
Author: Aleksandr Vityazev <avityazev@posteo.org>
Commit: Aleksandr Vityazev <avityazev@posteo.org>
srht-read-with-annotaion: Add category arg.
* lisp/srht (srht-read-with-annotaion): Add category argument.
(srht--api-request): Fix srht-token check.
* lisp/srht-git (srht-git--repo-name-read): Update according to changes.
* lisp/srht-paste (srht-paste--sha): -/-/-.
---
lisp/srht-git.el | 2 +-
lisp/srht-paste.el | 7 ++++---
lisp/srht.el | 11 +++++++----
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/lisp/srht-git.el b/lisp/srht-git.el
index 8f5adbd8ac..f317cc33ce 100644
--- a/lisp/srht-git.el
+++ b/lisp/srht-git.el
@@ -194,7 +194,7 @@ is assumed."
(defun srht-git--repo-name-read ()
"Read a repository name in the minibuffer, with completion."
(srht-read-with-annotaion "Select repository: "
- (srht-git--candidates) #'srht-git--annot))
+ (srht-git--candidates) #'srht-git--annot 'sourcehut-git-repository))
(defvar srht-git-repo-name-history nil
"History variable.")
diff --git a/lisp/srht-paste.el b/lisp/srht-paste.el
index 483842f524..5522529e7f 100644
--- a/lisp/srht-paste.el
+++ b/lisp/srht-paste.el
@@ -76,9 +76,10 @@ QUERY is the query for the URI."
(defun srht-paste--sha ()
"Read a FILENAME in the minibuffer, with completion and return SHA."
(let ((cand (srht-paste--candidates)))
- (car (last (assoc (srht-read-with-annotaion
- "Select paste: " cand #'srht-paste--annot)
- cand)))))
+ (car (last (assoc
+ (srht-read-with-annotaion
+ "Select paste: " cand #'srht-paste--annot 'sourcehut-paste)
+ 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 d35b38464c..9fb12f684d 100644
--- a/lisp/srht.el
+++ b/lisp/srht.el
@@ -126,7 +126,7 @@ THEN (see `plz').
THEN is a callback function, which is called in the response data.
ELSE is an optional callback function called when the request
fails with one argument, a `plz-error' struct."
- (unless srht-token
+ (when (or (string-empty-p srht-token) (not srht-token))
(error "Need a token"))
(let ((uri (srht--make-uri service path query))
(content-type (or form "application/json")))
@@ -169,17 +169,20 @@ URI."
"Create an API request with ARGS using the DELETE method."
(srht--make-crud-request 'delete args))
-(defun srht-read-with-annotaion (prompt collection annot-function)
+(defun srht-read-with-annotaion (prompt collection annot-function category)
"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."
+ANNOT-FUNCTION value should be a function for “annotating” completions.
+The function should take one argument, STRING, which is a possible completion.
+CATEGORY value should be a symbol describing what kind of text the
+completion function is trying to complete."
(declare (indent 1))
(let ((table
(lambda (string pred action)
(if (eq action 'metadata)
`(metadata
+ (category . ,category)
(annotation-function . ,annot-function)
(cycle-sort-function . identity)
(display-sort-function . identity))
- [elpa] externals/srht 41b2163b39 08/27: Replace emacs with emacs-next., (continued)
- [elpa] externals/srht 41b2163b39 08/27: Replace emacs with emacs-next., ELPA Syncer, 2022/05/17
- [elpa] externals/srht 0db1310218 09/27: Downgrade Emacs requirements to 27.1., ELPA Syncer, 2022/05/17
- [elpa] externals/srht 235929a7a6 21/27: Update README., ELPA Syncer, 2022/05/17
- [elpa] externals/srht e17edd7643 04/27: Add README., ELPA Syncer, 2022/05/17
- [elpa] externals/srht 6037d9f03c 22/27: Update README., ELPA Syncer, 2022/05/17
- [elpa] externals/srht 3c4df2cff1 06/27: Add make rules., ELPA Syncer, 2022/05/17
- [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 <=
- [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, 2022/05/17
- [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