-;;; esh-mode.el --- user interface
+;;; esh-mode.el --- user interface -*- lexical-binding:t -*-
-;; Copyright (C) 1999-2013 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2016 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@gnu.org>
:group 'eshell-mode)
(defcustom eshell-password-prompt-regexp
- "[Pp]ass\\(word\\|phrase\\).*:\\s *\\'"
+ (format "\\(%s\\).*:\\s *\\'" (regexp-opt password-word-equivalents))
"Regexp matching prompts for passwords in the inferior process.
This is used by `eshell-watch-for-password-prompt'."
:type 'regexp
;; Internal Variables:
-;; these are only set to `nil' initially for the sake of the
+;; these are only set to nil initially for the sake of the
;; byte-compiler, when compiling other files which `require' this one
(defvar eshell-mode nil)
(defvar eshell-mode-map nil)
(run-hooks 'eshell-exit-hook))
;;;###autoload
-(define-derived-mode eshell-mode fundamental-mode "EShell"
+(define-derived-mode eshell-mode fundamental-mode "Eshell"
"Emacs shell interactive mode."
(setq-local eshell-mode t)
(setq local-abbrev-table eshell-mode-abbrev-table)
- (set (make-local-variable 'dired-directory) default-directory)
(set (make-local-variable 'list-buffers-directory)
(expand-file-name default-directory))
(declare-function find-tag-interactive "etags" (prompt &optional no-default))
(defun eshell-find-tag (&optional tagname next-p regexp-p)
- "A special version of `find-tag' that ignores read-onlyness."
+ "A special version of `find-tag' that ignores whether the text is read-only."
(interactive)
(require 'etags)
(let ((inhibit-read-only t)
(let ((proc-running-p (and (eshell-interactive-process)
(not queue-p)))
(inhibit-point-motion-hooks t)
- after-change-functions)
+ (inhibit-modification-hooks t))
(unless (and proc-running-p
(not (eq (process-status
- (eshell-interactive-process)) 'run)))
+ (eshell-interactive-process))
+ 'run)))
(if (or proc-running-p
(>= (point) eshell-last-output-end))
(goto-char (point-max))
(run-hooks 'eshell-input-filter-functions)
(and (catch 'eshell-terminal
(ignore
- (if (eshell-invoke-directly cmd input)
+ (if (eshell-invoke-directly cmd)
(eval cmd)
(eshell-eval-command cmd input))))
(eshell-life-is-too-much)))))
(let ((oprocbuf (if process (process-buffer process)
(current-buffer)))
(inhibit-point-motion-hooks t)
- after-change-functions)
+ (inhibit-modification-hooks t))
(let ((functions eshell-preoutput-filter-functions))
(while (and functions string)
(setq string (funcall (car functions) string))
(goto-char (point-max))
(recenter -1))
+(defun eshell/clear (&optional scrollback)
+ "Scroll contents of eshell window out of sight, leaving a blank window.
+If SCROLLBACK is non-nil, clear the scrollback contents."
+ (interactive)
+ (if scrollback
+ (eshell/clear-scrollback)
+ (insert (make-string (window-size) ?\n))
+ (eshell-send-input)))
+
+(defun eshell/clear-scrollback ()
+ "Clear the scrollback content of the eshell window."
+ (let ((inhibit-read-only t))
+ (erase-buffer)))
+
(defun eshell-get-old-input (&optional use-current-region)
"Return the command input on the current line."
(if use-current-region
This function could be in the list `eshell-output-filter-functions'."
(when (eshell-interactive-process)
(save-excursion
- (goto-char eshell-last-output-block-begin)
- (beginning-of-line)
- (if (re-search-forward eshell-password-prompt-regexp
- eshell-last-output-end t)
- (eshell-send-invisible)))))
+ (let ((case-fold-search t))
+ (goto-char eshell-last-output-block-begin)
+ (beginning-of-line)
+ (if (re-search-forward eshell-password-prompt-regexp
+ eshell-last-output-end t)
+ (eshell-send-invisible))))))
(custom-add-option 'eshell-output-filter-functions
'eshell-watch-for-password-prompt)