emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/multishell bf8285b 1/2: Make multishell command-key cus


From: Stefan Monnier
Subject: [elpa] externals/multishell bf8285b 1/2: Make multishell command-key customization work.
Date: Wed, 4 Aug 2021 18:28:48 -0400 (EDT)

branch: externals/multishell
commit bf8285ba07ae6d1939c91a2db3eae438044540b7
Author: Ken Manheimer <ken.manheimer@gmail.com>
Commit: Ken Manheimer <ken.manheimer@gmail.com>

    Make multishell command-key customization work.
    
    We're deprecating the complicated mess that wasn't working. That
    deprecation is partial, because I don't see how to deprecate defcustom
    entries in a way that keeps them from being show in the customization
    buffer, sigh.
---
 multishell.el | 61 ++++++++++++++++++++++++++++++++++++++++-------------------
 1 file changed, 42 insertions(+), 19 deletions(-)

diff --git a/multishell.el b/multishell.el
index 6d93485..133a1bf 100644
--- a/multishell.el
+++ b/multishell.el
@@ -60,6 +60,8 @@
 ;;
 ;; Change Log:
 ;;
+;; * 2021-08-02 1.1.10 Ken Manheimer:
+;;   - Get basic multishell command-key customization working.
 ;; * 2020-10-30 1.1.9 Ken Manheimer:
 ;;   - Require cl-lib when compiling for cl-letf macro.
 ;; * 2020-10-28 1.1.8 Ken Manheimer:
@@ -174,7 +176,7 @@
 (require 'savehist)
 (eval-when-compile (require 'cl-lib))
 
-(defvar multishell-version "1.1.9")
+(defvar multishell-version "1.1.10")
 (defun multishell-version (&optional here)
   "Return string describing the loaded multishell version."
   (interactive "P")
@@ -191,20 +193,39 @@ Customize `allout-widgets-auto-activation' to activate 
allout-widgets
 with allout-mode."
   :group 'shell)
 
+(defun multishell-command-key-setter (symbol value)
+  "Establish key binding, or do nothing if none selected."
+  symbol
+  (cond (value
+         (setq multishell-command-key value)
+         (global-set-key multishell-command-key 'multishell-pop-to-shell))
+        ((and multishell-command-key
+              (equal (lookup-key (current-global-map)
+                                 multishell-command-key)
+                     'multishell-pop-to-shell))
+         (global-unset-key multishell-command-key)
+         (setq multishell-command-key nil)))
+ )
 (defcustom multishell-command-key "\M- "
-  "The key to use if `multishell-activate-command-key' is true.
+  "Key to bind to `multishell-pop-to-shell`.
 
-You can instead manually bind `multishell-pop-to-shell' using emacs
-lisp, eg: (global-set-key \"\\M- \" \\='multishell-pop-to-shell)."
-  :type 'key-sequence)
+Choose nil to not establish a key binding, and remove the prior binding
+if there was one."
+  :set #'multishell-command-key-setter
+  :type '(choice (const nil)
+                 (key-sequence)))
 
 (defvar multishell--responsible-for-command-key nil
   "Coordination for multishell key assignment.")
+(make-obsolete 'multishell--responsible-for-command-key nil "1.1.10")
+
 (defun multishell-activate-command-key-setter (symbol setting)
   "Implement `multishell-activate-command-key' choice."
+  (declare (obsolete 'multishell-activate-command-key-setter "1.1.10"))
   (set-default symbol setting)
   (when (or setting multishell--responsible-for-command-key)
     (multishell-implement-command-key-choice (not setting))))
+
 (defun multishell-implement-command-key-choice (&optional unbind)
   "If settings dicate, implement binding of multishell command key.
 
@@ -212,6 +233,7 @@ If optional UNBIND is true, globally unbind the key.
 
 * `multishell-activate-command-key' - Set this to get the binding or not.
 * `multishell-command-key' - The key to use for the binding, if appropriate."
+  (declare (obsolete 'multishell-implement-command-key-choice "1.1.10"))
   (when (bound-and-true-p multishell-command-key)
     (if unbind
         (global-unset-key multishell-command-key)
@@ -219,20 +241,21 @@ If optional UNBIND is true, globally unbind the key.
         (setq multishell--responsible-for-command-key t)
         (global-set-key multishell-command-key 'multishell-pop-to-shell)))))
 
-(defcustom multishell-activate-command-key nil
-  "Set this to impose the `multishell-command-key' binding.
-
-You can instead manually bind `multishell-pop-to-shell' using emacs
-lisp, eg: (global-set-key \"\\M- \" \\='multishell-pop-to-shell)."
-  :type 'boolean
-  :set #'multishell-activate-command-key-setter)
-
-;; Implement the key customization whenever the package is loaded:
-(if (fboundp 'with-eval-after-load)
-    (with-eval-after-load "multishell"
-      (multishell-implement-command-key-choice))
-  (eval-after-load "multishell"
-    '(multishell-implement-command-key-choice)))
+;; (defcustom multishell-activate-command-key nil
+;;   "Set this to impose the `multishell-command-key' binding.
+
+;; You can instead manually bind `multishell-pop-to-shell' using emacs
+;; lisp, eg: (global-set-key \"\\M- \" \\='multishell-pop-to-shell)."
+;;   :type 'boolean
+;;   :set #'multishell-activate-command-key-setter)
+(make-obsolete 'multishell--responsible-for-command-key nil "1.1.10")
+
+;; ;; Implement the key customization whenever the package is loaded:
+;; (if (fboundp 'with-eval-after-load)
+;;     (with-eval-after-load "multishell"
+;;       (multishell-implement-command-key-choice))
+;;   (eval-after-load "multishell"
+;;     '(multishell-implement-command-key-choice)))
 
 (defcustom multishell-pop-to-frame nil
   "*If non-nil, jump to a frame already showing the shell, if another one is.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]