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

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

[elpa] externals/multishell 7343133f3f 2/3: Autoload customizations so t


From: ken manheimer
Subject: [elpa] externals/multishell 7343133f3f 2/3: Autoload customizations so the customized keybinding loads the package.
Date: Sun, 5 Jun 2022 11:50:10 -0400 (EDT)

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

    Autoload customizations so the customized keybinding loads the package.
    
    An explanation of the technique (included in the code):
    
    ;; For the package load to be triggered by a user's customized
    ;; multishell-command-key we have to autoload the customizations. That
    ;; requires a workaround like that described here, which I use:
    ;; 
https://stackoverflow.com/questions/32693757/emacs-package-customization-and-autoloads
---
 multishell.el | 72 ++++++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 44 insertions(+), 28 deletions(-)

diff --git a/multishell.el b/multishell.el
index 49c4fbea22..626d0d4f78 100644
--- a/multishell.el
+++ b/multishell.el
@@ -191,40 +191,54 @@
           (message "%s" msg)
         msg))))
 
-(defgroup multishell nil
-  "Allout extension that highlights outline structure graphically.
+
+;;;###autoload
+(unless (fboundp 'multishell-pop-to-shell)
+  (defgroup multishell nil
+    "Allout extension that highlights outline structure graphically.
 
 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)))
+    :group 'shell))
+
+;;;###autoload
+(unless (fboundp 'multishell-pop-to-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-space]
-  "Key to bind to `multishell-pop-to-shell`.
+
+;; For the package load to be triggered by a user's customized
+;; multishell-command-key we have to autoload the customizations. That
+;; requires a workaround like that described here, which I use:
+;; 
https://stackoverflow.com/questions/32693757/emacs-package-customization-and-autoloads
+;;;###autoload
+(unless (fboundp 'multishell-pop-to-shell)
+  (defcustom multishell-command-key [M-space]
+    "Key to bind to `multishell-pop-to-shell`.
 
 If you select None then the prior binding is removed.
 
 \(In some windowing environments `M- ` (Meta-space) doesn't
 work. A possibly appealing alternative is `M-<return>`.)"
-  :set #'multishell-command-key-setter
-  :type '(choice
-          (const :tag "None" nil)
-          (key-sequence :tag "Key sequence")))
+    :set #'multishell-command-key-setter
+    :type '(choice
+            (const :tag "None" nil)
+            (key-sequence :tag "Key sequence"))))
 
-(defcustom multishell-pop-to-frame nil
-  "*If non-nil, jump to a frame already showing the shell, if another one is.
+;;;###autoload
+(unless (fboundp 'multishell-pop-to-shell)
+  (defcustom multishell-pop-to-frame nil
+    "*If non-nil, jump to a frame already showing the shell, if another one is.
 
 Otherwise, disregard already-open windows on the shell if they're
 in another frame, and open a new window on the shell in the
@@ -232,17 +246,19 @@ current frame.
 
 \(Use `pop-up-windows' to change multishell other-window vs
 current-window behavior.)"
-  :type 'boolean)
+    :type 'boolean))
 
-(defcustom multishell-history-entry-tracks-current-directory t
-  "Maintain shell's current directory in its multishell history entry.
+;;;###autoload
+(unless (fboundp 'multishell-pop-to-shell)
+  (defcustom multishell-history-entry-tracks-current-directory t
+    "Maintain shell's current directory in its multishell history entry.
 
 When set, the history entry for shells started with explicit
 paths will track the shell's current working directory.
 
 If `savehist-save-minibuffer-history' is enabled, the current
 working directory of shells will be conveyed between Emacs sessions."
- :type 'boolean)
+    :type 'boolean))
 
 (defvar multishell-history nil
   "Name/path entries, most recent first.")



reply via email to

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