comparison lisp/eshell/em-unix.el @ 31241:3099993cba0f

See ChangeLog
author John Wiegley <johnw@newartisans.com>
date Tue, 29 Aug 2000 00:47:45 +0000
parents 30829e002c1b
children aab90b31807c
comparison
equal deleted inserted replaced
31240:10b1c85c0bbe 31241:3099993cba0f
115 (defcustom eshell-ln-interactive-query (= (user-uid) 0) 115 (defcustom eshell-ln-interactive-query (= (user-uid) 0)
116 "*If non-nil, `ln' will query before overwriting anything." 116 "*If non-nil, `ln' will query before overwriting anything."
117 :type 'boolean 117 :type 'boolean
118 :group 'eshell-unix) 118 :group 'eshell-unix)
119 119
120 (defcustom eshell-ln-overwrite-files t 120 (defcustom eshell-ln-overwrite-files nil
121 "*If non-nil, `ln' will overwrite files without warning." 121 "*If non-nil, `ln' will overwrite files without warning."
122 :type 'boolean 122 :type 'boolean
123 :group 'eshell-unix) 123 :group 'eshell-unix)
124 124
125 (require 'esh-opt) 125 (require 'esh-opt)
222 (unless (or preview 222 (unless (or preview
223 (and interactive 223 (and interactive
224 (not (y-or-n-p (format "rm: delete buffer `%s'? " 224 (not (y-or-n-p (format "rm: delete buffer `%s'? "
225 entry))))) 225 entry)))))
226 (eshell-funcalln 'kill-buffer entry))) 226 (eshell-funcalln 'kill-buffer entry)))
227 ((processp entry) 227 ((eshell-processp entry)
228 (if verbose 228 (if verbose
229 (eshell-printn (format "rm: killing process `%s'" entry))) 229 (eshell-printn (format "rm: killing process `%s'" entry)))
230 (unless (or preview 230 (unless (or preview
231 (and interactive 231 (and interactive
232 (not (y-or-n-p (format "rm: kill process `%s'? " 232 (not (y-or-n-p (format "rm: kill process `%s'? "
351 (eshell-printn 351 (eshell-printn
352 (format "%s: making directory %s" 352 (format "%s: making directory %s"
353 command target))) 353 command target)))
354 (unless preview 354 (unless preview
355 (eshell-funcalln 'make-directory target))) 355 (eshell-funcalln 'make-directory target)))
356 (eshell-shuffle-files command action 356 (apply 'eshell-shuffle-files
357 (mapcar 357 command action
358 (function 358 (mapcar
359 (lambda (file) 359 (function
360 (concat source "/" file))) 360 (lambda (file)
361 (directory-files source)) 361 (concat source "/" file)))
362 target func t args) 362 (directory-files source))
363 target func t args)
363 (when (eq func 'rename-file) 364 (when (eq func 'rename-file)
364 (if verbose 365 (if verbose
365 (eshell-printn 366 (eshell-printn
366 (format "%s: deleting directory %s" 367 (format "%s: deleting directory %s"
367 command source))) 368 command source)))
525 526
526 (defun eshell/cat (&rest args) 527 (defun eshell/cat (&rest args)
527 "Implementation of cat in Lisp." 528 "Implementation of cat in Lisp."
528 (if eshell-in-pipeline-p 529 (if eshell-in-pipeline-p
529 (throw 'eshell-replace-command 530 (throw 'eshell-replace-command
530 (eshell-parse-command "*cat" args)) 531 (eshell-parse-command "*cat" (eshell-flatten-list args)))
531 (eshell-init-print-buffer) 532 (eshell-init-print-buffer)
532 (eshell-eval-using-options 533 (eshell-eval-using-options
533 "cat" args 534 "cat" args
534 '((?h "help" nil nil "show this usage screen") 535 '((?h "help" nil nil "show this usage screen")
535 :external "cat" 536 :external "cat"
566 (list 'lambda nil 567 (list 'lambda nil
567 (list 'setq 'process-environment 568 (list 'setq 'process-environment
568 (list 'quote (eshell-copy-environment)))))) 569 (list 'quote (eshell-copy-environment))))))
569 (compile (concat "make " (eshell-flatten-and-stringify args)))) 570 (compile (concat "make " (eshell-flatten-and-stringify args))))
570 (throw 'eshell-replace-command 571 (throw 'eshell-replace-command
571 (eshell-parse-command "*make" args)))) 572 (eshell-parse-command "*make" (eshell-flatten-list args)))))
572 573
573 (defun eshell-occur-mode-goto-occurrence () 574 (defun eshell-occur-mode-goto-occurrence ()
574 "Go to the occurrence the current line describes." 575 "Go to the occurrence the current line describes."
575 (interactive) 576 (interactive)
576 (let ((pos (occur-mode-find-occurrence))) 577 (let ((pos (occur-mode-find-occurrence)))
642 (if (or eshell-plain-grep-behavior 643 (if (or eshell-plain-grep-behavior
643 (not (and (eshell-interactive-output-p) 644 (not (and (eshell-interactive-output-p)
644 (not eshell-in-pipeline-p) 645 (not eshell-in-pipeline-p)
645 (not eshell-in-subcommand-p)))) 646 (not eshell-in-subcommand-p))))
646 (throw 'eshell-replace-command 647 (throw 'eshell-replace-command
647 (eshell-parse-command (concat "*" command) args)) 648 (eshell-parse-command (concat "*" command)
649 (eshell-flatten-list args)))
648 (let* ((compilation-process-setup-function 650 (let* ((compilation-process-setup-function
649 (list 'lambda nil 651 (list 'lambda nil
650 (list 'setq 'process-environment 652 (list 'setq 'process-environment
651 (list 'quote (eshell-copy-environment))))) 653 (list 'quote (eshell-copy-environment)))))
652 (args (mapconcat 'identity 654 (args (mapconcat 'identity
743 (caar entries))) 745 (caar entries)))
744 (symlink (and (stringp (cadr (car entries))) 746 (symlink (and (stringp (cadr (car entries)))
745 (cadr (car entries))))) 747 (cadr (car entries)))))
746 (unless (or (and symlink (not dereference-links)) 748 (unless (or (and symlink (not dereference-links))
747 (and only-one-filesystem 749 (and only-one-filesystem
748 (not (= only-one-filesystem 750 (/= only-one-filesystem
749 (nth 12 (car entries)))))) 751 (nth 12 (car entries)))))
750 (if symlink 752 (if symlink
751 (setq entry symlink)) 753 (setq entry symlink))
752 (setq size 754 (setq size
753 (+ size 755 (+ size
754 (if (eq t (cadr (car entries))) 756 (if (eq t (cadr (car entries)))
767 (eshell-print (concat (eshell-du-size-string size) 769 (eshell-print (concat (eshell-du-size-string size)
768 (directory-file-name path) "\n"))) 770 (directory-file-name path) "\n")))
769 size)) 771 size))
770 772
771 (defun eshell/du (&rest args) 773 (defun eshell/du (&rest args)
772 "Implementation of \"du\" in Lisp, passing RAGS." 774 "Implementation of \"du\" in Lisp, passing ARGS."
773 (if (eshell-search-path "du") 775 (if (eshell-search-path "du")
774 (throw 'eshell-replace-command 776 (throw 'eshell-replace-command
775 (eshell-parse-command "*du" args)) 777 (eshell-parse-command "*du" (eshell-flatten-list args)))
776 (eshell-eval-using-options 778 (eshell-eval-using-options
777 "du" args 779 "du" args
778 '((?a "all" nil show-all 780 '((?a "all" nil show-all
779 "write counts for all files, not just directories") 781 "write counts for all files, not just directories")
780 (nil "block-size" t block-size 782 (nil "block-size" t block-size
873 (if eshell-diff-window-config 875 (if eshell-diff-window-config
874 (set-window-configuration eshell-diff-window-config))) 876 (set-window-configuration eshell-diff-window-config)))
875 877
876 (defun eshell/diff (&rest args) 878 (defun eshell/diff (&rest args)
877 "Alias \"diff\" to call Emacs `diff' function." 879 "Alias \"diff\" to call Emacs `diff' function."
878 (if (or eshell-plain-diff-behavior 880 (let ((orig-args (eshell-flatten-list args)))
879 (not (and (eshell-interactive-output-p) 881 (if (or eshell-plain-diff-behavior
880 (not eshell-in-pipeline-p) 882 (not (and (eshell-interactive-output-p)
881 (not eshell-in-subcommand-p)))) 883 (not eshell-in-pipeline-p)
882 (throw 'eshell-replace-command 884 (not eshell-in-subcommand-p))))
883 (eshell-parse-command "*diff" args)) 885 (throw 'eshell-replace-command
884 (setq args (eshell-flatten-list args)) 886 (eshell-parse-command "*diff" orig-args))
885 (if (< (length args) 2) 887 (setq args (eshell-copy-list orig-args))
886 (error "diff: missing operand")) 888 (if (< (length args) 2)
887 (let ((old (car (last args 2))) 889 (throw 'eshell-replace-command
888 (new (car (last args))) 890 (eshell-parse-command "*diff" orig-args)))
889 (config (current-window-configuration))) 891 (let ((old (car (last args 2)))
890 (if (= (length args) 2) 892 (new (car (last args)))
891 (setq args nil) 893 (config (current-window-configuration)))
892 (setcdr (last args 3) nil)) 894 (if (= (length args) 2)
893 (with-current-buffer 895 (setq args nil)
894 (diff old new (eshell-flatten-and-stringify args)) 896 (setcdr (last args 3) nil))
895 (when (fboundp 'diff-mode) 897 (with-current-buffer
896 (diff-mode) 898 (condition-case err
897 (set (make-local-variable 'eshell-diff-window-config) config) 899 (diff old new (eshell-flatten-and-stringify args))
898 (local-set-key [?q] 'eshell-diff-quit) 900 (error
899 (if (fboundp 'turn-on-font-lock-if-enabled) 901 (throw 'eshell-replace-command
900 (turn-on-font-lock-if-enabled)))) 902 (eshell-parse-command "*diff" orig-args))))
901 (other-window 1) 903 (when (fboundp 'diff-mode)
902 (goto-char (point-min)) 904 (diff-mode)
903 nil))) 905 (set (make-local-variable 'eshell-diff-window-config) config)
906 (local-set-key [?q] 'eshell-diff-quit)
907 (if (fboundp 'turn-on-font-lock-if-enabled)
908 (turn-on-font-lock-if-enabled))))
909 (other-window 1)
910 (goto-char (point-min))
911 nil))))
904 912
905 (defun eshell/locate (&rest args) 913 (defun eshell/locate (&rest args)
906 "Alias \"locate\" to call Emacs `locate' function." 914 "Alias \"locate\" to call Emacs `locate' function."
907 (if (or eshell-plain-locate-behavior 915 (if (or eshell-plain-locate-behavior
908 (not (and (eshell-interactive-output-p) 916 (not (and (eshell-interactive-output-p)
909 (not eshell-in-pipeline-p) 917 (not eshell-in-pipeline-p)
910 (not eshell-in-subcommand-p))) 918 (not eshell-in-subcommand-p)))
911 (and (stringp (car args)) 919 (and (stringp (car args))
912 (string-match "^-" (car args)))) 920 (string-match "^-" (car args))))
913 (throw 'eshell-replace-command 921 (throw 'eshell-replace-command
914 (eshell-parse-command "*locate" args)) 922 (eshell-parse-command "*locate" (eshell-flatten-list args)))
915 (save-selected-window 923 (save-selected-window
916 (let ((locate-history-list (list (car args)))) 924 (let ((locate-history-list (list (car args))))
917 (locate-with-filter (car args) (cadr args)))))) 925 (locate-with-filter (car args) (cadr args))))))
918 926
919 (defun eshell/occur (&rest args) 927 (defun eshell/occur (&rest args)