[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/objed be54bfa 155/166: Simplify optional dependency loa
From: |
Clemens Radermacher |
Subject: |
[elpa] externals/objed be54bfa 155/166: Simplify optional dependency loading (fix #56) |
Date: |
Sun, 29 Dec 2019 08:21:18 -0500 (EST) |
branch: externals/objed
commit be54bfa562ce24170c1007f279a5e3cb04a0ab46
Author: Clemens Radermacher <address@hidden>
Commit: Clemens Radermacher <address@hidden>
Simplify optional dependency loading (fix #56)
---
objed.el | 61 +++++++++++++++++++++----------------------------------------
1 file changed, 21 insertions(+), 40 deletions(-)
diff --git a/objed.el b/objed.el
index 7362c2e..01185c8 100644
--- a/objed.el
+++ b/objed.el
@@ -683,9 +683,8 @@ BEFORE and AFTER are forms to execute before/after calling
the command."
;; TODO: birdview mode/scroll mode
(define-key map (kbd "C-h k") 'objed-describe-key)
- (when objed-use-which-key-if-available
- (define-key map (kbd "C-h n") 'which-key-show-next-page-cycle)
- (define-key map (kbd "C-h p") 'which-key-show-previous-page-cycle))
+ (define-key map (kbd "C-h n") 'which-key-show-next-page-cycle)
+ (define-key map (kbd "C-h p") 'which-key-show-previous-page-cycle)
(define-key map (kbd "C-M-w") 'objed-append-mode)
;; use uppercase as C-M replacement
@@ -1179,8 +1178,6 @@ search backwards."
(interactive)
(let ((msg (format "%s is undefined"
(key-description (this-single-command-keys)))))
- ;;(if (not objed--which-key-avail-p)
- ;; (objed--maybe-which-key objed-map msg t))))
(message msg)))
(defvar objed--look-around nil
@@ -1218,12 +1215,6 @@ and end postion will be used for toggle."
;; * Init active state
-(defvar objed--which-key-avail-p nil
- "Whether `which-key' package is available.")
-
-(defvar objed--avy-avail-p nil
- "Whether `avy' package is available.")
-
(defvar objed--saved-vars nil
"Variables to save and restore.")
@@ -1572,9 +1563,8 @@ Waits `which-key-idle-delay' before displaying the popup
unless
NOWAIT is non-nil. IREGEX is a regular expressions of bindings to
ignore in `which-key' popup. Any binding whose description
matches IREGEX is not displayed."
- (when (and objed--which-key-avail-p
- ;; let the user deactivate later as well...
- objed-use-which-key-if-available
+ (when (and objed-use-which-key-if-available
+ (require 'which-key nil t)
(bound-and-true-p which-key-mode)
(or nowait (sit-for which-key-idle-delay)))
(prog1 t
@@ -2420,22 +2410,22 @@ OBJ defaults to current object. BEG and END limit the
region
which should be searched for candidates and default to
`window-start' and `window-end.'"
(interactive)
- (if (eq objed--object 'char)
- (progn (call-interactively #'avy-goto-char)
- (objed--update-current-object))
- (unless (and objed--avy-avail-p
- objed-use-avy-if-available)
+ (when objed-use-avy-if-available
+ (unless (require 'avy nil t)
(user-error objed--avy-err-msg))
- (let* ((avy-action #'goto-char)
- (avy-style 'at-full)
- (avy-all-windows t)
- (posns (let* ((objed--object (or obj objed--object))
- (beg (or beg (window-start)))
- (end (or end (window-end))))
- (objed--collect-object-positions
- beg end
- (when obj
- (point))))))
+ (if (eq objed--object 'char)
+ (progn (call-interactively #'avy-goto-char)
+ (objed--update-current-object))
+ (let* ((avy-action #'goto-char)
+ (avy-style 'at-full)
+ (avy-all-windows t)
+ (posns (let* ((objed--object (or obj objed--object))
+ (beg (or beg (window-start)))
+ (end (or end (window-end))))
+ (objed--collect-object-positions
+ beg end
+ (when obj
+ (point))))))
(cond (posns
(if (> (length posns) 1)
(avy--process
@@ -2445,7 +2435,7 @@ which should be searched for candidates and default to
(objed--switch-to obj)
(objed--update-current-object)))
(t
- (message "No objects found."))))))
+ (message "No objects found.")))))))
(defvar ivy-sort-function-alist)
(defun objed-occur ()
@@ -4082,22 +4072,13 @@ operations and objects can be found in `objed-map',
`objed-op-map' and `objed-object-map'.
To define your own text objects and editing operations see
-`objed-define-object' and `objed-define-op'.
-
-Activating this mode loads the optional dependencies `which-key'
-and `avy' if they are available. This can be deactivated by
-setting the user options `objed-use-which-key-if-available' and
-`objed-use-avy-if-available' before loading."
+`objed-define-object' and `objed-define-op'."
:global t
:keymap objed-mode-map
:require 'objed
(if objed-mode
(progn
(add-hook 'minibuffer-setup-hook 'objed--reset)
- (setq objed--which-key-avail-p (when objed-use-which-key-if-available
- (require 'which-key nil t))
- objed--avy-avail-p (when objed-use-avy-if-available
- (require 'avy nil t)))
(when objed-auto-init
;; interactive cmds
(objed--install-advices objed-cmd-alist t)
- [elpa] externals/objed fdea65d 151/166: Adding `objed-switch-alist` #57, (continued)
- [elpa] externals/objed fdea65d 151/166: Adding `objed-switch-alist` #57, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed c3cd6ab 150/166: Merge pull request #55 from r-darwish/patch-1, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed e079a76 152/166: Add objed-init-hook #57, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed a5684df 156/166: Add objed-switch-functions (#57), Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 18eb298 161/166: Add objed-define-local-object-keys*, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 878b5eb 154/166: Don't use obsolete var names, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 5c4ac71 159/166: Improve `objed-define-object` docstring, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed e5648b4 165/166: Ensure minibuffer commands reset even without objed-mode, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed ccc7bc7 164/166: Describe new object binding helpers, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 4a954dc 157/166: Update docstring, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed be54bfa 155/166: Simplify optional dependency loading (fix #56),
Clemens Radermacher <=
- [elpa] externals/objed 5e600c6 163/166: Version bump, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 01f0621 166/166: Version bump, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed 226fd50 149/166: Update README.asc, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed f55b4c9 160/166: Add key definition helpers for object keys, Clemens Radermacher, 2019/12/29
- [elpa] externals/objed b683880 162/166: Fix init for region object without mark, Clemens Radermacher, 2019/12/29