[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/vcomplete 8ade381c7c 44/91: Move Embark integration to a s
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/vcomplete 8ade381c7c 44/91: Move Embark integration to a separate file |
Date: |
Tue, 24 May 2022 15:59:08 -0400 (EDT) |
branch: elpa/vcomplete
commit 8ade381c7c346517a1ffb488a0e0ab129e46e650
Author: Daniel Semyonov <daniel@dsemy.com>
Commit: Daniel Semyonov <daniel@dsemy.com>
Move Embark integration to a separate file
* vcomplete.el (vcomplete-embark--eliminiate-delay)
(vcomplete-embark--advise-commands, vcomplete-embark-current-completion)
(vcomplete-embark-collect-candidates): Move to vcomplete-embark.el.
* vcomplete-embark.el: New file now containing the Embark integration.
---
vcomplete-embark.el | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++
vcomplete.el | 43 ---------------------------
2 files changed, 83 insertions(+), 43 deletions(-)
diff --git a/vcomplete-embark.el b/vcomplete-embark.el
new file mode 100644
index 0000000000..04fe81bf17
--- /dev/null
+++ b/vcomplete-embark.el
@@ -0,0 +1,83 @@
+;;; vcomplete-embark.el --- Embark integration for Vcomplete -*-
lexical-binding: t; -*-
+
+;; Copyright (C) 2021 Daniel Semyonov
+
+;; Author: Daniel Semyonov <daniel@dsemy.com>
+;; Maintainer: Daniel Semyonov <daniel@dsemy.com>
+;; Version: 1.0
+;; Package-Requires: ((emacs "27.1"))
+;; Keywords: convenience, matching
+;; URL: https://dsemy.com/software/vcomplete
+
+;; This file is not part of GNU Emacs.
+
+;; Vcomplete is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published
+;; by the Free Software Foundation; either version 3, or (at your
+;; option) any later version.
+
+;; Vcomplete is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Embark integration for Vcomplete.
+;; This integration is not tested regularly, and might have issues.
+
+;;; Code:
+
+(require 'vcomplete)
+(require 'embark)
+
+(declare-function embark-target-completion-at-point "ext:embark")
+(declare-function embark-completions-buffer-candidates "ext:embark")
+
+(defun vcomplete-embark--eliminate-delay (fun &rest args)
+ "Call FUN with ARGS and `minibuffer-message-timeout' locally set to `0'."
+ (let ((minibuffer-message-timeout 0))
+ (apply fun args)))
+
+(defun vcomplete-embark--advise-commands ()
+ "Advise Embark commands with `vcomplete-embark--eliminate-delay'."
+ (dolist (cmd '(embark-act embark-default-action))
+ (if vcomplete-mode
+ (advice-add cmd :around #'vcomplete-embark--eliminate-delay)
+ (advice-remove cmd #'vcomplete-embark--eliminate-delay))))
+
+(add-hook 'vcomplete-mode-hook
+ #'vcomplete-embark--advise-commands)
+
+;; In case `vcomplete-mode' is enabled already.
+(vcomplete-embark--advise-commands)
+
+(defun vcomplete-embark-current-completion (&optional relative)
+ "Call `embark-target-completion-at-point' in the `*Completions*' buffer.
+If the completions are file names and RELATIVE is non-nil, return
+relative path."
+ (when (and vcomplete-mode
+ (or (minibufferp) completion-in-region-mode))
+ (vcomplete-with-completions-buffer
+ (embark-target-completion-at-point relative))))
+
+(defun vcomplete-embark-collect-candidates ()
+ "Call `embark-completions-buffer-candidates' in the `*Completions*' buffer.
+If the completions are file names and RELATIVE is non-nil, return
+relative path."
+ (when (and vcomplete-mode
+ (or (minibufferp) completion-in-region-mode))
+ (vcomplete-with-completions-buffer
+ (embark-completions-buffer-candidates))))
+
+(add-hook 'embark-target-finders
+ #'vcomplete-embark-current-completion)
+(add-hook 'embark-candidate-collectors
+ #'vcomplete-embark-collect-candidates)
+
+(provide 'vcomplete-embark)
+
+;;; vcomplete-embark.el ends here
diff --git a/vcomplete.el b/vcomplete.el
index eb0e214d2d..aa22422efc 100644
--- a/vcomplete.el
+++ b/vcomplete.el
@@ -285,49 +285,6 @@ completion:
(remove-hook 'minibuffer-exit-hook #'vcomplete--reset-vars)
(remove-hook 'completion-in-region-mode-hook
#'vcomplete--setup-in-region)))
-;;;; Embark integration:
-
-;; Note: this integration is not tested regularly as I don't
-;; use Embark currently.
-
-(declare-function embark-target-completion-at-point "ext:embark")
-(declare-function embark-completions-buffer-candidates "ext:embark")
-
-(defun vcomplete-embark--eliminate-delay (fun &rest args)
- "Call FUN with `minibuffer-message-timeout' locally set to `0'."
- (let ((minibuffer-message-timeout 0))
- (apply fun args)))
-
-(defun vcomplete-embark--advise-commands ()
- "Advise Embark commands with `vcomplete-embark--eliminate-delay'."
- (dolist (cmd '(embark-act embark-default-action))
- (if vcomplete-mode
- (advice-add cmd :around #'vcomplete-embark--eliminate-delay)
- (advice-remove cmd #'vcomplete-embark--eliminate-delay))))
-
-(defun vcomplete-embark-current-completion (&optional relative)
- "Call `embark-target-completion-at-point' in the `*Completions*' buffer."
- (when (and vcomplete-mode
- (or (minibufferp) completion-in-region-mode))
- (vcomplete-with-completions-buffer
- (embark-target-completion-at-point relative))))
-
-(defun vcomplete-embark-collect-candidates ()
- "Call `embark-completions-buffer-candidates' in the `*Completions*' buffer."
- (when (and vcomplete-mode
- (or (minibufferp) completion-in-region-mode))
- (vcomplete-with-completions-buffer
- (embark-completions-buffer-candidates))))
-
-(with-eval-after-load 'embark
- (vcomplete-embark--advise-commands)
- (add-hook 'vcomplete-mode-hook
- #'vcomplete-embark--advise-commands)
- (add-hook 'embark-target-finders
- #'vcomplete-embark-current-completion)
- (add-hook 'embark-candidate-collectors
- #'vcomplete-embark-collect-candidates))
-
(provide 'vcomplete)
;;; vcomplete.el ends here
- [nongnu] elpa/vcomplete 45adfdd13e 55/91: ; Document last commit in the NEWS file, (continued)
- [nongnu] elpa/vcomplete 45adfdd13e 55/91: ; Document last commit in the NEWS file, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete a64c37e780 89/91: ; Generate 'vcomplete-pkg.el' automatically, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 7cd781f7f3 59/91: ; Documentation improvements, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 60b5a005bf 22/91: ; Add last few changes to NEWS file, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 5e055dc556 30/91: Fix cases where 'completion-in-region-mode' is used in the minibuffer, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 21edba4beb 01/91: Initial commit, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete faca6e8c18 32/91: ; Change all instances of "‘" and "’" to "`" and "'" respectively, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete db010f4f61 34/91: Mark variables as risky local variables, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 5fefec3e91 40/91: Fix broken highlighting in completion list buffers when completing in-region, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 6136a3ba16 42/91: ; Update NEWS file, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 8ade381c7c 44/91: Move Embark integration to a separate file,
ELPA Syncer <=
- [nongnu] elpa/vcomplete b8402112ba 60/91: ; Remove unnecessary declaration, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete b30cedbf26 65/91: ; Fix small style issue in info file, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 8450b1befd 91/91: ; Bump to version 1.2.1, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 4019e76a3d 78/91: New internal function for getting the '*Completions*' window, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 3ac64b6241 87/91: ; Fix info node hyperlink in the commentary of vcomplete.el, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 6dbdbf1a4b 82/91: ; Add build manifest, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 739fee1af0 21/91: Cleanup automatic update code, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 56a95cc1df 24/91: ; Fix indentation, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete 0170c083a3 26/91: Eliminate delay after Embark action from minibuffer when auto updates are on, ELPA Syncer, 2022/05/24
- [nongnu] elpa/vcomplete b658642c23 12/91: * vcomplete.el (vcomplete-auto-help): Reset vars when setting, ELPA Syncer, 2022/05/24