# HG changeset patch # User John Wiegley # Date 967848492 0 # Node ID a36c3cf583d4bdb5d2a7e361fed05ead4a64c1cd # Parent f365a6dc7773c5b9a97314936af986d3cfe80914 See ChangeLog diff -r f365a6dc7773 -r a36c3cf583d4 lisp/ChangeLog --- a/lisp/ChangeLog Fri Sep 01 21:41:22 2000 +0000 +++ b/lisp/ChangeLog Fri Sep 01 22:48:12 2000 +0000 @@ -1,3 +1,28 @@ +2000-09-01 John Wiegley + + * pcomplete.el (pcomplete-dirs-or-entries): Added a missing + predicate, which caused entries in the completion list to be + doubled. + +2000-08-30 John Wiegley + + * eshell/esh-mode.el (eshell-mode): Bound C-c M-d to toggle direct + sending to subprocesses. Also, hook pre-command-hook if + `eshell-send-direct-to-subprocesses' is non-nil. + (eshell-send-direct-to-subprocesses): New config variable. If t, + subprocess input is send immediately. + (eshell-toggle-direct-send): New function. + (eshell-self-insert-command): New function. + (eshell-intercept-commands): New function. + (eshell-send-input): If direct subprocess sending is enabled, + don't echo any input to the Eshell buffer. Let the subprocess + handle that. This requires "stty echo" in bash, for example. + +2000-08-28 John Wiegley + + * eshell/esh-var.el (pcomplete/eshell-mode/unset): Added + completion function for Eshell's implementation of `unset'. + 2000-09-02 Eli Zaretskii * info.el (Info-directory-list): Doc fix. diff -r f365a6dc7773 -r a36c3cf583d4 lisp/eshell/esh-mode.el --- a/lisp/eshell/esh-mode.el Fri Sep 01 21:41:22 2000 +0000 +++ b/lisp/eshell/esh-mode.el Fri Sep 01 22:48:12 2000 +0000 @@ -107,6 +107,11 @@ :type 'hook :group 'eshell-mode) +(defcustom eshell-send-direct-to-subprocesses nil + "*If t, send any input immediately to a subprocess." + :type 'boolean + :group 'eshell-mode) + (defcustom eshell-expand-input-functions nil "*Functions to call before input is parsed. Each function is passed two arguments, which bounds the region of the @@ -331,6 +336,7 @@ (if (eq (key-binding [(meta ?.)]) 'find-tag) (define-key eshell-mode-map [(meta ?.)] 'eshell-find-tag)) (define-key eshell-command-map [(meta ?o)] 'eshell-mark-output) + (define-key eshell-command-map [(meta ?d)] 'eshell-toggle-direct-send) (define-key eshell-command-map [(control ?a)] 'eshell-bol) (define-key eshell-command-map [(control ?b)] 'eshell-backward-argument) @@ -414,9 +420,13 @@ (if (and load-hook (boundp load-hook)) (run-hooks load-hook)))) - (when eshell-scroll-to-bottom-on-input - (make-local-hook 'pre-command-hook) - (add-hook 'pre-command-hook 'eshell-preinput-scroll-to-bottom t t)) + (make-local-hook 'pre-command-hook) + + (if eshell-send-direct-to-subprocesses + (add-hook 'pre-command-hook 'eshell-intercept-commands t t)) + + (if eshell-scroll-to-bottom-on-input + (add-hook 'pre-command-hook 'eshell-preinput-scroll-to-bottom t t)) (when eshell-scroll-show-maximum-output (set (make-local-variable 'scroll-conservatively) 1000)) @@ -471,6 +481,44 @@ ;;; Internal Functions: +(defun eshell-toggle-direct-send () + (interactive) + (if eshell-send-direct-to-subprocesses + (progn + (setq eshell-send-direct-to-subprocesses nil) + (remove-hook 'pre-command-hook 'eshell-intercept-commands t) + (message "Sending subprocess input on RET")) + (setq eshell-send-direct-to-subprocesses t) + (add-hook 'pre-command-hook 'eshell-intercept-commands t t) + (message "Sending subprocess input directly"))) + +(defun eshell-self-insert-command (N) + (interactive "i") + (process-send-string + (eshell-interactive-process) + (char-to-string (if (symbolp last-command-char) + (get last-command-char 'ascii-character) + last-command-char)))) + +(defun eshell-intercept-commands () + (when (and (eshell-interactive-process) + (not (and (integerp last-input-event) + (memq last-input-event '(?\C-x ?\C-c))))) + (let ((possible-events (where-is-internal this-command)) + (name (symbol-name this-command)) + (intercept t)) + ;; Assume that any multikey combination which does NOT target an + ;; Eshell command, is a combo the user wants invoked rather than + ;; sent to the underlying subprocess. + (unless (and (> (length name) 7) + (equal (substring name 0 7) "eshell-")) + (while possible-events + (if (> (length (car possible-events)) 1) + (setq intercept nil possible-events nil) + (setq possible-events (cdr possible-events))))) + (if intercept + (setq this-command 'eshell-self-insert-command))))) + (defun eshell-find-tag (&optional tagname next-p regexp-p) "A special version of `find-tag' that ignores read-onlyness." (interactive) @@ -652,12 +700,15 @@ (let ((copy (eshell-get-old-input use-region))) (goto-char eshell-last-output-end) (insert-and-inherit copy))) - (unless no-newline + (unless (or no-newline + (and eshell-send-direct-to-subprocesses + proc-running-p)) (insert-before-markers-and-inherit ?\n)) (if proc-running-p (progn (eshell-update-markers eshell-last-output-end) - (if (= eshell-last-input-start eshell-last-input-end) + (if (or eshell-send-direct-to-subprocesses + (= eshell-last-input-start eshell-last-input-end)) (unless no-newline (process-send-string (eshell-interactive-process) "\n")) (process-send-region (eshell-interactive-process) diff -r f365a6dc7773 -r a36c3cf583d4 lisp/eshell/esh-var.el --- a/lisp/eshell/esh-var.el Fri Sep 01 21:41:22 2000 +0000 +++ b/lisp/eshell/esh-var.el Fri Sep 01 22:48:12 2000 +0000 @@ -299,6 +299,13 @@ (match-string 2 (car sets)))) (setq sets (cdr sets)))) +(defun pcomplete/eshell-mode/export () + "Completion function for Eshell's `export'." + (while (pcomplete-here + (if eshell-complete-export-definition + process-environment + (eshell-envvar-names))))) + (defun eshell/unset (&rest args) "Unset an environment variable." (while args @@ -306,12 +313,9 @@ (setenv (car args) nil t)) (setq args (cdr args)))) -(defun pcomplete/eshell-mode/export () - "Completion function for Eshell's `export'." - (while (pcomplete-here - (if eshell-complete-export-definition - process-environment - (eshell-envvar-names))))) +(defun pcomplete/eshell-mode/unset () + "Completion function for Eshell's `unset'." + (while (pcomplete-here (eshell-envvar-names)))) (defun eshell/setq (&rest args) "Allow command-ish use of `setq'." diff -r f365a6dc7773 -r a36c3cf583d4 lisp/pcomplete.el --- a/lisp/pcomplete.el Fri Sep 01 21:41:22 2000 +0000 +++ b/lisp/pcomplete.el Fri Sep 01 22:48:12 2000 +0000 @@ -686,7 +686,11 @@ (defsubst pcomplete-dirs-or-entries (&optional regexp predicate) "Return either directories, or qualified entries." (append (let ((pcomplete-stub pcomplete-stub)) - (pcomplete-entries regexp predicate)) + (pcomplete-entries + regexp (or predicate + (function + (lambda (path) + (not (file-directory-p path))))))) (pcomplete-entries nil 'file-directory-p))) (defun pcomplete-entries (&optional regexp predicate)