⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shell.el

📁 早期freebsd实现
💻 EL
📖 第 1 页 / 共 2 页
字号:
    (error (funcall shell-set-directory-error-hook)))  (let ((process (get-buffer-process (current-buffer))))    (process-send-region process last-input-start last-input-end)    (set-marker (process-mark process) (point))));;;  If this code changes (shell-send-input and shell-set-directory),;;;  the customization tutorial in;;;  info/customizing-tutorial must also change, since it explains this;;;  code.  Please let marick@gswd-vms.arpa know of any changes you;;;  make. (defun shell-set-directory ()  (cond ((and (looking-at shell-popd-regexp)	      (memq (char-after (match-end 0)) '(?\; ?\n)))	 (if shell-directory-stack	     (progn	       (cd (car shell-directory-stack))	       (setq shell-directory-stack (cdr shell-directory-stack)))))	((looking-at shell-pushd-regexp)	 (cond ((memq (char-after (match-end 0)) '(?\; ?\n))		(if shell-directory-stack		    (let ((old default-directory))		      (cd (car shell-directory-stack))		      (setq shell-directory-stack			    (cons old (cdr shell-directory-stack))))))	       ((memq (char-after (match-end 0)) '(?\  ?\t))		(let (dir)		  (skip-chars-forward "^ ")		  (skip-chars-forward " \t")		  (if (file-directory-p			(setq dir			      (expand-file-name				(substitute-in-file-name				  (buffer-substring				    (point)				    (progn				      (skip-chars-forward "^\n \t;")				      (point)))))))		      (progn			(setq shell-directory-stack			      (cons default-directory shell-directory-stack))			(cd dir)))))))	((looking-at shell-cd-regexp)	 (cond ((memq (char-after (match-end 0)) '(?\; ?\n))		(cd (getenv "HOME")))	       ((memq (char-after (match-end 0)) '(?\  ?\t))		(let (dir)		  (forward-char 3)		  (skip-chars-forward " \t")		  (if (file-directory-p			(setq dir			      (expand-file-name				(substitute-in-file-name				  (buffer-substring				    (point)				    (progn				      (skip-chars-forward "^\n \t;")				      (point)))))))		      (cd dir))))))))  (defun shell-send-eof ()  "Send eof to subshell (or to the program running under it)."  (interactive)  (process-send-eof))(defun kill-output-from-shell ()  "Kill all output from shell since last input."  (interactive)  (goto-char (point-max))  (beginning-of-line)  (kill-region last-input-end (point))  (insert "*** output flushed ***\n")  (goto-char (point-max)))(defun show-output-from-shell ()  "Display start of this batch of shell output at top of window.Also put cursor there."  (interactive)  (set-window-start (selected-window) last-input-end)  (goto-char last-input-end))(defun copy-last-shell-input ()  "Copy previous shell input, sans newline, and insert before point."  (interactive)  (insert (buffer-substring last-input-end last-input-start))  (delete-char -1))(defun interrupt-shell-subjob ()  "Interrupt this shell's current subjob."  (interactive)  (interrupt-process nil t))(defun kill-shell-subjob ()  "Send kill signal to this shell's current subjob."  (interactive)  (kill-process nil t))(defun quit-shell-subjob ()  "Send quit signal to this shell's current subjob."  (interactive)  (quit-process nil t))(defun stop-shell-subjob ()  "Stop this shell's current subjob."  (interactive)  (stop-process nil t))(defun kill-shell-input ()  "Kill all text since last stuff output by the shell or its subjobs."  (interactive)  (kill-region (process-mark (get-buffer-process (current-buffer)))	       (point)))(defvar inferior-lisp-mode-map nil)(if inferior-lisp-mode-map    nil  (setq inferior-lisp-mode-map (copy-alist shell-mode-map))  (lisp-mode-commands inferior-lisp-mode-map)  (define-key inferior-lisp-mode-map "\e\C-x" 'lisp-send-defun))(defvar inferior-lisp-program "lisp"  "*Program name for invoking an inferior Lisp with `run-lisp'.")(defvar inferior-lisp-load-command "(load \"%s\")\n"  "*Format-string for building a Lisp expression to load a file.This format string should use %s to substitute a file nameand should result in a Lisp expression that will command the inferior Lispto load that file.  The default works acceptably on most Lisps.The string \"(progn (load \\\"%s\\\" :verbose nil :print t) (values))\\\n\"produces cosmetically superior output for this application,but it works only in Common Lisp.")(defvar inferior-lisp-prompt "^.*>:? *$"  "*Regexp to recognize prompts from the inferior Lisp.Default is right for Franz Lisp and kcl.")(defun inferior-lisp-mode ()  "Major mode for interacting with an inferior Lisp process.Runs a Lisp interpreter as a subprocess of Emacs, with Lisp I/Othrough an Emacs buffer.  Variable inferior-lisp-program controlswhich Lisp interpreter is run.  Variables inferior-lisp-promptand inferior-lisp-load-command can customize this mode for differentLisp interpreters.Commands:DELETE converts tabs to spaces as it moves back.TAB indents for Lisp; with argument, shifts rest of expression rigidly with the current line.Meta-Control-Q does TAB on each line starting within following expression.Paragraphs are separated only by blank lines.  Semicolons start comments.Return at end of buffer sends line as input.Return not at end copies rest of line to end and sends it.The following commands imitate the usual Unix interrupt andediting control characters:\\{shell-mode-map}Entry to this mode calls the value of lisp-mode-hook with no arguments,if that value is non-nil.  Likewise with the value of shell-mode-hook.lisp-mode-hook is called after shell-mode-hook.You can send text to the inferior Lisp from other buffersusing the commands process-send-region, process-send-stringand \\[lisp-send-defun]."  (interactive)  (kill-all-local-variables)  (setq major-mode 'inferior-lisp-mode)  (setq mode-name "Inferior Lisp")  (setq mode-line-process '(": %s"))  (lisp-mode-variables t)  (use-local-map inferior-lisp-mode-map)  (make-local-variable 'last-input-start)  (setq last-input-start (make-marker))  (make-local-variable 'last-input-end)  (setq last-input-end (make-marker))  (run-hooks 'shell-mode-hook 'lisp-mode-hook))(defun run-lisp ()  "Run an inferior Lisp process, input and output via buffer *lisp*."  (interactive)  (switch-to-buffer (make-shell "lisp" inferior-lisp-program))  (inferior-lisp-mode))(defun lisp-send-defun (display-flag)  "Send the current defun to the Lisp process made by M-x run-lisp.With argument, force redisplay and scrolling of the *lisp* buffer.Variable `inferior-lisp-load-command' controls formatting ofthe `load' form that is set to the Lisp process."  (interactive "P")  (or (get-process "lisp")      (error "No current lisp process"))  (save-excursion   (end-of-defun)   (let ((end (point))	 (filename (format "/tmp/emlisp%d" (process-id (get-process "lisp")))))     (beginning-of-defun)     (write-region (point) end filename nil 'nomessage)     (process-send-string "lisp" (format inferior-lisp-load-command filename)))   (if display-flag       (let* ((process (get-process "lisp"))	      (buffer (process-buffer process))	      (w (or (get-buffer-window buffer) (display-buffer buffer)))	      (height (window-height w))	      (end))	 (save-excursion	   (set-buffer buffer)	   (setq end (point-max))	   (while (progn		    (accept-process-output process)		    (goto-char (point-max))		    (beginning-of-line)		    (or (= (point-max) end)			(not (looking-at inferior-lisp-prompt)))))	   (setq end (point-max))	   (vertical-motion (- 4 height))	   (set-window-start w (point)))	 (set-window-point w end)))))(defun lisp-send-defun-and-go ()  "Send the current defun to the inferior Lisp, and switch to *lisp* buffer."  (interactive)  (lisp-send-defun nil)  (switch-to-buffer "*lisp*"))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -