[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/embark edfd0a8 6/6: Merge pull request #404 from minad/
From: |
ELPA Syncer |
Subject: |
[elpa] externals/embark edfd0a8 6/6: Merge pull request #404 from minad/remove-from-history |
Date: |
Tue, 16 Nov 2021 16:57:17 -0500 (EST) |
branch: externals/embark
commit edfd0a842a75ad25115f95f56b0c8a9351d3e248
Merge: 5182b7e 24dd7b1
Author: Omar AntolĂn Camarena <omar.antolin@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #404 from minad/remove-from-history
Remove from history and minor changes
---
embark-consult.el | 23 +++++++++--------------
embark.el | 25 ++++++++++++++++++++++---
2 files changed, 31 insertions(+), 17 deletions(-)
diff --git a/embark-consult.el b/embark-consult.el
index ba7d18e..b05d5c9 100644
--- a/embark-consult.el
+++ b/embark-consult.el
@@ -313,22 +313,17 @@ that is a Consult async command."
;;; Tables of contents for buffers: imenu and outline candidate collectors
-
-(defun embark-consult-toc-outline ()
- "Collect all outline headings in the current buffer."
+(defun embark-consult-outline-candidates ()
+ "Collect all outline headings in the current buffer."
(cons 'consult-location (consult--outline-candidates)))
-(defun embark-consult-toc-imenu ()
- "Collect all imenu items in the current buffer."
- (cons 'consult-location
- (mapcar (pcase-lambda (`(,item . ,pos))
- (propertize item 'consult-location
- (cons pos (line-number-at-pos pos))))
- (consult-imenu--items))))
-
-(unless (memq 'embark-consult-toc-outline embark-candidate-collectors)
- (setq embark-candidate-collectors
- (append embark-candidate-collectors '(embark-consult-toc-outline))))
+(autoload 'consult-imenu--items "consult-imenu")
+(defun embark-consult-imenu-candidates ()
+ "Collect all imenu items in the current buffer."
+ (cons 'imenu (mapcar #'car (consult-imenu--items))))
+
+(setf (alist-get 'imenu embark-default-action-overrides) #'consult-imenu)
+(add-to-list 'embark-candidate-collectors #'embark-consult-outline-candidates
'append)
(provide 'embark-consult)
;;; embark-consult.el ends here
diff --git a/embark.el b/embark.el
index 4e0025e..b90a0c3 100644
--- a/embark.el
+++ b/embark.el
@@ -472,6 +472,7 @@ arguments and more details."
(bookmark-rename embark--restart)
(delete-file embark--restart)
(embark-recentf-remove embark--restart)
+ (embark-history-remove embark--restart)
(rename-file embark--restart)
(copy-file embark--restart)
(delete-directory embark--restart)
@@ -1141,7 +1142,7 @@ If NESTED is non-nil subkeymaps are not flattened."
(defun embark-completing-read-prompter (keymap update &optional no-default)
"Prompt via completion for a command bound in KEYMAP.
-If NO-DEFAULT is t, no default value is passed to`completing-read'.
+If NO-DEFAULT is t, no default value is passed to`completing-read'.
UPDATE is the indicator update function. It is not used directly
here, but if the user switches to `embark-keymap-prompter', the
@@ -3104,8 +3105,25 @@ When called with a prefix argument OTHER-WINDOW, open
dired in other window."
(defun embark-recentf-remove (file)
"Remove FILE from the list of recent files."
(interactive (list (completing-read "Remove recent file: " recentf-list nil
t)))
+ (embark-history-remove file)
(setq recentf-list (delete (expand-file-name file) recentf-list)))
+(defun embark-history-remove (str)
+ "Remove STR from `minibuffer-history-variable'.
+Many completion UIs sort by history position. This command can be used
+to remove entries from the history, such that they are not sorted closer
+to the top."
+ (interactive
+ (list
+ (completing-read "Remove history item: "
+ (if (eq minibuffer-history-variable t)
+ (user-error "No minibuffer history")
+ (symbol-value minibuffer-history-variable))
+ nil t)))
+ (unless (eq minibuffer-history-variable t)
+ (set minibuffer-history-variable
+ (delete str (symbol-value minibuffer-history-variable)))))
+
(defvar xref-backend-functions)
(defun embark-find-definition (symbol)
@@ -3443,7 +3461,7 @@ and leaves the point to the left of it."
("=" ediff-files)
("e" embark-eshell)
("+" make-directory)
- ("-" embark-recentf-remove)
+ ("\\" embark-recentf-remove)
("I" embark-insert-relative-path)
("W" embark-save-relative-path)
("l" load-file)
@@ -3532,7 +3550,8 @@ and leaves the point to the left of it."
("e" pp-eval-expression)
("a" apropos)
("n" embark-next-symbol)
- ("p" embark-previous-symbol))
+ ("p" embark-previous-symbol)
+ ("\\" embark-history-remove))
(embark-define-keymap embark-face-map
"Keymap for Embark face actions."
- [elpa] externals/embark updated (5182b7e -> edfd0a8), ELPA Syncer, 2021/11/16
- [elpa] externals/embark b8564a9 2/6: Use add-to-list, ELPA Syncer, 2021/11/16
- [elpa] externals/embark dbaa43a 1/6: Add embark-history-remove, ELPA Syncer, 2021/11/16
- [elpa] externals/embark 376662e 3/6: embark-consult-toc-imenu: Use the imenu category, ELPA Syncer, 2021/11/16
- [elpa] externals/embark 4cb5394 4/6: Adjust naming convention, ELPA Syncer, 2021/11/16
- [elpa] externals/embark 24dd7b1 5/6: Add embark-default-action-overrides for imenu, ELPA Syncer, 2021/11/16
- [elpa] externals/embark edfd0a8 6/6: Merge pull request #404 from minad/remove-from-history,
ELPA Syncer <=