[elpa] externals/vertico 95a3f42 2/4: vertico-indexed: Better formatting

2021-07-11 Thread ELPA Syncer
branch: externals/vertico
commit 95a3f42f3e177599156030c3a768739af704b5e4
Author: Daniel Mendler 
Commit: Daniel Mendler 

vertico-indexed: Better formatting
---
 extensions/vertico-indexed.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/extensions/vertico-indexed.el b/extensions/vertico-indexed.el
index e5e4067..25ffe37 100644
--- a/extensions/vertico-indexed.el
+++ b/extensions/vertico-indexed.el
@@ -46,7 +46,9 @@
   "Format candidate, see `vertico--format-candidate' for arguments."
   (setq vertico-indexed--min start vertico-indexed--max index)
   (funcall orig cand
-   (concat (propertize (format "%-2s " (- index start))
+   (concat (propertize (format
+(format "%%%ds " (if (> vertico-count 10) 2 1))
+(- index start))
'face 'vertico-indexed)
prefix)
suffix index start))



[elpa] externals/vertico 3c4088a 3/4: README updates

2021-07-11 Thread ELPA Syncer
branch: externals/vertico
commit 3c4088ae482a219c710864bb44130582c9389847
Author: Daniel Mendler 
Commit: Daniel Mendler 

README updates
---
 README.org | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/README.org b/README.org
index be24218..f93c53e 100644
--- a/README.org
+++ b/README.org
@@ -163,14 +163,18 @@
   the subdirectory 
[[https://github.com/minad/vertico/tree/main/extensions][extensions/]]. The 
extensions can be installed additionally to
   Vertico. Currently these extensions are available:
 
-  - 
[[https://github.com/minad/vertico/blob/main/extensions/vertico-buffer.el][vertico-buffer.el]]:
 Enable =vertico-buffer-mode= to display Vertico in a separate buffer
+  - 
[[https://github.com/minad/vertico/blob/main/extensions/vertico-buffer.el][vertico-buffer.el]]:
 =vertico-buffer-mode= to display Vertico in a separate buffer
   - 
[[https://github.com/minad/vertico/blob/main/extensions/vertico-directory.el][vertico-directory.el]]:
 Commands for Ido-like directory navigation
-  - 
[[https://github.com/minad/vertico/blob/main/extensions/vertico-flat.el][vertico-flat.el]]:
 Enable =vertico-flat-mode= to enable a flat, horizontal display
-  - 
[[https://github.com/minad/vertico/blob/main/extensions/vertico-indexed.el][vertico-indexed.el]]:
 Select indexed candidates with prefix arguments
-  - 
[[https://github.com/minad/vertico/blob/main/extensions/vertico-mouse.el][vertico-mouse.el]]:
 Mouse support for scrolling and candidate selection
-  - 
[[https://github.com/minad/vertico/blob/main/extensions/vertico-quick.el][vertico-quick.el]]:
 Select using Avy-style quick keys
+  - 
[[https://github.com/minad/vertico/blob/main/extensions/vertico-flat.el][vertico-flat.el]]:
 =vertico-flat-mode= to enable a flat, horizontal display
+  - 
[[https://github.com/minad/vertico/blob/main/extensions/vertico-indexed.el][vertico-indexed.el]]:
 =vertico-indexed-mode= to select indexed candidates with prefix arguments
+  - 
[[https://github.com/minad/vertico/blob/main/extensions/vertico-mouse.el][vertico-mouse.el]]:
 =vertico-mouse-mode= to support for scrolling and candidate selection
+  - 
[[https://github.com/minad/vertico/blob/main/extensions/vertico-quick.el][vertico-quick.el]]:
 Commands to select using Avy-style quick keys
   - 
[[https://github.com/minad/vertico/blob/main/extensions/vertico-repeat.el][vertico-repeat.el]]:
 The command =vertico-repeat= repeats the last completion session
-  - 
[[https://github.com/minad/vertico/blob/main/extensions/vertico-reverse.el][vertico-reverse.el]]:
 Enable =vertico-reverse-mode= to reverse the display
+  - 
[[https://github.com/minad/vertico/blob/main/extensions/vertico-reverse.el][vertico-reverse.el]]:
 =vertico-reverse-mode= to reverse the display
+
+  With these extensions it is possible to adapt Vertico heavily such that it
+  matches your preference or behaves similar to familiar UIs. The combination
+  =vertico-flat= plus =vertico-directory= resembles Ido in look and feel.
 
 * Complementary packages
 



[elpa] externals/vertico f5be4a5 1/4: vertico-indexed--handle-prefix-argument: Ignore argument

2021-07-11 Thread ELPA Syncer
branch: externals/vertico
commit f5be4a5d84a20a6cb4fb2ca0e56302a1d05deac9
Author: Daniel Mendler 
Commit: Daniel Mendler 

vertico-indexed--handle-prefix-argument: Ignore argument
---
 extensions/vertico-indexed.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/extensions/vertico-indexed.el b/extensions/vertico-indexed.el
index c7c2859..e5e4067 100644
--- a/extensions/vertico-indexed.el
+++ b/extensions/vertico-indexed.el
@@ -51,7 +51,7 @@
prefix)
suffix index start))
 
-(defun vertico-indexed--handle-prefix (orig)
+(defun vertico-indexed--handle-prefix (orig &optional _)
   "Handle prefix argument before calling ORIG function."
   (let ((vertico--index (if current-prefix-arg
 (+ vertico-indexed--min (prefix-numeric-value 
current-prefix-arg))



[elpa] externals/vertico updated (bb9ab12 -> b51a260)

2021-07-11 Thread ELPA Syncer
elpasync pushed a change to branch externals/vertico.

  from  bb9ab12   Fix vertico-indexed
   new  f5be4a5   vertico-indexed--handle-prefix-argument: Ignore argument
   new  95a3f42   vertico-indexed: Better formatting
   new  3c4088a   README updates
   new  b51a260   Remove nop


Summary of changes:
 README.org| 16 ++--
 extensions/vertico-indexed.el |  6 --
 vertico.el|  3 +--
 3 files changed, 15 insertions(+), 10 deletions(-)



[elpa] externals/vertico b51a260 4/4: Remove nop

2021-07-11 Thread ELPA Syncer
branch: externals/vertico
commit b51a26078bea890ea2638ae6009e77b60c829e74
Author: Daniel Mendler 
Commit: Daniel Mendler 

Remove nop
---
 vertico.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/vertico.el b/vertico.el
index 2d4492b..dcaf434 100644
--- a/vertico.el
+++ b/vertico.el
@@ -473,8 +473,7 @@ See `resize-mini-windows' for documentation."
(setq start (or start index))
(when (string-match-p "\n" cand)
  (setq cand (vertico--truncate-multiline cand max-width)))
-   (setcar line (vertico--format-candidate cand prefix suffix index 
start))
-   (setq index (1+ index
+   (setcar line (vertico--format-candidate cand prefix suffix index 
start
 (pop line)))
 lines))
 



[elpa] externals/consult updated (2d8751a -> f66acb3)

2021-07-11 Thread ELPA Syncer
elpasync pushed a change to branch externals/consult.

  from  2d8751a   project buffers: Check default directory instead of 
buffer-file-name (Fix #357)
   new  16c8200   func-arity may return nil
   new  f66acb3   default-directory may be nil


Summary of changes:
 consult.el | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)



[elpa] externals/consult 16c8200 1/2: func-arity may return nil

2021-07-11 Thread ELPA Syncer
branch: externals/consult
commit 16c8200b6c0a719342bb34313ffd27927e96d51e
Author: Daniel Mendler 
Commit: Daniel Mendler 

func-arity may return nil
---
 consult.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/consult.el b/consult.el
index e3f13b4..94d1280 100644
--- a/consult.el
+++ b/consult.el
@@ -631,7 +631,7 @@ The line beginning/ending BEG/END is bound in BODY."
   (unless (get-text-property pos 'invisible string)
 (setq width (+ width
;; bug#47712: Emacs 28 can compute 
`string-width' of substrings
-   (consult--static-if (= 3 (cdr (func-arity 
#'string-width)))
+   (consult--static-if (eq 3 (cdr (func-arity 
#'string-width)))
(string-width string pos nexti)
  (string-width
   ;; Avoid allocation for the full string.



[elpa] externals/consult f66acb3 2/2: default-directory may be nil

2021-07-11 Thread ELPA Syncer
branch: externals/consult
commit f66acb3b72e6b137a9a6d2d6f1e895509bb64358
Author: Daniel Mendler 
Commit: Daniel Mendler 

default-directory may be nil
---
 consult.el | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/consult.el b/consult.el
index 94d1280..a6a8780 100644
--- a/consult.el
+++ b/consult.el
@@ -3509,9 +3509,8 @@ If NORECORD is non-nil, do not record the buffer switch 
in the buffer list."
  (mapcar #'buffer-name
  (seq-filter
   (lambda (x)
-(string-prefix-p
- root
- (expand-file-name (buffer-local-value 'default-directory 
x
+(when-let (dir (buffer-local-value 'default-directory x))
+  (string-prefix-p root (expand-file-name dir
   (consult--cached-buffers))
   "Project buffer candidate source for `consult-buffer'.")
 



[elpa] externals/vertico 319687d: vertico-repeat: Use minibuffer-setup-hook, don't let-bind vertico-repeat--restore

2021-07-11 Thread ELPA Syncer
branch: externals/vertico
commit 319687d041cc528d6a0e3196d2f94355ef5cbef7
Author: Daniel Mendler 
Commit: Daniel Mendler 

vertico-repeat: Use minibuffer-setup-hook, don't let-bind 
vertico-repeat--restore

This ensures that repeating recursive sessions works.
---
 extensions/vertico-repeat.el | 31 ---
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/extensions/vertico-repeat.el b/extensions/vertico-repeat.el
index a850906..19b2fd6 100644
--- a/extensions/vertico-repeat.el
+++ b/extensions/vertico-repeat.el
@@ -35,10 +35,10 @@
 
 (require 'vertico)
 
+(defvar-local vertico-repeat--restore nil)
 (defvar vertico-repeat--input nil)
 (defvar vertico-repeat--command nil)
 (defvar vertico-repeat--candidate nil)
-(defvar vertico-repeat--restore nil)
 
 (defun vertico-repeat--save-input ()
   "Save current minibuffer content for `vertico-repeat'."
@@ -53,18 +53,20 @@
 
 (defun vertico-repeat--save ()
   "Save Vertico status for `vertico-repeat'."
-  (unless vertico-repeat--restore
-(setq vertico-repeat--command (if (boundp 'minibuffer-current-command)
-  minibuffer-current-command
-this-command)
-  vertico-repeat--input ""
-  vertico-repeat--candidate nil
-  vertico-repeat--restore nil))
-  (add-hook 'post-command-hook #'vertico-repeat--save-input nil 'local)
-  (add-hook 'minibuffer-exit-hook #'vertico-repeat--save-candidate nil 'local))
+  (when vertico--input
+(unless vertico-repeat--restore
+  (setq vertico-repeat--command (if (boundp 'minibuffer-current-command)
+minibuffer-current-command
+  this-command)
+vertico-repeat--input ""
+vertico-repeat--candidate nil
+vertico-repeat--restore nil))
+(add-hook 'post-command-hook #'vertico-repeat--save-input nil 'local)
+(add-hook 'minibuffer-exit-hook #'vertico-repeat--save-candidate nil 
'local)))
 
 (defun vertico-repeat--restore ()
   "Restore Vertico status for `vertico-repeat'."
+  (setq vertico-repeat--restore t)
   (delete-minibuffer-contents)
   (insert vertico-repeat--input)
   (when vertico-repeat--candidate
@@ -81,13 +83,12 @@
   (interactive)
   (unless vertico-repeat--command
 (user-error "No repeatable Vertico session"))
-  (let ((vertico-repeat--restore t))
-(minibuffer-with-setup-hook
-#'vertico-repeat--restore
-  (command-execute (setq this-command vertico-repeat--command)
+  (minibuffer-with-setup-hook
+  #'vertico-repeat--restore
+(command-execute (setq this-command vertico-repeat--command
 
 ;;;###autoload
-(advice-add #'vertico--setup :after #'vertico-repeat--save)
+(add-hook 'minibuffer-setup-hook #'vertico-repeat--save)
 
 (provide 'vertico-repeat)
 ;;; vertico-repeat.el ends here



[elpa] externals/vertico a770d33: Rename format-candidates to arrange-candidates

2021-07-11 Thread ELPA Syncer
branch: externals/vertico
commit a770d33df0c1cce5c130a3c719da8864006bcb65
Author: Daniel Mendler 
Commit: Daniel Mendler 

Rename format-candidates to arrange-candidates
---
 extensions/vertico-flat.el | 8 
 vertico.el | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/extensions/vertico-flat.el b/extensions/vertico-flat.el
index 98044d4..f167b18 100644
--- a/extensions/vertico-flat.el
+++ b/extensions/vertico-flat.el
@@ -54,8 +54,8 @@
(plist-get vertico-flat-format :right))
  (plist-get vertico-flat-format :no-match)
 
-(defun vertico-flat--format-candidates (_metadata)
-  "Format candidates."
+(defun vertico-flat--arrange-candidates (_metadata)
+  "Arrange candidates."
   (let* ((index (max 0 vertico--index))
  (count vertico-count)
  (candidates (nthcdr vertico--index vertico--candidates))
@@ -91,10 +91,10 @@
   :global t
   (cond
(vertico-flat-mode
-(advice-add #'vertico--format-candidates :override 
#'vertico-flat--format-candidates)
+(advice-add #'vertico--arrange-candidates :override 
#'vertico-flat--arrange-candidates)
 (advice-add #'vertico--display-candidates :override 
#'vertico-flat--display))
(t
-(advice-remove #'vertico--format-candidates 
#'vertico-flat--format-candidates)
+(advice-remove #'vertico--arrange-candidates 
#'vertico-flat--arrange-candidates)
 (advice-remove #'vertico--display-candidates #'vertico-flat--display
 
 (provide 'vertico-flat)
diff --git a/vertico.el b/vertico.el
index dcaf434..9e2ec08 100644
--- a/vertico.el
+++ b/vertico.el
@@ -433,8 +433,8 @@ See `resize-mini-windows' for documentation."
 (add-face-text-property 0 (length cand) 'vertico-current 'append cand))
   cand)
 
-(defun vertico--format-candidates (metadata)
-  "Format current candidates with METADATA."
+(defun vertico--arrange-candidates (metadata)
+  "Arrange candidates given the current METADATA."
   (let ((curr-line 0) (lines))
 ;; Compute group titles
 (let* ((start (min (max 0 (- vertico--index (/ vertico-count 2) (1- (mod 
vertico-count 2
@@ -553,7 +553,7 @@ See `resize-mini-windows' for documentation."
   (vertico--update-candidates pt content bounds metadata))
 (vertico--prompt-selection)
 (vertico--display-count)
-(vertico--display-candidates (vertico--format-candidates metadata
+(vertico--display-candidates (vertico--arrange-candidates metadata
 
 (defun vertico--allow-prompt-selection-p ()
   "Return t if prompt can be selected."



[elpa] externals/vertico updated (a770d33 -> 9f024fe)

2021-07-11 Thread ELPA Syncer
elpasync pushed a change to branch externals/vertico.

  from  a770d33   Rename format-candidates to arrange-candidates
   new  e2c91a6   Add vertico-sort-function and 
vertico-sort-override-function
   new  9f024fe   Add autoload to vertico-repeat--save


Summary of changes:
 README.org   |   2 +-
 extensions/vertico-flat.el   |   2 +-
 extensions/vertico-quick.el  |   4 +-
 extensions/vertico-repeat.el |  27 +--
 vertico.el   | 105 ++-
 5 files changed, 82 insertions(+), 58 deletions(-)



[elpa] externals/vertico e2c91a6 1/2: Add vertico-sort-function and vertico-sort-override-function

2021-07-11 Thread ELPA Syncer
branch: externals/vertico
commit e2c91a69566616f1fe07816b0ea989b55ae49c8d
Author: Daniel Mendler 
Commit: Daniel Mendler 

Add vertico-sort-function and vertico-sort-override-function

These variables can be configured as follows:

* nil/identity
* vertico-sort-recency-length-alpha (default)
* vertico-sort-recency-alpha
* vertico-sort-length-alpha
* vertico-sort-alpha
---
 README.org  |   2 +-
 extensions/vertico-flat.el  |   2 +-
 extensions/vertico-quick.el |   4 +-
 vertico.el  | 105 +++-
 4 files changed, 68 insertions(+), 45 deletions(-)

diff --git a/README.org b/README.org
index f93c53e..2f16bd5 100644
--- a/README.org
+++ b/README.org
@@ -27,7 +27,7 @@
   - Prompt shows the current candidate index and the total number of candidates
   - The current candidate is inserted with =TAB= and selected with =RET=
   - Non-existing candidates can be entered by moving the point to the prompt 
line
-  - Sorting by history position, string length and alphabetically
+  - Configurable sorting by recency (history position), length and 
alphabetically
   - Long candidates with newlines are formatted to take up less space
   - Deferred completion style highlighting for performance
   - Support for annotations (~annotation-function~ and ~affixation-function~)
diff --git a/extensions/vertico-flat.el b/extensions/vertico-flat.el
index f167b18..afa702b 100644
--- a/extensions/vertico-flat.el
+++ b/extensions/vertico-flat.el
@@ -68,7 +68,7 @@
  (result))
 (while (and candidates (> width 0) (> count 0))
   (let ((cand (car candidates)))
-(setq cand (car (funcall vertico--highlight (list cand
+(setq cand (car (funcall vertico--highlight-function (list cand
 (when (string-match-p "\n" cand)
   (setq cand (vertico--truncate-multiline cand width)))
 (setq cand (string-trim
diff --git a/extensions/vertico-quick.el b/extensions/vertico-quick.el
index 6da93e3..dd3033f 100644
--- a/extensions/vertico-quick.el
+++ b/extensions/vertico-quick.el
@@ -77,7 +77,7 @@
(let ((first (elt vertico-quick2 (mod (/ (- idx fst) len) 
snd)))
  (second (elt (concat vertico-quick1 vertico-quick2) 
(mod (- idx fst) len
  (push (cons first t) vertico-quick--list)
- (push (cons (+ first (lsh second 16)) index) 
vertico-quick--list)
+ (push (cons (+ first (ash second 16)) index) 
vertico-quick--list)
  (cond
   ((eq first vertico-quick--first)
(concat " " (propertize (char-to-string second) 'face 
'vertico-quick1)))
@@ -112,7 +112,7 @@
   (let ((vertico-quick--first key)
 (vertico-quick--list))
 (vertico--exhibit))
-  (setq key (+ key (lsh (read-key) 16
+  (setq key (+ key (ash (read-key) 16
 (when-let (idx (alist-get key vertico-quick--list))
   (setq vertico--index idx
 
diff --git a/vertico.el b/vertico.el
index 9e2ec08..21496e8 100644
--- a/vertico.el
+++ b/vertico.el
@@ -73,6 +73,14 @@ See `resize-mini-windows' for documentation."
   "Replacements for multiline strings."
   :type '(cons string string))
 
+(defcustom vertico-sort-override-function nil
+  "Sorting function override, which takes precedence over the 
`display-sort-function'."
+  :type '(choice (const nil) function))
+
+(defcustom vertico-sort-function #'vertico-sort-recency-length-alpha
+  "Default sorting function, which is used if no `display-sort-function' is 
specified."
+  :type '(choice (const nil) function))
+
 (defgroup vertico-faces nil
   "Faces used by Vertico."
   :group 'vertico
@@ -110,7 +118,7 @@ See `resize-mini-windows' for documentation."
 map)
   "Vertico minibuffer keymap derived from `minibuffer-local-map'.")
 
-(defvar-local vertico--highlight #'identity
+(defvar-local vertico--highlight-function #'identity
   "Deferred candidate highlighting function.")
 
 (defvar-local vertico--history-hash nil
@@ -155,12 +163,6 @@ See `resize-mini-windows' for documentation."
 (defvar-local vertico--default-missing nil
   "Default candidate is missing from candidates list.")
 
-(defun vertico--sort-predicate (x y)
-  "Sorting predicate which compares X and Y."
-  (or (< (length x) (length y))
-  (and (= (length x) (length y))
-   (string< x y
-
 (defun vertico--update-history-hash (base)
   "Update history hash, given current BASE prefix string."
   (unless (and vertico--history-hash (equal vertico--history-base base))
@@ -187,33 +189,51 @@ See `resize-mini-windows' for documentation."
   (setq vertico--history-hash hash
 vertico--history-base base
 
-(defun vertico--sort (candidates)
-  "Sort CANDIDATES by history, length and alphabetically."
-  ;; Separate history candidates from candidates first.
-  ;; Move the remaining candidates into buckets a

[elpa] externals/vertico 9f024fe 2/2: Add autoload to vertico-repeat--save

2021-07-11 Thread ELPA Syncer
branch: externals/vertico
commit 9f024fec906680cd3adee01e6b8ad87fa1f2ace3
Author: Daniel Mendler 
Commit: Daniel Mendler 

Add autoload to vertico-repeat--save

Thanks, @kljohann
---
 extensions/vertico-repeat.el | 27 ++-
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/extensions/vertico-repeat.el b/extensions/vertico-repeat.el
index 19b2fd6..702897f 100644
--- a/extensions/vertico-repeat.el
+++ b/extensions/vertico-repeat.el
@@ -51,19 +51,6 @@
  (>= vertico--index 0)
  (nth vertico--index vertico--candidates
 
-(defun vertico-repeat--save ()
-  "Save Vertico status for `vertico-repeat'."
-  (when vertico--input
-(unless vertico-repeat--restore
-  (setq vertico-repeat--command (if (boundp 'minibuffer-current-command)
-minibuffer-current-command
-  this-command)
-vertico-repeat--input ""
-vertico-repeat--candidate nil
-vertico-repeat--restore nil))
-(add-hook 'post-command-hook #'vertico-repeat--save-input nil 'local)
-(add-hook 'minibuffer-exit-hook #'vertico-repeat--save-candidate nil 
'local)))
-
 (defun vertico-repeat--restore ()
   "Restore Vertico status for `vertico-repeat'."
   (setq vertico-repeat--restore t)
@@ -78,6 +65,20 @@
  (vertico--exhibit))
 
 ;;;###autoload
+(defun vertico-repeat--save ()
+  "Save Vertico status for `vertico-repeat'."
+  (when vertico--input
+(unless vertico-repeat--restore
+  (setq vertico-repeat--command (if (boundp 'minibuffer-current-command)
+minibuffer-current-command
+  this-command)
+vertico-repeat--input ""
+vertico-repeat--candidate nil
+vertico-repeat--restore nil))
+(add-hook 'post-command-hook #'vertico-repeat--save-input nil 'local)
+(add-hook 'minibuffer-exit-hook #'vertico-repeat--save-candidate nil 
'local)))
+
+;;;###autoload
 (defun vertico-repeat ()
   "Repeat last Vertico completion session."
   (interactive)



[elpa] externals/setup ec0772b 2/2: Extract common functionality into utility functions

2021-07-11 Thread ELPA Syncer
branch: externals/setup
commit ec0772bbc26d5595dc918e80d4cddc4440a1b029
Author: Philip Kaludercic 
Commit: Philip Kaludercic 

Extract common functionality into utility functions
---
 setup.el | 161 +--
 1 file changed, 75 insertions(+), 86 deletions(-)

diff --git a/setup.el b/setup.el
index 78204a4..86570e3 100644
--- a/setup.el
+++ b/setup.el
@@ -212,6 +212,55 @@ If not given, it is assumed nothing is evaluated."
  #'setup-xref-def-function)
 
 
+;;; common utility functions for keywords
+
+(defun setup--ensure-kbd (sexp)
+  "Attempt to return SEXP as a key binding expression."
+  (cond ((stringp sexp) (kbd sexp))
+((symbolp sexp) `(kbd ,sexp))
+(sexp)))
+
+(defun setup--ensure-function (sexp)
+  "Attempt to return SEXP as a quoted function name."
+  (cond ((eq (car-safe sexp) 'function)
+ sexp)
+((eq (car-safe sexp) 'quote)
+ `#',(cadr sexp))
+((symbolp sexp)
+ `#',sexp)
+(sexp)))
+
+(defun setup--make-setter (name val old-val-fn wrap-fn)
+  "Convert NAME and VAL into setter code.
+The function OLD-VAL-FN is used to extract the old value of
+VAL.  The function WRAP-FN combines the transformed values of NAME
+and VAL into one s-expression."
+  (cond ((symbolp name) (funcall wrap-fn name val))
+((eq (car-safe name) 'append)
+ (funcall wrap-fn
+  (cadr name)
+  (let ((sym (gensym)))
+`(let ((,sym ,val)
+   (list ,(funcall old-val-fn name)))
+   (if (member ,sym list)
+   list
+ (append list (list ,sym)))
+((eq (car-safe name) 'prepend)
+ (funcall wrap-fn
+  (cadr name)
+  (let ((sym (gensym)))
+`(let ((,sym ,val)
+   (list ,(funcall old-val-fn name)))
+   (if (member ,sym list)
+   list
+ (cons ,sym list))
+((eq (car-safe name) 'remove)
+ (funcall wrap-fn
+  (cadr name)
+  `(remove ,val ,(funcall old-val-fn name
+((error "Invalid option %S" name
+
+
 ;;; definitions of `setup' keywords
 
 (setup-define :with-feature
@@ -302,16 +351,8 @@ the first FEATURE."
 (setup-define :global
   (lambda (key command)
 `(global-set-key
-  ,(cond ((stringp key) (kbd key))
- ((symbolp key) `(kbd ,key))
- (t key))
-  ,(cond ((eq (car-safe command) 'function)
-  command)
- ((eq (car-safe command) 'quote)
-  `#',(cadr command))
- ((symbolp 'quote)
-  `#',command)
- (command
+  ,(setup--ensure-kbd key)
+  ,(setup--ensure-function command)))
   :documentation "Globally bind KEY to COMMAND."
   :debug '(form sexp)
   :repeatable t)
@@ -319,16 +360,8 @@ the first FEATURE."
 (setup-define :bind
   (lambda (key command)
 `(define-key (symbol-value setup-map)
-   ,(cond ((stringp key) (kbd key))
-  ((symbolp key) `(kbd ,key))
-  (t key))
-   ,(cond ((eq (car-safe command) 'function)
- command)
-((eq (car-safe command) 'quote)
- `#',(cadr command))
-((symbolp 'quote)
- `#',command)
-(command
+   ,(setup--ensure-kbd key)
+   ,(setup--ensure-function command)))
   :documentation "Bind KEY to COMMAND in current map."
   :after-loaded t
   :debug '(form sexp)
@@ -337,9 +370,7 @@ the first FEATURE."
 (setup-define :unbind
   (lambda (key)
 `(define-key (symbol-value setup-map)
-   ,(cond ((stringp key) (kbd key))
-  ((symbolp key) `(kbd ,key))
-  (t key))
+   ,(setup--ensure-kbd key)
nil))
   :documentation "Unbind KEY in current map."
   :after-loaded t
@@ -352,16 +383,8 @@ the first FEATURE."
(dolist (key (where-is-internal ',command (symbol-value setup-map)))
  (define-key (symbol-value setup-map) key nil))
(define-key (symbol-value setup-map)
- ,(cond ((stringp key) (kbd key))
-((symbolp key) `(kbd ,key))
-(t key))
- ,(cond ((eq (car-safe command) 'function)
- command)
-((eq (car-safe command) 'quote)
- `#',(cadr command))
-((symbolp 'quote)
- `#',command)
-(command)
+ ,(setup--ensure-kbd key)
+ ,(setup--ensure-function command
   :documentation "Unbind the current key for COMMAND, and bind it to KEY."
   :after-loaded t
   :debug '(form sexp)
@@ -369,7 +392,7 @@ the first FEATURE."
 
 (setup-define :hook
   (lambda (function)
-`(add-hook setup-hook #',function))
+`(add-hook setup-hook ,(setup--ensure-function function)))
   :documentation "Add FUNCTION to current hook."
   :repeatable t)
 
@@ -385,37 +408,17 @@ the first FEATURE."
 
 (s

[elpa] externals/setup updated (d04e69c -> ec0772b)

2021-07-11 Thread ELPA Syncer
elpasync pushed a change to branch externals/setup.

  from  d04e69c   Remove variable comment from :option
   new  fdd335f   Return nil when path doesn't exist in :load-from
   new  ec0772b   Extract common functionality into utility functions


Summary of changes:
 setup.el | 163 +--
 1 file changed, 76 insertions(+), 87 deletions(-)



[elpa] externals/setup fdd335f 1/2: Return nil when path doesn't exist in :load-from

2021-07-11 Thread ELPA Syncer
branch: externals/setup
commit fdd335f0480cd0b9cb5f0198fb96f11883886310
Author: Philip Kaludercic 
Commit: Philip Kaludercic 

Return nil when path doesn't exist in :load-from
---
 setup.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/setup.el b/setup.el
index cf21f0d..78204a4 100644
--- a/setup.el
+++ b/setup.el
@@ -556,7 +556,7 @@ the first PACKAGE."
   (lambda (path)
 `(if (file-exists-p ,path)
  (add-to-list 'load-path (expand-file-name ,path))
-   (throw 'setup-exit t)))
+   (throw 'setup-exit nil)))
   :documentation "Add PATH to load path.
 This macro can be used as HEAD, and it will replace itself with
 the nondirectory part of PATH.



[elpa] externals/vertico updated (9f024fe -> c35c9a1)

2021-07-11 Thread ELPA Syncer
elpasync pushed a change to branch externals/vertico.

  from  9f024fe   Add autoload to vertico-repeat--save
   new  0ff9daa   Minor simplification
   new  c35c9a1   Simplify sorting function macro


Summary of changes:
 vertico.el | 68 +-
 1 file changed, 32 insertions(+), 36 deletions(-)



[elpa] externals/vertico 0ff9daa 1/2: Minor simplification

2021-07-11 Thread ELPA Syncer
branch: externals/vertico
commit 0ff9daa98bffbde0c8ac75f3727db1f144411051
Author: Daniel Mendler 
Commit: Daniel Mendler 

Minor simplification
---
 vertico.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/vertico.el b/vertico.el
index 21496e8..ab680d5 100644
--- a/vertico.el
+++ b/vertico.el
@@ -319,9 +319,9 @@ The function is configured by RECENCY, BSIZE, BINDEX, BPRED 
and PRED."
  (concat "\\|" (regexp-opt 
completion-ignored-extensions) "\\'")
 (setq all (cl-delete-if (lambda (x) (string-match-p ignore x)) all
 ;; Sort using the `display-sort-function' or the Vertico sort functions
-(when-let (sort (or (and (not vertico-sort-override-function)
- (completion-metadata-get metadata 
'display-sort-function))
-vertico-sort-override-function vertico-sort-function))
+(when-let (sort (or vertico-sort-override-function
+(completion-metadata-get metadata 
'display-sort-function)
+vertico-sort-function))
   (unless (eq sort #'identity)
 (vertico--update-history-hash (substring content 0 base))
 (setq all (funcall sort all



[elpa] externals/vertico c35c9a1 2/2: Simplify sorting function macro

2021-07-11 Thread ELPA Syncer
branch: externals/vertico
commit c35c9a14e17917c0928a4db1efcf0ec6d6848475
Author: Daniel Mendler 
Commit: Daniel Mendler 

Simplify sorting function macro
---
 vertico.el | 62 +-
 1 file changed, 29 insertions(+), 33 deletions(-)

diff --git a/vertico.el b/vertico.el
index ab680d5..12e2226 100644
--- a/vertico.el
+++ b/vertico.el
@@ -195,45 +195,41 @@ See `resize-mini-windows' for documentation."
   (and (= (length x) (length y))
(string< x y
 
-(defmacro vertico--define-sort (fun recency bsize bindex bpred pred)
-  "Generate optimized sort FUN.
-The function is configured by RECENCY, BSIZE, BINDEX, BPRED and PRED."
-  `(defun ,fun (candidates)
+(defmacro vertico--define-sort (by bsize bindex bpred pred)
+  "Generate optimized sorting function.
+The function is configured by BY, BSIZE, BINDEX, BPRED and PRED."
+  `(defun ,(intern (mapconcat #'symbol-name `(vertico sort ,@by) "-")) 
(candidates)
+ ,(concat "Sort candidates by " (mapconcat #'symbol-name by ", ") ".")
  (let* ((buckets (make-vector ,bsize nil))
-(recent-candidates))
-   ,@(if recency
- `((dolist (cand candidates)
- (if-let (idx (gethash cand vertico--history-hash))
- (push (cons idx cand) recent-candidates)
+(recent-cands))
+   ,@(if (eq (car by) 'recency)
+ `((dolist (% candidates)
+ ;; Find recent-cands or fill buckets
+ (if-let (idx (gethash % vertico--history-hash))
+ (push (cons idx %) recent-cands)
(let ((idx (min ,(1- bsize) ,bindex)))
- (aset buckets idx (cons cand (aref buckets idx))
+ (aset buckets idx (cons % (aref buckets idx))
;; Sort recent candidates
-   (setq recent-candidates (sort recent-candidates 
#'car-less-than-car))
-   (let ((cand recent-candidates))
+   (setq recent-cands (sort recent-cands #'car-less-than-car))
+   (let ((cand recent-cands))
  (while cand
(setcar cand (cdar cand))
(pop cand
-  `((dolist (cand candidates)
-  (let ((idx (min ,(1- bsize) ,bindex)))
-(aset buckets idx (cons cand (aref buckets idx)))
-   (nconc
-;; Sorted recent candidates
-recent-candidates
-;; Sort bucket candidates
-(mapcan
- (lambda (bucket) (sort bucket #',bpred))
- (nbutlast (append buckets nil)))
-;; Last bucket needs special treatment
-(sort (aref buckets ,(1- bsize)) #',pred)
-
-(vertico--define-sort vertico-sort-recency-length-alpha
-  'recency 32 (length cand) string< vertico--length-string<)
-(vertico--define-sort vertico-sort-recency-alpha
-  'recency 32 (if (eq cand "") 0 (/ (aref cand 0) 4)) string< string<)
-(vertico--define-sort vertico-sort-length-alpha
-  nil 32 (length cand) string< vertico--length-string<)
-(vertico--define-sort vertico-sort-alpha
-  nil 32 (if (eq cand "") 0 (/ (aref cand 0) 4)) string< string<)
+   `((dolist (% candidates)
+   ;; Fill buckets
+   (let ((idx (min ,(1- bsize) ,bindex)))
+ (aset buckets idx (cons % (aref buckets idx)))
+   (nconc recent-cands
+  ;; Sort bucket candidates
+  (mapcan (lambda (bucket) (sort bucket #',bpred))
+  (nbutlast (append buckets nil)))
+  ;; Last bucket needs special treatment
+  (sort (aref buckets ,(1- bsize)) #',pred)
+
+(vertico--define-sort (recency length alpha) 32 (length %) string< 
vertico--length-string<)
+(vertico--define-sort (recency alpha) 32 (if (eq % "") 0 (/ (aref % 0) 4)) 
string< string<)
+(vertico--define-sort (length alpha) 32 (length %) string< 
vertico--length-string<)
+(vertico--define-sort (alpha) 32 (if (eq % "") 0 (/ (aref % 0) 4)) string< 
string<)
 
 (defun vertico--affixate (metadata candidates)
   "Annotate CANDIDATES with annotation function specified by METADATA."



[elpa] externals/js2-mode updated (3bbff3c -> be49133)

2021-07-11 Thread ELPA Syncer
elpasync pushed a change to branch externals/js2-mode.

  from  3bbff3c   Use memq instead of member
   new  39a3f50   js2-jump-to-definition: Stop erroring when encounter 
'this'
   new  be49133   Support for 'this.method()' navigation


Summary of changes:
 NEWS.md |  2 ++
 js2-mode.el | 61 +++--
 tests/navigation.el |  6 +-
 3 files changed, 48 insertions(+), 21 deletions(-)



[elpa] externals/js2-mode 39a3f50 1/2: js2-jump-to-definition: Stop erroring when encounter 'this'

2021-07-11 Thread ELPA Syncer
branch: externals/js2-mode
commit 39a3f50af6b5126f717a4d1649124418771308ba
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

js2-jump-to-definition: Stop erroring when encounter 'this'

#423
---
 js2-mode.el | 21 +++--
 tests/navigation.el |  2 +-
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/js2-mode.el b/js2-mode.el
index d72f4ec..f86f578 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -12978,7 +12978,10 @@ i.e. (\\='name\\=' \\='value\\=') = {name : { value: 
3}}"
 NAMES is a list of property values to search for. For functions
 and variables NAMES will contain one element."
   (let (node-init
-(val (js2-name-node-name (car names
+(val (and
+  ;; TODO: Consider 'this' specially, to limit search scope.
+  (js2-name-node-p (car names))
+  (js2-name-node-name (car names)
 (setq node-init (js2-get-symbol-declaration node val))
 
 (when (> (length names) 1)
@@ -13004,11 +13007,17 @@ and variables NAMES will contain one element."
  (temp-names names))
  (when (js2-prop-get-node-p left)
(let* ((prop-list (js2-compute-nested-prop-get left))
-  (found (cl-loop for prop in prop-list
-  until (not (string= 
(js2-name-node-name
-   (pop 
temp-names))
-  
(js2-name-node-name prop)))
-  if (not temp-names) return prop))
+  ;; 'this' or 'super'
+  (target-is-keyword (js2-keyword-node-p (car 
temp-names)))
+  (_ (when target-is-keyword
+   (pop temp-names)))
+  (found (unless target-is-keyword
+   (cl-loop for prop in prop-list
+until (not (string= 
(js2-name-node-name
+ (pop 
temp-names))
+(and 
(js2-name-node-p prop)
+ 
(js2-name-node-name prop
+if (not temp-names) return prop)))
   (found-node (or found
   (when (js2-object-node-p right)
 (js2-search-object-for-prop right
diff --git a/tests/navigation.el b/tests/navigation.el
index c71afae..b56089f 100644
--- a/tests/navigation.el
+++ b/tests/navigation.el
@@ -47,7 +47,7 @@
   (js2-navigation-helper "var p1 = 4; function aFunction(p1, p2) {p1};" 32 4))
 
 (ert-deftest js2-jump-to-object-property ()
-  (js2-navigation-helper "var aObject = {prop1: 3, prop2: \"hello\"}; 
aObject.prop1" 16))
+  (js2-navigation-helper "var aObject = {prop1: 3, prop2: \"hello\"}; 
this.prop1 = 4; aObject.prop1" 16))
 
 (ert-deftest js2-no-jump-to-object-property ()
   (js2-navigation-helper "var aObject = {prop1: 3, prop2: \"hello\"}; 
anotherObject.prop1"



[elpa] externals/js2-mode be49133 2/2: Support for 'this.method()' navigation

2021-07-11 Thread ELPA Syncer
branch: externals/js2-mode
commit be49133767ea9e0210f15ba631dc731ec9eabd64
Author: Dmitry Gutov 
Commit: Dmitry Gutov 

Support for 'this.method()' navigation

#423
---
 NEWS.md |  2 ++
 js2-mode.el | 48 ++--
 tests/navigation.el |  4 
 3 files changed, 36 insertions(+), 18 deletions(-)

diff --git a/NEWS.md b/NEWS.md
index 224a034..7ec1edd 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,8 @@
 
 ## Next
 
+* Minor improvements in `js2-jump-to-definition`
+  ([#423](https://github.com/mooz/js2-mode/issues/423)).
 * Support for private class memebers
   ([#537](https://github.com/mooz/js2-mode/issues/537)).
 * Support for dynamic imports and `import.meta`
diff --git a/js2-mode.el b/js2-mode.el
index f86f578..a5563b9 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -12950,7 +12950,7 @@ it marks the next defun after the ones already marked."
   (cl-assert (js2-object-node-p node))
   ;; Only support name-node and nodes for the time being
   (cl-loop for elem in (js2-object-node-elems node)
-   for left = (js2-object-prop-node-left elem)
+   for left = (js2-infix-node-left elem)
if (or (and (js2-name-node-p left)
(equal (js2-name-node-name name-node)
   (js2-name-node-name left)))
@@ -12970,31 +12970,43 @@ i.e. (\\='name\\=' \\='value\\=') = {name : { value: 
3}}"
 (while (and temp names (js2-object-node-p temp-object))
   (setq temp (js2-search-object temp-object (pop names)))
   (and (setq node temp)
- (setq temp-object (js2-object-prop-node-right temp
+ (setq temp-object (js2-infix-node-right temp
 (unless names node)))
 
 (defun js2-search-scope (node names)
   "Searches NODE scope for jump location matching NAMES.
 NAMES is a list of property values to search for. For functions
 and variables NAMES will contain one element."
-  (let (node-init
-(val (and
-  ;; TODO: Consider 'this' specially, to limit search scope.
-  (js2-name-node-p (car names))
-  (js2-name-node-name (car names)
-(setq node-init (js2-get-symbol-declaration node val))
+  (let (node-init val)
+(cond
+ ((js2-name-node-p (car names))
+  (setq val (js2-name-node-name (car names)))
+  (setq node-init (js2-get-symbol-declaration node val)))
+ ((and (js2-keyword-node-p (car names))
+   (equal (js2-keyword-node-type (car names))
+  js2-THIS))
+  (let* ((scope (js2-node-get-enclosing-scope node))
+ (parent (js2-node-parent scope)))
+(when (or (js2-method-node-p parent)
+  (js2-object-prop-node-p parent))
+  ;; class or object
+  (setq node-init (js2-node-parent parent))
 
 (when (> (length names) 1)
-
-  ;; Check var declarations
-  (when (and node-init (string= val (js2-name-node-name node-init)))
-(let ((parent (js2-node-parent node-init))
-  (temp-names names))
-  (pop temp-names) ;; First element is var name
-  (setq node-init (when (js2-var-init-node-p parent)
-(js2-search-object-for-prop
- (js2-var-init-node-initializer parent)
- temp-names)
+  (when node-init
+(cond
+ ((js2-name-node-p (car names))
+  ;; Check var declarations
+  (when (string= val (js2-name-node-name node-init))
+(let ((parent (js2-node-parent node-init)))
+  (setq node-init (when (js2-var-init-node-p parent)
+(js2-search-object-for-prop
+ (js2-var-init-node-initializer parent)
+ (cdr names)))
+ ((js2-object-node-p node-init)
+  (setq node-init (js2-search-object-for-prop
+   node-init
+   (cdr names))
 
   ;; Check all assign nodes
   (js2-visit-ast
diff --git a/tests/navigation.el b/tests/navigation.el
index b56089f..9f605e9 100644
--- a/tests/navigation.el
+++ b/tests/navigation.el
@@ -77,6 +77,10 @@
 (ert-deftest js2-jump-to-function-inside-property-value-syntax ()
   (js2-navigation-helper "function aFunction(p1, p2) {return p1+p2}; 
module.exports = {aFunction};" 1 6))
 
+(ert-deftest js2-jump-to-this-inside-same-class ()
+  (js2-navigation-helper "class App { something() { return \"s\" } render() { 
this.something"
+ 13))
+
 
 ;; forward-sexp
 



[elpa] externals-release/org 1ee52c5: Backport commit 348b2aed0 from Emacs

2021-07-11 Thread ELPA Syncer
branch: externals-release/org
commit 1ee52c5eb68de7cc0ebbc72e2f701dada7efeaaf
Author: Amin Bandali 
Commit: Kyle Meyer 

Backport commit 348b2aed0 from Emacs

Update IRC-related references to point to Libera.Chat
348b2aed0c8c3630be4c15c8e70acf7ea9c023af
Amin Bandali
Sat Jul 3 23:39:18 2021 -0400
---
 lisp/ol-irc.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/ol-irc.el b/lisp/ol-irc.el
index e3d7651..df62dd0 100644
--- a/lisp/ol-irc.el
+++ b/lisp/ol-irc.el
@@ -39,9 +39,9 @@
 ;;
 ;; Links within an org buffer might look like this:
 ;;
-;; [[irc:/irc.freenode.net/#emacs/bob][chat with bob in #emacs on freenode]]
-;; [[irc:/irc.freenode.net/#emacs][#emacs on freenode]]
-;; [[irc:/irc.freenode.net/]]
+;; [[irc:/irc.libera.chat/#emacs/bob][chat with bob in #emacs on Libera.Chat]]
+;; [[irc:/irc.libera.chat/#emacs][#emacs on Libera.Chat]]
+;; [[irc:/irc.libera.chat/]]
 ;;
 ;; If, when the resulting link is visited, there is no connection to a
 ;; requested server then one will be created.



[elpa] externals/org fc273bf: Merge branch 'maint'

2021-07-11 Thread ELPA Syncer
branch: externals/org
commit fc273bfce1ba35d003608aa38d1ca366426fee58
Merge: 61e0837 1ee52c5
Author: Kyle Meyer 
Commit: Kyle Meyer 

Merge branch 'maint'
---
 lisp/ol-irc.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/ol-irc.el b/lisp/ol-irc.el
index e3d7651..df62dd0 100644
--- a/lisp/ol-irc.el
+++ b/lisp/ol-irc.el
@@ -39,9 +39,9 @@
 ;;
 ;; Links within an org buffer might look like this:
 ;;
-;; [[irc:/irc.freenode.net/#emacs/bob][chat with bob in #emacs on freenode]]
-;; [[irc:/irc.freenode.net/#emacs][#emacs on freenode]]
-;; [[irc:/irc.freenode.net/]]
+;; [[irc:/irc.libera.chat/#emacs/bob][chat with bob in #emacs on Libera.Chat]]
+;; [[irc:/irc.libera.chat/#emacs][#emacs on Libera.Chat]]
+;; [[irc:/irc.libera.chat/]]
 ;;
 ;; If, when the resulting link is visited, there is no connection to a
 ;; requested server then one will be created.



[elpa] externals/org updated (61e0837 -> fc273bf)

2021-07-11 Thread ELPA Syncer
elpasync pushed a change to branch externals/org.

  from  61e0837   org-attach: Possibly delete empty attach directory
   new  1ee52c5   Backport commit 348b2aed0 from Emacs
   new  fc273bf   Merge branch 'maint'


Summary of changes:
 lisp/ol-irc.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)