]> code.delx.au - gnu-emacs-elpa/commitdiff
multishell - Change "multishell:" to "multishell-", and use on all funcs.
authorKen Manheimer <ken.manheimer@gmail.com>
Mon, 4 Jan 2016 16:34:44 +0000 (11:34 -0500)
committerKen Manheimer <ken.manheimer@gmail.com>
Mon, 4 Jan 2016 16:34:44 +0000 (11:34 -0500)
For ELPA conformance.

multishell.el

index b9804207dbb7d9472a84bc782eb62772daba9860..c8d46cae723d521afba12f119f4780ebbaa49290 100644 (file)
@@ -11,7 +11,7 @@
 ;;; Commentary:
 ;;
 ;; Easily use and manage multiple shell buffers, including remote shells.
-;; Fundamentally, multishell is the function `multishell:pop-to-shell - like
+;; Fundamentally, multishell is the function `multishell-pop-to-shell - like
 ;; pop-to-buffer - plus a keybinding. Together, they enable you to:
 ;;
 ;; * Get to the input point from wherever you are in a shell buffer,
 ;; Customize-group `multishell` to select and activate a keybinding and set
 ;; various behaviors.
 ;;
-;; See the pop-to-shell docstring for details.
+;; See the multishell-pop-to-shell docstring for details.
 ;;
 ;;; Change Log:
 ;;
-;; 2016-01-02 Ken Manheimer - working on this in public.
+;; 2016-01-02 Ken Manheimer - working on this in public, but not yet released.
 ;;
 ;;; TODO:
 ;;
@@ -65,84 +65,88 @@ Customize `allout-widgets-auto-activation' to activate allout-widgets
 with allout-mode."
   :group 'shell)
 
-(defcustom multishell:non-interactive-process-buffers
+(defcustom multishell-non-interactive-process-buffers
   '("*compilation*" "*grep*")
   "Names of buffers that have processes but are not for interaction.
-Add names of buffers that you don't want pop-to-shell to stick around in."
+Identify which buffers you don't want to be multishell-pop-to-shell \"sticky\"."
   :type '(repeat string)
   :group 'multishell)
-(defcustom multishell:command-key "\M- "
-  "The key to use if `multishell:activate-command-key' is true.
+(defcustom multishell-command-key "\M- "
+  "The key to use if `multishell-activate-command-key' is true.
 
-You can instead bind `pop-to-shell` to your preferred key using emacs
-lisp, eg: (global-set-key \"\\M- \" '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
   :group 'multishell)
 
-(defvar multishell:responsible-for-command-key nil
+(defvar multishell--responsible-for-command-key nil
   "Multishell internal.")
-(defun multishell:activate-command-key-setter (symbol setting)
-  "Implement `multishell:activate-command-key' choice."
-  (set-default 'multishell:activate-command-key setting)
-  (when (or setting multishell:responsible-for-command-key)
-    (multishell:implement-command-key-choice (not setting))))
-(defun multishell:implement-command-key-choice (&optional unbind)
+(defun multishell-activate-command-key-setter (symbol setting)
+  "Implement `multishell-activate-command-key' choice."
+  (set-default 'multishell-activate-command-key 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.
 
 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."
+* `multishell-activate-command-key' - Set this to get the binding or not.
+* `multishell-command-key' - The key to use for the binding, if appropriate."
   (cond (unbind
-         (when (and (boundp 'multishell:command-key) multishell:command-key)
-           (global-unset-key multishell:command-key)))
-        ((not (and (boundp 'multishell:activate-command-key)
-                   (boundp 'multishell:command-key)))
+         (when (and (boundp 'multishell-command-key) multishell-command-key)
+           (global-unset-key multishell-command-key)))
+        ((not (and (boundp 'multishell-activate-command-key)
+                   (boundp 'multishell-command-key)))
          nil)
-        ((and multishell:activate-command-key multishell:command-key)
-         (setq multishell:responsible-for-command-key t)
-         (global-set-key multishell:command-key 'pop-to-shell))))
+        ((and multishell-activate-command-key multishell-command-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.
+(defcustom multishell-activate-command-key nil
+  "Set this to impose the `multishell-command-key' binding.
 
-You can instead bind `pop-to-shell` to your preferred key using emacs
-lisp, eg: (global-set-key \"\\M- \" '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 'boolean
-  :set 'multishell:activate-command-key-setter
+  :set 'multishell-activate-command-key-setter
   :group 'multishell)
 
 ;; Assert the customizations whenever the package is loaded:
 (with-eval-after-load "multishell"
-  (multishell:implement-command-key-choice))
+  (multishell-implement-command-key-choice))
 
-(defcustom multishell:pop-to-frame nil
+(defcustom multishell-pop-to-frame nil
   "*If non-nil, jump to a frame already showing the shell, if another is.
 
-Otherwise, open a new window in the current frame.
+Otherwise, disregard already-open windows on the shell if they're
+in another frame, and open a new window on the shell in the
+current frame.
 
-\(Adjust `pop-up-windows' to change other-buffer vs current-buffer behavior.)"
+\(Use `pop-up-windows' to change multishell other-buffer vs
+current-buffer behavior.)"
   :type 'boolean
   :group 'multishell)
 
-;; (defcustom multishell:persist-shell-names nil
+;; (defcustom multishell-persist-shell-names nil
 ;;   "Remember shell name/path associations across sessions. Note well:
 ;; This will activate minibuffer history persistence, in general, if it's not
 ;; already active."
 ;;   :type 'boolean
 ;;  :group 'shell)
 
-(defvar multishell:name-path-assoc nil
+(defvar multishell-name-path-assoc nil
   "Assoc list from name to path")
 
-(defvar multishell:primary-name "*shell*"
-  "Shell name to use for un-modified pop-to-shell buffer target.")
-(defvar multishell:buffer-name-history nil
-  "Distinct pop-to-shell completion history container.")
-(defvar multishell:buffer-name-path-history nil
-  "Another pop-to-shell completion history container, including paths.")
+(defvar multishell-primary-name "*shell*"
+  "Shell name to use for un-modified multishell-pop-to-shell buffer target.")
+(defvar multishell-buffer-name-history nil
+  "Distinct multishell-pop-to-shell completion history container.")
+(defvar multishell-buffer-name-path-history nil
+  "Another multishell-pop-to-shell completion history container,
+including paths.")
 
-(defun pop-to-shell (&optional arg)
+(defun multishell-pop-to-shell (&optional arg)
   "Easily navigate to and within multiple shell buffers, local and remote.
 
 Use universal arguments to launch and choose between alternate
@@ -221,7 +225,7 @@ For example:
 ;; shell buffer names and paths across emacs sessions. To do so,
 ;; customize the `savehist' group, and:
 
-;; 1. Add `multishell:pop-to-shell-buffer-name-history' to Savehist Additional
+;; 1. Add `multishell-pop-to-shell-buffer-name-history' to Savehist Additional
 ;;    Variables.
 ;; 2. Activate Savehist Mode, if not already activated.
 ;; 3. Save.
@@ -232,16 +236,16 @@ For example:
          (from-buffer-is-shell (eq major-mode 'shell-mode))
          (doublearg (equal arg '(16)))
          (target-name-and-path
-          (multishell:derive-target-name-and-path
+          (multishell-derive-target-name-and-path
            (if arg
-               (multishell:read-bare-shell-buffer-name
+               (multishell-read-bare-shell-buffer-name
                 (format "Shell buffer name [%s]%s "
                         (substring-no-properties
-                         multishell:primary-name
-                         1 (- (length multishell:primary-name) 1))
+                         multishell-primary-name
+                         1 (- (length multishell-primary-name) 1))
                         (if doublearg " <==" ":"))
-                multishell:primary-name)
-             multishell:primary-name)))
+                multishell-primary-name)
+             multishell-primary-name)))
          (use-default-dir (cadr target-name-and-path))
          (target-shell-buffer-name (car target-name-and-path))
          (curr-buff-proc (get-buffer-process from-buffer))
@@ -254,7 +258,7 @@ For example:
          already-there)
 
     (when doublearg
-      (setq multishell:primary-name target-shell-buffer-name))
+      (setq multishell-primary-name target-shell-buffer-name))
 
     ;; Situate:
 
@@ -273,12 +277,12 @@ For example:
 
      ((or (not target-buffer)
           (not (setq inwin
-                     (multishell:get-visible-window-for-buffer target-buffer))))
+                     (multishell-get-visible-window-for-buffer target-buffer))))
       ;; No preexisting shell buffer, or not in a visible window:
       (pop-to-buffer target-shell-buffer-name pop-up-windows))
 
        ;; Buffer exists and already has a window - jump to it:
-     (t (if (and multishell:pop-to-frame
+     (t (if (and multishell-pop-to-frame
                  inwin
                  (not (equal (window-frame (selected-window))
                              (window-frame inwin))))
@@ -290,7 +294,7 @@ For example:
     ;; We're in the buffer. Activate:
 
     (cond ((not (comint-check-proc (current-buffer)))
-           (multishell:start-shell-in-buffer (buffer-name (current-buffer))
+           (multishell-start-shell-in-buffer (buffer-name (current-buffer))
                                              use-default-dir))
           (use-default-dir
            (cd use-default-dir)))
@@ -305,7 +309,7 @@ For example:
       (and (get-buffer-process from-buffer)
            (goto-char (process-mark (get-buffer-process from-buffer)))))))
 
-(defun multishell:get-visible-window-for-buffer (buffer)
+(defun multishell-get-visible-window-for-buffer (buffer)
   "Return visible window containing buffer."
   (catch 'got-a-vis
     (walk-windows
@@ -319,7 +323,7 @@ For example:
      nil 'visible)
     nil))
 
-(defun multishell:read-bare-shell-buffer-name (prompt default)
+(defun multishell-read-bare-shell-buffer-name (prompt default)
   "PROMPT for shell buffer name, sans asterisks.
 
 Return the supplied name bracketed with the asterisks, or specified DEFAULT
@@ -342,10 +346,10 @@ on empty input."
                                nil        ; PREDICATE
                                'confirm   ; REQUIRE-MATCH
                                nil        ; INITIAL-INPUT
-                               'multishell:buffer-name-history ; HIST
+                               'multishell-buffer-name-history ; HIST
                                )))
-    (if (not (string= got "")) (multishell:bracket-asterisks got) default)))
-(defun multishell:derive-target-name-and-path (path-ish)
+    (if (not (string= got "")) (multishell-bracket-asterisks got) default)))
+(defun multishell-derive-target-name-and-path (path-ish)
   "Give tramp-style PATH-ISH, determine target name and default directory.
 
 The name is the part of the string before the initial '/' slash,
@@ -355,7 +359,7 @@ besides the string before the initial '/' slash.
 
 Return them as a list (name dir), with dir nil if none given."
   (let (name (path "") dir)
-    (cond ((string= path-ish "") (setq dir multishell:primary-name))
+    (cond ((string= path-ish "") (setq dir multishell-primary-name))
           ((string-match "^\\*\\([^/]*\\)\\(/.*/\\)\\(.*\\)\\*" path-ish)
            ;; We have a path, use it
            (let ((overt-name (match-string 1 path-ish))
@@ -366,7 +370,7 @@ Return them as a list (name dir), with dir nil if none given."
              (if (string= trailing-name "") (setq trailing-name nil))
              (setq path (concat overt-path trailing-name))
              (setq name
-                   (multishell:bracket-asterisks
+                   (multishell-bracket-asterisks
                     (or overt-name
                         (if (tramp-file-name-p path)
                             (let ((vec (tramp-dissect-file-name path)))
@@ -375,19 +379,19 @@ Return them as a list (name dir), with dir nil if none given."
                                   (tramp-file-name-localname vec)
                                   trailing-name
                                   system-name))
-                          (multishell:unbracket-asterisks
-                           multishell:primary-name)))))))
-          (t (setq name (multishell:bracket-asterisks path-ish))))
+                          (multishell-unbracket-asterisks
+                           multishell-primary-name)))))))
+          (t (setq name (multishell-bracket-asterisks path-ish))))
     (list name path)))
 
-(defun multishell:bracket-asterisks (name)
+(defun multishell-bracket-asterisks (name)
   "Return a copy of name, ensuring it has an asterisk at the beginning and end."
   (if (not (string= (substring name 0 1) "*"))
       (setq name (concat "*" name)))
   (if (not (string= (substring name -1) "*"))
       (setq name (concat name "*")))
   name)
-(defun multishell:unbracket-asterisks (name)
+(defun multishell-unbracket-asterisks (name)
   "Return a copy of name, removing asterisks, if any, at beginning and end."
   (if (string= (substring name 0 1) "*")
       (setq name (substring name 1)))
@@ -395,7 +399,7 @@ Return them as a list (name dir), with dir nil if none given."
       (setq name (substring name 0 -1)))
   name)
 
-(defun multishell:start-shell-in-buffer (buffer-name dir)
+(defun multishell-start-shell-in-buffer (buffer-name dir)
   "Ensure a shell is started, using whatever name we're passed."
   ;; We work around shell-mode's bracketing of the buffer name, and do
   ;; some tramp-mode hygiene for remote connections.
@@ -420,7 +424,7 @@ Return them as a list (name dir), with dir nil if none given."
     (if dir
         (cd dir))
     (setq buffer (set-buffer (apply 'make-comint
-                                    (multishell:unbracket-asterisks buffer-name)
+                                    (multishell-unbracket-asterisks buffer-name)
                                     prog
                                     (if (file-exists-p startfile)
                                         startfile)