branch: externals/hyperbole
commit 42487cb95661ec6de3ad73111ed6cbd11aa608cc
Author: Bob Weiner <[email protected]>
Commit: Bob Weiner <[email protected]>
Temporarily disable helm-mode when executing a key series
---
Changes | 3 ++-
hib-kbd.el | 30 ++++++++++++++++--------------
hsys-org.el | 12 ++++++------
3 files changed, 24 insertions(+), 21 deletions(-)
diff --git a/Changes b/Changes
index 2aef647..a09de9f 100644
--- a/Changes
+++ b/Changes
@@ -1,7 +1,8 @@
2020-07-25 Bob Weiner <[email protected]>
* hib-kbd.el (kbd-key:execute-special-series): Added and used in kbd-key:act
- to make key series work properly when helm-mode or counsel-mode are
enabled.
+ to make key series work properly when helm-mode is enabled. Counsel-mode
+ works without any change.
2020-07-23 Bob Weiner <[email protected]>
diff --git a/hib-kbd.el b/hib-kbd.el
index 074d5f8..4545a90 100644
--- a/hib-kbd.el
+++ b/hib-kbd.el
@@ -129,30 +129,32 @@ Returns t if KEY-SERIES has a binding, else nil."
(defun kbd-key:execute-special-series (key-series)
"Execute key series."
- (if (eq (key-binding [?\M-x]) #'execute-extended-command)
+ (if (memq (key-binding [?\M-x]) #'(execute-extended-command counsel-M-x))
(kbd-key:key-series-to-events key-series)
- ;; Disable helm or counsel while processing M-x commands; helm at
- ;; least gobbles final RET key,
+ ;; Disable helm while processing M-x commands; helm
+ ;; gobbles final RET key. Counsel works without modification.
(let ((orig-binding (global-key-binding [?\M-x]))
- (counsel-flag (and (boundp 'counsel-mode) counsel-mode))
(helm-flag (and (boundp 'helm-mode) helm-mode)))
(unwind-protect
(progn
- (when counsel-flag (counsel-mode -1))
- (when helm-flag (helm-mode -1))
+ (when helm-flag (helm-mode -1))
(global-set-key [?\M-x] 'execute-extended-command)
- (kbd-key:key-series-to-events key-series)
- (sit-for 0.001))
- (when counsel-flag (counsel-mode 1))
- (when helm-flag (helm-mode 1))
- (global-set-key [?\M-x] orig-binding)))))
+ (kbd-key:key-series-to-events key-series))
+ (kbd-key:key-series-to-events
+ (format "M-: SPC (kbd-key:maybe-enable-helm SPC %s SPC #'%S) RET"
+ helm-flag orig-binding))))))
+
+(defun kbd-key:maybe-enable-helm (helm-flag orig-M-x-binding)
+ "Enable helm-mode if HELM-FLAG is non-nil. Restore M-x binding to
ORIG-M-X-BINDING."
+ (when helm-flag (helm-mode 1))
+ (global-set-key [?\M-x] orig-M-x-binding))
(defun kbd-key:key-series-to-events (key-series)
- "Insert the key-series as a series of keyboard events into Emacs' unread
input stream."
+ "Insert the key-series as a series of keyboard events into Emacs' unread
input stream.
+Emacs then executes them when its command-loop regains control."
(setq unread-command-events (nconc unread-command-events
(listify-key-sequence
- (kbd-key:kbd
- key-series)))))
+ (kbd-key:kbd key-series)))))
(defun kbd-key:doc (key-series &optional full)
"Show first line of doc for binding of keyboard KEY-SERIES in minibuffer.
diff --git a/hsys-org.el b/hsys-org.el
index 3094cb7..89ae575 100644
--- a/hsys-org.el
+++ b/hsys-org.el
@@ -4,7 +4,7 @@
;;
;; Orig-Date: 2-Jul-16 at 14:54:14
;;
-;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2020 Free Software Foundation, Inc.
;; See the "HY-COPY" file for license information.
;;
;; This file is part of GNU Hyperbole.
@@ -15,11 +15,11 @@
;; triggered when the major mode is org-mode or is derived from
;; org-mode and point is anywhere other than at the end of a line.
;;
-;; When:
-;; on an Org mode link - displays the link referent
-;; on an Org mode heading - cycles through the available display
-;; views for that heading
-;; anywhere else - executes `org-meta-return'.
+;; See the doc for ibtypes::org-mode for details of what it does and
+;; its compatibility with org-mode.
+;;
+;; For a good tutorial on basic use of Org-mode, see:
+;; https://orgmode.org/worg/org-tutorials/orgtutorial_dto.html
;;; Code:
;;; ************************************************************************