;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\300\303!\207" [require comint shell savehist] 2) (defvar multishell-version "1.1.9") #@78 Return string describing the loaded multishell version. (fn &optional HERE) (defalias 'multishell-version #[256 "\301P\203\n\211c\207\302\303!\203\304\305\"\207\207" [multishell-version "Multishell " called-interactively-p interactive message "%s"] 5 (#$ . 211) "P"]) (byte-code "\300\301\302\303\304\305%\210\306\307\310\311\312DD\313\314\315%\207" [custom-declare-group multishell nil "Allout extension that highlights outline structure graphically.\n\nCustomize `allout-widgets-auto-activation' to activate allout-widgets\nwith allout-mode." :group shell custom-declare-variable multishell-command-key funcall function #[0 "\300\207" [#1="\240"] 1 #1#] "The key to use if `multishell-activate-command-key' is true.\n\nYou can instead manually bind `multishell-pop-to-shell' using emacs\nlisp, eg: (global-set-key \"\\M- \" \\='multishell-pop-to-shell)." :type key-sequence] 6) #@45 Coordination for multishell key assignment. (defvar multishell--responsible-for-command-key nil (#$ . 1104)) #@74 Implement `multishell-activate-command-key' choice. (fn SYMBOL SETTING) (defalias 'multishell-activate-command-key-setter #[514 "\301\"\210\211\204 \205\302?!\207" [multishell--responsible-for-command-key set-default multishell-implement-command-key-choice] 5 (#$ . 1219)]) #@295 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. (fn &optional UNBIND) (defalias 'multishell-implement-command-key-choice #[256 "\303\300!\205\"\205\"\211\203\304!\207\303\301!\205\" \205\"\305\306\307\"\207" [multishell-command-key multishell-activate-command-key multishell--responsible-for-command-key boundp global-unset-key t global-set-key multishell-pop-to-shell] 4 (#$ . 1508)]) (byte-code "\300\301\302\303\304DD\305\306\307\310\311&\210\312\313!\203\314\315\316\"\210\202\"\314\315\317\"\210\300\320\302\303\321DD\322\306\307%\210\300\323\302\303\324DD\325\306\307%\207" [custom-declare-variable multishell-activate-command-key funcall function #[0 "\300\207" [nil] 1] "Set this to impose the `multishell-command-key' binding.\n\nYou can instead manually bind `multishell-pop-to-shell' using emacs\nlisp, eg: (global-set-key \"\\M- \" \\='multishell-pop-to-shell)." :type boolean :set multishell-activate-command-key-setter fboundp with-eval-after-load eval-after-load "multishell" #[0 "\300 \207" [multishell-implement-command-key-choice] 1] #[0 "\300 \207" [multishell-implement-command-key-choice] 1] multishell-pop-to-frame #[0 "\300\207" [nil] 1] "*If non-nil, jump to a frame already showing the shell, if another one is.\n\nOtherwise, disregard already-open windows on the shell if they're\nin another frame, and open a new window on the shell in the\ncurrent frame.\n\n(Use `pop-up-windows' to change multishell other-window vs\ncurrent-window behavior.)" multishell-history-entry-tracks-current-directory #[0 "\300\207" [t] 1] "Maintain shell's current directory in its multishell history entry.\n\nWhen set, the history entry for shells started with explicit\npaths will track the shell's current working directory.\n\nIf `savehist-save-minibuffer-history' is enabled, the current\nworking directory of shells will be conveyed between Emacs sessions."] 8) #@39 Name/path entries, most recent first. (defvar multishell-history nil (#$ . 3627)) (byte-code "\204\302\301!\203 \203 \303\303\207" [multishell-history multishell-buffer-name-history boundp nil] 2) #@380 Default shell name for un-modified multishell-pop-to-shell buffer target. This is set by `multishell-pop-to-shell' as the current default, when invoked with doubled universal argument. If you want the designated primary that you have at the end of one emacs session to be resumed at the next, customize `savehist-additional-variables' to include the `multishell-primary-name'. (defvar multishell-primary-name "*shell*" (#$ . 3840)) #@92 Internal use, conveying whether or not we're in the midst of a multishell completing-read. (defvar multishell-completing-read nil (#$ . 4280)) #@218 Add or replace entry associating NAME with PATH in `multishell-history'. If NAME already had a PATH and new PATH is empty, retain the prior one. Promote added/changed entry to the front of the list. (fn NAME PATH) (defalias 'multishell-register-name-to-path #[514 "\301!\206\302\211\203(\211@\302\230\203\303!A@\262\304\"A\266\202\202 \210PB\211\211\207" [multishell-history multishell-history-entries "" multishell-split-entry delete] 9 (#$ . 4430)]) #@184 Replace every instance of ENTRY in `multishell-history' with REVISED. Revised entry is situated where former one was. Returns non-nil iff any changes were made. (fn ENTRY REVISED) (defalias 'multishell-replace-entry #[514 "\301\235\211\262\203\240\210A\262\302\262\202\207" [multishell-history nil t] 6 (#$ . 4913)]) #@85 Return `multishell-history' entry that starts with NAME, or nil if none. (fn NAME) (defalias 'multishell-history-entries #[257 "\301\211\203\"\211@\302!\230\203\211\235\204\211B\262A\266\202\202\210\207" [multishell-history nil multishell-name-from-entry] 7 (#$ . 5252)]) #@4524 Easily navigate to and within multiple shell buffers, local and remote. Use a single `universal-argument' (\[universal-argument]) to launch and choose between nalternate shell buffers, and a doubled universal argument to also set your choice as the ongoing default. Append a path to a new shell name to launch a shell in that directory, and use Emacs tramp syntax to launch a remote shell. There is a shortcut to manage your list of current and historical shells, collectively, using `multishell-list' - see below. Customize-group `multishell' to set up a key binding and tweak behaviors. Manage your collection of current and historical shells by recursively invoking \[multishell-pop-to-shell] at the `multishell-pop-to-shell' universal argument prompts, eg: \[universal-argument] \[multishell-pop-to-shell] \[multishell-pop-to-shell] (That will be just a few keys if you do the above customization.) Hit ? in the listing buffer for editing commands. ==== Basic operation: - If the current buffer is in shell-mode then focus is moved to the process input point. (Use a universal argument go to a different shell buffer when already in a buffer that has a process - see below.) - If not in a shell buffer, go to a window that is already showing a shell buffer, if any. In this case, the cursor is not moved to the process input point. Repeating the command once you're in the buffer will then move the cursor to the process input point. We respect `pop-up-windows', so you can adjust it to set the other-buffer/same-buffer behavior. - Otherwise, start a new shell buffer, using the current directory as the working directory. If a buffer with the resulting name exists and its shell process was disconnected or otherwise stopped, it's resumed. ===== Universal arg to start and select between named shell buffers: You can assign a distinct name to new shell buffers by prefixing your \[multishell-pop-to-shell] invocation with a single or double `universal-argument', \[universal-argument]: - With a single universal argument, prompt for the buffer name to use (without the asterisks that shell mode will put around the name), defaulting to `shell'. Completion is available. This combination makes it easy to start and switch across multiple shell restarts. - A double universal argument will prompt for the name and set the default to that name, so the target shell becomes the primary. See `multishell-primary-name' for info about preserving the setting across emacs restarts. - Manage your collection of current and historical shells by recursively invoking \[multishell-pop-to-shell] at the `multishell-pop-to-shell' universal argument prompts, or at any time via \[multishell-list]. Hit ? in the listing buffer for editing commands. ===== Select starting directory and remote host: The shell buffer name you give to the prompt for a universal arg can include an appended path. That will be used for the startup directory. You can use tramp remote syntax to specify a remote shell. If there is an element after a final `/', that's used for the buffer name. Otherwise, the host, domain, or path is used. For example: * `#root/sudo:root@localhost:/etc' for a buffer named "*#root*" with a root shell starting in /etc. * `/ssh:example.net:' for a shell buffer in your homedir on example.net. The buffer will be named "*example.net*". * `#ex/ssh:example.net|sudo:root@example.net:/var/log' for a root shell starting in /var/log on example.net named "*#ex*". * `interior/ssh:gateway.corp.com|ssh:interior.corp.com:' to go via gateway.corp.com to your homedir on interior.corp.com. The buffer will be named "*interior*". You could append a sudo hop to the path, combining the previous example, and so on. File visits from the shell, and many common emacs activities like dired, will be on the host where the shell is running, in the auspices of the target account, and relative to the current directory. You can change the startup path for a shell buffer by editing it at the completion prompt. The new path will not take effect for an already-running shell. To remove a shell buffer's history entry, kill the buffer and affirm removal of the entry when prompted. ===== Activate savehist to retain shell buffer names and paths across Emacs restarts: To have emacs maintain your history of shell buffer names and paths, customize the savehist group to activate savehist. (fn &optional ARG NAME HERE) (defalias 'multishell-pop-to-shell #[768 "\300\301 \203 \302\303\"\207\3032\304#0\232\203\305 \207\211<\203.\304\3068@A@#\207\207" [(token) window-minibuffer-p throw multishell-minibuffer-exit multishell-pop-to-shell-worker multishell-list 2] 9 (#$ . 5547) "P"]) #@85 Do real work of `multishell-pop-to-shell', which see. (fn &optional ARG NAME HERE) (defalias 'multishell-pop-to-shell-worker #[768 "p\303\304!\305!\203\306!\202\211\307\232\310\203!\202>\203=\311\312\313\2033\314\2024\315#!\206>\202>!\211A@@\316!\317 !\320\211\321\305!\"\210\203]\204f\n\203\201\204\201 =\203\201\306 !=\204\201\322\262\202\355\306 \230\203\216\322\262\202\355\203\233\323!\211\262\204\273\316!\204\247\324\325\"\210\f\203\263\326!\210\202\355\327 \"\210\202\355\n\203\324\203\324\330\331 !\330!\232\204\324\332\330!!\210\306p!\230\204\355\f\203\350\326!\210\202\355\327\322\"\210\333p!\204\370\334!\210\317p!\211\203 \335!\336=\203 \337!\210\210\211\204p\f\232\205(db\210\317\f!\205(\340\317 !!b\207" [multishell-primary-name pop-up-windows multishell-pop-to-frame derived-mode-p shell-mode multishell-unbracket buffer-name (16) multishell-resolve-target-name-and-path multishell-read-unbracketed-entry format "Shell buffer name [%s]%s " " <==" ":" get-buffer get-buffer-process nil multishell-register-name-to-path t multishell-get-visible-window-for-buffer message "Creating new shell buffer '%s'" switch-to-buffer pop-to-buffer window-frame selected-window select-frame-set-input-focus comint-check-proc multishell-start-shell-in-buffer process-status stop continue-process process-mark] 18 (#$ . 10354)]) #@175 Remove all multishell history entries for NAME. if optional ask is non-nil (default nil), ask before each deletion. Return the last entry deleted. (fn NAME &optional ASK) (defalias 'multishell-delete-history-name #[513 "\301\302!\211\203*\211@\211\203#\203\303\304\305\"!\203#\211\262\306\"A\266\202\202\207" [multishell-history nil multishell-history-entries y-or-n-p format "Remove multishell history entry `%s'? " delete] 9 (#$ . 11789)]) #@54 Offer to remove multishell-history entry for buffer. (defalias 'multishell-kill-buffer-query-function #[0 "\3001\301\302!\205\303\304\305 !\306\"0\210\202\307\310\"\266\306\207" [(error) derived-mode-p shell-mode multishell-delete-history-name multishell-unbracket buffer-name t message "multishell-kill-buffer-query-function error: %s"] 4 (#$ . 12256)]) (add-hook 'kill-buffer-query-functions 'multishell-kill-buffer-query-function) #@55 Return visible window containing buffer. (fn BUFFER) (defalias 'multishell-get-visible-window-for-buffer #[257 "\3002\301\302\303\"\304\305#\210\3040\207" [got-a-vis walk-windows make-closure #[257 "\301!\300=\205\302\303 \304\"\302\305!\304\"\232\205\306\307\"\207" [V0 window-buffer frame-parameter selected-frame display window-frame throw got-a-vis] 5 "\n\n(fn WIN)"] nil visible] 5 (#$ . 12704)]) #@284 Return multishell history, with active buffers listed first. Optional ACTIVE-DUPLICATED will return a copy of `multishell-history' with unbracketed names of active buffers, sans paths, appended to the list, so they have short and long completions. (fn &optional ACTIVE-DUPLICATED) (defalias 'multishell-all-entries #[256 "\301\211\211\211\211\211\211\211\203_\211@\302!\262@\262\205 \303\304!!\262\305!\203O\306!\203C\211 B\211\262\n\262 B\211\262 \262\202X\211B\211\262\262\202X\211B\211\262\262A\266\202\202\210\307\310!\310!\310!#\203z\307\"\207\207" [multishell-history nil multishell-split-entry get-buffer multishell-bracket buffer-live-p comint-check-proc append reverse] 13 (#$ . 13124)]) #@330 PROMPT for shell buffer name, sans asterisks. Optional INITIAL is preliminary value to be edited. Optional NO-RECORD prevents changes to `multishell-history' across the activity. Input and completion can include associated path, if any. Return what's provided, if anything, else nil. (fn PROMPT &optional INITIAL NO-RECORD) (defalias 'multishell-read-unbracketed-entry #[769 "\302\303!\304\305K\306\307\"\216\305\310M\210\311\312!\313\314 \300&)\262\203'\211\315\230?\205/\211)\207" [multishell-history multishell-completing-read multishell-all-entries active-duplicated t display-completion-list make-closure #[0 "\301\300M\207" [V0 display-completion-list] 2] multishell-list completing-read reverse nil confirm ""] 13 (#$ . 13876)]) #@500 Given name/tramp-style address shell spec, resolve buffer name and directory. The name is the part of the string up to the first `/' slash, if any. Missing pieces are filled in from remote path elements, if any, and multishell history. Given a tramp-style remote address and no name part, either the user@host is used for the buffer name, if a user is specified, or just the host. Return them as a list: (name path), with name asterisk-bracketed and path nil if none is resolved. (fn SHELL-SPEC) (defalias 'multishell-resolve-target-name-and-path #[257 "\300\206\301!\211A@@\206\302!\204:\303\304!!\211\2039\211@\203+\301\230\2032\300!A@\262A\266\202\202\210\305!D\207" [multishell-split-entry "" multishell-name-from-entry multishell-history-entries multishell-unbracket multishell-bracket] 8 (#$ . 14638)]) #@66 Derive a name for a shell buffer according to ENTRY. (fn ENTRY) (defalias 'multishell-name-from-entry #[257 "\211\204\301!\207\302!\211@A@\206A\303!\203>\303\304\"\303\305\"\2030\211\2030\306\307#\207\2036\207\211\203;\207\310 \207\301!\207" [multishell-primary-name multishell-unbracket multishell-split-entry file-remote-p host user format "%s@%s" system-name] 10 (#$ . 15478)]) #@236 Start, restart, or continue a shell in current-buffer on WHERE. If WHERE is remote and includes a directory, cd to that directory on the remote host. If cd fails to an included remote directory, try again without the cd. (fn WHERE) (defalias 'multishell-start-shell-in-buffer #[257 "\301p!\203m\211\204m\302\303!\203 \304!\203 \305\306\307\"\310\311#\210\304!\204-\312!\210\202m\313\314\"\210\3151>\312!0\210\202m\211A@\316\230\203e\317\320\"\321TOT\322O\313\323\"\210\324\325!\210\312!\266\202m\326@A\"\266\327p!\207" [default-directory comint-check-proc derived-mode-p shell-mode file-remote-p tramp-cleanup-connection tramp-dissect-file-name noexpand keep-debug keep-password cd message "Connecting to %s" (error) "No such directory found via CDPATH environment variable" string-match ":[^:]+$" 0 nil "Failed to cd to %s, trying again without..." sit-for 0.5 signal shell] 9 (#$ . 15888)]) #@66 t if dirpath is an unexpanded remote homedir spec. (fn DIRPATH) (defalias 'multishell-homedir-shorthand-p #[257 "\300\301\"\211\205!\211\302\230\206!\303 \304\305\"\216\306\307!\310P\")?\262\207" [file-remote-p localname "" match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] string-match regexp-quote "/?$"] 6 (#$ . 16818)]) #@80 Change multishell history entry to track current directory. (fn NAME NEWPATH) (defalias 'multishell-track-dirchange #[514 "\301!\211\211\205P\211@\302!\211A@\206\303\211\203G\304\305\"\206 \211\306!\203-P\202:\307\310!\311P\312\211%\235\211\203E\211\240\210\266\266A\266\202\202\207" [multishell-history multishell-history-entries multishell-split-entry "" file-remote-p localname multishell-homedir-shorthand-p replace-regexp-in-string regexp-quote "$" t] 14 (#$ . 17188)]) #@41 Provide for tracking directory changes. (defvar multishell-was-default-directory nil (#$ . 17698)) (make-variable-buffer-local 'multishell-was-default-directory) #@28 Do multishell bookkeeping. (defalias 'multishell-post-command-business #[0 "\30315\2053\304\305!\2053\306 !\203\306 \307\"\202 \211\n\206\"\310\230\204.\311\312\313 !\"\210\211\211\2620\207\314\315\"\207" [multishell-history-entry-tracks-current-directory default-directory multishell-was-default-directory (error) derived-mode-p shell-mode file-remote-p localname "" multishell-track-dirchange multishell-unbracket buffer-name message "multishell-post-command-business error: %s"] 4 (#$ . 17866)]) (add-hook 'post-command-hook 'multishell-post-command-business) #@148 Given multishell name/path ENTRY, return the separated name and path pair. Returns nil for empty parts, rather than the empty string. (fn ENTRY) (defalias 'multishell-split-entry #[257 "\300 \301\302\"\216\303\304\"\210\305\306\"\305\307\"\310\230\203\311\262\211\310\230\203&\311\262D\266\202)\207" [match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data evaporate] 3] string-match "^\\([^/]*\\)\\(/?.*\\)?" match-string 1 2 "" nil] 6 (#$ . 18450)]) #@89 Return a copy of name, ensuring it has an asterisk at the beginning and end. (fn NAME) (defalias 'multishell-bracket #[257 "\211\300\301O\302\230\204\302P\262\211\303\304O\302\230\204\211\302P\262\207" [0 1 "*" -1 nil] 4 (#$ . 18934)]) #@85 Return a copy of name, removing asterisks, if any, at beginning and end. (fn NAME) (defalias 'multishell-unbracket #[257 "\211\300\301O\302\230\203\211\301\303O\262\211\304\303O\302\230\203\211\300\304O\262\207" [0 1 "*" nil -1] 4 (#$ . 19184)]) (provide 'multishell)