aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Wiegley2000-09-01 22:48:12 +0000
committerJohn Wiegley2000-09-01 22:48:12 +0000
commit79cf8e808eed44d1fb836639a6ede0f19b92726d (patch)
tree94b930a7a2be0b8816b00a6f75e86460508423fb
parent778911b922acbca7fe4dae5c025e39141b7145fa (diff)
downloademacs-79cf8e808eed44d1fb836639a6ede0f19b92726d.tar.gz
emacs-79cf8e808eed44d1fb836639a6ede0f19b92726d.zip
See ChangeLog
-rw-r--r--lisp/ChangeLog25
-rw-r--r--lisp/eshell/esh-mode.el61
-rw-r--r--lisp/eshell/esh-var.el16
-rw-r--r--lisp/pcomplete.el6
4 files changed, 96 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d422cb057ae..0a16adc5b5b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,28 @@
12000-09-01 John Wiegley <johnw@gnu.org>
2
3 * pcomplete.el (pcomplete-dirs-or-entries): Added a missing
4 predicate, which caused entries in the completion list to be
5 doubled.
6
72000-08-30 John Wiegley <johnw@gnu.org>
8
9 * eshell/esh-mode.el (eshell-mode): Bound C-c M-d to toggle direct
10 sending to subprocesses. Also, hook pre-command-hook if
11 `eshell-send-direct-to-subprocesses' is non-nil.
12 (eshell-send-direct-to-subprocesses): New config variable. If t,
13 subprocess input is send immediately.
14 (eshell-toggle-direct-send): New function.
15 (eshell-self-insert-command): New function.
16 (eshell-intercept-commands): New function.
17 (eshell-send-input): If direct subprocess sending is enabled,
18 don't echo any input to the Eshell buffer. Let the subprocess
19 handle that. This requires "stty echo" in bash, for example.
20
212000-08-28 John Wiegley <johnw@gnu.org>
22
23 * eshell/esh-var.el (pcomplete/eshell-mode/unset): Added
24 completion function for Eshell's implementation of `unset'.
25
12000-09-02 Eli Zaretskii <eliz@is.elta.co.il> 262000-09-02 Eli Zaretskii <eliz@is.elta.co.il>
2 27
3 * info.el (Info-directory-list): Doc fix. 28 * info.el (Info-directory-list): Doc fix.
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index 2db4f2a10b6..1d79c8af701 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -107,6 +107,11 @@ The input is contained in the region from `eshell-last-input-start' to
107 :type 'hook 107 :type 'hook
108 :group 'eshell-mode) 108 :group 'eshell-mode)
109 109
110(defcustom eshell-send-direct-to-subprocesses nil
111 "*If t, send any input immediately to a subprocess."
112 :type 'boolean
113 :group 'eshell-mode)
114
110(defcustom eshell-expand-input-functions nil 115(defcustom eshell-expand-input-functions nil
111 "*Functions to call before input is parsed. 116 "*Functions to call before input is parsed.
112Each function is passed two arguments, which bounds the region of the 117Each function is passed two arguments, which bounds the region of the
@@ -331,6 +336,7 @@ sessions, such as when using `eshell-command'.")
331 (if (eq (key-binding [(meta ?.)]) 'find-tag) 336 (if (eq (key-binding [(meta ?.)]) 'find-tag)
332 (define-key eshell-mode-map [(meta ?.)] 'eshell-find-tag)) 337 (define-key eshell-mode-map [(meta ?.)] 'eshell-find-tag))
333 (define-key eshell-command-map [(meta ?o)] 'eshell-mark-output) 338 (define-key eshell-command-map [(meta ?o)] 'eshell-mark-output)
339 (define-key eshell-command-map [(meta ?d)] 'eshell-toggle-direct-send)
334 340
335 (define-key eshell-command-map [(control ?a)] 'eshell-bol) 341 (define-key eshell-command-map [(control ?a)] 'eshell-bol)
336 (define-key eshell-command-map [(control ?b)] 'eshell-backward-argument) 342 (define-key eshell-command-map [(control ?b)] 'eshell-backward-argument)
@@ -414,9 +420,13 @@ sessions, such as when using `eshell-command'.")
414 (if (and load-hook (boundp load-hook)) 420 (if (and load-hook (boundp load-hook))
415 (run-hooks load-hook)))) 421 (run-hooks load-hook))))
416 422
417 (when eshell-scroll-to-bottom-on-input 423 (make-local-hook 'pre-command-hook)
418 (make-local-hook 'pre-command-hook) 424
419 (add-hook 'pre-command-hook 'eshell-preinput-scroll-to-bottom t t)) 425 (if eshell-send-direct-to-subprocesses
426 (add-hook 'pre-command-hook 'eshell-intercept-commands t t))
427
428 (if eshell-scroll-to-bottom-on-input
429 (add-hook 'pre-command-hook 'eshell-preinput-scroll-to-bottom t t))
420 430
421 (when eshell-scroll-show-maximum-output 431 (when eshell-scroll-show-maximum-output
422 (set (make-local-variable 'scroll-conservatively) 1000)) 432 (set (make-local-variable 'scroll-conservatively) 1000))
@@ -471,6 +481,44 @@ sessions, such as when using `eshell-command'.")
471 481
472;;; Internal Functions: 482;;; Internal Functions:
473 483
484(defun eshell-toggle-direct-send ()
485 (interactive)
486 (if eshell-send-direct-to-subprocesses
487 (progn
488 (setq eshell-send-direct-to-subprocesses nil)
489 (remove-hook 'pre-command-hook 'eshell-intercept-commands t)
490 (message "Sending subprocess input on RET"))
491 (setq eshell-send-direct-to-subprocesses t)
492 (add-hook 'pre-command-hook 'eshell-intercept-commands t t)
493 (message "Sending subprocess input directly")))
494
495(defun eshell-self-insert-command (N)
496 (interactive "i")
497 (process-send-string
498 (eshell-interactive-process)
499 (char-to-string (if (symbolp last-command-char)
500 (get last-command-char 'ascii-character)
501 last-command-char))))
502
503(defun eshell-intercept-commands ()
504 (when (and (eshell-interactive-process)
505 (not (and (integerp last-input-event)
506 (memq last-input-event '(?\C-x ?\C-c)))))
507 (let ((possible-events (where-is-internal this-command))
508 (name (symbol-name this-command))
509 (intercept t))
510 ;; Assume that any multikey combination which does NOT target an
511 ;; Eshell command, is a combo the user wants invoked rather than
512 ;; sent to the underlying subprocess.
513 (unless (and (> (length name) 7)
514 (equal (substring name 0 7) "eshell-"))
515 (while possible-events
516 (if (> (length (car possible-events)) 1)
517 (setq intercept nil possible-events nil)
518 (setq possible-events (cdr possible-events)))))
519 (if intercept
520 (setq this-command 'eshell-self-insert-command)))))
521
474(defun eshell-find-tag (&optional tagname next-p regexp-p) 522(defun eshell-find-tag (&optional tagname next-p regexp-p)
475 "A special version of `find-tag' that ignores read-onlyness." 523 "A special version of `find-tag' that ignores read-onlyness."
476 (interactive) 524 (interactive)
@@ -652,12 +700,15 @@ newline."
652 (let ((copy (eshell-get-old-input use-region))) 700 (let ((copy (eshell-get-old-input use-region)))
653 (goto-char eshell-last-output-end) 701 (goto-char eshell-last-output-end)
654 (insert-and-inherit copy))) 702 (insert-and-inherit copy)))
655 (unless no-newline 703 (unless (or no-newline
704 (and eshell-send-direct-to-subprocesses
705 proc-running-p))
656 (insert-before-markers-and-inherit ?\n)) 706 (insert-before-markers-and-inherit ?\n))
657 (if proc-running-p 707 (if proc-running-p
658 (progn 708 (progn
659 (eshell-update-markers eshell-last-output-end) 709 (eshell-update-markers eshell-last-output-end)
660 (if (= eshell-last-input-start eshell-last-input-end) 710 (if (or eshell-send-direct-to-subprocesses
711 (= eshell-last-input-start eshell-last-input-end))
661 (unless no-newline 712 (unless no-newline
662 (process-send-string (eshell-interactive-process) "\n")) 713 (process-send-string (eshell-interactive-process) "\n"))
663 (process-send-region (eshell-interactive-process) 714 (process-send-region (eshell-interactive-process)
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
index 34994630251..ddbcf257d7e 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -299,6 +299,13 @@ This function is explicit for adding to `eshell-parse-argument-hook'."
299 (match-string 2 (car sets)))) 299 (match-string 2 (car sets))))
300 (setq sets (cdr sets)))) 300 (setq sets (cdr sets))))
301 301
302(defun pcomplete/eshell-mode/export ()
303 "Completion function for Eshell's `export'."
304 (while (pcomplete-here
305 (if eshell-complete-export-definition
306 process-environment
307 (eshell-envvar-names)))))
308
302(defun eshell/unset (&rest args) 309(defun eshell/unset (&rest args)
303 "Unset an environment variable." 310 "Unset an environment variable."
304 (while args 311 (while args
@@ -306,12 +313,9 @@ This function is explicit for adding to `eshell-parse-argument-hook'."
306 (setenv (car args) nil t)) 313 (setenv (car args) nil t))
307 (setq args (cdr args)))) 314 (setq args (cdr args))))
308 315
309(defun pcomplete/eshell-mode/export () 316(defun pcomplete/eshell-mode/unset ()
310 "Completion function for Eshell's `export'." 317 "Completion function for Eshell's `unset'."
311 (while (pcomplete-here 318 (while (pcomplete-here (eshell-envvar-names))))
312 (if eshell-complete-export-definition
313 process-environment
314 (eshell-envvar-names)))))
315 319
316(defun eshell/setq (&rest args) 320(defun eshell/setq (&rest args)
317 "Allow command-ish use of `setq'." 321 "Allow command-ish use of `setq'."
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index 4f506212230..218bc670f49 100644
--- a/lisp/pcomplete.el
+++ b/lisp/pcomplete.el
@@ -686,7 +686,11 @@ Magic characters are those in `pcomplete-arg-quote-list'."
686(defsubst pcomplete-dirs-or-entries (&optional regexp predicate) 686(defsubst pcomplete-dirs-or-entries (&optional regexp predicate)
687 "Return either directories, or qualified entries." 687 "Return either directories, or qualified entries."
688 (append (let ((pcomplete-stub pcomplete-stub)) 688 (append (let ((pcomplete-stub pcomplete-stub))
689 (pcomplete-entries regexp predicate)) 689 (pcomplete-entries
690 regexp (or predicate
691 (function
692 (lambda (path)
693 (not (file-directory-p path)))))))
690 (pcomplete-entries nil 'file-directory-p))) 694 (pcomplete-entries nil 'file-directory-p)))
691 695
692(defun pcomplete-entries (&optional regexp predicate) 696(defun pcomplete-entries (&optional regexp predicate)