changeset 31240:10b1c85c0bbe

See ChangeLog
author John Wiegley <johnw@newartisans.com>
date Tue, 29 Aug 2000 00:37:10 +0000
parents f793dd23ad1f
children 3099993cba0f
files lisp/ChangeLog lisp/eshell/em-dirs.el lisp/eshell/em-smart.el lisp/eshell/esh-mode.el lisp/eshell/esh-util.el
diffstat 5 files changed, 89 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Aug 28 23:48:02 2000 +0000
+++ b/lisp/ChangeLog	Tue Aug 29 00:37:10 2000 +0000
@@ -1,3 +1,16 @@
+2000-08-28  John Wiegley  <johnw@gnu.org>
+
+	* eshell/em-smart.el (eshell-smart-redisplay): Added a safety
+	catch, in case re-centering point at bottom messes up the display.
+	This happens frequently in Emacs 21, due I believe to variable
+	line heights.
+
+	* eshell/esh-mode.el (eshell-find-tag): Require `etags', in order
+	to call `find-tag-interactive'.
+
+	* eshell/em-dirs.el (eshell/cd): Use buffered printing to display
+	the list of remember directories.
+
 2000-08-28  John Wiegley  <johnw@gnu.org>
 
 	* align.el: Test align-region-separate to see if it's a symbol.
@@ -4068,7 +4081,7 @@
 
 2000-05-07  Dave Love  <fx@gnu.org>
 
-	* time.el: Small doc fixes from Pavel Jan,Am(Bk ml.
+	* time.el: Small doc fixes from Pavel Janík ml.
 
 2000-05-05  Dave Love  <fx@gnu.org>
 
--- a/lisp/eshell/em-dirs.el	Mon Aug 28 23:48:02 2000 +0000
+++ b/lisp/eshell/em-dirs.el	Tue Aug 29 00:37:10 2000 +0000
@@ -258,7 +258,7 @@
   (if (> (length args) 1)
       (error "%s: command not found" (car args))
     (throw 'eshell-replace-command
-	   (eshell-parse-command "cd" args))))
+	   (eshell-parse-command "cd" (eshell-flatten-list args)))))
 
 (defun eshell-parse-user-reference ()
   "An argument beginning with ~ is a filename to be expanded."
@@ -351,8 +351,10 @@
 
 (defun eshell/cd (&rest args)           ; all but first ignored
   "Alias to extend the behavior of `cd'."
+  (setq args (eshell-flatten-list args))
   (let ((path (car args))
 	(subpath (car (cdr args)))
+	(case-fold-search (eshell-under-windows-p))
 	handled)
     (if (numberp path)
 	(setq path (number-to-string path)))
--- a/lisp/eshell/em-smart.el	Mon Aug 28 23:48:02 2000 +0000
+++ b/lisp/eshell/em-smart.el	Tue Aug 29 00:37:10 2000 +0000
@@ -94,10 +94,20 @@
   :group 'eshell-smart)
 
 (defcustom eshell-review-quick-commands nil
-  "*If nil, point does not stay on quick commands.
-A quick command is one that produces no output, and exits
-successfully."
-  :type 'boolean
+  "*If t, always review commands.
+Reviewing means keeping point on the text of the command that was just
+invoked, to allow corrections to be made easily.
+
+If set to nil, quick commands won't be reviewed.  A quick command is a
+command that produces no output, and exits successfully.
+
+If set to `not-even-short-output', then the definition of \"quick
+command\" is extended to include commands that produce output, iff
+that output can be presented in its entirely in the Eshell window."
+  :type '(choice (const :tag "No" nil)
+		 (const :tag "Yes" t)
+		 (const :tag "Not even short output"
+			not-even-short-output))
   :group 'eshell-smart)
 
 (defcustom eshell-smart-display-navigate-list
@@ -177,7 +187,7 @@
 		(lambda ()
 		  (setq eshell-smart-command-done t))) t t)
 
-    (unless eshell-review-quick-commands
+    (unless (eq eshell-review-quick-commands t)
       (add-hook 'eshell-post-command-hook
 		'eshell-smart-maybe-jump-to-end nil t))))
 
@@ -233,11 +243,14 @@
 
 (defun eshell-smart-maybe-jump-to-end ()
   "Jump to the end of the input buffer.
-This is done whenever a command exits sucessfully that displayed no
-output."
+This is done whenever a command exits sucessfully and both the command
+and the end of the buffer are still visible."
   (when (and (= eshell-last-command-status 0)
-	     (= (count-lines eshell-last-input-end
-			     eshell-last-output-end) 0))
+	     (if (eq eshell-review-quick-commands 'not-even-short-output)
+		 (and (pos-visible-in-window-p (point-max))
+		      (pos-visible-in-window-p eshell-last-input-start))
+	       (= (count-lines eshell-last-input-end
+			       eshell-last-output-end) 0)))
     (goto-char (point-max))
     (remove-hook 'pre-command-hook 'eshell-smart-display-move t)))
 
--- a/lisp/eshell/esh-mode.el	Mon Aug 28 23:48:02 2000 +0000
+++ b/lisp/eshell/esh-mode.el	Tue Aug 29 00:37:10 2000 +0000
@@ -326,6 +326,10 @@
        (symbol-function eshell-command-prefix))
   (define-key eshell-mode-map [(control ?c)] eshell-command-prefix)
 
+  ;; without this, find-tag complains about read-only text being
+  ;; modified
+  (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 [(control ?a)] 'eshell-bol)
@@ -339,6 +343,7 @@
   (define-key eshell-command-map [(control ?t)] 'eshell-truncate-buffer)
   (define-key eshell-command-map [(control ?u)] 'eshell-kill-input)
   (define-key eshell-command-map [(control ?w)] 'backward-kill-word)
+  (define-key eshell-command-map [(control ?y)] 'eshell-repeat-argument)
 
   (setq local-abbrev-table eshell-mode-abbrev-table)
   (set-syntax-table eshell-mode-syntax-table)
@@ -351,6 +356,9 @@
   ;; commands which do their own formatting almost always expect this
   (set (make-local-variable 'tab-width) 8)
 
+  ;; don't ever use auto-fill in Eshell buffers
+  (setq auto-fill-function nil)
+
   ;; always display everything from a return value
   (if (boundp 'print-length)
       (set (make-local-variable 'print-length) nil))
@@ -463,21 +471,27 @@
 
 ;;; Internal Functions:
 
+(defun eshell-find-tag (&optional tagname next-p regexp-p)
+  "A special version of `find-tag' that ignores read-onlyness."
+  (interactive)
+  (let ((inhibit-read-only t)
+	(no-default (eobp)))
+    (setq tagname (find-tag-interactive "Find tag: " no-default))
+    (find-tag tagname next-p regexp-p)))
+
 (defun eshell-move-argument (limit func property arg)
   "Move forward ARG arguments."
   (catch 'eshell-incomplete
     (eshell-parse-arguments (save-excursion (eshell-bol) (point))
 			    (line-end-position)))
-  (let ((pos
-	 (save-excursion
-	   (funcall func 1)
-	   (while (and (> arg 0)
-		       (not (= (point) limit)))
-	     (if (get-text-property (point) property)
-		 (setq arg (1- arg)))
-	     (if (> arg 0)
-		 (funcall func 1)))
-	   (point))))
+  (let ((pos (save-excursion
+	       (funcall func 1)
+	       (while (and (> arg 0) (/= (point) limit))
+		 (if (get-text-property (point) property)
+		     (setq arg (1- arg)))
+		 (if (> arg 0)
+		     (funcall func 1)))
+	       (point))))
     (goto-char pos)
     (if (and (eq func 'forward-char)
 	     (= (1+ pos) limit))
@@ -507,6 +521,14 @@
   (interactive "p")
   (eshell-move-argument (point-min) 'backward-char 'arg-begin arg))
 
+(defun eshell-repeat-argument (&optional arg)
+  (interactive "p")
+  (let ((begin (save-excursion
+		 (eshell-backward-argument arg)
+		 (point))))
+    (kill-ring-save begin (point))
+    (yank)))
+
 (defun eshell-bol ()
   "Goes to the beginning of line, then skips past the prompt, if any."
   (interactive)
@@ -562,11 +584,17 @@
 If nil is returned, more input is necessary (probably because a
 multi-line input string wasn't terminated properly).  Otherwise, it
 will return the parsed command."
-  (let (command)
-    (unless (catch 'eshell-incomplete
-	      (ignore
-	       (setq command
-		     (eshell-parse-command (cons beg end) args t))))
+  (let (delim command)
+    (if (setq delim
+	      (catch 'eshell-incomplete
+		(ignore
+		 (setq command (eshell-parse-command (cons beg end)
+						     args t)))))
+	(ignore
+	 (message "Expecting completion of delimeter %c ..."
+		  (if (listp delim)
+		      (car delim)
+		    delim)))
       command)))
 
 (defun eshell-update-markers (pmark)
--- a/lisp/eshell/esh-util.el	Mon Aug 28 23:48:02 2000 +0000
+++ b/lisp/eshell/esh-util.el	Tue Aug 29 00:37:10 2000 +0000
@@ -262,7 +262,7 @@
 
 (put 'eshell-for 'lisp-indent-function 2)
 
-(defun eshell-flatten-list (args)
+(defsubst eshell-flatten-list (args)
   "Flatten any lists within ARGS, so that there are no sublists."
   (let ((new-list (list t)))
     (eshell-for a args
@@ -417,7 +417,8 @@
 		  (split-string (buffer-substring
 				 (point) (progn (end-of-line)
 						(point))) ":")))
-	    (if (and fields (nth 0 fields) (nth 2 fields))
+	    (if (and (and fields (nth 0 fields) (nth 2 fields))
+		     (not (assq (string-to-int (nth 2 fields)) names)))
 		(setq names (cons (cons (string-to-int (nth 2 fields))
 					(nth 0 fields))
 				  names))))
@@ -606,6 +607,10 @@
 	    (aset tree i (eshell-copy-tree (aref tree i) vecp))))))
   tree)
 
+(defsubst eshell-processp (proc)
+  "If the `processp' function does not exist, PROC is not a process."
+  (and (fboundp 'processp) (processp proc)))
+
 ; (defun eshell-copy-file
 ;   (file newname &optional ok-if-already-exists keep-date)
 ;   "Copy FILE to NEWNAME.  See docs for `copy-file'."