comparison lisp/eshell/em-unix.el @ 88155:d7ddb3e565de

sync with trunk
author Henrik Enberg <henrik.enberg@telia.com>
date Mon, 16 Jan 2006 00:03:54 +0000
parents 8094bb2ffe5b
children
comparison
equal deleted inserted replaced
88154:8ce476d3ba36 88155:d7ddb3e565de
1 ;;; em-unix.el --- UNIX command aliases 1 ;;; em-unix.el --- UNIX command aliases
2 2
3 ;; Copyright (C) 1999, 2000, 2001 Free Software Foundation 3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005 Free Software Foundation, Inc.
4 5
5 ;; Author: John Wiegley <johnw@gnu.org> 6 ;; Author: John Wiegley <johnw@gnu.org>
6 7
7 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
8 9
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details. 18 ;; GNU General Public License for more details.
18 19
19 ;; You should have received a copy of the GNU General Public License 20 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02111-1307, USA. 23 ;; Boston, MA 02110-1301, USA.
23 24
24 (provide 'em-unix) 25 (provide 'em-unix)
25 26
26 (eval-when-compile (require 'esh-maint)) 27 (eval-when-compile (require 'esh-maint))
28 (require 'eshell)
27 29
28 (defgroup eshell-unix nil 30 (defgroup eshell-unix nil
29 "This module defines many of the more common UNIX utilities as 31 "This module defines many of the more common UNIX utilities as
30 aliases implemented in Lisp. These include mv, ln, cp, rm, etc. If 32 aliases implemented in Lisp. These include mv, ln, cp, rm, etc. If
31 the user passes arguments which are too complex, or are unrecognized 33 the user passes arguments which are too complex, or are unrecognized
74 Standalone in this context means not redirected, and not on the 76 Standalone in this context means not redirected, and not on the
75 receiving side of a command pipeline." 77 receiving side of a command pipeline."
76 :type 'boolean 78 :type 'boolean
77 :group 'eshell-unix) 79 :group 'eshell-unix)
78 80
79 (defcustom eshell-plain-locate-behavior nil 81 (defcustom eshell-plain-locate-behavior (eshell-under-xemacs-p)
80 "*If non-nil, standalone \"locate\" commands will behave normally. 82 "*If non-nil, standalone \"locate\" commands will behave normally.
81 Standalone in this context means not redirected, and not on the 83 Standalone in this context means not redirected, and not on the
82 receiving side of a command pipeline." 84 receiving side of a command pipeline."
83 :type 'boolean 85 :type 'boolean
84 :group 'eshell-unix) 86 :group 'eshell-unix)
705 (not eshell-in-subcommand-p)))) 707 (not eshell-in-subcommand-p))))
706 (throw 'eshell-replace-command 708 (throw 'eshell-replace-command
707 (eshell-parse-command (concat "*" command) 709 (eshell-parse-command (concat "*" command)
708 (eshell-stringify-list 710 (eshell-stringify-list
709 (eshell-flatten-list args)))) 711 (eshell-flatten-list args))))
710 (let* ((compilation-process-setup-function 712 (let* ((args (mapconcat 'identity
711 (list 'lambda nil
712 (list 'setq 'process-environment
713 (list 'quote (eshell-copy-environment)))))
714 (args (mapconcat 'identity
715 (mapcar 'shell-quote-argument 713 (mapcar 'shell-quote-argument
716 (eshell-stringify-list 714 (eshell-stringify-list
717 (eshell-flatten-list args))) 715 (eshell-flatten-list args)))
718 " ")) 716 " "))
719 (cmd (progn 717 (cmd (progn
800 "Summarize PATH, and its member directories." 798 "Summarize PATH, and its member directories."
801 (let ((entries (eshell-directory-files-and-attributes path)) 799 (let ((entries (eshell-directory-files-and-attributes path))
802 (size 0.0)) 800 (size 0.0))
803 (while entries 801 (while entries
804 (unless (string-match "\\`\\.\\.?\\'" (caar entries)) 802 (unless (string-match "\\`\\.\\.?\\'" (caar entries))
805 (let* ((entry (concat path (char-to-string directory-sep-char) 803 (let* ((entry (concat path "/"
806 (caar entries))) 804 (caar entries)))
807 (symlink (and (stringp (cadr (car entries))) 805 (symlink (and (stringp (cadr (car entries)))
808 (cadr (car entries))))) 806 (cadr (car entries)))))
809 (unless (or (and symlink (not dereference-links)) 807 (unless (or (and symlink (not dereference-links))
810 (and only-one-filesystem 808 (and only-one-filesystem
878 :usage "[OPTION]... FILE... 876 :usage "[OPTION]... FILE...
879 Summarize disk usage of each FILE, recursively for directories.") 877 Summarize disk usage of each FILE, recursively for directories.")
880 (unless by-bytes 878 (unless by-bytes
881 (setq block-size (or block-size 1024))) 879 (setq block-size (or block-size 1024)))
882 (if (and max-depth (stringp max-depth)) 880 (if (and max-depth (stringp max-depth))
883 (setq max-depth (string-to-int max-depth))) 881 (setq max-depth (string-to-number max-depth)))
884 ;; filesystem support means nothing under Windows 882 ;; filesystem support means nothing under Windows
885 (if (eshell-under-windows-p) 883 (if (eshell-under-windows-p)
886 (setq only-one-filesystem nil)) 884 (setq only-one-filesystem nil))
887 (let ((size 0.0) ange-cache) 885 (let ((size 0.0) ange-cache)
888 (while args 886 (while args
1013 1011
1014 (put 'eshell/occur 'eshell-no-numeric-conversions t) 1012 (put 'eshell/occur 'eshell-no-numeric-conversions t)
1015 1013
1016 ;;; Code: 1014 ;;; Code:
1017 1015
1016 ;;; arch-tag: 2462edd2-a76a-4cf2-897d-92e9a82ac1c9
1018 ;;; em-unix.el ends here 1017 ;;; em-unix.el ends here