Hi all,
I've merged the latest GPLv2 version of eshell with our one. Here's
the result patch.
Can you help evaluate and commit to package reporsitory?
Note, this sync-up also fixed Issue67 in our tracker.
Thanks,
FKtPp
ChangeLog addition:
2008-08-19 It's me FKtPp ;) <m_pupil(a)yahoo.com.cn>
* Upstream version 2.4.2 (the last GPLv2 version avaiable,
savannah git version tag: 0fc80a3f6bb3bb59f42e9ff83cc8b89bf90fe658).
eshell[Packages] source patch:
Diff command: cvs -q diff -u
Files affected: eshell.el
===================================================================
RCS esh-var.el
===================================================================
RCS esh-util.el
===================================================================
RCS esh-test.el
===================================================================
RCS esh-proc.el
===================================================================
RCS esh-opt.el
===================================================================
RCS esh-module.el
===================================================================
RCS esh-mode.el
===================================================================
RCS esh-maint.el
===================================================================
RCS esh-io.el
===================================================================
RCS esh-ext.el
===================================================================
RCS esh-cmd.el
===================================================================
RCS esh-arg.el
===================================================================
RCS em-xtra.el
===================================================================
RCS em-unix.el
===================================================================
RCS em-term.el
===================================================================
RCS em-smart.el
===================================================================
RCS em-script.el
===================================================================
RCS em-rebind.el
===================================================================
RCS em-prompt.el
===================================================================
RCS em-pred.el
===================================================================
RCS em-ls.el
===================================================================
RCS em-hist.el
===================================================================
RCS em-glob.el
===================================================================
RCS em-dirs.el
===================================================================
RCS em-cmpl.el
===================================================================
RCS em-basic.el
===================================================================
RCS em-banner.el
===================================================================
RCS em-alias.el
===================================================================
RCS Makefile
===================================================================
RCS
Index: Makefile
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/Makefile,v
retrieving revision 1.22
diff -u -r1.22 Makefile
--- Makefile 2008/07/10 21:08:32 1.22
+++ Makefile 2008/08/19 15:54:58
@@ -17,9 +17,9 @@
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-VERSION = 1.13
+VERSION = 1.14
# eshell is now integrated in GNU Emacs, versioning may need to change
-AUTHOR_VERSION = 2.4.1
+AUTHOR_VERSION = 2.4.2
MAINTAINER = XEmacs Dev Team <xemacs-beta(a)xemacs.org>
PACKAGE = eshell
PKG_TYPE = regular
Index: em-alias.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/em-alias.el,v
retrieving revision 1.1
diff -u -r1.1 em-alias.el
--- em-alias.el 2001/01/10 02:52:42 1.1
+++ em-alias.el 2008/08/19 15:54:59
@@ -1,6 +1,7 @@
-;;; em-alias --- creation and management of command aliases
+;;; em-alias.el --- creation and management of command aliases
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'em-alias)
@@ -28,7 +29,7 @@
(defgroup eshell-alias nil
"Command aliases allow for easy definition of alternate commands."
:tag "Command aliases"
-:link '(info-link "(eshell)Command aliases")
+ ;; :link '(info-link "(eshell)Command aliases")
:group 'eshell-module)
;;; Commentary:
@@ -103,7 +104,7 @@
(defcustom eshell-bad-command-tolerance 3
"*The number of failed commands to ignore before creating an alias."
:type 'integer
-:link '(custom-manual "(eshell)Auto-correction of bad commands")
+ ;; :link '(custom-manual "(eshell)Auto-correction of bad commands")
:group 'eshell-alias)
;;;
@@ -147,16 +148,14 @@
(defun eshell-alias-initialize ()
"Initialize the alias handling code."
(make-local-variable 'eshell-failed-commands-alist)
- (make-local-hook 'eshell-alternate-command-hook)
(add-hook 'eshell-alternate-command-hook 'eshell-fix-bad-commands t t)
(eshell-read-aliases-list)
- (make-local-hook 'eshell-named-command-hook)
(add-hook 'eshell-named-command-hook 'eshell-maybe-replace-by-alias t t)
(make-local-variable 'eshell-complex-commands)
(add-to-list 'eshell-complex-commands 'eshell-command-aliased-p))
(defun eshell-command-aliased-p (name)
- (member name eshell-command-aliases-list))
+ (assoc name eshell-command-aliases-list))
(defun eshell/alias (&optional alias &rest definition)
"Define an ALIAS in the user's alias list using DEFINITION."
Index: em-banner.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/em-banner.el,v
retrieving revision 1.1
diff -u -r1.1 em-banner.el
--- em-banner.el 2001/01/10 02:52:43 1.1
+++ em-banner.el 2008/08/19 15:54:59
@@ -1,6 +1,7 @@
-;;; em-banner --- sample module that displays a login banner
+;;; em-banner.el --- sample module that displays a login banner
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'em-banner)
@@ -30,7 +31,7 @@
It exists so that others wishing to create their own Eshell extension
modules may have a simple template to begin with."
:tag "Login banner"
-:link '(info-link "(eshell)Login banner")
+ ;; :link '(info-link "(eshell)Login banner")
:group 'eshell-module)
;;; Commentary:
Index: em-basic.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/em-basic.el,v
retrieving revision 1.1
diff -u -r1.1 em-basic.el
--- em-basic.el 2001/01/10 02:52:43 1.1
+++ em-basic.el 2008/08/19 15:54:59
@@ -1,6 +1,7 @@
-;;; em-basic --- basic shell builtin commands
+;;; em-basic.el --- basic shell builtin commands
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'em-basic)
Index: em-cmpl.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/em-cmpl.el,v
retrieving revision 1.1
diff -u -r1.1 em-cmpl.el
--- em-cmpl.el 2001/01/10 02:52:44 1.1
+++ em-cmpl.el 2008/08/19 15:54:59
@@ -1,6 +1,7 @@
-;;; em-cmpl --- completion using the TAB key
+;;; em-cmpl.el --- completion using the TAB key
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,12 +19,13 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'em-cmpl)
(eval-when-compile (require 'esh-maint))
+(require 'esh-util)
(defgroup eshell-cmpl nil
"This module provides a programmable completion function bound to
@@ -116,8 +118,9 @@
("CC" . "\\.[Cc]\\([Cc]\\|[Pp][Pp]\\)?\\'")
("acc" . "\\.[Cc]\\([Cc]\\|[Pp][Pp]\\)?\\'")
("bcc" . "\\.[Cc]\\([Cc]\\|[Pp][Pp]\\)?\\'")
- ("objdump" . "\\(\\`[^.]*\\|\\.[ao]\\)\\'")
- ("nm" . "\\(\\`[^.]*\\|\\.[ao]\\)\\'")
+ ("readelf" . "\\(\\`[^.]*\\|\\.\\([ao]\\|so\\)\\)\\'")
+ ("objdump" . "\\(\\`[^.]*\\|\\.\\([ao]\\|so\\)\\)\\'")
+ ("nm" . "\\(\\`[^.]*\\|\\.\\([ao]\\|so\\)\\)\\'")
("gdb" . "\\`\\([^.]*\\|a\\.out\\)\\'")
("dbx" . "\\`\\([^.]*\\|a\\.out\\)\\'")
("sdb" . "\\`\\([^.]*\\|a\\.out\\)\\'")
@@ -277,13 +280,11 @@
;; `pcomplete-arg-quote-list' should only be set after all the
;; load-hooks for any other extension modules have been run, which
;; is true at the time `eshell-mode-hook' is run
- (make-local-hook 'eshell-mode-hook)
(add-hook 'eshell-mode-hook
(function
(lambda ()
(set (make-local-variable 'pcomplete-arg-quote-list)
eshell-special-chars-outside-quoting))) nil t)
- (make-local-hook 'pcomplete-quote-arg-hook)
(add-hook 'pcomplete-quote-arg-hook 'eshell-quote-backslash nil t)
(define-key eshell-mode-map [(meta tab)] 'lisp-complete-symbol)
(define-key eshell-mode-map [(meta control ?i)] 'lisp-complete-symbol)
@@ -306,7 +307,7 @@
"Return the command name, possibly sans globbing."
(let ((cmd (file-name-nondirectory (pcomplete-arg 'first))))
(setq cmd (if (and (> (length cmd) 0)
- (eq (aref cmd 0) ?*))
+ (eq (aref cmd 0) eshell-explicit-command-char))
(substring cmd 1)
cmd))
(if (eshell-under-windows-p)
@@ -370,7 +371,8 @@
(setq args (nthcdr (1+ l) args)
posns (nthcdr (1+ l) posns))))
(assert (= (length args) (length posns)))
- (when (and args (eq (char-syntax (char-before end)) ? ))
+ (when (and args (eq (char-syntax (char-before end)) ? )
+ (not (eq (char-before (1- end)) ?\\)))
(nconc args (list ""))
(nconc posns (list (point))))
(cons (mapcar
@@ -396,7 +398,7 @@
(if (file-name-directory filename)
(pcomplete-executables)
(if (and (> (length filename) 0)
- (eq (aref filename 0) ?*))
+ (eq (aref filename 0) eshell-explicit-command-char))
(setq filename (substring filename 1)
pcomplete-stub filename
glob-name t))
Index: em-dirs.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/em-dirs.el,v
retrieving revision 1.1
diff -u -r1.1 em-dirs.el
--- em-dirs.el 2001/01/10 02:52:44 1.1
+++ em-dirs.el 2008/08/19 15:54:59
@@ -1,6 +1,7 @@
-;;; em-dirs --- directory navigation commands
+;;; em-dirs.el --- directory navigation commands
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'em-dirs)
@@ -172,7 +173,7 @@
:type 'boolean
:group 'eshell-dirs)
-;;; Internal Variables:
+;;; Internal Variables:
(defvar eshell-dirstack nil
"List of directories saved by pushd in the Eshell buffer.
@@ -211,7 +212,6 @@
'eshell-dirs-substitute-cd)
eshell-interpreter-alist)))
- (make-local-hook 'eshell-parse-argument-hook)
(add-hook 'eshell-parse-argument-hook
'eshell-parse-user-reference nil t)
(if (eshell-under-windows-p)
@@ -219,7 +219,6 @@
'eshell-parse-drive-letter nil t))
(when (eshell-using-module 'eshell-cmpl)
- (make-local-hook 'pcomplete-try-first-hook)
(add-hook 'pcomplete-try-first-hook
'eshell-complete-user-reference nil t))
@@ -231,7 +230,6 @@
(unless eshell-last-dir-ring
(setq eshell-last-dir-ring (make-ring eshell-last-dir-ring-size)))
- (make-local-hook 'eshell-exit-hook)
(add-hook 'eshell-exit-hook 'eshell-write-last-dir-ring nil t)
(add-hook 'kill-emacs-hook 'eshell-save-some-last-dir))
@@ -373,7 +371,7 @@
(setq path
(ring-remove eshell-last-dir-ring
(if index
- (string-to-int index)
+ (string-to-number index)
0)))))
((and path (string-match "^=\\(.*\\)$" path))
(let ((oldpath (eshell-find-previous-directory
@@ -408,6 +406,8 @@
(eshell-parse-command "ls" (cdr args))))
nil))))
+(put 'eshell/cd 'eshell-no-numeric-conversions t)
+
(defun eshell-add-to-dir-ring (path)
"Add PATH to the last-dir-ring, if applicable."
(unless (and (not (ring-empty-p eshell-last-dir-ring))
@@ -469,6 +469,8 @@
(eshell/dirs t)))))
nil)
+(put 'eshell/pushd 'eshell-no-numeric-conversions t)
+
;;; popd [+n]
(defun eshell/popd (&rest args)
"Implementation of popd in Lisp."
@@ -496,6 +498,8 @@
(t
(error "Couldn't popd"))))
nil)
+
+(put 'eshell/popd 'eshell-no-numeric-conversions t)
(defun eshell/dirs (&optional if-verbose)
"Implementation of dirs in Lisp."
Index: em-glob.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/em-glob.el,v
retrieving revision 1.1
diff -u -r1.1 em-glob.el
--- em-glob.el 2001/01/10 02:52:45 1.1
+++ em-glob.el 2008/08/19 15:54:59
@@ -1,6 +1,7 @@
-;;; em-glob --- extended file name globbing
+;;; em-glob.el --- extended file name globbing
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,12 +19,15 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+;;; Code:
+
(provide 'em-glob)
(eval-when-compile (require 'esh-maint))
+(require 'esh-util)
(defgroup eshell-glob nil
"This module provides extended globbing syntax, similar what is used
@@ -93,7 +97,7 @@
:type 'boolean
:group 'eshell-glob)
-(defcustom eshell-glob-chars-list '(?\] ?\[ ?* ?? ?~ ?\( ?\) ?| ?#)
+(defcustom eshell-glob-chars-list '(?\] ?\[ ?* ?? ?~ ?\( ?\) ?| ?# ?^)
"*List of additional characters used in extended globbing."
:type '(repeat character)
:group 'eshell-glob)
@@ -101,6 +105,7 @@
(defcustom eshell-glob-translate-alist
'((?\] . "]")
(?\[ . "[")
+ (?^ . "^")
(?? . ".")
(?* . ".*")
(?~ . "~")
@@ -119,22 +124,15 @@
:type '(repeat (cons character (choice regexp function)))
:group 'eshell-glob)
-;;; Internal Variables:
-
-(defvar eshell-glob-chars-regexp nil)
-
;;; Functions:
(defun eshell-glob-initialize ()
"Initialize the extended globbing code."
;; it's important that `eshell-glob-chars-list' come first
- (set (make-local-variable 'eshell-special-chars-outside-quoting)
- (append eshell-glob-chars-list eshell-special-chars-outside-quoting))
- (set (make-local-variable 'eshell-glob-chars-regexp)
- (format "[%s]+" (apply 'string eshell-glob-chars-list)))
- (make-local-hook 'eshell-parse-argument-hook)
+ (when (boundp 'eshell-special-chars-outside-quoting)
+ (set (make-local-variable 'eshell-special-chars-outside-quoting)
+ (append eshell-glob-chars-list eshell-special-chars-outside-quoting)))
(add-hook 'eshell-parse-argument-hook 'eshell-parse-glob-chars t t)
- (make-local-hook 'eshell-pre-rewrite-command-hook)
(add-hook 'eshell-pre-rewrite-command-hook
'eshell-no-command-globbing nil t))
@@ -182,6 +180,8 @@
(buffer-substring-no-properties (1- (point)) (1+ end))
(goto-char (1+ end))))))))))
+(defvar eshell-glob-chars-regexp nil)
+
(defun eshell-glob-regexp (pattern)
"Convert glob-pattern PATTERN to a regular expression.
The basic syntax is:
@@ -202,8 +202,11 @@
resulting regular expression."
(let ((matched-in-pattern 0) ; How much of PATTERN handled
regexp)
- (while (string-match eshell-glob-chars-regexp
- pattern matched-in-pattern)
+ (while (string-match
+ (or eshell-glob-chars-regexp
+ (set (make-local-variable 'eshell-glob-chars-regexp)
+ (format "[%s]+" (apply 'string eshell-glob-chars-list))))
+ pattern matched-in-pattern)
(let* ((op-begin (match-beginning 0))
(op-char (aref pattern op-begin)))
(setq regexp
@@ -230,19 +233,19 @@
(defun eshell-extended-glob (glob)
"Return a list of files generated from GLOB, perhaps looking for DIRS-ONLY.
- This function almost fully supports zsh style filename generation
- syntax. Things that are not supported are:
+This function almost fully supports zsh style filename generation
+syntax. Things that are not supported are:
^foo for matching everything but foo
(foo~bar) tilde within a parenthesis group
foo<1-10> numeric ranges
foo~x(a|b) (a|b) will be interpreted as a predicate/modifier list
- Mainly they are not supported because file matching is done with Emacs
- regular expressions, and these cannot support the above constructs.
+Mainly they are not supported because file matching is done with Emacs
+regular expressions, and these cannot support the above constructs.
- If this routine fails, it returns nil. Otherwise, it returns a list
- the form:
+If this routine fails, it returns nil. Otherwise, it returns a list
+the form:
(INCLUDE-REGEXP EXCLUDE-REGEXP (PRED-FUNC-LIST) (MOD-FUNC-LIST))"
(let ((paths (eshell-split-path glob))
@@ -354,7 +357,5 @@
(while rdirs
(eshell-glob-entries (car rdirs) globs recurse-p)
(setq rdirs (cdr rdirs)))))
-
-;;; Code:
;;; em-glob.el ends here
Index: em-hist.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/em-hist.el,v
retrieving revision 1.1
diff -u -r1.1 em-hist.el
--- em-hist.el 2001/01/10 02:52:45 1.1
+++ em-hist.el 2008/08/19 15:55:00
@@ -1,6 +1,7 @@
-;;; em-hist --- history list management
+;;; em-hist.el --- history list management
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'em-hist)
@@ -109,12 +110,12 @@
History is always preserved after sanely exiting an Eshell buffer.
However, when Emacs is being shut down, this variable determines
whether to prompt the user.
-If set to nil, it means never ask whether history should be saved.
-If set to t, always ask if any Eshell buffers are open at exit time.
-If set to `always', history will always be saved, silently."
+If set to nil, it means never save history on termination of Emacs.
+If set to `ask', ask if any Eshell buffers are open at exit time.
+If set to t, history will always be saved, silently."
:type '(choice (const :tag "Never" nil)
- (const :tag "Ask" t)
- (const :tag "Always save" always))
+ (const :tag "Ask" ask)
+ (const :tag "Always save" t))
:group 'eshell-hist)
(defcustom eshell-input-filter
@@ -203,34 +204,33 @@
(define-key eshell-isearch-map [(control ?c)] 'eshell-isearch-cancel-map)
(define-key eshell-isearch-cancel-map [(control ?c)] 'eshell-isearch-cancel))
+(defvar eshell-rebind-keys-alist)
+
;;; Functions:
(defun eshell-hist-initialize ()
"Initialize the history management code for one Eshell buffer."
- (make-local-hook 'eshell-expand-input-functions)
(add-hook 'eshell-expand-input-functions
'eshell-expand-history-references nil t)
(when (eshell-using-module 'eshell-cmpl)
- (make-local-hook 'pcomplete-try-first-hook)
(add-hook 'pcomplete-try-first-hook
'eshell-complete-history-reference nil t))
- (if (eshell-using-module 'eshell-rebind)
- (let ((rebind-alist (symbol-value 'eshell-rebind-keys-alist)))
+ (if (and (eshell-using-module 'eshell-rebind)
+ (not eshell-non-interactive-p))
+ (let ((rebind-alist eshell-rebind-keys-alist))
(make-local-variable 'eshell-rebind-keys-alist)
- (set 'eshell-rebind-keys-alist
- (append rebind-alist eshell-hist-rebind-keys-alist))
+ (setq eshell-rebind-keys-alist
+ (append rebind-alist eshell-hist-rebind-keys-alist))
(set (make-local-variable 'search-invisible) t)
(set (make-local-variable 'search-exit-option) t)
- (make-local-hook 'isearch-mode-hook)
(add-hook 'isearch-mode-hook
(function
(lambda ()
(if (>= (point) eshell-last-output-end)
(setq overriding-terminal-local-map
eshell-isearch-map)))) nil t)
- (make-local-hook 'isearch-mode-end-hook)
(add-hook 'isearch-mode-end-hook
(function
(lambda ()
@@ -270,13 +270,18 @@
(make-local-variable 'eshell-history-index)
(make-local-variable 'eshell-save-history-index)
- (make-local-variable 'eshell-history-ring)
- (if eshell-history-file-name
- (eshell-read-history nil t))
+
+ (if (minibuffer-window-active-p (selected-window))
+ (set (make-local-variable 'eshell-save-history-on-exit) nil)
+ (set (make-local-variable 'eshell-history-ring) nil)
+ (if eshell-history-file-name
+ (eshell-read-history nil t))
+
+ (add-hook 'eshell-exit-hook 'eshell-write-history nil t))
+
(unless eshell-history-ring
(setq eshell-history-ring (make-ring eshell-history-size)))
- (make-local-hook 'eshell-exit-hook)
(add-hook 'eshell-exit-hook 'eshell-write-history nil t)
(add-hook 'kill-emacs-hook 'eshell-save-some-history)
@@ -294,8 +299,8 @@
(with-current-buffer buf
(if (and eshell-mode
eshell-history-file-name
- eshell-ask-to-save-history
- (or (eq eshell-ask-to-save-history 'always)
+ eshell-save-history-on-exit
+ (or (eq eshell-save-history-on-exit t)
(y-or-n-p
(format "Save input history for Eshell buffer `%s'? "
(buffer-name buf)))))
@@ -360,22 +365,40 @@
"Get an input line from the history ring."
(ring-ref (or ring eshell-history-ring) index))
-(defun eshell-add-to-history ()
- "Add INPUT to the history ring.
-The input is entered into the input history ring, if the value of
+(defun eshell-add-input-to-history (input)
+ "Add the string INPUT to the history ring.
+Input is entered into the input history ring, if the value of
variable `eshell-input-filter' returns non-nil when called on the
input."
+ (if (and (funcall eshell-input-filter input)
+ (or (null eshell-hist-ignoredups)
+ (not (ring-p eshell-history-ring))
+ (ring-empty-p eshell-history-ring)
+ (not (string-equal (eshell-get-history 0) input))))
+ (eshell-put-history input))
+ (setq eshell-save-history-index eshell-history-index)
+ (setq eshell-history-index nil))
+
+(defun eshell-add-command-to-history ()
+ "Add the command entered at `eshell-command's prompt to the history ring.
+The command is added to the input history ring, if the value of
+variable `eshell-input-filter' returns non-nil when called on the
+command.
+
+This function is supposed to be called from the minibuffer, presumably
+as a minibuffer-exit-hook."
+ (eshell-add-input-to-history
+ (buffer-substring (minibuffer-prompt-end) (point-max))))
+
+(defun eshell-add-to-history ()
+ "Add last Eshell command to the history ring.
+The command is entered into the input history ring, if the value of
+variable `eshell-input-filter' returns non-nil when called on the
+command."
(when (> (1- eshell-last-input-end) eshell-last-input-start)
(let ((input (buffer-substring eshell-last-input-start
(1- eshell-last-input-end))))
- (if (and (funcall eshell-input-filter input)
- (or (null eshell-hist-ignoredups)
- (not (ring-p eshell-history-ring))
- (ring-empty-p eshell-history-ring)
- (not (string-equal (eshell-get-history 0) input))))
- (eshell-put-history input))
- (setq eshell-save-history-index eshell-history-ring)
- (setq eshell-history-index nil))))
+ (eshell-add-input-to-history input))))
(defun eshell-read-history (&optional filename silent)
"Sets the buffer's `eshell-history-ring' from a history file.
@@ -483,7 +506,7 @@
;; Change "completion" to "history reference"
;; to make the display accurate.
(with-output-to-temp-buffer history-buffer
- (display-completion-list history)
+ (display-completion-list history prefix)
(set-buffer history-buffer)
(forward-line 3)
(while (search-backward "completion" nil 'move)
@@ -503,7 +526,7 @@
((string= "^" ref) 1)
((string= "$" ref) nil)
((string= "%" ref)
- (error "`%' history word designator not yet implemented"))))
+ (error "`%%' history word designator not yet implemented"))))
(defun eshell-hist-parse-arguments (&optional silent b e)
"Parse current command arguments in a history-code-friendly way."
@@ -816,9 +839,10 @@
(if (null pos)
(error "Not found")
(setq eshell-history-index pos)
- (message "History item: %d" (- (ring-length eshell-history-ring) pos))
+ (unless (minibuffer-window-active-p (selected-window))
+ (message "History item: %d" (- (ring-length eshell-history-ring) pos)))
;; Can't use kill-region as it sets this-command
- (delete-region (save-excursion (eshell-bol) (point)) (point))
+ (delete-region eshell-last-output-end (point))
(insert-and-inherit (eshell-get-history pos)))))
(defun eshell-next-matching-input (regexp arg)
Index: em-ls.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/em-ls.el,v
retrieving revision 1.1
diff -u -r1.1 em-ls.el
--- em-ls.el 2001/01/10 02:52:46 1.1
+++ em-ls.el 2008/08/19 15:55:00
@@ -1,6 +1,7 @@
-;;; em-ls --- implementation of ls in Lisp
+;;; em-ls.el --- implementation of ls in Lisp
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'em-ls)
@@ -63,8 +64,14 @@
:type '(repeat :tag "Arguments" string)
:group 'eshell-ls)
+(defcustom eshell-ls-dired-initial-args nil
+ "*If non-nil, args is included before any call to `ls' in Dired.
+This is useful for enabling human-readable format (-h), for example."
+:type '(repeat :tag "Arguments" string)
+:group 'eshell-ls)
+
(defcustom eshell-ls-use-in-dired nil
- "*If non-nil, use `eshell-ls' to read directories in dired."
+ "*If non-nil, use `eshell-ls' to read directories in Dired."
:set (lambda (symbol value)
(if value
(unless (and (boundp 'eshell-ls-use-in-dired)
@@ -85,7 +92,7 @@
(defcustom eshell-ls-exclude-regexp nil
"*Unless -a is specified, files matching this regexp will not be shown."
-:type 'regexp
+:type '(choice regexp (const nil))
:group 'eshell-ls)
(defcustom eshell-ls-exclude-hidden t
@@ -100,48 +107,62 @@
:type 'boolean
:group 'eshell-ls)
-(defface eshell-ls-directory-face
+(defface eshell-ls-directory
'((((class color) (background light)) (:foreground "Blue" :bold t))
(((class color) (background dark)) (:foreground "SkyBlue" :bold t))
(t (:bold t)))
"*The face used for highlight directories."
:group 'eshell-ls)
+;; backward-compatibility alias
+(put 'eshell-ls-directory-face 'face-alias 'eshell-ls-directory)
-(defface eshell-ls-symlink-face
+(defface eshell-ls-symlink
'((((class color) (background light)) (:foreground "Dark Cyan" :bold t))
(((class color) (background dark)) (:foreground "Cyan" :bold t)))
"*The face used for highlight symbolic links."
:group 'eshell-ls)
+;; backward-compatibility alias
+(put 'eshell-ls-symlink-face 'face-alias 'eshell-ls-symlink)
-(defface eshell-ls-executable-face
+(defface eshell-ls-executable
'((((class color) (background light)) (:foreground "ForestGreen" :bold
t))
(((class color) (background dark)) (:foreground "Green" :bold t)))
"*The face used for highlighting executables (not directories, though)."
:group 'eshell-ls)
+;; backward-compatibility alias
+(put 'eshell-ls-executable-face 'face-alias 'eshell-ls-executable)
-(defface eshell-ls-readonly-face
+(defface eshell-ls-readonly
'((((class color) (background light)) (:foreground "Brown"))
(((class color) (background dark)) (:foreground "Pink")))
"*The face used for highlighting read-only files."
:group 'eshell-ls)
+;; backward-compatibility alias
+(put 'eshell-ls-readonly-face 'face-alias 'eshell-ls-readonly)
-(defface eshell-ls-unreadable-face
+(defface eshell-ls-unreadable
'((((class color) (background light)) (:foreground "Grey30"))
(((class color) (background dark)) (:foreground "DarkGrey")))
"*The face used for highlighting unreadable files."
:group 'eshell-ls)
+;; backward-compatibility alias
+(put 'eshell-ls-unreadable-face 'face-alias 'eshell-ls-unreadable)
-(defface eshell-ls-special-face
+(defface eshell-ls-special
'((((class color) (background light)) (:foreground "Magenta" :bold t))
(((class color) (background dark)) (:foreground "Magenta" :bold t)))
"*The face used for highlighting non-regular files."
:group 'eshell-ls)
+;; backward-compatibility alias
+(put 'eshell-ls-special-face 'face-alias 'eshell-ls-special)
-(defface eshell-ls-missing-face
+(defface eshell-ls-missing
'((((class color) (background light)) (:foreground "Red" :bold t))
(((class color) (background dark)) (:foreground "Red" :bold t)))
"*The face used for highlighting non-existant file names."
:group 'eshell-ls)
+;; backward-compatibility alias
+(put 'eshell-ls-missing-face 'face-alias 'eshell-ls-missing)
(defcustom eshell-ls-archive-regexp
(concat "\\.\\(t\\(a[rz]\\|gz\\)\\|arj\\|lzh\\|"
@@ -152,11 +173,13 @@
:type 'regexp
:group 'eshell-ls)
-(defface eshell-ls-archive-face
+(defface eshell-ls-archive
'((((class color) (background light)) (:foreground "Orchid" :bold t))
(((class color) (background dark)) (:foreground "Orchid" :bold t)))
"*The face used for highlighting archived and compressed file names."
:group 'eshell-ls)
+;; backward-compatibility alias
+(put 'eshell-ls-archive-face 'face-alias 'eshell-ls-archive)
(defcustom eshell-ls-backup-regexp
"\\(\\`\\.?#\\|\\(\\.bak\\|~\\)\\'\\)"
@@ -164,25 +187,29 @@
:type 'regexp
:group 'eshell-ls)
-(defface eshell-ls-backup-face
+(defface eshell-ls-backup
'((((class color) (background light)) (:foreground "OrangeRed"))
(((class color) (background dark)) (:foreground "LightSalmon")))
"*The face used for highlighting backup file names."
:group 'eshell-ls)
+;; backward-compatibility alias
+(put 'eshell-ls-backup-face 'face-alias 'eshell-ls-backup)
(defcustom eshell-ls-product-regexp
- "\\.\\(elc\\|o\\(bj\\)?\\|a\\||lib\\|res\\)\\'"
+ "\\.\\(elc\\|o\\(bj\\)?\\|a\\|lib\\|res\\)\\'"
"*A regular expression that matches names of product files.
Products are files that get generated from a source file, and hence
ought to be recreatable if they are deleted."
:type 'regexp
:group 'eshell-ls)
-(defface eshell-ls-product-face
+(defface eshell-ls-product
'((((class color) (background light)) (:foreground "OrangeRed"))
(((class color) (background dark)) (:foreground "LightSalmon")))
"*The face used for highlighting files that are build products."
:group 'eshell-ls)
+;; backward-compatibility alias
+(put 'eshell-ls-product-face 'face-alias 'eshell-ls-product)
(defcustom eshell-ls-clutter-regexp
"\\(^texput\\.log\\|^core\\)\\'"
@@ -192,11 +219,13 @@
:type 'regexp
:group 'eshell-ls)
-(defface eshell-ls-clutter-face
+(defface eshell-ls-clutter
'((((class color) (background light)) (:foreground "OrangeRed" :bold t))
(((class color) (background dark)) (:foreground "OrangeRed" :bold t)))
"*The face used for highlighting junk file names."
:group 'eshell-ls)
+;; backward-compatibility alias
+(put 'eshell-ls-clutter-face 'face-alias 'eshell-ls-clutter)
(defsubst eshell-ls-filetype-p (attrs type)
"Test whether ATTRS specifies a directory."
@@ -250,11 +279,13 @@
(if (stringp switches)
(setq switches (split-string switches)))
(let (eshell-current-handles
- eshell-current-subjob-p)
+ eshell-current-subjob-p
+ font-lock-mode)
;; use the fancy highlighting in `eshell-ls' rather than font-lock
(when (and eshell-ls-use-colors
(featurep 'font-lock))
(font-lock-mode -1)
+ (setq font-lock-defaults nil)
(if (boundp 'font-lock-buffers)
(set 'font-lock-buffers
(delq (current-buffer)
@@ -262,7 +293,7 @@
(let ((insert-func 'insert)
(error-func 'insert)
(flush-func 'ignore)
- eshell-ls-initial-args)
+ eshell-ls-dired-initial-args)
(eshell-do-ls (append switches (list file))))))))
(defsubst eshell/ls (&rest args)
@@ -272,6 +303,8 @@
(flush-func 'eshell-flush))
(eshell-do-ls args)))
+(put 'eshell/ls 'eshell-no-numeric-conversions t)
+
(eval-when-compile
(defvar block-size)
(defvar dereference-links)
@@ -288,7 +321,8 @@
(defvar show-recursive)
(defvar show-size)
(defvar sort-method)
- (defvar ange-cache))
+ (defvar ange-cache)
+ (defvar dired-flag))
(defun eshell-do-ls (&rest args)
"Implementation of \"ls\" in Lisp, passing ARGS."
@@ -301,7 +335,7 @@
`((?a "all" nil show-all
"show all files in directory")
(?c nil by-ctime sort-method
- "sort by modification time")
+ "sort by last status change time")
(?d "directory" nil dir-literal
"list directory entries instead of contents")
(?k "kilobytes" 1024 block-size
@@ -340,6 +374,8 @@
"sort alphabetically by entry extension")
(?1 nil single-column listing-style
"list one file per line")
+ (nil "dired" nil dired-flag
+ "Here for compatibility with GNU ls.")
(nil "help" nil nil
"show this usage display")
:external "ls"
@@ -471,8 +507,8 @@
""))
(let* ((str (eshell-ls-printable-size (nth 7 attrs)))
(len (length str)))
- (if (< len 8)
- (concat (make-string (- 8 len) ? ) str)
+ (if (< len (or size-width 4))
+ (concat (make-string (- (or size-width 4) len) ? ) str)
str))
" " (format-time-string
(concat
@@ -832,47 +868,46 @@
(cons col-widths newfiles)))))
(defun eshell-ls-decorated-name (file)
- "Return FILE, possibly decorated.
-Use TRUENAME for predicate tests, if passed."
+ "Return FILE, possibly decorated."
(if eshell-ls-use-colors
(let ((face
(cond
((not (cdr file))
- 'eshell-ls-missing-face)
+ 'eshell-ls-missing)
((stringp (cadr file))
- 'eshell-ls-symlink-face)
+ 'eshell-ls-symlink)
((eq (cadr file) t)
- 'eshell-ls-directory-face)
+ 'eshell-ls-directory)
((not (eshell-ls-filetype-p (cdr file) ?-))
- 'eshell-ls-special-face)
+ 'eshell-ls-special)
((and (/= (user-uid) 0) ; root can execute anything
(eshell-ls-applicable (cdr file) 3
'file-executable-p (car file)))
- 'eshell-ls-executable-face)
+ 'eshell-ls-executable)
((not (eshell-ls-applicable (cdr file) 1
'file-readable-p (car file)))
- 'eshell-ls-unreadable-face)
+ 'eshell-ls-unreadable)
((string-match eshell-ls-archive-regexp (car file))
- 'eshell-ls-archive-face)
+ 'eshell-ls-archive)
((string-match eshell-ls-backup-regexp (car file))
- 'eshell-ls-backup-face)
+ 'eshell-ls-backup)
((string-match eshell-ls-product-regexp (car file))
- 'eshell-ls-product-face)
+ 'eshell-ls-product)
((string-match eshell-ls-clutter-regexp (car file))
- 'eshell-ls-clutter-face)
+ 'eshell-ls-clutter)
((not (eshell-ls-applicable (cdr file) 2
'file-writable-p (car file)))
- 'eshell-ls-readonly-face)
+ 'eshell-ls-readonly)
(eshell-ls-highlight-alist
(let ((tests eshell-ls-highlight-alist)
value)
Index: em-pred.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/em-pred.el,v
retrieving revision 1.1
diff -u -r1.1 em-pred.el
--- em-pred.el 2001/01/10 02:52:46 1.1
+++ em-pred.el 2008/08/19 15:55:00
@@ -1,6 +1,7 @@
-;;; em-pred --- argument predicates and modifiers (ala zsh)
+;;; em-pred.el --- argument predicates and modifiers (ala zsh)
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'em-pred)
@@ -58,6 +59,8 @@
;; See the zsh docs for more on the syntax ([(zsh.info)Filename
;; Generation]).
+;;; Code:
+
;;; User Variables:
(defcustom eshell-pred-load-hook '(eshell-pred-initialize)
@@ -111,7 +114,7 @@
(put 'eshell-predicate-alist 'risky-local-variable t)
(defcustom eshell-modifier-alist
- '((?e . '(lambda (lst)
+ '((?E . '(lambda (lst)
(mapcar
(function
(lambda (str)
@@ -184,12 +187,13 @@
FILE ATTRIBUTES:
l[+-]N +/-/= N links
- a[Mwhm][+-](N|'FILE') access time +/-/= N mnths/weeks/days/mins
- if FILE specified, use as comparison basis;
- so a+'file.c' shows files accessed before
- file.c was last accessed
- m[Mwhm][+-](N|'FILE') modification time...
- c[Mwhm][+-](N|'FILE') change time...
+ a[Mwhms][+-](N|'FILE') access time +/-/= N mnths/weeks/hours/mins/secs
+ (days if unspecified) if FILE specified,
+ use as comparison basis; so a+'file.c'
+ shows files accessed before file.c was
+ last accessed
+ m[Mwhms][+-](N|'FILE') modification time...
+ c[Mwhms][+-](N|'FILE') change time...
L[kmp][+-]N file size +/-/= N Kb/Mb/blocks
EXAMPLES:
@@ -205,7 +209,7 @@
"Eshell modifier quick reference:
FOR SINGLE ARGUMENTS, or each argument of a list of strings:
- e evaluate again
+ E evaluate again
L lowercase
U uppercase
C capitalize
@@ -216,7 +220,7 @@
q escape special characters
S split string at any whitespace character
- S/PAT/ split string at each occurance of PAT
+ S/PAT/ split string at each occurrence of PAT
FOR LISTS OF ARGUMENTS:
o sort alphabetically
@@ -230,7 +234,7 @@
x/PAT/ exclude all members matching PAT
s/pat/match/ substitute PAT with MATCH
- g/pat/match/ substitute PAT with MATCH for all occurances
+ g/pat/match/ substitute PAT with MATCH for all occurrences
EXAMPLES:
*.c(:o) sorted list of .c files")
@@ -253,7 +257,6 @@
(defun eshell-pred-initialize ()
"Initialize the predicate/modifier code."
- (make-local-hook 'eshell-parse-argument-hook)
(add-hook 'eshell-parse-argument-hook
'eshell-parse-arg-modifier t t)
(define-key eshell-command-map [(meta ?q)] 'eshell-display-predicate-help)
@@ -408,7 +411,7 @@
"Return a predicate to test whether a file matches a certain time."
(let* ((quantum 86400)
qual amount when open close end)
- (when (memq (char-after) '(?M ?w ?h ?m))
+ (when (memq (char-after) '(?M ?w ?h ?m ?s))
(setq quantum (char-after))
(cond
((eq quantum ?M)
@@ -598,7 +601,5 @@
(function
(lambda (str)
(split-string str ,sep))) lst))))
-
-;;; Code:
;;; em-pred.el ends here
Index: em-prompt.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/em-prompt.el,v
retrieving revision 1.1
diff -u -r1.1 em-prompt.el
--- em-prompt.el 2001/01/10 02:52:47 1.1
+++ em-prompt.el 2008/08/19 15:55:00
@@ -1,6 +1,7 @@
-;;; em-prompt --- command prompts
+;;; em-prompt.el --- command prompts
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'em-prompt)
@@ -68,7 +69,7 @@
:type 'boolean
:group 'eshell-prompt)
-(defface eshell-prompt-face
+(defface eshell-prompt
'((((class color) (background light)) (:foreground "Red" :bold t))
(((class color) (background dark)) (:foreground "Pink" :bold t))
(t (:bold t)))
@@ -76,6 +77,8 @@
For highlighting other kinds of strings -- similar to shell mode's
behavior -- simply use an output filer which changes text properties."
:group 'eshell-prompt)
+;; backward-compatibility alias
+(put 'eshell-prompt-face 'face-alias 'eshell-prompt)
(defcustom eshell-before-prompt-hook nil
"*A list of functions to call before outputting the prompt."
@@ -98,7 +101,6 @@
(defun eshell-prompt-initialize ()
"Initialize the prompting code."
(unless eshell-non-interactive-p
- (make-local-hook 'eshell-post-command-hook)
(add-hook 'eshell-post-command-hook 'eshell-emit-prompt nil t)
(make-local-variable 'eshell-prompt-regexp)
@@ -120,7 +122,7 @@
(and eshell-highlight-prompt
(add-text-properties 0 (length prompt)
'(read-only t
- face eshell-prompt-face
+ face eshell-prompt
rear-nonsticky (face read-only))
prompt))
(eshell-interactive-print prompt)))
Index: em-rebind.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/em-rebind.el,v
retrieving revision 1.1
diff -u -r1.1 em-rebind.el
--- em-rebind.el 2001/01/10 02:52:47 1.1
+++ em-rebind.el 2008/08/19 15:55:00
@@ -1,6 +1,7 @@
-;;; em-rebind --- rebind keys when point is at current input
+;;; em-rebind.el --- rebind keys when point is at current input
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'em-rebind)
@@ -127,7 +128,6 @@
forward-word
backward-word
forward-line
- backward-line
previous-line
next-line
forward-visible-line
@@ -148,12 +148,9 @@
(defun eshell-rebind-initialize ()
"Initialize the inputing code."
(unless eshell-non-interactive-p
- (make-local-hook 'eshell-mode-hook)
(add-hook 'eshell-mode-hook 'eshell-setup-input-keymap nil t)
- (make-local-hook 'pre-command-hook)
(make-local-variable 'eshell-previous-point)
(add-hook 'pre-command-hook 'eshell-save-previous-point nil t)
- (make-local-hook 'post-command-hook)
(make-local-variable 'overriding-local-map)
(add-hook 'post-command-hook 'eshell-rebind-input-map nil t)
(set (make-local-variable 'eshell-lock-keymap) nil)
Index: em-script.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/em-script.el,v
retrieving revision 1.1
diff -u -r1.1 em-script.el
--- em-script.el 2001/01/10 02:52:48 1.1
+++ em-script.el 2008/08/19 15:55:00
@@ -1,6 +1,7 @@
-;;; em-script --- Eshell script files
+;;; em-script.el --- Eshell script files
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,9 +19,11 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+;;; Code:
+
(provide 'em-script)
(eval-when-compile (require 'esh-maint))
@@ -119,6 +122,8 @@
$2, etc.")
(eshell-source-file (car args) (cdr args) t)))
+(put 'eshell/source 'eshell-no-numeric-conversions t)
+
(defun eshell/. (&rest args)
"Source a file in the current environment."
(eshell-eval-using-options
@@ -130,6 +135,6 @@
environment, binding ARGS to $1, $2, etc.")
(eshell-source-file (car args) (cdr args))))
-;;; Code:
+(put 'eshell/. 'eshell-no-numeric-conversions t)
;;; em-script.el ends here
Index: em-smart.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/em-smart.el,v
retrieving revision 1.1
diff -u -r1.1 em-smart.el
--- em-smart.el 2001/01/10 02:52:49 1.1
+++ em-smart.el 2008/08/19 15:55:00
@@ -1,6 +1,7 @@
-;;; em-smart --- smart display of output
+;;; em-smart.el --- smart display of output
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'em-smart)
@@ -33,7 +34,7 @@
Most likely you will have to turn this option on and play around with
it to get a real sense of how it works."
:tag "Smart display of output"
-:link '(info-link "(eshell)Smart display of output")
+ ;; :link '(info-link "(eshell)Smart display of output")
:group 'eshell-module)
;;; Commentary:
@@ -172,22 +173,16 @@
(set (make-local-variable 'eshell-scroll-to-bottom-on-input) nil)
(set (make-local-variable 'eshell-scroll-show-maximum-output) t)
- (make-local-hook 'window-scroll-functions)
(add-hook 'window-scroll-functions 'eshell-smart-scroll-window nil t)
(add-hook 'window-configuration-change-hook 'eshell-refresh-windows)
- (make-local-hook 'eshell-output-filter-functions)
(add-hook 'eshell-output-filter-functions 'eshell-refresh-windows t t)
- (make-local-hook 'pre-command-hook)
- (make-local-hook 'after-change-functions)
(add-hook 'after-change-functions 'eshell-disable-after-change nil t)
- (make-local-hook 'eshell-input-filter-functions)
(add-hook 'eshell-input-filter-functions 'eshell-smart-display-setup nil t)
(make-local-variable 'eshell-smart-command-done)
- (make-local-hook 'eshell-post-command-hook)
(add-hook 'eshell-post-command-hook
(function
(lambda ()
@@ -248,7 +243,7 @@
(defun eshell-smart-maybe-jump-to-end ()
"Jump to the end of the input buffer.
-This is done whenever a command exits sucessfully and both the command
+This is done whenever a command exits successfully and both the command
and the end of the buffer are still visible."
(when (and (= eshell-last-command-status 0)
(if (eq eshell-review-quick-commands 'not-even-short-output)
@@ -262,7 +257,11 @@
(defun eshell-smart-redisplay ()
"Display as much output as possible, smartly."
(if (eobp)
- (recenter -1)
+ (save-excursion
+ (recenter -1)
+ ;; trigger the redisplay now, so that we catch any attempted
+ ;; point motion; this is to cover for a redisplay bug
+ (eshell-redisplay))
(let ((top-point (point)))
(and (memq 'eshell-smart-display-move pre-command-hook)
(>= (point) eshell-last-input-start)
Index: em-term.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/em-term.el,v
retrieving revision 1.2
diff -u -r1.2 em-term.el
--- em-term.el 2005/05/20 14:55:10 1.2
+++ em-term.el 2008/08/19 15:55:00
@@ -1,6 +1,7 @@
-;;; em-term --- running visual commands
+;;; em-term.el --- running visual commands
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'em-term)
@@ -161,11 +162,8 @@
; (interactive)
; ;; Convert `return' to C-m, etc.
; (if (and (symbolp last-input-char)
-; (or (get last-input-char 'character-of-keysym)
-; (get last-input-char 'ascii-character)))
-; (setq last-input-char
-; (or (get last-input-char 'character-of-keysym)
-; (get last-input-char 'ascii-character))))
+; (get last-input-char 'ascii-character))
+; (setq last-input-char (get last-input-char 'ascii-character)))
; (eshell-term-send-raw-string (make-string 1 last-input-char)))
; (defun eshell-term-send-raw-meta ()
@@ -177,8 +175,7 @@
; (setq last-input-char (car tmp)))
; (if (symbolp last-input-char)
; (progn
-; (setq tmp (or (get last-input-char 'character-of-keysym)
-; (get last-input-char 'ascii-character)))
+; (setq tmp (get last-input-char 'ascii-character))
; (if tmp (setq last-input-char tmp))))))
; (eshell-term-send-raw-string (if (and (numberp last-input-char)
; (> last-input-char 127)
Index: em-unix.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/em-unix.el,v
retrieving revision 1.2
diff -u -r1.2 em-unix.el
--- em-unix.el 2003/03/25 17:34:32 1.2
+++ em-unix.el 2008/08/19 15:55:01
@@ -1,6 +1,7 @@
-;;; em-unix --- UNIX command aliases
+;;; em-unix.el --- UNIX command aliases
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'em-unix)
@@ -141,9 +142,7 @@
(defun eshell-unix-initialize ()
"Initialize the UNIX support/emulation code."
- (make-local-hook 'eshell-post-command-hook)
(when (eshell-using-module 'eshell-cmpl)
- (make-local-hook 'pcomplete-try-first-hook)
(add-hook 'pcomplete-try-first-hook
'eshell-complete-host-reference nil t))
(make-local-variable 'eshell-complex-commands)
@@ -166,6 +165,8 @@
"Invoke man, flattening the arguments appropriately."
(funcall 'man (apply 'eshell-flatten-and-stringify args)))
+(put 'eshell/man 'eshell-no-numeric-conversions t)
+
(defun eshell-remove-entries (path files &optional top-level)
"From PATH, remove all of the given FILES, perhaps interactively."
(while files
@@ -276,6 +277,8 @@
(setq args (cdr args)))
nil))
+(put 'eshell/rm 'eshell-no-numeric-conversions t)
+
(defun eshell/mkdir (&rest args)
"Implementation of mkdir in Lisp."
(eshell-eval-using-options
@@ -290,6 +293,8 @@
(setq args (cdr args)))
nil))
+(put 'eshell/mkdir 'eshell-no-numeric-conversions t)
+
(defun eshell/rmdir (&rest args)
"Implementation of rmdir in Lisp."
(eshell-eval-using-options
@@ -304,6 +309,8 @@
(setq args (cdr args)))
nil))
+(put 'eshell/rmdir 'eshell-no-numeric-conversions t)
+
(eval-when-compile
(defvar no-dereference)
(defvar preview)
@@ -334,9 +341,11 @@
(eq system-type 'ms-dos))
(setq attr (eshell-file-attributes (car files)))
(nth 10 attr-target) (nth 10 attr)
- (= (nth 10 attr-target) (nth 10 attr))
+ ;; Use equal, not -, since the inode and the device could
+ ;; cons cells.
+ (equal (nth 10 attr-target) (nth 10 attr))
(nth 11 attr-target) (nth 11 attr)
- (= (nth 11 attr-target) (nth 11 attr)))
+ (equal (nth 11 attr-target) (nth 11 attr)))
(eshell-error (format "%s: `%s' and `%s' are the same file\n"
command (car files) target)))
(t
@@ -358,12 +367,16 @@
(let (eshell-warn-dot-directories)
(if (and (not deep)
(eq func 'rename-file)
- (= (nth 11 (eshell-file-attributes
- (file-name-directory
- (expand-file-name source))))
- (nth 11 (eshell-file-attributes
- (file-name-directory
- (expand-file-name target))))))
+ ;; Use equal, since the device might be a
+ ;; cons cell.
+ (equal (nth 11 (eshell-file-attributes
+ (file-name-directory
+ (directory-file-name
+ (expand-file-name source)))))
+ (nth 11 (eshell-file-attributes
+ (file-name-directory
+ (directory-file-name
+ (expand-file-name target)))))))
(apply 'eshell-funcalln func source target args)
(unless (file-directory-p target)
(if verbose
@@ -481,6 +494,8 @@
eshell-mv-interactive-query
eshell-mv-overwrite-files))))
+(put 'eshell/mv 'eshell-no-numeric-conversions t)
+
(defun eshell/cp (&rest args)
"Implementation of cp in Lisp."
(eshell-eval-using-options
@@ -514,6 +529,8 @@
eshell-cp-interactive-query
eshell-cp-overwrite-files preserve)))
+(put 'eshell/cp 'eshell-no-numeric-conversions t)
+
(defun eshell/ln (&rest args)
"Implementation of ln in Lisp."
(eshell-eval-using-options
@@ -544,6 +561,8 @@
eshell-ln-interactive-query
eshell-ln-overwrite-files))))
+(put 'eshell/ln 'eshell-no-numeric-conversions t)
+
(defun eshell/cat (&rest args)
"Implementation of cat in Lisp.
If in a pipeline, or the file is not a regular file, directory or
@@ -552,9 +571,12 @@
(if (or eshell-in-pipeline-p
(catch 'special
(eshell-for arg args
- (unless (let ((attrs (eshell-file-attributes arg)))
- (and attrs (memq (aref (nth 8 attrs) 0)
- '(?d ?l ?-))))
+ (unless (or (and (stringp arg)
+ (> (length arg) 0)
+ (eq (aref arg 0) ?-))
+ (let ((attrs (eshell-file-attributes arg)))
+ (and attrs (memq (aref (nth 8 attrs) 0)
+ '(?d ?l ?-)))))
(throw 'special t)))))
(let ((ext-cat (eshell-search-path "cat")))
(if ext-cat
@@ -591,6 +613,8 @@
;; if the file does not end in a newline, do not emit one
(setq eshell-ensure-newline-p nil))))
+(put 'eshell/cat 'eshell-no-numeric-conversions t)
+
;; special front-end functions for compilation-mode buffers
(defun eshell/make (&rest args)
@@ -606,6 +630,8 @@
(eshell-parse-command "*make" (eshell-stringify-list
(eshell-flatten-list args))))))
+(put 'eshell/make 'eshell-no-numeric-conversions t)
+
(defun eshell-occur-mode-goto-occurrence ()
"Go to the occurrence the current line describes."
(interactive)
@@ -616,13 +642,12 @@
(defun eshell-occur-mode-mouse-goto (event)
"In Occur mode, go to the occurrence whose line you click on."
(interactive "e")
- (let (buffer pos)
+ (let (pos)
(save-excursion
(set-buffer (window-buffer (posn-window (event-end event))))
(save-excursion
(goto-char (posn-point (event-end event)))
- (setq pos (occur-mode-find-occurrence))
- (setq buffer occur-buffer)))
+ (setq pos (occur-mode-find-occurrence))))
(pop-to-buffer (marker-buffer pos))
(goto-char (marker-position pos))))
@@ -658,7 +683,6 @@
(if string (insert string))
(setq string nil
files (cdr files)))))
- (setq occur-buffer (current-buffer))
(local-set-key [mouse-2] 'eshell-occur-mode-mouse-goto)
(local-set-key [(control ?c) (control ?c)]
'eshell-occur-mode-goto-occurrence)
@@ -684,11 +708,7 @@
(eshell-parse-command (concat "*" command)
(eshell-stringify-list
(eshell-flatten-list args))))
- (let* ((compilation-process-setup-function
- (list 'lambda nil
- (list 'setq 'process-environment
- (list 'quote (eshell-copy-environment)))))
- (args (mapconcat 'identity
+ (let* ((args (mapconcat 'identity
(mapcar 'shell-quote-argument
(eshell-stringify-list
(eshell-flatten-list args)))
@@ -857,7 +877,7 @@
(unless by-bytes
(setq block-size (or block-size 1024)))
(if (and max-depth (stringp max-depth))
- (setq max-depth (string-to-int max-depth)))
+ (setq max-depth (string-to-number max-depth)))
;; filesystem support means nothing under Windows
(if (eshell-under-windows-p)
(setq only-one-filesystem nil))
@@ -930,7 +950,7 @@
(not eshell-in-subcommand-p))))
(throw 'eshell-replace-command
(eshell-parse-command "*diff" orig-args))
- (setq args (eshell-copy-list orig-args))
+ (setq args (copy-sequence orig-args))
(if (< (length args) 2)
(throw 'eshell-replace-command
(eshell-parse-command "*diff" orig-args)))
@@ -947,15 +967,23 @@
(throw 'eshell-replace-command
(eshell-parse-command "*diff" orig-args))))
(when (fboundp 'diff-mode)
- (diff-mode)
- (set (make-local-variable 'eshell-diff-window-config) config)
- (local-set-key [?q] 'eshell-diff-quit)
- (if (fboundp 'turn-on-font-lock-if-enabled)
- (turn-on-font-lock-if-enabled))))
- (other-window 1)
- (goto-char (point-min))
- nil))))
+ (make-local-variable 'compilation-finish-functions)
+ (add-hook
+ 'compilation-finish-functions
+ `(lambda (buff msg)
+ (with-current-buffer buff
+ (diff-mode)
+ (set (make-local-variable 'eshell-diff-window-config)
+ ,config)
+ (local-set-key [?q] 'eshell-diff-quit)
+ (if (fboundp 'turn-on-font-lock-if-enabled)
+ (turn-on-font-lock-if-enabled))
+ (goto-char (point-min))))))
+ (pop-to-buffer (current-buffer))))))
+ nil)
+(put 'eshell/diff 'eshell-no-numeric-conversions t)
+
(defun eshell/locate (&rest args)
"Alias \"locate\" to call Emacs `locate' function."
(if (or eshell-plain-locate-behavior
@@ -971,12 +999,16 @@
(let ((locate-history-list (list (car args))))
(locate-with-filter (car args) (cadr args))))))
+(put 'eshell/locate 'eshell-no-numeric-conversions t)
+
(defun eshell/occur (&rest args)
"Alias \"occur\" to call Emacs `occur' function."
(let ((inhibit-read-only t))
- (if args
- (error "usage: occur: (REGEXP)")
- (occur (car args)))))
+ (if (> (length args) 2)
+ (error "usage: occur: (REGEXP &optional NLINES)")
+ (apply 'occur args))))
+
+(put 'eshell/occur 'eshell-no-numeric-conversions t)
;;; Code:
Index: em-xtra.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/em-xtra.el,v
retrieving revision 1.1
diff -u -r1.1 em-xtra.el
--- em-xtra.el 2001/01/10 02:52:51 1.1
+++ em-xtra.el 2008/08/19 15:55:04
@@ -1,6 +1,7 @@
-;;; em-xtra --- extra alias functions
+;;; em-xtra.el --- extra alias functions
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'em-xtra)
Index: esh-arg.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/esh-arg.el,v
retrieving revision 1.2
diff -u -r1.2 esh-arg.el
--- esh-arg.el 2008/07/10 20:08:20 1.2
+++ esh-arg.el 2008/08/19 15:55:04
@@ -1,6 +1,7 @@
-;;; esh-arg --- argument processing
+;;; esh-arg.el --- argument processing
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'esh-arg)
@@ -52,7 +53,10 @@
(looking-at eshell-number-regexp)
(eshell-arg-delimiter (match-end 0)))
(goto-char (match-end 0))
- (string-to-number (match-string 0)))))
+ (let ((str (match-string 0)))
+ (if (> (length str) 0)
+ (add-text-properties 0 1 '(number t) str))
+ str))))
;; parse any non-special characters, based on the current context
(function
@@ -342,8 +346,10 @@
(save-restriction
(forward-char)
(narrow-to-region (point) end)
- (list 'eshell-escape-arg
- (eshell-parse-argument)))
+ (let ((arg (eshell-parse-argument)))
+ (if (eq arg nil)
+ ""
+ (list 'eshell-escape-arg arg))))
(goto-char (1+ end)))))))
(defun eshell-parse-special-reference ()
Index: esh-cmd.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/esh-cmd.el,v
retrieving revision 1.1
diff -u -r1.1 esh-cmd.el
--- esh-cmd.el 2001/01/10 02:52:53 1.1
+++ esh-cmd.el 2008/08/19 15:55:04
@@ -1,6 +1,7 @@
-;;; esh-cmd --- command invocation
+;;; esh-cmd.el --- command invocation
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'esh-cmd)
@@ -30,7 +31,7 @@
pressing <RET>. There are several different kinds of commands,
however."
:tag "Command invocation"
-:link '(info-link "(eshell)Command invocation")
+ ;; :link '(info-link "(eshell)Command invocation")
:group 'eshell)
;;; Commentary:
@@ -295,28 +296,24 @@
(set (make-local-variable 'eshell-last-command-name) nil)
(set (make-local-variable 'eshell-last-async-proc) nil)
- (make-local-hook 'eshell-kill-hook)
(add-hook 'eshell-kill-hook 'eshell-resume-command nil t)
;; make sure that if a command is over, and no process is being
;; waited for, that `eshell-current-command' is set to nil. This
;; situation can occur, for example, if a Lisp function results in
;; `debug' being called, and the user then types \\[top-level]
- (make-local-hook 'eshell-post-command-hook)
(add-hook 'eshell-post-command-hook
(function
(lambda ()
(setq eshell-current-command nil
eshell-last-async-proc nil))) nil t)
- (make-local-hook 'eshell-parse-argument-hook)
(add-hook 'eshell-parse-argument-hook
'eshell-parse-subcommand-argument nil t)
(add-hook 'eshell-parse-argument-hook
'eshell-parse-lisp-argument nil t)
(when (eshell-using-module 'eshell-cmpl)
- (make-local-hook 'pcomplete-try-first-hook)
(add-hook 'pcomplete-try-first-hook
'eshell-complete-lisp-symbols nil t)))
@@ -456,12 +453,14 @@
(defun eshell-rewrite-named-command (terms)
"If no other rewriting rule transforms TERMS, assume a named command."
- (list (if eshell-in-pipeline-p
- 'eshell-named-command*
- 'eshell-named-command)
- (car terms)
- (and (cdr terms)
- (append (list 'list) (cdr terms)))))
+ (let ((sym (if eshell-in-pipeline-p
+ 'eshell-named-command*
+ 'eshell-named-command))
+ (cmd (car terms))
+ (args (cdr terms)))
+ (if args
+ (list sym cmd (append (list 'list) (cdr terms)))
+ (list sym cmd))))
(eshell-deftest cmd named-command
"Execute named command"
@@ -498,7 +497,7 @@
(defun eshell-rewrite-for-command (terms)
"Rewrite a `for' command into its equivalent Eshell command form.
Because the implementation of `for' relies upon conditional evaluation
-of its argumbent (i.e., use of a Lisp special form), it must be
+of its argument (i.e., use of a Lisp special form), it must be
implemented via rewriting, rather than as a function."
(if (and (stringp (car terms))
(string= (car terms) "for")
@@ -613,10 +612,10 @@
(eshell-invokify-arg (cadr terms) nil t)
(list 'eshell-protect
(eshell-invokify-arg
- (if (= (length terms) 5)
- (car (last terms 3))
+ (if (= (length terms) 4)
+ (car (last terms 2))
(car (last terms))) t))
- (if (= (length terms) 5)
+ (if (= (length terms) 4)
(list 'eshell-protect
(eshell-invokify-arg
(car (last terms)))) t))))
@@ -625,7 +624,9 @@
"Return non-nil if the last command was \"successful\".
For a bit of Lisp code, this means a return value of non-nil.
For an external command, it means an exit code of 0."
- (if (string= eshell-last-command-name "#<Lisp>")
+ (if (save-match-data
+ (string-match "#<\\(Lisp object\\|function .*\\)>"
+ eshell-last-command-name))
eshell-last-command-result
(= eshell-last-command-status 0)))
@@ -711,7 +712,7 @@
reversed last-terms-sym)
"Separate TERMS using SEPARATOR.
If REVERSED is non-nil, the list of separated term groups will be
-returned in reverse order. If LAST-TERMS-SYM is a symbol, it's value
+returned in reverse order. If LAST-TERMS-SYM is a symbol, its value
will be set to a list of all the separator operators found (or '(list
nil)' if none)."
(let ((sub-terms (list t))
@@ -759,7 +760,7 @@
(defmacro eshell-do-subjob (object)
"Evaluate a command OBJECT as a subjob.
-We indicate thet the process was run in the background by returned it
+We indicate that the process was run in the background by returning it
ensconced in a list."
`(let ((eshell-current-subjob-p t))
,object))
@@ -1006,11 +1007,12 @@
(setq eshell-current-command command)
(let ((delim (catch 'eshell-incomplete
(eshell-resume-eval))))
- (if delim
- (error "Unmatched delimiter: %c"
- (if (listp delim)
- (car delim)
- delim))))))
+ ;; On systems that don't support async subprocesses, eshell-resume
+ ;; can return t. Don't treat that as an error.
+ (if (listp delim)
+ (setq delim (car delim)))
+ (if (and delim (not (eq delim t)))
+ (error "Unmatched delimiter: %c" delim)))))
(defun eshell-resume-command (proc status)
"Resume the current command when a process ends."
@@ -1060,7 +1062,7 @@
object)
(defconst function-p-func
- (if (eshell-under-xemacs-p)
+ (if (fboundp 'compiled-function-p)
'compiled-function-p
'byte-code-function-p))
@@ -1231,7 +1233,7 @@
"Identify the COMMAND, and where it is located."
(eshell-for name (cons command names)
(let (program alias direct)
- (if (eq (aref name 0) ?*)
+ (if (eq (aref name 0) eshell-explicit-command-char)
(setq name (substring name 1)
direct t))
(if (and (not direct)
@@ -1246,9 +1248,8 @@
(setq program (eshell-search-path name))
(let* ((esym (eshell-find-alias-function name))
(sym (or esym (intern-soft name))))
- (if (and sym (fboundp sym)
- (or esym eshell-prefer-lisp-functions
- (not program)))
+ (if (and (or esym (and sym (fboundp sym)))
+ (or eshell-prefer-lisp-functions (not direct)))
(let ((desc (let ((inhibit-redisplay t))
(save-window-excursion
(prog1
@@ -1265,6 +1266,8 @@
name (getenv "PATH")))
(eshell-printn program)))))
+(put 'eshell/which 'eshell-no-numeric-conversions t)
+
(defun eshell-named-command (command &optional args)
"Insert output from a plain COMMAND, using ARGS.
COMMAND may result in an alias being executed, or a plain command."
@@ -1284,20 +1287,23 @@
(defun eshell-find-alias-function (name)
"Check whether a function called `eshell/NAME' exists."
(let* ((sym (intern-soft (concat "eshell/" name)))
- (file (symbol-file sym))
- module-sym)
+ (file (symbol-file sym 'defun)))
+ ;; If the function exists, but is defined in an eshell module
+ ;; that's not currently enabled, don't report it as found
(if (and file
(string-match "\\(em\\|esh\\)-\\(.*\\)\\(\\.el\\)?\\'" file))
- (setq file (concat "eshell-" (match-string 2 file))))
- (setq module-sym
- (and sym file (fboundp 'symbol-file)
+ (let ((module-sym
(intern (file-name-sans-extension
- (file-name-nondirectory file)))))
- (and sym (functionp sym)
- (or (not module-sym)
- (eshell-using-module module-sym)
- (memq module-sym (eshell-subgroups 'eshell)))
- sym)))
+ (file-name-nondirectory
+ (concat "eshell-" (match-string 2 file)))))))
+ (if (and (functionp sym)
+ (or (null module-sym)
+ (eshell-using-module module-sym)
+ (memq module-sym (eshell-subgroups 'eshell))))
+ sym))
+ ;; Otherwise, if it's bound, return it.
+ (if (functionp sym)
+ sym))))
(defun eshell-plain-command (command args)
"Insert output from a plain COMMAND, using ARGS.
@@ -1380,13 +1386,28 @@
(defun eshell-lisp-command (object &optional args)
"Insert Lisp OBJECT, using ARGS if a function."
- (setq eshell-last-arguments args
- eshell-last-command-name "#<Lisp>")
(catch 'eshell-external ; deferred to an external command
(let* ((eshell-ensure-newline-p (eshell-interactive-output-p))
(result
(if (functionp object)
- (eshell-apply object args)
+ (progn
+ (setq eshell-last-arguments args
+ eshell-last-command-name
+ (concat "#<function " (symbol-name object) ">"))
+ ;; if any of the arguments are flagged as numbers
+ ;; waiting for conversion, convert them now
+ (unless (get object 'eshell-no-numeric-conversions)
+ (while args
+ (let ((arg (car args)))
+ (if (and (stringp arg)
+ (> (length arg) 0)
+ (not (text-property-not-all
+ 0 (length arg) 'number t arg)))
+ (setcar args (string-to-number arg))))
+ (setq args (cdr args))))
+ (eshell-apply object eshell-last-arguments))
+ (setq eshell-last-arguments args
+ eshell-last-command-name "#<Lisp object>")
(eshell-eval object))))
(if (and eshell-ensure-newline-p
(save-excursion
Index: esh-ext.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/esh-ext.el,v
retrieving revision 1.2
diff -u -r1.2 esh-ext.el
--- esh-ext.el 2002/03/24 20:13:49 1.2
+++ esh-ext.el 2008/08/19 15:55:06
@@ -1,6 +1,7 @@
-;;; esh-ext --- commands external to Eshell
+;;; esh-ext.el --- commands external to Eshell
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,12 +19,13 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'esh-ext)
(eval-when-compile (require 'esh-maint))
+(require 'esh-util)
(defgroup eshell-ext nil
"External commands are invoked when operating system executables are
@@ -48,6 +50,8 @@
:type 'hook
:group 'eshell-ext)
+;; XEmacs specific, GNU have a 'exec-suffixes implemented in C source
+;; code, but XEmacs dont.
(defcustom eshell-binary-suffixes
(if (eshell-under-windows-p)
'(".exe" ".com" ".bat" ".cmd"
"")
@@ -93,12 +97,12 @@
(if (string-match "\\(\\`cmdproxy\\|sh\\)\\.\\(com\\|exe\\)"
shell-file-name)
(or (eshell-search-path "cmd.exe")
- (eshell-search-path "command.exe"))
+ (eshell-search-path "command.com"))
shell-file-name))
"*The name of the shell command to use for DOS/Windows batch files.
This defaults to nil on non-Windows systems, where this variable is
wholly ignored."
-:type 'file
+:type '(choice file (const nil))
:group 'eshell-ext)
(defsubst eshell-invoke-batch-file (&rest args)
@@ -150,18 +154,24 @@
:type 'integer
:group 'eshell-ext)
+(defcustom eshell-explicit-command-char ?*
+ "*If this char occurs before a command name, call it externally.
+That is, although `vi' may be an alias, `\vi' will always call the
+external version."
+:type 'character
+:group 'eshell-ext)
+
;;; Functions:
(defun eshell-ext-initialize ()
"Initialize the external command handling code."
- (make-local-hook 'eshell-named-command-hook)
(add-hook 'eshell-named-command-hook 'eshell-explicit-command nil t))
(defun eshell-explicit-command (command args)
"If a command name begins with `*', call it externally always.
This bypasses all Lisp functions and aliases."
(when (and (> (length command) 1)
- (eq (aref command 0) ?*))
+ (eq (aref command 0) eshell-explicit-command-char))
(let ((cmd (eshell-search-path (substring command 1))))
(if cmd
(or (eshell-external-command cmd args)
@@ -241,6 +251,8 @@
(eshell-printn (car paths))
(setq paths (cdr paths)))))))
+(put 'eshell/addpath 'eshell-no-numeric-conversions t)
+
(defun eshell-script-interpreter (file)
"Extract the script to run from FILE, if it has #!<interp> in it.
Return nil, or a list of the form:
@@ -251,7 +263,7 @@
(file-regular-p file))
(with-temp-buffer
(insert-file-contents-literally file nil 0 maxlen)
- (if (looking-at "#!\\([^ \t\n]+\\)\\([ \t]+\\(.+\\)\\)?")
+ (if (looking-at "#![ \t]*\\([^ \r\t\n]+\\)\\([ \t]+\\(.+\\)\\)?")
(if (match-string 3)
(list (match-string 1)
(match-string 3)
Index: esh-io.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/esh-io.el,v
retrieving revision 1.1
diff -u -r1.1 esh-io.el
--- esh-io.el 2001/01/10 02:52:54 1.1
+++ esh-io.el 2008/08/19 15:55:06
@@ -1,6 +1,7 @@
-;;; esh-io --- I/O management
+;;; esh-io.el --- I/O management
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'esh-io)
@@ -169,14 +170,11 @@
(defun eshell-io-initialize ()
"Initialize the I/O subsystem code."
- (make-local-hook 'eshell-parse-argument-hook)
(add-hook 'eshell-parse-argument-hook
'eshell-parse-redirection nil t)
(make-local-variable 'eshell-current-redirections)
- (make-local-hook 'eshell-pre-rewrite-command-hook)
(add-hook 'eshell-pre-rewrite-command-hook
'eshell-strip-redirections nil t)
- (make-local-hook 'eshell-post-rewrite-command-hook)
(add-hook 'eshell-post-rewrite-command-hook
'eshell-apply-redirections nil t))
@@ -195,7 +193,7 @@
(eshell-finish-arg
(prog1
(list 'eshell-set-output-handle
- (or (and sh (string-to-int sh)) 1)
+ (or (and sh (string-to-number sh)) 1)
(list 'quote
(aref [overwrite append insert]
(1- (length oper)))))
@@ -336,26 +334,28 @@
(cond
((stringp target)
(let ((redir (assoc target eshell-virtual-targets)))
- (if redir
- (if (nth 2 redir)
- (funcall (nth 1 redir) mode)
- (nth 1 redir))
- (let* ((exists (get-file-buffer target))
- (buf (find-file-noselect target t)))
- (with-current-buffer buf
- (if buffer-read-only
- (error "Cannot write to read-only file `%s'" target))
- (set (make-local-variable 'eshell-output-file-buffer)
- (if (eq exists buf) 0 t))
- (cond ((eq mode 'overwrite)
- (erase-buffer))
- ((eq mode 'append)
- (goto-char (point-max))))
- (point-marker))))))
+ (if redir
+ (if (nth 2 redir)
+ (funcall (nth 1 redir) mode)
+ (nth 1 redir))
+ (let* ((exists (get-file-buffer target))
+ (buf (find-file-noselect target t)))
+ (with-current-buffer buf
+ (if buffer-read-only
+ (error "Cannot write to read-only file `%s'" target))
+ (set (make-local-variable 'eshell-output-file-buffer)
+ (if (eq exists buf) 0 t))
+ (cond ((eq mode 'overwrite)
+ (erase-buffer))
+ ((eq mode 'append)
+ (goto-char (point-max))))
+ (point-marker))))))
+
((or (bufferp target)
(and (boundp 'eshell-buffer-shorthand)
(symbol-value 'eshell-buffer-shorthand)
- (symbolp target)))
+ (symbolp target)
+ (not (memq target '(t nil)))))
(let ((buf (if (bufferp target)
target
(get-buffer-create
@@ -366,17 +366,20 @@
((eq mode 'append)
(goto-char (point-max))))
(point-marker))))
- ((functionp target)
- nil)
+
+ ((functionp target) nil)
+
((symbolp target)
(if (eq mode 'overwrite)
(set target nil))
target)
+
((or (eshell-processp target)
(markerp target))
target)
+
(t
- (error "Illegal redirection target: %s"
+ (error "Invalid redirection target: %s"
(eshell-stringify target)))))
(eval-when-compile
@@ -399,7 +402,7 @@
(if (and (listp current)
(not (member where current)))
(setq current (append current (list where)))
- (setq current where))
+ (setq current (list where)))
(if (not (aref eshell-current-handles index))
(aset eshell-current-handles index (cons nil 1)))
(setcar (aref eshell-current-handles index) current)))))
@@ -484,7 +487,8 @@
(let ((moving (= (point) target)))
(save-excursion
(goto-char target)
- (setq object (eshell-stringify object))
+ (unless (stringp object)
+ (setq object (eshell-stringify object)))
(insert-and-inherit object)
(set-marker target (point-marker)))
(if moving
@@ -492,7 +496,8 @@
((eshell-processp target)
(when (eq (process-status target) 'run)
- (setq object (eshell-stringify object))
+ (unless (stringp object)
+ (setq object (eshell-stringify object)))
(process-send-string target object)))
((consp target)
Index: esh-maint.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/esh-maint.el,v
retrieving revision 1.1
diff -u -r1.1 esh-maint.el
--- esh-maint.el 2001/01/10 02:52:55 1.1
+++ esh-maint.el 2008/08/19 15:55:06
@@ -1,6 +1,7 @@
-;;; esh-maint --- init code for building eshell
+;;; esh-maint.el --- init code for building eshell -*- no-byte-compile: t -*-
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
@@ -34,8 +35,6 @@
("(eshell-deftest\\>" . font-lock-keyword-face)
("(eshell-condition-case\\>" . font-lock-keyword-face))))
-(add-to-list 'load-path ".")
-
(if (file-directory-p "../pcomplete")
(add-to-list 'load-path "../pcomplete"))
@@ -46,101 +45,101 @@
(require 'cl)
(setq cl-optimize-speed 9))
-(defun eshell-generate-autoloads ()
- (interactive)
- (require 'autoload)
- (setq generated-autoload-file
- (expand-file-name (car command-line-args-left)))
- (setq command-line-args-left (cdr command-line-args-left))
- (batch-update-autoloads))
+;; (defun eshell-generate-autoloads ()
+;; (interactive)
+;; (require 'autoload)
+;; (setq generated-autoload-file
+;; (expand-file-name (car command-line-args-left)))
+;; (setq command-line-args-left (cdr command-line-args-left))
+;; (batch-update-autoloads))
(require 'eshell)
(require 'esh-mode) ; brings in eshell-util
(require 'esh-opt)
(require 'esh-test)
-(defun eshell-generate-main-menu ()
- "Create the main menu for the eshell documentation."
- (insert "@menu
- * The Emacs shell:: eshell.
-
- Core Functionality\n")
- (eshell-for module
- (sort (eshell-subgroups 'eshell)
- (function
- (lambda (a b)
- (string-lessp (symbol-name a)
- (symbol-name b)))))
- (insert (format "* %-34s"
- (concat (get module 'custom-tag) "::"))
- (symbol-name module) ".\n"))
- (insert "\nOptional Functionality\n")
- (eshell-for module
- (sort (eshell-subgroups 'eshell-module)
- (function
- (lambda (a b)
- (string-lessp (symbol-name a)
- (symbol-name b)))))
- (insert (format "* %-34s"
- (concat (get module 'custom-tag) "::"))
- (symbol-name module) ".\n"))
- (insert "@end menu\n"))
-
-(defun eshell-make-texi ()
- "Make the eshell.texi file."
- (interactive)
- (require 'eshell-auto)
- (require 'texidoc)
- (require 'pcomplete)
- (apply 'texidoc-files 'eshell-generate-main-menu "eshell.doci"
- (append
- (list "eshell.el")
- (sort (mapcar
- (function
- (lambda (sym)
- (let ((name (symbol-name sym)))
- (if (string-match "\\`eshell-\\(.*\\)" name)
- (setq name (concat "esh-" (match-string 1 name))))
- (concat name ".el"))))
- (eshell-subgroups 'eshell))
- 'string-lessp)
- (sort (mapcar
- (function
- (lambda (sym)
- (let ((name (symbol-name sym)))
- (if (string-match "\\`eshell-\\(.*\\)" name)
- (setq name (concat "em-" (match-string 1 name))))
- (concat name ".el"))))
- (eshell-subgroups 'eshell-module))
- 'string-lessp)
- (list "eshell.texi"))))
-
-(defun eshell-make-readme ()
- "Make the README file from eshell.el."
- (interactive)
- (require 'eshell-auto)
- (require 'texidoc)
- (require 'pcomplete)
- (texidoc-files nil "eshell.doci" "eshell.el"
"README.texi")
- (set-buffer (get-buffer "README.texi"))
- (goto-char (point-min))
- (search-forward "@chapter")
- (beginning-of-line)
- (forward-line -1)
- (kill-line 2)
- (re-search-forward "^@section User Options")
- (beginning-of-line)
- (delete-region (point) (point-max))
- (insert "@bye\n")
- (save-buffer)
- (with-temp-buffer
- (call-process "makeinfo" nil t nil "--no-headers"
"README.texi")
- (goto-char (point-min))
- (search-forward "The Emacs Shell")
- (beginning-of-line)
- (delete-region (point-min) (point))
- (write-file "README"))
- (delete-file "README.texi")
- (kill-buffer "README.texi"))
+;; (defun eshell-generate-main-menu ()
+;; "Create the main menu for the eshell documentation."
+;; (insert "@menu
+;; * The Emacs shell:: eshell.
+
+;; Core Functionality\n")
+;; (eshell-for module
+;; (sort (eshell-subgroups 'eshell)
+;; (function
+;; (lambda (a b)
+;; (string-lessp (symbol-name a)
+;; (symbol-name b)))))
+;; (insert (format "* %-34s"
+;; (concat (get module 'custom-tag) "::"))
+;; (symbol-name module) ".\n"))
+;; (insert "\nOptional Functionality\n")
+;; (eshell-for module
+;; (sort (eshell-subgroups 'eshell-module)
+;; (function
+;; (lambda (a b)
+;; (string-lessp (symbol-name a)
+;; (symbol-name b)))))
+;; (insert (format "* %-34s"
+;; (concat (get module 'custom-tag) "::"))
+;; (symbol-name module) ".\n"))
+;; (insert "@end menu\n"))
+
+;; (defun eshell-make-texi ()
+;; "Make the eshell.texi file."
+;; (interactive)
+;; (require 'eshell-auto)
+;; (require 'texidoc)
+;; (require 'pcomplete)
+;; (apply 'texidoc-files 'eshell-generate-main-menu "eshell.doci"
+;; (append
+;; (list "eshell.el")
+;; (sort (mapcar
+;; (function
+;; (lambda (sym)
+;; (let ((name (symbol-name sym)))
+;; (if (string-match "\\`eshell-\\(.*\\)" name)
+;; (setq name (concat "esh-" (match-string 1 name))))
+;; (concat name ".el"))))
+;; (eshell-subgroups 'eshell))
+;; 'string-lessp)
+;; (sort (mapcar
+;; (function
+;; (lambda (sym)
+;; (let ((name (symbol-name sym)))
+;; (if (string-match "\\`eshell-\\(.*\\)" name)
+;; (setq name (concat "em-" (match-string 1 name))))
+;; (concat name ".el"))))
+;; (eshell-subgroups 'eshell-module))
+;; 'string-lessp)
+;; (list "eshell.texi"))))
+
+;; (defun eshell-make-readme ()
+;; "Make the README file from eshell.el."
+;; (interactive)
+;; (require 'eshell-auto)
+;; (require 'texidoc)
+;; (require 'pcomplete)
+;; (texidoc-files nil "eshell.doci" "eshell.el"
"README.texi")
+;; (set-buffer (get-buffer "README.texi"))
+;; (goto-char (point-min))
+;; (search-forward "@chapter")
+;; (beginning-of-line)
+;; (forward-line -1)
+;; (kill-line 2)
+;; (re-search-forward "^@section User Options")
+;; (beginning-of-line)
+;; (delete-region (point) (point-max))
+;; (insert "@bye\n")
+;; (save-buffer)
+;; (with-temp-buffer
+;; (call-process "makeinfo" nil t nil "--no-headers"
"README.texi")
+;; (goto-char (point-min))
+;; (search-forward "The Emacs Shell")
+;; (beginning-of-line)
+;; (delete-region (point-min) (point))
+;; (write-file "README"))
+;; (delete-file "README.texi")
+;; (kill-buffer "README.texi"))
;;; esh-maint.el ends here
Index: esh-mode.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/esh-mode.el,v
retrieving revision 1.3
diff -u -r1.3 esh-mode.el
--- esh-mode.el 2005/06/26 19:17:11 1.3
+++ esh-mode.el 2008/08/19 15:55:07
@@ -1,6 +1,7 @@
-;;; esh-mode --- user interface
+;;; esh-mode.el --- user interface
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,9 +19,11 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+;;; Code:
+
(provide 'esh-mode)
(eval-when-compile (require 'esh-maint))
@@ -188,7 +191,7 @@
(defcustom eshell-skip-prompt-function nil
"*A function called from beginning of line to skip the prompt."
-:type 'function
+:type '(choice (const nil) function)
:group 'eshell-mode)
(defcustom eshell-status-in-modeline t
@@ -196,11 +199,6 @@
:type 'boolean
:group 'eshell-mode)
-(defvar eshell-non-interactive-p nil
- "A variable which is non-nil when Eshell is not running interactively.
-Modules should use this variable so that they don't clutter non-interactive
-sessions, such as when using `eshell-command'.")
-
(defvar eshell-first-time-p t
"A variable which is non-nil the first time Eshell is loaded.")
@@ -310,7 +308,7 @@
(when eshell-status-in-modeline
(make-local-variable 'eshell-command-running-string)
- (let ((fmt (eshell-copy-list mode-line-format)))
+ (let ((fmt (copy-sequence mode-line-format)))
(make-local-variable 'mode-line-format)
(setq mode-line-format fmt))
(let ((modeline (memq 'mode-line-modified mode-line-format)))
@@ -387,7 +385,7 @@
(set (make-local-variable 'eshell-last-output-end) (point-marker))
(set (make-local-variable 'eshell-last-output-block-begin) (point))
- (let ((modules-list (eshell-copy-list eshell-modules-list)))
+ (let ((modules-list (copy-sequence eshell-modules-list)))
(make-local-variable 'eshell-modules-list)
(setq eshell-modules-list modules-list))
@@ -420,8 +418,6 @@
(if (and load-hook (boundp load-hook))
(run-hooks load-hook))))
- (make-local-hook 'pre-command-hook)
-
(if eshell-send-direct-to-subprocesses
(add-hook 'pre-command-hook 'eshell-intercept-commands t t))
@@ -432,12 +428,9 @@
(set (make-local-variable 'scroll-conservatively) 1000))
(when eshell-status-in-modeline
- (make-local-hook 'eshell-pre-command-hook)
(add-hook 'eshell-pre-command-hook 'eshell-command-started nil t)
- (make-local-hook 'eshell-post-command-hook)
(add-hook 'eshell-post-command-hook 'eshell-command-finished nil t))
- (make-local-hook 'kill-buffer-hook)
(add-hook 'kill-buffer-hook
(function
(lambda ()
@@ -445,7 +438,7 @@
(if eshell-first-time-p
(run-hooks 'eshell-first-time-mode-hook))
- (run-hooks 'eshell-mode-hook)
+ (run-mode-hooks 'eshell-mode-hook)
(run-hooks 'eshell-post-command-hook))
(put 'eshell-mode 'mode-class 'special)
@@ -498,9 +491,7 @@
(process-send-string
(eshell-interactive-process)
(char-to-string (if (symbolp last-command-char)
- (if (fboundp 'get-character-of-keysym)
- (get-character-of-keysym last-command-char)
- (get last-command-char 'ascii-character))
+ (get last-command-char 'ascii-character)
last-command-char))))
(defun eshell-intercept-commands ()
@@ -529,7 +520,8 @@
(let ((inhibit-read-only t)
(no-default (eobp))
(find-tag-default-function 'ignore))
- (setq tagname (car (find-tag-interactive "Find tag: ")))
+ (with-no-warnings
+ (setq tagname (car (find-tag-interactive "Find tag: "))))
(find-tag tagname next-p regexp-p)))
(defun eshell-move-argument (limit func property arg)
@@ -675,7 +667,7 @@
(eshell-match-result "alpha\n"))
(defun eshell-send-input (&optional use-region queue-p no-newline)
- "Send the input received to Eshell for parsing and processing..
+ "Send the input received to Eshell for parsing and processing.
After `eshell-last-output-end', sends all text from that marker to
point as input. Before that marker, calls `eshell-get-old-input' to
retrieve old input, copies it to the end of the buffer, and sends it.
@@ -752,19 +744,19 @@
(run-hooks 'eshell-post-command-hook)
(insert-and-inherit input)))))))))
-(eshell-deftest proc send-to-subprocess
- "Send input to a subprocess"
- ;; jww (1999-12-06): what about when bc is unavailable?
- (if (not (eshell-search-path "bc"))
- t
- (eshell-insert-command "bc")
- (eshell-insert-command "1 + 2")
- (sit-for 1 0)
- (forward-line -1)
- (prog1
- (looking-at "3\n")
- (eshell-insert-command "quit")
- (sit-for 1 0))))
+; (eshell-deftest proc send-to-subprocess
+; "Send input to a subprocess"
+; ;; jww (1999-12-06): what about when bc is unavailable?
+; (if (not (eshell-search-path "bc"))
+; t
+; (eshell-insert-command "bc")
+; (eshell-insert-command "1 + 2")
+; (sit-for 1 0)
+; (forward-line -1)
+; (prog1
+; (looking-at "3\n")
+; (eshell-insert-command "quit")
+; (sit-for 1 0))))
(defsubst eshell-kill-new ()
"Add the last input text to the kill ring."
@@ -829,7 +821,7 @@
"Go to the end of buffer in all windows showing it.
Movement occurs if point in the selected window is not after the
process mark, and `this-command' is an insertion command. Insertion
-commands recognised are `self-insert-command', `yank', and
+commands recognized are `self-insert-command', `yank', and
`hilit-yank'. Depends on the value of
`eshell-scroll-to-bottom-on-input'.
@@ -955,10 +947,11 @@
(eshell-bol)
(kill-region (point) here))))
-(defun eshell-show-maximum-output ()
- "Put the end of the buffer at the bottom of the window."
- (interactive)
- (if (interactive-p)
+(defun eshell-show-maximum-output (&optional interactive)
+ "Put the end of the buffer at the bottom of the window.
+When run interactively, widen the buffer first."
+ (interactive "p")
+ (if interactive
(widen))
(goto-char (point-max))
(recenter -1))
@@ -1014,7 +1007,7 @@
(let ((pos (point)))
(if (bobp)
(if (interactive-p)
- (error "Buffer too short to truncate"))
+ (message "Buffer too short to truncate"))
(delete-region (point-min) (point))
(if (interactive-p)
(message "Truncated buffer from %d to %d lines (%.1fk freed)"
@@ -1024,12 +1017,12 @@
(custom-add-option 'eshell-output-filter-functions
'eshell-truncate-buffer)
-(defun send-invisible (str)
+(defun eshell-send-invisible (str)
"Read a string without echoing.
Then send it to the process running in the current buffer."
(interactive "P") ; Defeat snooping via C-x ESC ESC
(let ((str (read-passwd
- (format "Password: "
+ (format "%s Password: "
(process-name (eshell-interactive-process))))))
(if (stringp str)
(process-send-string (eshell-interactive-process)
@@ -1038,7 +1031,7 @@
(defun eshell-watch-for-password-prompt ()
"Prompt in the minibuffer for password and send without echoing.
-This function uses `send-invisible' to read and send a password to the
+This function uses `eshell-send-invisible' to read and send a password to the
buffer's process if STRING contains a password prompt defined by
`eshell-password-prompt-regexp'.
@@ -1049,7 +1042,7 @@
(beginning-of-line)
(if (re-search-forward eshell-password-prompt-regexp
eshell-last-output-end t)
- (send-invisible nil)))))
+ (eshell-send-invisible nil)))))
(custom-add-option 'eshell-output-filter-functions
'eshell-watch-for-password-prompt)
@@ -1087,6 +1080,13 @@
(custom-add-option 'eshell-output-filter-functions
'eshell-handle-control-codes)
-;;; Code:
+(defun eshell-handle-ansi-color ()
+ "Handle ANSI color codes."
+ (require 'ansi-color)
+ (ansi-color-apply-on-region eshell-last-output-start
+ eshell-last-output-end))
+
+(custom-add-option 'eshell-output-filter-functions
+ 'eshell-handle-ansi-color)
;;; esh-mode.el ends here
Index: esh-module.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/esh-module.el,v
retrieving revision 1.1
diff -u -r1.1 esh-module.el
--- esh-module.el 2001/01/10 02:52:57 1.1
+++ esh-module.el 2008/08/19 15:55:08
@@ -1,6 +1,7 @@
-;;; esh-module --- Eshell modules
+;;; esh-module.el --- Eshell modules
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
;; Keywords: processes
@@ -19,8 +20,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'esh-module)
@@ -41,32 +42,33 @@
(defun eshell-load-defgroups (&optional directory)
"Load `defgroup' statements from Eshell's module files."
- (with-current-buffer
- (find-file-noselect (expand-file-name "esh-groups.el" directory))
- (erase-buffer)
- (insert ";;; do not modify this file; it is auto-generated\n\n")
- (let ((files (directory-files (or directory
- (car command-line-args-left))
- nil "\\`em-.*\\.el\\'")))
- (while files
- (message "Loading defgroup from `%s'" (car files))
- (let (defgroup)
- (catch 'handled
- (with-current-buffer (find-file-noselect (car files))
- (goto-char (point-min))
- (while t
- (forward-sexp)
- (if (eobp) (throw 'handled t))
- (backward-sexp)
- (let ((begin (point))
- (defg (looking-at "(defgroup")))
+ (let ((vc-handled-backends nil)) ; avoid VC fucking things up
+ (with-current-buffer
+ (find-file-noselect (expand-file-name "esh-groups.el" directory))
+ (erase-buffer)
+ (insert ";;; do not modify this file; it is auto-generated -*-
no-byte-compile: t -*-\n\n")
+ (let ((files (directory-files (or directory
+ (car command-line-args-left))
+ nil "\\`em-.*\\.el\\'")))
+ (while files
+ (message "Loading defgroup from `%s'" (car files))
+ (let (defgroup)
+ (catch 'handled
+ (with-current-buffer (find-file-noselect (car files))
+ (goto-char (point-min))
+ (while t
(forward-sexp)
- (if defg
- (setq defgroup (buffer-substring begin (point))))))))
- (if defgroup
- (insert defgroup "\n\n")))
- (setq files (cdr files))))
- (save-buffer)))
+ (if (eobp) (throw 'handled t))
+ (backward-sexp)
+ (let ((begin (point))
+ (defg (looking-at "(defgroup")))
+ (forward-sexp)
+ (if defg
+ (setq defgroup (buffer-substring begin (point))))))))
+ (if defgroup
+ (insert defgroup "\n\n")))
+ (setq files (cdr files))))
+ (save-buffer))))
;; load the defgroup's for the standard extension modules, so that
;; documentation can be provided when the user customize's
Index: esh-opt.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/esh-opt.el,v
retrieving revision 1.1
diff -u -r1.1 esh-opt.el
--- esh-opt.el 2001/01/10 02:52:57 1.1
+++ esh-opt.el 2008/08/19 15:55:08
@@ -1,6 +1,7 @@
-;;; esh-opt --- command options processing
+;;; esh-opt.el --- command options processing
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'esh-opt)
@@ -98,7 +99,7 @@
last-value (eval (append (list 'progn)
body-forms)))
nil))
- (error usage-msg))))
+ (error "%s" usage-msg))))
(throw 'eshell-external
(eshell-external-command ext-command args))
last-value))
Index: esh-proc.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/esh-proc.el,v
retrieving revision 1.1
diff -u -r1.1 esh-proc.el
--- esh-proc.el 2001/01/10 02:52:58 1.1
+++ esh-proc.el 2008/08/19 15:55:09
@@ -1,6 +1,7 @@
-;;; esh-proc --- process management
+;;; esh-proc.el --- process management
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'esh-proc)
@@ -118,9 +119,9 @@
(define-key eshell-command-map [(control ?c)] 'eshell-interrupt-process)
(define-key eshell-command-map [(control ?k)] 'eshell-kill-process)
(define-key eshell-command-map [(control ?d)] 'eshell-send-eof-to-process)
- (define-key eshell-command-map [(control ?q)] 'eshell-continue-process)
+; (define-key eshell-command-map [(control ?q)] 'eshell-continue-process)
(define-key eshell-command-map [(control ?s)] 'list-processes)
- (define-key eshell-command-map [(control ?z)] 'eshell-stop-process)
+; (define-key eshell-command-map [(control ?z)] 'eshell-stop-process)
(define-key eshell-command-map [(control ?\\)] 'eshell-quit-process))
(defun eshell-reset-after-proc (proc status)
@@ -180,7 +181,7 @@
(setq signum (abs (string-to-number id))))
((stringp id)
(let (case-fold-search)
- (if (string-match "^-\\([A-Z]+\\)$" id)
+ (if (string-match "^-\\([A-Z]+[12]?\\)$" id)
(setq signum
(intern (concat "SIG" (match-string 1 id))))
(error "kill: bad signal spec `%s'" id))))
@@ -224,8 +225,8 @@
(if (and (eshell-processp (car entry))
(nth 2 entry)
eshell-done-messages-in-minibuffer)
- (message (format "[%s]+ Done %s" (process-name (car entry))
- (process-command (car entry)))))
+ (message "[%s]+ Done %s" (process-name (car entry))
+ (process-command (car entry))))
(setq eshell-process-list
(delq entry eshell-process-list)))
@@ -480,20 +481,20 @@
(unless (eshell-process-interact 'quit-process)
(run-hook-with-args 'eshell-kill-hook nil "quit")))
-(defun eshell-stop-process ()
- "Send STOP signal to process."
- (interactive)
- (unless (eshell-process-interact 'stop-process)
- (run-hook-with-args 'eshell-kill-hook nil "stopped")))
-
-(defun eshell-continue-process ()
- "Send CONTINUE signal to process."
- (interactive)
- (unless (eshell-process-interact 'continue-process)
- ;; jww (1999-09-17): this signal is not dealt with yet. For
- ;; example, `eshell-reset' will be called, and so will
- ;; `eshell-resume-eval'.
- (run-hook-with-args 'eshell-kill-hook nil "continue")))
+;(defun eshell-stop-process ()
+; "Send STOP signal to process."
+; (interactive)
+; (unless (eshell-process-interact 'stop-process)
+; (run-hook-with-args 'eshell-kill-hook nil "stopped")))
+
+;(defun eshell-continue-process ()
+; "Send CONTINUE signal to process."
+; (interactive)
+; (unless (eshell-process-interact 'continue-process)
+; ;; jww (1999-09-17): this signal is not dealt with yet. For
+; ;; example, `eshell-reset' will be called, and so will
+; ;; `eshell-resume-eval'.
+; (run-hook-with-args 'eshell-kill-hook nil "continue")))
(defun eshell-send-eof-to-process ()
"Send EOF to process."
Index: esh-test.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/esh-test.el,v
retrieving revision 1.1
diff -u -r1.1 esh-test.el
--- esh-test.el 2001/01/10 02:52:59 1.1
+++ esh-test.el 2008/08/19 15:55:09
@@ -1,6 +1,7 @@
-;;; esh-test --- Eshell test suite
+;;; esh-test.el --- Eshell test suite
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'esh-test)
@@ -42,18 +43,22 @@
;;; User Variables:
-(defface eshell-test-ok-face
+(defface eshell-test-ok
'((((class color) (background light)) (:foreground "Green" :bold t))
(((class color) (background dark)) (:foreground "Green" :bold t)))
"*The face used to highlight OK result strings."
:group 'eshell-test)
+;; backward-compatibility alias
+(put 'eshell-test-ok-face 'face-alias 'eshell-test-ok)
-(defface eshell-test-failed-face
+(defface eshell-test-failed
'((((class color) (background light)) (:foreground "OrangeRed" :bold t))
(((class color) (background dark)) (:foreground "OrangeRed" :bold t))
(t (:bold t)))
"*The face used to highlight FAILED result strings."
:group 'eshell-test)
+;; backward-compatibility alias
+(put 'eshell-test-failed-face 'face-alias 'eshell-test-failed)
(defcustom eshell-show-usage-metrics nil
"*If non-nil, display different usage metrics for each Eshell command."
@@ -108,12 +113,10 @@
(if truth
(progn
(setq str " OK ")
- (put-text-property 0 6 'face
- 'eshell-test-ok-face str))
+ (put-text-property 0 6 'face 'eshell-test-ok str))
(setq str "FAILED")
(setq eshell-test-failures (1+ eshell-test-failures))
- (put-text-property 0 6 'face
- 'eshell-test-failed-face str))
+ (put-text-property 0 6 'face 'eshell-test-failed str))
str) "]")
(add-text-properties (line-beginning-position) (point)
(list 'test-func funcsym))
@@ -125,7 +128,7 @@
(let ((fsym (get-text-property (point) 'test-func)))
(when fsym
(let* ((def (symbol-function fsym))
- (library (locate-library (symbol-file fsym)))
+ (library (locate-library (symbol-file fsym 'defun)))
(name (substring (symbol-name fsym)
(length "eshell-test--")))
(inhibit-redisplay t))
@@ -167,13 +170,7 @@
(local-set-key [(control ?m)] 'eshell-test-goto-func)
(local-set-key [return] 'eshell-test-goto-func)
- (insert "Testing Eshell under "
- (format "GNU Emacs %s (%s%s)"
- emacs-version
- system-configuration
- (cond ((featurep 'motif) ", Motif")
- ((featurep 'x-toolkit) ", X toolkit")
- (t ""))))
+ (insert "Testing Eshell under " (emacs-version))
(switch-to-buffer test-buffer)
(delete-other-windows))
(eshell-for funcname (sort (all-completions "eshell-test--"
Index: esh-util.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/esh-util.el,v
retrieving revision 1.5
diff -u -r1.5 esh-util.el
--- esh-util.el 2007/09/04 09:00:06 1.5
+++ esh-util.el 2008/08/19 15:55:11
@@ -1,6 +1,7 @@
-;;; esh-util --- general utilities
+;;; esh-util.el --- general utilities
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'esh-util)
@@ -84,11 +85,22 @@
(defcustom eshell-convert-numeric-arguments t
"*If non-nil, converting arguments of numeric form to Lisp numbers.
Numeric form is tested using the regular expression
-`eshell-number-regexp'."
+`eshell-number-regexp'.
+
+NOTE: If you find that numeric conversions are intefering with the
+specification of filenames (for example, in calling `find-file', or
+some other Lisp function that deals with files, not numbers), add the
+following in your .emacs file:
+
+ (put 'find-file 'eshell-no-numeric-conversions t)
+
+Any function with the property `eshell-no-numeric-conversions' set to
+a non-nil value, will be passed strings, not numbers, even when an
+argument matches `eshell-number-regexp'."
:type 'boolean
:group 'eshell-util)
-(defcustom eshell-number-regexp "\\(0\\|-?[1-9][0-9]*\\(\\.[0-9]+\\)?\\)"
+(defcustom eshell-number-regexp "-?\\([0-9]*\\.\\)?[0-9]+\\(e[-0-9.]+\\)?"
"*Regular expression used to match numeric arguments.
If `eshell-convert-numeric-arguments' is non-nil, and an argument
matches this regexp, it will be converted to a Lisp number, using the
@@ -98,7 +110,7 @@
(defcustom eshell-ange-ls-uids nil
"*List of user/host/id strings, used to determine remote ownership."
-:type '(repeat (cons :tag "Host/User Pair"
+:type '(repeat (cons :tag "Host for User/UID map"
(string :tag "Hostname")
(repeat (cons :tag "User/UID List"
(string :tag "Username")
@@ -225,7 +237,7 @@
(defun eshell-sublist (l &optional n m)
"Return from LIST the N to M elements.
If N or M is nil, it means the end of the list."
- (let* ((a (eshell-copy-list l))
+ (let* ((a (copy-sequence l))
result)
(if (and m (consp (nthcdr m a)))
(setcdr (nthcdr m a) nil))
@@ -439,8 +451,8 @@
(point) (progn (end-of-line)
(point))) ":")))
(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))
+ (not (assq (string-to-number (nth 2 fields)) names)))
+ (setq names (cons (cons (string-to-number (nth 2 fields))
(nth 0 fields))
names))))
(forward-line))))
@@ -577,14 +589,20 @@
string)))
(unless (fboundp 'directory-files-and-attributes)
- (defun directory-files-and-attributes (dir &optional full match nosort)
- (documentation 'directory-files)
- (let ((dir (expand-file-name dir)) ange-cache)
+ (defun directory-files-and-attributes (directory &optional full match nosort)
+ "Return a list of names of files and their attributes in DIRECTORY.
+There are three optional arguments:
+If FULL is non-nil, return absolute file names. Otherwise return names
+ that are relative to the specified directory.
+If MATCH is non-nil, mention only file names that match the regexp MATCH.
+If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
+ NOSORT is useful if you plan to sort the result yourself."
+ (let ((directory (expand-file-name directory)) ange-cache)
(mapcar
(function
(lambda (file)
- (cons file (eshell-file-attributes (expand-file-name file dir)))))
- (directory-files dir full match nosort)))))
+ (cons file (eshell-file-attributes (expand-file-name file directory)))))
+ (directory-files directory full match nosort)))))
(eval-when-compile
(defvar ange-cache))
@@ -699,32 +717,7 @@
(setq entry nil)))))))
(or entry (funcall handler 'file-attributes file)))))
-(defun eshell-copy-list (list)
- "Return a copy of a list, which may be a dotted list.
-The elements of the list are not copied, just the list structure itself."
- (if (consp list)
- (let ((res nil))
- (while (consp list) (push (pop list) res))
- (prog1 (nreverse res) (setcdr res list)))
- (car list)))
-
-(defun eshell-copy-tree (tree &optional vecp)
- "Make a copy of TREE.
-If TREE is a cons cell, this recursively copies both its car and its cdr.
-Contrast to copy-sequence, which copies only along the cdrs. With second
-argument VECP, this copies vectors as well as conses."
- (if (consp tree)
- (let ((p (setq tree (eshell-copy-list tree))))
- (while (consp p)
- (if (or (consp (car p)) (and vecp (vectorp (car p))))
- (setcar p (eshell-copy-tree (car p) vecp)))
- (or (listp (cdr p)) (setcdr p (eshell-copy-tree (cdr p) vecp)))
- (pop p)))
- (if (and vecp (vectorp tree))
- (let ((i (length (setq tree (copy-sequence tree)))))
- (while (>= (setq i (1- i)) 0)
- (aset tree i (eshell-copy-tree (aref tree i) vecp))))))
- tree)
+(defalias 'eshell-copy-tree 'copy-tree)
(defsubst eshell-processp (proc)
"If the `processp' function does not exist, PROC is not a process."
Index: esh-var.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/esh-var.el,v
retrieving revision 1.1
diff -u -r1.1 esh-var.el
--- esh-var.el 2001/01/10 02:53:01 1.1
+++ esh-var.el 2008/08/19 15:55:11
@@ -1,6 +1,7 @@
-;;; esh-var --- handling of variables
+;;; esh-var.el --- handling of variables
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
@@ -18,8 +19,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'esh-var)
@@ -28,7 +29,7 @@
(defgroup eshell-var nil
"Variable interpolation is introduced whenever the '$' character
appears unquoted in any argument (except when that argument is
-surrounded by single quotes) . It may be used to interpolate a
+surrounded by single quotes). It may be used to interpolate a
variable value, a subcommand, or even the result of a Lisp form."
:tag "Variable handling"
:group 'eshell)
@@ -137,6 +138,11 @@
:type 'boolean
:group 'eshell-var)
+(defcustom eshell-modify-global-environment nil
+ "*If non-nil, using `export' changes Emacs's global environment."
+:type 'boolean
+:group 'eshell-var)
+
(defcustom eshell-variable-name-regexp "[A-Za-z0-9_-]+"
"*A regexp identifying what constitutes a variable name reference.
Note that this only applies for '$NAME'. If the syntax '$<NAME>'
is
@@ -199,7 +205,9 @@
"Initialize the variable handle code."
;; Break the association with our parent's environment. Otherwise,
;; changing a variable will affect all of Emacs.
- (set (make-local-variable 'process-environment) (eshell-copy-environment))
+ (unless eshell-modify-global-environment
+ (set (make-local-variable 'process-environment)
+ (eshell-copy-environment)))
(define-key eshell-command-map [(meta ?v)] 'eshell-insert-envvar)
@@ -272,7 +280,7 @@
(eshell-parse-variable))))
(defun eshell/define (var-alias definition)
- "Define an VAR-ALIAS using DEFINITION."
+ "Define a VAR-ALIAS using DEFINITION."
(if (not definition)
(setq eshell-variable-aliases-list
(delq (assoc var-alias eshell-variable-aliases-list)
@@ -293,7 +301,7 @@
nil)
(defun eshell/export (&rest sets)
- "This alias allows the 'export' command to act as bash users
expect."
+ "This alias allows the `export' command to act as bash users expect."
(while sets
(if (and (stringp (car sets))
(string-match "^\\([^=]+\\)=\\(.*\\)" (car sets)))
@@ -426,11 +434,11 @@
(eshell-parse-double-quote))))
(if name
(list 'eshell-get-variable (eval name) 'indices))))
- ((eq (char-after) ?<)
+ ((eq (char-after) ?\<)
(let ((end (eshell-find-delimiter ?\< ?\>)))
(if (not end)
(throw 'eshell-incomplete ?\<)
- (let* ((temp (make-temp-name temporary-file-directory))
+ (let* ((temp (make-temp-file temporary-file-directory))
(cmd (concat (buffer-substring (1+ (point)) end)
" > " temp)))
(prog1
@@ -564,7 +572,7 @@
(split-string value separator)))))
(cond
((< (length refs) 0)
- (error "Illegal array variable index: %s"
+ (error "Invalid array variable index: %s"
(eshell-stringify refs)))
((= (length refs) 1)
(setq value (eshell-index-value value (car refs))))
Index: eshell.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/eshell/eshell.el,v
retrieving revision 1.3
diff -u -r1.3 eshell.el
--- eshell.el 2004/06/28 21:45:14 1.3
+++ eshell.el 2008/08/19 15:55:13
@@ -1,8 +1,10 @@
-;;; eshell --- the Emacs command shell
+;;; eshell.el --- the Emacs command shell
-;; Copyright (C) 1999, 2000 Free Software Foundation
+;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw(a)gnu.org>
+;; Version: 2.4.2
;; Keywords: processes
;; This file is part of GNU Emacs.
@@ -19,8 +21,8 @@
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
(provide 'eshell)
@@ -33,7 +35,7 @@
bash, zsh, rc, 4dos; since Emacs itself is capable of handling most of
the tasks accomplished by such tools."
:tag "The Emacs shell"
-:link '(info-link "(eshell)The Emacs shell")
+:link '(info-link "(eshell)Top")
:version "21.1"
:group 'applications)
@@ -63,7 +65,7 @@
;; @ Command argument completion (tcsh, zsh)
;; @ Input history management (bash)
;; @ Intelligent output scrolling
-;; @ Psuedo-devices (such as "/dev/clip" for copying to the clipboard)
+;; @ Pseudo-devices (such as "/dev/clip" for copying to the clipboard)
;; @ Extended globbing (zsh)
;; @ Argument and globbing predication (zsh)
;; @ I/O redirection to buffers, files, symbols, processes, etc.
@@ -85,8 +87,8 @@
;;
;; You should have received a copy of the GNU General Public License
;; along with Eshell; see the file COPYING. If not, write to the Free
-;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-;; 02111-1307, USA.
+;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+;; MA 02110-1301, USA.
;;
;;;_* How to begin
;;
@@ -210,11 +212,63 @@
;; @ 4nt
;; @ csh
+;;;_* Speeding up load time
+;;
+;; If you find that Eshell loads too slowly, there is something you
+;; can do to speed it up.
+;;
+;; Create a file, named /tmp/elc, containing this filelist:
+;;
+;; esh-util.elc
+;; eshell.elc
+;; esh-module.elc
+;; esh-var.elc
+;; esh-proc.elc
+;; esh-arg.elc
+;; esh-io.elc
+;; esh-ext.elc
+;; esh-cmd.elc
+;; esh-mode.elc
+;; esh-opt.elc
+;; em-alias.elc
+;; em-banner.elc
+;; em-basic.elc
+;; em-cmpl.elc
+;; em-dirs.elc
+;; em-pred.elc
+;; em-glob.elc
+;; em-hist.elc
+;; em-ls.elc
+;; em-prompt.elc
+;; em-rebind.elc
+;; em-script.elc
+;; em-smart.elc
+;; em-term.elc
+;; em-unix.elc
+;; em-xtra.elc
+;;
+;; The order is very important. Remove from the filelist any features
+;; you don't use. These all begin with "em-". If you don't use
+;; Eshell's key rebinding module, you can remove "em-rebind.elc" from
+;; the filelist. The modules you are currently using are listed in
+;; `eshell-modules-list'.
+;;
+;; Now, concatenating all of the above mentioned .elc files, in that
+;; order, to another file. Here is how to do this on UNIX:
+;;
+;; cat `cat /tmp/elc` > tmp.elc ; mv tmp.elc eshell.elc
+;;
+;; Now your eshell.elc file contains all of the .elc files that make
+;; up Eshell, in the right load order. When you next load Eshell, it
+;; will only have to read in this one file, which will greatly speed
+;; things up.
+
;;;_* User Options
;;
;; The following user options modify the behavior of Eshell overall.
-(load "esh-util" nil t)
+(unless (featurep 'esh-util)
+ (load "esh-util" nil t))
(defsubst eshell-add-to-window-buffer-names ()
"Add `eshell-buffer-name' to `same-window-buffer-names'."
@@ -254,7 +308,6 @@
"`eshell-buffer-name' is a member of `same-window-buffer-names'"
(member eshell-buffer-name same-window-buffer-names))
-;;;###autoload
(defcustom eshell-directory-name (convert-standard-filename "~/.eshell/")
"*The directory where Eshell control files should be kept."
:type 'directory
@@ -270,6 +323,7 @@
(= (file-modes eshell-directory-name)
eshell-private-directory-modes)))
+;; XEmacs Specific
(defcustom eshell-prefer-to-shell nil
"*If non-nil, \\[shell-command] will use Eshell instead of shell-mode."
:set (lambda (symbol value)
@@ -300,13 +354,20 @@
The buffer used for Eshell sessions is determined by the value of
`eshell-buffer-name'. If there is already an Eshell session active in
that buffer, Emacs will simply switch to it. Otherwise, a new session
-will begin. A new session is always created if the the prefix
-argument ARG is specified. Returns the buffer selected (or created)."
+will begin. A numeric prefix arg (as in `C-u 42 M-x eshell RET')
+switches to the session with that number, creating it if necessary. A
+nonnumeric prefix arg means to create a new session. Returns the
+buffer selected (or created)."
(interactive "P")
(assert eshell-buffer-name)
- (let ((buf (if arg
- (generate-new-buffer eshell-buffer-name)
- (get-buffer-create eshell-buffer-name))))
+ (let ((buf (cond ((numberp arg)
+ (get-buffer-create (format "%s<%d>"
+ eshell-buffer-name
+ arg)))
+ (arg
+ (generate-new-buffer eshell-buffer-name))
+ (t
+ (get-buffer-create eshell-buffer-name)))))
;; Simply calling `pop-to-buffer' will not mimic the way that
;; shell-mode buffers appear, since they always reuse the same
;; window that that command was invoked from. To achieve this,
@@ -314,11 +375,10 @@
;; `same-window-buffer-names', which is done when Eshell is loaded
(assert (and buf (buffer-live-p buf)))
(pop-to-buffer buf)
- (unless (fboundp 'eshell-mode)
+ (if (fboundp 'eshell-mode)
+ (unless (eq major-mode 'eshell-mode)
+ (eshell-mode))
(error "`eshell-auto' must be loaded before Eshell can be used"))
- (unless (eq major-mode 'eshell-mode)
- (eshell-mode))
- (assert (eq major-mode 'eshell-mode))
buf))
(defun eshell-return-exits-minibuffer ()
@@ -329,19 +389,28 @@
(define-key eshell-mode-map [(meta return)] 'exit-minibuffer)
(define-key eshell-mode-map [(meta control ?m)] 'exit-minibuffer))
+(defvar eshell-non-interactive-p nil
+ "A variable which is non-nil when Eshell is not running interactively.
+Modules should use this variable so that they don't clutter
+non-interactive sessions, such as when using `eshell-command'.")
+
;;;###autoload
(defun eshell-command (&optional command arg)
"Execute the Eshell command string COMMAND.
With prefix ARG, insert output into the current buffer at point."
(interactive)
(require 'esh-cmd)
- (setq arg current-prefix-arg)
+ (unless arg
+ (setq arg current-prefix-arg))
(unwind-protect
(let ((eshell-non-interactive-p t))
(add-hook 'minibuffer-setup-hook 'eshell-mode)
+ (add-hook 'minibuffer-exit-hook 'eshell-add-command-to-history)
(add-hook 'eshell-mode-hook 'eshell-return-exits-minibuffer)
- (setq command (read-from-minibuffer "Emacs shell command: ")))
+ (unless command
+ (setq command (read-from-minibuffer "Emacs shell command: "))))
(remove-hook 'eshell-mode-hook 'eshell-return-exits-minibuffer)
+ (remove-hook 'minibuffer-exit-hook 'eshell-add-command-to-history)
(remove-hook 'minibuffer-setup-hook 'eshell-mode))
(unless command
(error "No command specified!"))
@@ -390,7 +459,7 @@
(message "(There was no command output)")
(kill-buffer buf))
((= len 1)
- (message (buffer-string))
+ (message "%s" (buffer-string))
(kill-buffer buf))
(t
(save-selected-window
@@ -446,7 +515,7 @@
;;;###autoload
(defun eshell-report-bug (topic)
"Report a bug in Eshell.
-Prompts for the TOPIC. Leaves you in a mail buffer.
+Prompts for the TOPIC. Leaves you in a mail buffer.
Please include any configuration details that might be involved."
(interactive "sBug Subject: ")
(compose-mail eshell-report-bug-address topic)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches