[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-hydra 721a3b7 371/395: Make ivy-mode more careful w
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy-hydra 721a3b7 371/395: Make ivy-mode more careful when setting globals |
Date: |
Thu, 25 Feb 2021 08:32:41 -0500 (EST) |
branch: externals/ivy-hydra
commit 721a3b7980897b6a8ade7b91a2daceefd3e04f8d
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>
Make ivy-mode more careful when setting globals
* ivy.el (ivy--old-crf, ivy--old-cirf): New variables.
(ivy-mode): Modify completing-read-function and
completion-in-region-function only if they contain the expected
value beforehand. Remember their previous value when enabling the
mode so that it can conditionally be restored when disabling.
Re: #2765.
---
ivy.el | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/ivy.el b/ivy.el
index 72e6d8e..00b120d 100644
--- a/ivy.el
+++ b/ivy.el
@@ -2627,6 +2627,12 @@ See `ivy-set-prompt'."
"When non-nil `ivy-mode' will set `completion-in-region-function'."
:type 'boolean)
+(defvar ivy--old-crf nil
+ "Store previous value of `completing-read-function'.")
+
+(defvar ivy--old-cirf nil
+ "Store previous value of `completion-in-region-function'.")
+
;;;###autoload
(define-minor-mode ivy-mode
"Toggle Ivy mode on or off.
@@ -2645,11 +2651,21 @@ Minibuffer bindings:
:lighter " ivy"
(if ivy-mode
(progn
- (setq completing-read-function 'ivy-completing-read)
+ (unless (eq completing-read-function #'ivy-completing-read)
+ (setq ivy--old-crf completing-read-function)
+ (setq completing-read-function #'ivy-completing-read))
(when ivy-do-completion-in-region
- (setq completion-in-region-function 'ivy-completion-in-region)))
- (setq completing-read-function 'completing-read-default)
- (setq completion-in-region-function 'completion--in-region)))
+ (unless (eq completion-in-region-function #'ivy-completion-in-region)
+ (setq ivy--old-cirf completion-in-region-function)
+ (setq completion-in-region-function #'ivy-completion-in-region))))
+ (when (eq completing-read-function #'ivy-completing-read)
+ (setq completing-read-function (or ivy--old-crf
+ #'completing-read-default))
+ (setq ivy--old-crf nil))
+ (when (eq completion-in-region-function #'ivy-completion-in-region)
+ (setq completion-in-region-function (or ivy--old-cirf
+ #'completion--in-region))
+ (setq ivy--old-cirf nil))))
(defun ivy--preselect-index (preselect candidates)
"Return the index of PRESELECT in CANDIDATES."
- [elpa] externals/ivy-hydra 7b9391f 320/395: ivy-avy.el: Fix typo, (continued)
- [elpa] externals/ivy-hydra 7b9391f 320/395: ivy-avy.el: Fix typo, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 6bfada5 359/395: ivy.el: Use ivy--completing-fname-p more, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 7e4c567 350/395: Makefile: Make plain.el load counsel instead of here, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 5db2513 341/395: Recognize remote executables in Emacs >= 27.1., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 92c91ca 342/395: counsel.el (counsel-org-capture): Display descriptions from prefix keys, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra accc0fe 339/395: counsel.el (counsel-compile--probe-make-targets): fail more gracefully, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 215bb22 348/395: ivy.el (ivy-configure): Only change a value if it was not modified by the user, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 4894b65 329/395: ivy-avy.el: Don't overwrite existing ivy-minibuffer-map binding, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 8783d92 321/395: ivy.el: Remove most minibuffer-only commands from the counsel-M-x list, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 40634b7 349/395: ivy.el (ivy--alist-set): Don't touch values set by customize, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 721a3b7 371/395: Make ivy-mode more careful when setting globals,
Basil L. Contovounesios <=
- [elpa] externals/ivy-hydra 5de2662 372/395: counsel.el (counsel-linux-app): Clean up env part of the cmd, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d2891aa 376/395: Percent-encode counsel-search query, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra f90c018 389/395: counsel.el (counsel-grep-like-occur): Use ivy-text as backup, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 3c53de1 390/395: * .elpaignore: New file., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 496a5e2 105/395: counsel.el: Fix ivy-occur ivy--regex-function bug, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 6b4f43a 111/395: ivy.el (ivy--update-minibuffer): Return string, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 0ce0bf1 123/395: counsel.el (counsel-evil-marks): Add, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra e05bc45 108/395: ivy.el (ivy--recompute-index): Take one less argument, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 723e4d6 126/395: counsel.el: Point to evil-common for evil-global-marker-p declaration., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 04e7942 130/395: counsel-kmacro: Small improvements to functions and documentation strings., Basil L. Contovounesios, 2021/02/25