summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2000-08-29 00:37:10 +0000
committerJohn Wiegley <johnw@newartisans.com>2000-08-29 00:37:10 +0000
commitb4bd214e74d885552fe38051253dbc2b362bfe67 (patch)
tree6bfb567c1a9af685b0c543b850a206bf57dc59fd /lisp
parentd44e146b8c0a9199b814487172721231d22eb7dc (diff)
downloademacs-b4bd214e74d885552fe38051253dbc2b362bfe67.tar.gz
See ChangeLog
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog15
-rw-r--r--lisp/eshell/em-dirs.el4
-rw-r--r--lisp/eshell/em-smart.el31
-rw-r--r--lisp/eshell/esh-mode.el58
-rw-r--r--lisp/eshell/esh-util.el9
5 files changed, 89 insertions, 28 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0d8ec3eb3a6..b0353360325 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,18 @@
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.
2000-08-27 John Wiegley <johnw@gnu.org>
@@ -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>
diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el
index 05eac156838..13565d87521 100644
--- a/lisp/eshell/em-dirs.el
+++ b/lisp/eshell/em-dirs.el
@@ -258,7 +258,7 @@ Thus, this does not include the current directory.")
(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 @@ in the minibuffer:
(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)))
diff --git a/lisp/eshell/em-smart.el b/lisp/eshell/em-smart.el
index e423b20e3b0..0d5a2732dd5 100644
--- a/lisp/eshell/em-smart.el
+++ b/lisp/eshell/em-smart.el
@@ -94,10 +94,20 @@ it to get a real sense of how it works."
: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 @@ The options are `begin', `after' or `end'."
(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 @@ The options are `begin', `after' or `end'."
(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)))
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index 8ab5dadf646..0bb07734c14 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -326,6 +326,10 @@ sessions, such as when using `eshell-command'.")
(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 @@ sessions, such as when using `eshell-command'.")
(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 @@ sessions, such as when using `eshell-command'.")
;; 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 @@ sessions, such as when using `eshell-command'.")
;;; 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 @@ sessions, such as when using `eshell-command'.")
(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 @@ function will inform the caller whether more input is required.
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)
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el
index f9f922a01b6..de19b636100 100644
--- a/lisp/eshell/esh-util.el
+++ b/lisp/eshell/esh-util.el
@@ -262,7 +262,7 @@ If N or M is nil, it means the end of the list."
(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 @@ list."
(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 @@ argument VECP, this copies vectors as well as conses."
(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'."