summaryrefslogtreecommitdiff
path: root/lisp/eshell
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/eshell')
-rw-r--r--lisp/eshell/em-dirs.el2
-rw-r--r--lisp/eshell/em-glob.el3
-rw-r--r--lisp/eshell/esh-mode.el62
-rw-r--r--lisp/eshell/esh-proc.el56
4 files changed, 61 insertions, 62 deletions
diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el
index 0000cae5adf..02556661b1b 100644
--- a/lisp/eshell/em-dirs.el
+++ b/lisp/eshell/em-dirs.el
@@ -319,7 +319,7 @@ in the minibuffer:
(before translate-multiple-dots
(filename &optional directory) activate)
(setq filename (eshell-expand-multiple-dots filename)))"
- (while (string-match "\\.\\.\\(\\.+\\)" path)
+ (while (string-match "\\(?:^\\|/\\)\\.\\.\\(\\.+\\)\\(?:$\\|/\\)" path)
(let* ((extra-dots (match-string 1 path))
(len (length extra-dots))
replace-text)
diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el
index 5d68fdf9437..2e95aaefae0 100644
--- a/lisp/eshell/em-glob.el
+++ b/lisp/eshell/em-glob.el
@@ -258,7 +258,7 @@ the form:
(eshell-glob-entries (file-name-as-directory ".") paths))
(if message-shown
(message nil)))
- (or (and matches (nreverse matches))
+ (or (and matches (sort matches #'string<))
(if eshell-error-if-no-glob
(error "No matches found: %s" glob)
glob))))
@@ -267,6 +267,7 @@ the form:
(defvar matches)
(defvar message-shown))
+;; FIXME does this really need to abuse matches, message-shown?
(defun eshell-glob-entries (path globs &optional recurse-p)
"Glob the entries in PATHS, possibly recursing if RECURSE-P is non-nil."
(let* ((entries (ignore-errors
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index 0a8c8be697f..8b7338f8833 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -778,38 +778,36 @@ This is done after all necessary filtering has been done."
(setq string (funcall (car functions) string))
(setq functions (cdr functions))))
(if (and string oprocbuf (buffer-name oprocbuf))
- (let ((obuf (current-buffer))
- opoint obeg oend)
- (set-buffer oprocbuf)
- (setq opoint (point))
- (setq obeg (point-min))
- (setq oend (point-max))
- (let ((buffer-read-only nil)
- (nchars (length string))
- (ostart nil))
- (widen)
- (goto-char eshell-last-output-end)
- (setq ostart (point))
- (if (<= (point) opoint)
- (setq opoint (+ opoint nchars)))
- (if (< (point) obeg)
- (setq obeg (+ obeg nchars)))
- (if (<= (point) oend)
- (setq oend (+ oend nchars)))
- (insert-before-markers string)
- (if (= (window-start (selected-window)) (point))
- (set-window-start (selected-window)
- (- (point) nchars)))
- (if (= (point) eshell-last-input-end)
- (set-marker eshell-last-input-end
- (- eshell-last-input-end nchars)))
- (set-marker eshell-last-output-start ostart)
- (set-marker eshell-last-output-end (point))
- (force-mode-line-update))
- (narrow-to-region obeg oend)
- (goto-char opoint)
- (eshell-run-output-filters)
- (set-buffer obuf)))))
+ (let (opoint obeg oend)
+ (with-current-buffer oprocbuf
+ (setq opoint (point))
+ (setq obeg (point-min))
+ (setq oend (point-max))
+ (let ((buffer-read-only nil)
+ (nchars (length string))
+ (ostart nil))
+ (widen)
+ (goto-char eshell-last-output-end)
+ (setq ostart (point))
+ (if (<= (point) opoint)
+ (setq opoint (+ opoint nchars)))
+ (if (< (point) obeg)
+ (setq obeg (+ obeg nchars)))
+ (if (<= (point) oend)
+ (setq oend (+ oend nchars)))
+ (insert-before-markers string)
+ (if (= (window-start (selected-window)) (point))
+ (set-window-start (selected-window)
+ (- (point) nchars)))
+ (if (= (point) eshell-last-input-end)
+ (set-marker eshell-last-input-end
+ (- eshell-last-input-end nchars)))
+ (set-marker eshell-last-output-start ostart)
+ (set-marker eshell-last-output-end (point))
+ (force-mode-line-update))
+ (narrow-to-region obeg oend)
+ (goto-char opoint)
+ (eshell-run-output-filters))))))
(defun eshell-run-output-filters ()
"Run the `eshell-output-filter-functions' on the current output."
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el
index fb226cf51fb..7338756e3f8 100644
--- a/lisp/eshell/esh-proc.el
+++ b/lisp/eshell/esh-proc.el
@@ -335,39 +335,39 @@ Used only on systems which do not support async subprocesses.")
PROC is the process for which we're inserting output. STRING is the
output."
(when (buffer-live-p (process-buffer proc))
- (set-buffer (process-buffer proc))
- (let ((entry (assq proc eshell-process-list)))
- (when entry
- (setcar (nthcdr 3 entry)
- (concat (nth 3 entry) string))
- (unless (nth 4 entry) ; already being handled?
- (while (nth 3 entry)
- (let ((data (nth 3 entry)))
- (setcar (nthcdr 3 entry) nil)
- (setcar (nthcdr 4 entry) t)
- (eshell-output-object data nil (cadr entry))
- (setcar (nthcdr 4 entry) nil))))))))
+ (with-current-buffer (process-buffer proc)
+ (let ((entry (assq proc eshell-process-list)))
+ (when entry
+ (setcar (nthcdr 3 entry)
+ (concat (nth 3 entry) string))
+ (unless (nth 4 entry) ; already being handled?
+ (while (nth 3 entry)
+ (let ((data (nth 3 entry)))
+ (setcar (nthcdr 3 entry) nil)
+ (setcar (nthcdr 4 entry) t)
+ (eshell-output-object data nil (cadr entry))
+ (setcar (nthcdr 4 entry) nil)))))))))
(defun eshell-sentinel (proc string)
"Generic sentinel for command processes. Reports only signals.
PROC is the process that's exiting. STRING is the exit message."
(when (buffer-live-p (process-buffer proc))
- (set-buffer (process-buffer proc))
- (unwind-protect
- (let* ((entry (assq proc eshell-process-list)))
-; (if (not entry)
-; (error "Sentinel called for unowned process `%s'"
-; (process-name proc))
- (when entry
- (unwind-protect
- (progn
- (unless (string= string "run")
- (unless (string-match "^\\(finished\\|exited\\)" string)
- (eshell-insertion-filter proc string))
- (eshell-close-handles (process-exit-status proc) 'nil
- (cadr entry))))
- (eshell-remove-process-entry entry))))
- (run-hook-with-args 'eshell-kill-hook proc string))))
+ (with-current-buffer (process-buffer proc)
+ (unwind-protect
+ (let* ((entry (assq proc eshell-process-list)))
+; (if (not entry)
+; (error "Sentinel called for unowned process `%s'"
+; (process-name proc))
+ (when entry
+ (unwind-protect
+ (progn
+ (unless (string= string "run")
+ (unless (string-match "^\\(finished\\|exited\\)" string)
+ (eshell-insertion-filter proc string))
+ (eshell-close-handles (process-exit-status proc) 'nil
+ (cadr entry))))
+ (eshell-remove-process-entry entry))))
+ (run-hook-with-args 'eshell-kill-hook proc string)))))
(defun eshell-process-interact (func &optional all query)
"Interact with a process, using PROMPT if more than one, via FUNC.