;ELC ;;; compiled by jwz@thalidomide on Thu Jan 13 19:32:50 1994 ;;; from file /th/jwz/emacs19/lisp/comint/shell.el ;;; emacs version 19.9 Lucid. ;;; bytecomp version 2.22; 22-dec-93. ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19"))) (error "This file was compiled for Emacs 19.")) (require 'comint) (defvar shell-prompt-pattern (purecopy "^[^#$%>\n]*[#$%>] *") "\ Regexp to match prompts in the inferior shell. Defaults to \"^[^#$%>\\n]*[#$%>] *\", which works pretty well. This variable is used to initialise `comint-prompt-regexp' in the shell buffer. The pattern should probably not match more than one line. If it does, shell-mode may become confused trying to distinguish prompt from input on lines which don't start with a prompt. This is a fine thing to set in your `.emacs' file.") (defvar shell-delimiter-argument-list nil "\ List of characters to recognise as separate arguments. Defaults to (\"|\" \"&\" \"(\" \")\" \";\"), which works pretty well. This variable is used to initialise `comint-delimiter-argument-list' in the shell buffer. This is a fine thing to set in your `.emacs' file.") (defvar shell-command-regexp "\\((.*)\\|[^;&|]\\)+" "\ *Regexp to match shell commands. Elements of pipes are considered as separate commands, forks and redirections as part of one command.") (defvar shell-completion-execonly t "\ *If non-nil, use executable files only for completion candidates. This mirrors the optional behavior of tcsh. Detecting executability of files may slow command completion considerably.") (defvar shell-popd-regexp "popd" "\ *Regexp to match subshell commands equivalent to popd.") (defvar shell-pushd-regexp "pushd" "\ *Regexp to match subshell commands equivalent to pushd.") (defvar shell-pushd-tohome nil "\ *If non-nil, make pushd with no arg behave as \"pushd ~\" (like cd). This mirrors the optional behavior of tcsh.") (defvar shell-pushd-dextract nil "\ *If non-nil, make \"pushd +n\" pop the nth dir to the stack top. This mirrors the optional behavior of tcsh.") (defvar shell-pushd-dunique nil "\ *If non-nil, make pushd only add unique directories to the stack. This mirrors the optional behavior of tcsh.") (defvar shell-cd-regexp "cd" "\ *Regexp to match subshell commands equivalent to cd.") (defvar explicit-shell-file-name nil "\ *If non-nil, is file name to use for explicitly requested inferior shell.") (defvar explicit-csh-args (byte-code "=‡Ç" [system-type hpux ("-i" "-T") ("-i")] 2) "\ *Args passed to inferior shell by M-x shell, if the shell is csh. Value is a list of strings, which may be nil.") (defvar shell-dirstack nil "\ List of directories saved by pushd in this buffer's shell. Thus, this does not include the shell's current directory.") (defvar shell-last-dir nil "\ Keep track of last directory for ksh `cd -' command.") (defvar shell-dirstack-query "dirs" "\ Command used by `shell-resync-dirs' to query the shell.") (byte-code "!  \" \" # # # # )‡" [boundp shell-mode-map nil make-keymap map set-keymap-parent comint-mode-map set-keymap-name define-key "" shell-forward-command "" shell-backward-command " " comint-dynamic-complete "" comint-dynamic-list-filename-completions] 4) (defvar shell-mode-hook nil "\ *Hook for customising Shell mode.") (fset 'shell-mode #[nil " !! ! \n! !!!!!!p!!@!\"᪕\"㪋\"媁&)! " [comint-mode shell-mode major-mode "Shell" mode-name use-local-map shell-mode-map make-local-variable comint-prompt-regexp shell-prompt-pattern comint-delimiter-argument-list shell-delimiter-argument-list comint-after-partial-filename-command shell-after-partial-filename comint-get-current-command shell-get-current-command comint-dynamic-complete-command-command shell-dynamic-complete-command paragraph-start shell-dirstack nil shell-last-dir shell-dirtrackp t shell-directory-tracker comint-input-sentinel process-command get-buffer-process shell getenv "HISTFILE" string-match "csh\\'" "~/.history" "bash\\'" "~/.bash_history" "ksh\\'" "~/.sh_history" comint-input-ring-file-name run-hooks shell-mode-hook comint-read-input-ring shell-dirstack-message] 3 "\ Major mode for interacting with an inferior shell. Return after the end of the process' output sends the text from the end of process to the end of the current line. Return before end of process output copies the current line (except for the prompt) to the end of the buffer and sends it. \\[send-invisible] reads a line of text without echoing it, and sends it to the shell. This is useful for entering passwords. If you accidentally suspend your process, use \\[comint-continue-subjob] to continue it. cd, pushd and popd commands given to the shell are watched by Emacs to keep this buffer's default directory the same as the shell's working directory. \\[shell-resync-dirs] queries the shell and resyncs Emacs' idea of what the current directory stack is. \\[shell-dirtrack-toggle] turns directory tracking on and off. \\{shell-mode-map} Customisation: Entry to this mode runs the hooks on `comint-mode-hook' and `shell-mode-hook' (in that order). After each shell output, the hooks on `comint-output-filter-functions' are run. Variables `shell-cd-regexp', `shell-pushd-regexp' and `shell-popd-regexp' are used to match their respective commands, while `shell-pushd-tohome', `shell-pushd-dextract' and `shell-pushd-dunique' control the behavior of the relevant command. Variables `comint-completion-autolist', `comint-completion-addsuffix' and `comint-completion-recexact' control the behavior of file name, command name and variable name completion. Variable `shell-completion-execonly' controls the behavior of command name completion. Variables `comint-input-ring-file-name' and `comint-input-autoexpand' control the initialisation of the input ring history, and history expansion. Variables `comint-output-filter-functions', `comint-scroll-to-bottom-on-input', and `comint-scroll-to-bottom-on-output' control whether input and output cause the window to scroll to the end of the buffer." nil]) (fset 'shell #[nil "!\n!!!  P  Q! ! !J%q ,!" [comint-check-proc "*shell*" explicit-shell-file-name getenv "ESHELL" "SHELL" "/bin/sh" prog file-name-nondirectory name "~/.emacs_" startfile intern-soft "explicit-" "-args" xargs-name apply make-comint "shell" file-exists-p boundp ("-i") shell-mode switch-to-buffer] 7 "\ Run an inferior shell, with I/O through buffer *shell*. If buffer exists but shell process is not running, make new shell. If buffer exists and shell process is running, just switch to buffer `*shell*'. Program used comes from variable `explicit-shell-file-name', or (if that is nil) from the ESHELL environment variable, or else from SHELL if there is no ESHELL. If a file `~/.emacs_SHELLNAME' exists, it is given as initial input (Note that this may lose due to a timing error if the shell discards input when it starts up.) The buffer is put in Shell mode, giving commands for sending input and controlling the subjobs of the shell. See `shell-mode'. See also the variable `shell-prompt-pattern'. The shell file name (sans directories) is used to make a symbol name such as `explicit-csh-args'. If that symbol is a variable, its value is used as a list of arguments when invoking the shell. Otherwise, one argument `-i' is passed to the shell. (Type \\[describe-mode] in the shell buffer for a list of commands.)" nil]) (fset 'shell-directory-tracker #[(str) "Ï" [shell-dirtrackp err (byte-code "\n\"Õĉ \n#Õ\nOÉ#\nOˉ# \"= !!\"= !!\"= !!\n#Õ," [string-match "^[;\\s ]*" str 0 nil arg1 cmd end start shell-command-regexp comint-arguments 1 shell-popd-regexp shell-process-popd substitute-in-file-name shell-pushd-regexp shell-process-pushd shell-cd-regexp shell-process-cd "[;\\s ]*"] 4) ((error (byte-code "! \"" [message nil display-error err t] 3)))] 3 "\ Tracks cd, pushd and popd commands issued to the shell. This function is called on each input passed to the shell. It watches for cd, pushd and popd commands and sets the buffer's default directory to track these commands. You may toggle this tracking on and off with \\[shell-dirtrack-toggle]. If emacs gets confused, you can resync with the shell with \\[shell-resync-dirs]. See variables `shell-cd-regexp', `shell-pushd-regexp', and `shell-popd-regexp', while `shell-pushd-tohome', `shell-pushd-dextract' and `shell-pushd-dunique' control the behavior of the relevant command. Environment variables are expanded, see function `substitute-in-file-name'."]) (byte-code "MMMMM" [shell-cd-1 #[(dir dirstack) "" [nil (byte-code " ! P! !  " [file-name-absolute-p dir cd-absolute comint-file-name-prefix cd dirstack shell-dirstack shell-dirstack-message] 3) ((file-error (message "Couldn't cd.")))] 3] shell-process-popd #[(arg) " !‰ U @ A\" V GX B SAAA *!!)" [shell-extract-num arg 0 num shell-dirstack shell-cd-1 nil ds cell shell-dirstack-message error message "Couldn't popd."] 4] shell-process-cd #[(arg) "GU!Ę  \")" [arg 0 getenv "HOME" "-" shell-last-dir new-dir default-directory shell-cd-1 shell-dirstack] 3] shell-process-pushd #[(arg) " ! GU ! @ AB\")!\n\nGV!\nU!!\nS8 !!\")BG\n\nZ!!\"@A\"- B\"))" [shell-extract-num arg num 0 shell-pushd-tohome shell-process-pushd "~" shell-dirstack default-directory old shell-cd-1 message "Directory stack empty." "Directory stack not that deep." error "Couldn't cd." shell-pushd-dextract dir shell-process-popd ds dslen front reverse back append new-ds old-wd shell-pushd-dunique] 5] shell-extract-num #[(str) "\n\"\n!" [string-match "^\\+[1-9][0-9]*$" str string-to-int] 3]] 2) (fset 'shell-dirtrack-toggle #[nil "?ê\"" [shell-dirtrackp message "Directory tracking %s" "ON" "OFF"] 3 "\ Turn directory tracking on and off in a shell buffer." nil]) (fset 'shell-resync-dirs #[nil "p! !b cc! \" \" `ɓ`\nc!! !\nb!n`Ǖ|g) b!ǔǕS{GW#̔̕OBǕ`!@A\"." [get-buffer-process proc process-mark pmark shell-dirstack-query "\n" sit-for 0 comint-send-string nil pt backward-char 1 looking-at ".+\n" accept-process-output "^dirs ?\n" delete-char dl dl-len ds i string-match "\\s *\\(\\S +\\)\\s *" reverse shell-cd-1] 5 "\ Resync the buffer's idea of the current directory stack. This command queries the shell with the command bound to `shell-dirstack-query' (default \"dirs\"), reads the next line output and parses it to form the new directory stack. DON'T issue this command unless the buffer is at a shell prompt. Also, note that if some other subprocess decides to do output immediately after the query, its output will be taken as the new directory stack -- you lose. If this happens, just do the command again." nil]) (defvar shell-dirstack-message-hook nil "\ Hook to run after a cd, pushd or popd event") (fset 'shell-dirstack-message #[nil "\n B!!\"\n  GU? !\" @\n\"̕OP  \"̕O  Q A)?! !," ["" msg default-directory shell-dirstack ds format "^%s\\(/\\|$\\)" regexp-quote getenv "HOME" home comint-file-name-prefix 0 prefix dir string-match "~/" nil " " run-hooks shell-dirstack-message-hook message] 5]) (fset 'shell-forward-command #[(&optional arg) "`) P $!)" [nil limit re-search-forward shell-command-regexp "\\([;&|][\\s ]*\\)+" move arg skip-syntax-backward "^\\s "] 5 "\ Move forward across ARG shell command(s). Does not cross lines. See `shell-command-regexp'." "p"]) (fset 'shell-backward-command #[(&optional arg) "!`)\n\"\"\n\n$˔b!)" [comint-bol nil limit skip-syntax-backward "\\s " re-search-backward format "[;&|]+[\\s ]*\\(%s\\)" shell-command-regexp move arg 1 "^\\s "] 5 "\ Move backward across ARG shell command(s). Does not cross lines. See `shell-command-regexp'." "p"]) (fset 'shell-get-current-command #[nil "!•b!`!l`ĕ{)" [looking-at "\\s *[^;&|]" 0 shell-backward-command 1 shell-forward-command] 3 "\ Function that returns the current command including arguments."]) (fset 'shell-after-partial-filename #[nil "  Ď \"*ǔ!`)=?)" [comint-match-partial-filename filename match-data _match_data_ ((store-match-data _match_data_)) string-match "/" 0 shell-backward-command 1] 3 "\ Returns t if point is after a file name. File names are assumed to contain `/'s or not be the first item in the command. See also `shell-backward-command'."]) (fset 'shell-dynamic-complete-command #[nil "  !!A !! #@!!! \"@P\" !!BA?A \" +GU@$ !$! GOc!($!骁c) \"\"$$! GOc.( $$$!骁c!0 $!!). " [nil completion-ignore-case comint-match-partial-filename filename file-name-nondirectory pathnondir reverse exec-path paths file-name-as-directory expand-file-name default-directory cwd mapconcat #[(x) " !P" [regexp-quote x "$"] 2] completion-ignored-extensions "\\|" ignored-extensions "" path comps-in-path file filepath completions comint-directory "." file-accessible-directory-p file-name-all-completions string-match file-directory-p shell-completion-execonly file-executable-p message "No completions of %s" ding 1 completion "Sole completion" directory-file-name "Completed" comint-completion-addsuffix "/" " " try-completion mapcar #[(x) "C" [x] 1] comint-completion-recexact "Completed shortest" comint-completion-autolist comint-dynamic-list-completions "Partially completed"] 6 "\ Dynamically complete the command at point. This function is similar to `comint-dynamic-complete-filename', except that it searches `exec-path' (minus the trailing emacs library path) for completion candidates. Note that this may not be the same as the shell's idea of the path. Completion is dependent on the value of `shell-completion-execonly', plus those that effect file completion. See `comint-dynamic-complete-filename'." nil]) (provide 'shell)