annotate lisp/eshell/em-script.el @ 105368:be2d9a296ba1

Update to Unicode 5.2.0. * admin/unidata/UnicodeData.txt: Update. * lisp/international/charprop.el: * lisp/international/uni-bidi.el: * lisp/international/uni-category.el: * lisp/international/uni-combining.el: * lisp/international/uni-comment.el: * lisp/international/uni-decimal.el: * lisp/international/uni-decomposition.e: * lisp/international/uni-digit.el: * lisp/international/uni-lowercase.el: * lisp/international/uni-mirrored.el: * lisp/international/uni-name.el: * lisp/international/uni-numeric.el: * lisp/international/uni-old-name.el: * lisp/international/uni-titlecase.el: * lisp/international/uni-uppercase.el: Regenerate.
author Juanma Barranquero <lekktu@gmail.com>
date Thu, 01 Oct 2009 23:34:27 +0000
parents 48428e99bf83
children 1d1d5d9bd884
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 37661
diff changeset
1 ;;; em-script.el --- Eshell script files
29876
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2
95152
ad5d26b1d5d1 Use eshell-defgroup rather than defgroup.
Glenn Morris <rgm@gnu.org>
parents: 94661
diff changeset
3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
100908
a9dc0e7c3f2b Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 95152
diff changeset
4 ;; 2008, 2009 Free Software Foundation, Inc.
29876
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5
32526
8e57189d61b4 Add author information.
Gerd Moellmann <gerd@gnu.org>
parents: 29934
diff changeset
6 ;; Author: John Wiegley <johnw@gnu.org>
8e57189d61b4 Add author information.
Gerd Moellmann <gerd@gnu.org>
parents: 29934
diff changeset
7
29876
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9
94661
b5b0801a7637 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
29876
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
94661
b5b0801a7637 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
12 ;; the Free Software Foundation, either version 3 of the License, or
b5b0801a7637 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
13 ;; (at your option) any later version.
29876
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
94661
b5b0801a7637 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
29876
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22
87073
1577bd98c621 Require individual files if needed when compiling, rather than
Glenn Morris <rgm@gnu.org>
parents: 78220
diff changeset
23 ;;; Commentary:
29876
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
24
87073
1577bd98c621 Require individual files if needed when compiling, rather than
Glenn Morris <rgm@gnu.org>
parents: 78220
diff changeset
25 ;;; Code:
29876
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
26
48578
bd778a4f4ece Require eshell.
Richard M. Stallman <rms@gnu.org>
parents: 38414
diff changeset
27 (require 'eshell)
bd778a4f4ece Require eshell.
Richard M. Stallman <rms@gnu.org>
parents: 38414
diff changeset
28
95152
ad5d26b1d5d1 Use eshell-defgroup rather than defgroup.
Glenn Morris <rgm@gnu.org>
parents: 94661
diff changeset
29 ;;;###autoload
ad5d26b1d5d1 Use eshell-defgroup rather than defgroup.
Glenn Morris <rgm@gnu.org>
parents: 94661
diff changeset
30 (eshell-defgroup eshell-script nil
29876
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 "This module allows for the execution of files containing Eshell
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
32 commands, as a script file."
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
33 :tag "Running script files."
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34 :group 'eshell-module)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36 ;;; User Variables:
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
37
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
38 (defcustom eshell-script-load-hook '(eshell-script-initialize)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
39 "*A list of functions to call when loading `eshell-script'."
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
40 :type 'hook
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
41 :group 'eshell-script)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
42
104994
48428e99bf83 * eshell/em-hist.el:
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
43 (defcustom eshell-login-script (expand-file-name "login" eshell-directory-name)
29876
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
44 "*If non-nil, a file to invoke when starting up Eshell interactively.
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
45 This file should be a file containing Eshell commands, where comment
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
46 lines begin with '#'."
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
47 :type 'file
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
48 :group 'eshell-script)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
49
104994
48428e99bf83 * eshell/em-hist.el:
Chong Yidong <cyd@stupidchicken.com>
parents: 100908
diff changeset
50 (defcustom eshell-rc-script (expand-file-name "profile" eshell-directory-name)
29876
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51 "*If non-nil, a file to invoke whenever Eshell is started.
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52 This includes when running `eshell-command'."
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 :type 'file
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54 :group 'eshell-script)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
56 ;;; Functions:
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
58 (defun eshell-script-initialize ()
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
59 "Initialize the script parsing code."
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
60 (make-local-variable 'eshell-interpreter-alist)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
61 (setq eshell-interpreter-alist
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
62 (cons '((lambda (file)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63 (string= (file-name-nondirectory file)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64 "eshell")) . eshell/source)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65 eshell-interpreter-alist))
33020
e21feeab77fb See ChangeLog
John Wiegley <johnw@newartisans.com>
parents: 32526
diff changeset
66 (make-local-variable 'eshell-complex-commands)
e21feeab77fb See ChangeLog
John Wiegley <johnw@newartisans.com>
parents: 32526
diff changeset
67 (setq eshell-complex-commands
e21feeab77fb See ChangeLog
John Wiegley <johnw@newartisans.com>
parents: 32526
diff changeset
68 (append '("source" ".") eshell-complex-commands))
29876
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 ;; these two variables are changed through usage, but we don't want
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70 ;; to ruin it for other modules
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71 (let (eshell-inside-quote-regexp
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72 eshell-outside-quote-regexp)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73 (and (not eshell-non-interactive-p)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74 eshell-login-script
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
75 (file-readable-p eshell-login-script)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76 (eshell-do-eval
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 (list 'eshell-commands
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
78 (catch 'eshell-replace-command
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
79 (eshell-source-file eshell-login-script))) t))
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80 (and eshell-rc-script
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81 (file-readable-p eshell-rc-script)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82 (eshell-do-eval
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83 (list 'eshell-commands
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84 (catch 'eshell-replace-command
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85 (eshell-source-file eshell-rc-script))) t))))
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
86
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87 (defun eshell-source-file (file &optional args subcommand-p)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
88 "Execute a series of Eshell commands in FILE, passing ARGS.
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
89 Comments begin with '#'."
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
90 (interactive "f")
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
91 (let ((orig (point))
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
92 (here (point-max))
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
93 (inhibit-point-motion-hooks t)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
94 after-change-functions)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
95 (goto-char (point-max))
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
96 (insert-file-contents file)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
97 (goto-char (point-max))
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
98 (throw 'eshell-replace-command
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 (prog1
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100 (list 'let
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101 (list (list 'eshell-command-name (list 'quote file))
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102 (list 'eshell-command-arguments
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103 (list 'quote args)))
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
104 (let ((cmd (eshell-parse-command (cons here (point)))))
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105 (if subcommand-p
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
106 (setq cmd (list 'eshell-as-subcommand cmd)))
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
107 cmd))
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
108 (delete-region here (point))
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
109 (goto-char orig)))))
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
110
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
111 (defun eshell/source (&rest args)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112 "Source a file in a subshell environment."
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 (eshell-eval-using-options
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
114 "source" args
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
115 '((?h "help" nil nil "show this usage screen")
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
116 :show-usage
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
117 :usage "FILE [ARGS]
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
118 Invoke the Eshell commands in FILE in a subshell, binding ARGS to $1,
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
119 $2, etc.")
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
120 (eshell-source-file (car args) (cdr args) t)))
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
121
37661
6d7c89c79996 Set the property `eshell-no-numeric-conversions' on the following
John Wiegley <johnw@newartisans.com>
parents: 33020
diff changeset
122 (put 'eshell/source 'eshell-no-numeric-conversions t)
6d7c89c79996 Set the property `eshell-no-numeric-conversions' on the following
John Wiegley <johnw@newartisans.com>
parents: 33020
diff changeset
123
29876
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
124 (defun eshell/. (&rest args)
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
125 "Source a file in the current environment."
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
126 (eshell-eval-using-options
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127 "." args
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
128 '((?h "help" nil nil "show this usage screen")
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
129 :show-usage
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
130 :usage "FILE [ARGS]
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
131 Invoke the Eshell commands in FILE within the current shell
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
132 environment, binding ARGS to $1, $2, etc.")
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 (eshell-source-file (car args) (cdr args))))
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
134
37661
6d7c89c79996 Set the property `eshell-no-numeric-conversions' on the following
John Wiegley <johnw@newartisans.com>
parents: 33020
diff changeset
135 (put 'eshell/. 'eshell-no-numeric-conversions t)
6d7c89c79996 Set the property `eshell-no-numeric-conversions' on the following
John Wiegley <johnw@newartisans.com>
parents: 33020
diff changeset
136
87073
1577bd98c621 Require individual files if needed when compiling, rather than
Glenn Morris <rgm@gnu.org>
parents: 78220
diff changeset
137 (provide 'em-script)
29876
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
138
95152
ad5d26b1d5d1 Use eshell-defgroup rather than defgroup.
Glenn Morris <rgm@gnu.org>
parents: 94661
diff changeset
139 ;; Local Variables:
ad5d26b1d5d1 Use eshell-defgroup rather than defgroup.
Glenn Morris <rgm@gnu.org>
parents: 94661
diff changeset
140 ;; generated-autoload-file: "esh-groups.el"
ad5d26b1d5d1 Use eshell-defgroup rather than defgroup.
Glenn Morris <rgm@gnu.org>
parents: 94661
diff changeset
141 ;; End:
ad5d26b1d5d1 Use eshell-defgroup rather than defgroup.
Glenn Morris <rgm@gnu.org>
parents: 94661
diff changeset
142
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
143 ;; arch-tag: a346439d-5ba8-4faf-ac2b-3aacfeaa4647
29876
edfec1c0d511 *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
144 ;;; em-script.el ends here