aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2007-12-29 02:51:57 +0000
committerMiles Bader2007-12-29 02:51:57 +0000
commite97d3ec0184763b2479224486e70d23f03bd340f (patch)
treefb5e5ad400914090c35e12eaf553358296d5929a
parenta0c92ed92d3d62d4926dafb1d595d87843df4688 (diff)
parentfd41ad9836f4b975f388f2fe84abd8a1de11a820 (diff)
downloademacs-e97d3ec0184763b2479224486e70d23f03bd340f.tar.gz
emacs-e97d3ec0184763b2479224486e70d23f03bd340f.zip
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-307
-rw-r--r--doc/misc/ChangeLog5
-rw-r--r--doc/misc/calc.texi108
-rw-r--r--lisp/ChangeLog40
-rw-r--r--lisp/calc/README2
-rw-r--r--lisp/calc/calc-aent.el4
-rw-r--r--lisp/calc/calc-ext.el4
-rw-r--r--lisp/calc/calc-help.el1
-rw-r--r--lisp/calc/calc-lang.el618
-rw-r--r--lisp/calc/calc-menu.el23
-rw-r--r--lisp/calc/calc.el3
-rw-r--r--lisp/calc/calccomp.el3
-rw-r--r--lisp/vc-hg.el12
-rw-r--r--src/ChangeLog3
-rw-r--r--src/process.c2
14 files changed, 802 insertions, 26 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 07d74fc32ed..a007f4da3a8 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,8 @@
12007-12-29 Jay Belanger <jay.p.belanger@gmail.com>
2
3 * calc.tex (Yacas Language, Maxima Language, Giac Language):
4 New sections.
5
12007-12-29 Reiner Steib <Reiner.Steib@gmx.de> 62007-12-29 Reiner Steib <Reiner.Steib@gmx.de>
2 7
3 * gnus.texi (Group Parameters): Reorder the text and add a note about 8 * gnus.texi (Group Parameters): Reorder the text and add a note about
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi
index b8a42f3c746..1a0729748b2 100644
--- a/doc/misc/calc.texi
+++ b/doc/misc/calc.texi
@@ -13802,6 +13802,9 @@ shifted letter key.
13802* C FORTRAN Pascal:: 13802* C FORTRAN Pascal::
13803* TeX and LaTeX Language Modes:: 13803* TeX and LaTeX Language Modes::
13804* Eqn Language Mode:: 13804* Eqn Language Mode::
13805* Yacas Language Mode::
13806* Maxima Language Mode::
13807* Giac Language Mode::
13805* Mathematica Language Mode:: 13808* Mathematica Language Mode::
13806* Maple Language Mode:: 13809* Maple Language Mode::
13807* Compositions:: 13810* Compositions::
@@ -13965,13 +13968,13 @@ entered this way or using square brackets. Since FORTRAN uses round
13965parentheses for both function calls and array subscripts, Calc displays 13968parentheses for both function calls and array subscripts, Calc displays
13966both in the same way; @samp{a(i)} is interpreted as a function call 13969both in the same way; @samp{a(i)} is interpreted as a function call
13967upon reading, and subscripts must be entered as @samp{subscr(a, i)}. 13970upon reading, and subscripts must be entered as @samp{subscr(a, i)}.
13968Also, if the variable @code{a} has been declared to have type 13971If the variable @code{a} has been declared to have type
13969@code{vector} or @code{matrix} then @samp{a(i)} will be parsed as a 13972@code{vector} or @code{matrix}, however, then @samp{a(i)} will be
13970subscript. (@xref{Declarations}.) Usually it doesn't matter, though; 13973parsed as a subscript. (@xref{Declarations}.) Usually it doesn't
13971if you enter the subscript expression @samp{a(i)} and Calc interprets 13974matter, though; if you enter the subscript expression @samp{a(i)} and
13972it as a function call, you'll never know the difference unless you 13975Calc interprets it as a function call, you'll never know the difference
13973switch to another language mode or replace @code{a} with an actual 13976unless you switch to another language mode or replace @code{a} with an
13974vector (or unless @code{a} happens to be the name of a built-in 13977actual vector (or unless @code{a} happens to be the name of a built-in
13975function!). 13978function!).
13976 13979
13977Underscores are allowed in variable and function names in all of these 13980Underscores are allowed in variable and function names in all of these
@@ -14404,7 +14407,7 @@ $$ \pmatrix{ {a \over b} & 0 \cr 0 & 2^{(x + 1)} } $$
14404@sp 2 14407@sp 2
14405@end iftex 14408@end iftex
14406 14409
14407@node Eqn Language Mode, Mathematica Language Mode, TeX and LaTeX Language Modes, Language Modes 14410@node Eqn Language Mode, Yacas Language Mode, TeX and LaTeX Language Modes, Language Modes
14408@subsection Eqn Language Mode 14411@subsection Eqn Language Mode
14409 14412
14410@noindent 14413@noindent
@@ -14480,7 +14483,87 @@ The words @code{lcol} and @code{rcol} are recognized as synonyms
14480for @code{ccol} during input, and are generated instead of @code{ccol} 14483for @code{ccol} during input, and are generated instead of @code{ccol}
14481if the matrix justification mode so specifies. 14484if the matrix justification mode so specifies.
14482 14485
14483@node Mathematica Language Mode, Maple Language Mode, Eqn Language Mode, Language Modes 14486@node Yacas Language Mode, Maxima Language Mode, Eqn Language Mode, Language Modes
14487@subsection Yacas Language Mode
14488
14489@noindent
14490@kindex d Y
14491@pindex calc-yacas-language
14492@cindex Yacas language
14493The @kbd{d Y} (@code{calc-yacas-language}) command selects the
14494conventions of Yacas, a free computer algebra system. While the
14495operators and functions in Yacas are similar to those of Calc, the names
14496of built-in functions in Yacas are capitalized. The Calc formula
14497@samp{sin(2 x)}, for example, is entered and displayed @samp{Sin(2 x)}
14498in Yacas mode, and `@samp{arcsin(x^2)} is @samp{ArcSin(x^2)} in Yacas
14499mode. Complex numbers are written are written @samp{3 + 4 I}.
14500The standard special constants are written @code{Pi}, @code{E},
14501@code{I}, @code{GoldenRatio} and @code{Gamma}. @code{Infinity}
14502represents both @code{inf} and @code{uinf}, and @code{Undefined}
14503represents @code{nan}.
14504
14505Certain operators on functions, such as @code{D} for differentiation
14506and @code{Integrate} for integration, take a prefix form in Yacas. For
14507example, the derivative of @w{@samp{e^x sin(x)}} can be computed with
14508@w{@samp{D(x) Exp(x)*Sin(x)}}.
14509
14510Other notable differences between Yacas and standard Calc expressions
14511are that vectors and matrices use curly braces in Yacas, and subscripts
14512use square brackets. If, for example, @samp{A} represents the list
14513@samp{@{a,2,c,4@}}, then @samp{A[3]} would equal @samp{c}.
14514
14515
14516@node Maxima Language Mode, Giac Language Mode, Yacas Language Mode, Language Modes
14517@subsection Maxima Language Mode
14518
14519@noindent
14520@kindex d X
14521@pindex calc-maxima-language
14522@cindex Maxima language
14523The @kbd{d X} (@code{calc-maxima-language}) command selects the
14524conventions of Maxima, another free computer algebra system. The
14525function names in Maxima are similar, but not always identical, to Calc.
14526For example, instead of @samp{arcsin(x)}, Maxima will use
14527@samp{asin(x)}. Complex numbers are written @samp{3 + 4 %i}. The
14528standard special constants are written @code{%pi}, @code{%e},
14529@code{%i}, @code{%phi} and @code{%gamma}. In Maxima, @code{inf} means
14530the same as in Calc, but @code{infinity} represents Calc's @code{uinf}.
14531
14532Underscores as well as percent signs are allowed in function and
14533variable names in Maxima mode. The underscore again is equivalent to
14534the @samp{#} in Normal mode, and the percent sign is equivalent to
14535@samp{o'o}.
14536
14537Maxima uses square brackets for lists and vectors, and matrices are
14538written as calls to the function @code{matrix}, given the row vectors of
14539the matrix as arguments. Square brackets are also used as subscripts.
14540
14541@node Giac Language Mode, Mathematica Language Mode, Maxima Language Mode, Language Modes
14542@subsection Giac Language Mode
14543
14544@noindent
14545@kindex d A
14546@pindex calc-giac-language
14547@cindex Giac language
14548The @kbd{d A} (@code{calc-giac-language}) command selects the
14549conventions of Giac, another free computer algebra system. The function
14550names in Giac are similar to Maxima. Complex numbers are written
14551@samp{3 + 4 i}. The standard special constants in Giac are the same as
14552in Calc, except that @code{infinity} represents both Calc's @code{inf}
14553and @code{uinf}.
14554
14555Underscores are allowed in function and variable names in Giac mode.
14556Brackets are used for subscripts. In Giac, indexing of lists begins at
145570, instead of 1 as in Calc. So if @samp{A} represents the list
14558@samp{[a,2,c,4]}, then @samp{A[2]} would equal @samp{c}. In general,
14559@samp{A[n]} in Giac mode corresponds to @samp{A_(n+1)} in Normal mode.
14560
14561The Giac interval notation @samp{2 .. 3} has no surrounding brackets;
14562Calc reads @samp{2 .. 3} as the closed interval @samp{[2 .. 3]} and
14563writes any kind of interval as @samp{2 .. 3}. This means you cannot see
14564the difference between an open and a closed interval while in Giac mode.
14565
14566@node Mathematica Language Mode, Maple Language Mode, Giac Language Mode, Language Modes
14484@subsection Mathematica Language Mode 14567@subsection Mathematica Language Mode
14485 14568
14486@noindent 14569@noindent
@@ -14525,11 +14608,8 @@ pass through Calc. As a special case, matrices are written as calls
14525to the function @code{matrix}, given a list of lists as the argument, 14608to the function @code{matrix}, given a list of lists as the argument,
14526and can be read in this form or with all-capitals @code{MATRIX}. 14609and can be read in this form or with all-capitals @code{MATRIX}.
14527 14610
14528The Maple interval notation @samp{2 .. 3} has no surrounding brackets; 14611The Maple interval notation @samp{2 .. 3} is like Giac's interval
14529Calc reads @samp{2 .. 3} as the closed interval @samp{[2 .. 3]}, and 14612notation, and is handled the same by Calc.
14530writes any kind of interval as @samp{2 .. 3}. This means you cannot
14531see the difference between an open and a closed interval while in
14532Maple display mode.
14533 14613
14534Maple writes complex numbers as @samp{3 + 4*I}. Its special constants 14614Maple writes complex numbers as @samp{3 + 4*I}. Its special constants
14535are @code{Pi}, @code{E}, @code{I}, and @code{infinity} (all three of 14615are @code{Pi}, @code{E}, @code{I}, and @code{infinity} (all three of
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ec710caa81b..7c3655b3044 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,43 @@
12007-12-29 Jay Belanger <jay.p.belanger@gmail.com>
2
3 * calc/calc-aent.el (math-read-token): Fix misplaced
4 parentheses.
5
6 * calc/calc-lang.el (calc-yacas-language, calc-maxima-language)
7 (calc-giac-language, math-yacas-parse-Sum, math-yacas-compose-sum)
8 (math-yacas-compose-deriv, math-yacas-compose-taylor)
9 (math-maxima-parse-subst, math-maxima-parse-taylor)
10 (math-maxima-compose-taylor, math-maxima-compose-subst)
11 (math-maxima-compose-if, math-lang-switch-args)
12 (math-lang-compose-switch-args, math-read-giac-subscr):
13 New functions.
14 (calc-lang-allow-underscores, calc-lang-allow-percentsigns)
15 (calc-lang-brackets-are-subscripts, calc-lang-c-type-hex):
16 Add languages.
17 (math-vector-brackets, math-complex-format, math-variable-table)
18 (math-parse-table, math-oper-table, math-function-table)
19 (math-special-function-table, math-compose-subscr):
20 Add values for new languages.
21
22 * calc/calccomp.el (math-compose-expr): Add new languages.
23
24 * calc/calc.el (calc-language): Add languages to docstring.
25
26 * calc/calc-ext.el (calc-init-extensions): Add keybindings
27 for new languages. Autoload commands to change languages.
28
29 * calc/calc-help.el (calc-d-prefix-help): Add new languages.
30
31 * calc/calc-menu.el (calc-modes-menu): Add new languages.
32
332007-12-28 Dan Nicolaescu <dann@ics.uci.edu>
34
35 * vc-hg.el (vc-hg-registered): Return the false when vc-hg-state
36 returns 'ignored or 'unregistered.
37 (vc-hg-state): Pass "-A" to the status command and deal with the
38 output.
39 (vc-hg-dir-state): Pass "-A" to the status command.
40
12007-12-29 Richard Stallman <rms@gnu.org> 412007-12-29 Richard Stallman <rms@gnu.org>
2 42
3 * progmodes/compile.el (compilation-start): Set initial visible 43 * progmodes/compile.el (compilation-start): Set initial visible
diff --git a/lisp/calc/README b/lisp/calc/README
index fbbd73b8fee..2ddd8645227 100644
--- a/lisp/calc/README
+++ b/lisp/calc/README
@@ -72,6 +72,8 @@ opinions.
72Summary of changes to "Calc" 72Summary of changes to "Calc"
73------- -- ------- -- ---- 73------- -- ------- -- ----
74 74
75* Added support for Yacas, Maxima and Giac languages.
76
75* Added a menu. 77* Added a menu.
76 78
77* Added logistic non-linear curves to curve-fitting. 79* Added logistic non-linear curves to curve-fitting.
diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el
index 5b93a544397..22022d8b0ce 100644
--- a/lisp/calc/calc-aent.el
+++ b/lisp/calc/calc-aent.el
@@ -775,9 +775,9 @@ in Calc algebraic input.")
775 (setq math-exp-token 'string 775 (setq math-exp-token 'string
776 math-expr-data (math-match-substring math-exp-str 1) 776 math-expr-data (math-match-substring math-exp-str 1)
777 math-exp-pos (match-end 0))) 777 math-exp-pos (match-end 0)))
778 ((and (setq adfn (get calc-language 'math-lang-read))) 778 ((and (setq adfn (get calc-language 'math-lang-read))
779 (eval (nth 0 adfn)) 779 (eval (nth 0 adfn))
780 (eval (nth 1 adfn))) 780 (eval (nth 1 adfn))))
781 ((eq (string-match "%%.*$" math-exp-str math-exp-pos) math-exp-pos) 781 ((eq (string-match "%%.*$" math-exp-str math-exp-pos) math-exp-pos)
782 (setq math-exp-pos (match-end 0)) 782 (setq math-exp-pos (match-end 0))
783 (math-read-token)) 783 (math-read-token))
diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el
index 56b95ef218e..bde8d419203 100644
--- a/lisp/calc/calc-ext.el
+++ b/lisp/calc/calc-ext.el
@@ -256,6 +256,7 @@
256 (define-key calc-mode-map "dt" 'calc-truncate-stack) 256 (define-key calc-mode-map "dt" 'calc-truncate-stack)
257 (define-key calc-mode-map "dw" 'calc-auto-why) 257 (define-key calc-mode-map "dw" 'calc-auto-why)
258 (define-key calc-mode-map "dz" 'calc-leading-zeros) 258 (define-key calc-mode-map "dz" 'calc-leading-zeros)
259 (define-key calc-mode-map "dA" 'calc-giac-language)
259 (define-key calc-mode-map "dB" 'calc-big-language) 260 (define-key calc-mode-map "dB" 'calc-big-language)
260 (define-key calc-mode-map "dD" 'calc-redo) 261 (define-key calc-mode-map "dD" 'calc-redo)
261 (define-key calc-mode-map "dC" 'calc-c-language) 262 (define-key calc-mode-map "dC" 'calc-c-language)
@@ -269,6 +270,8 @@
269 (define-key calc-mode-map "dL" 'calc-latex-language) 270 (define-key calc-mode-map "dL" 'calc-latex-language)
270 (define-key calc-mode-map "dU" 'calc-unformatted-language) 271 (define-key calc-mode-map "dU" 'calc-unformatted-language)
271 (define-key calc-mode-map "dW" 'calc-maple-language) 272 (define-key calc-mode-map "dW" 'calc-maple-language)
273 (define-key calc-mode-map "dX" 'calc-maxima-language)
274 (define-key calc-mode-map "dY" 'calc-yacas-language)
272 (define-key calc-mode-map "d[" 'calc-truncate-up) 275 (define-key calc-mode-map "d[" 'calc-truncate-up)
273 (define-key calc-mode-map "d]" 'calc-truncate-down) 276 (define-key calc-mode-map "d]" 'calc-truncate-down)
274 (define-key calc-mode-map "d." 'calc-point-char) 277 (define-key calc-mode-map "d." 'calc-point-char)
@@ -1053,6 +1056,7 @@ calc-keypad-press)
1053 1056
1054 ("calc-lang" calc-big-language calc-c-language calc-eqn-language 1057 ("calc-lang" calc-big-language calc-c-language calc-eqn-language
1055calc-flat-language calc-fortran-language calc-maple-language 1058calc-flat-language calc-fortran-language calc-maple-language
1059calc-yacas-language calc-maxima-language calc-giac-language
1056calc-mathematica-language calc-normal-language calc-pascal-language 1060calc-mathematica-language calc-normal-language calc-pascal-language
1057calc-tex-language calc-latex-language calc-unformatted-language) 1061calc-tex-language calc-latex-language calc-unformatted-language)
1058 1062
diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el
index 49d1fd937ba..409f96d13bc 100644
--- a/lisp/calc/calc-help.el
+++ b/lisp/calc/calc-help.el
@@ -601,6 +601,7 @@ C-w Describe how there is no warranty for Calc."
601 "\" (strings); Truncate, [, ]; SPC (refresh), RET, @" 601 "\" (strings); Truncate, [, ]; SPC (refresh), RET, @"
602 "SHIFT + language: Normal, One-line, Big, Unformatted" 602 "SHIFT + language: Normal, One-line, Big, Unformatted"
603 "SHIFT + language: C, Pascal, Fortran; TeX, LaTeX, Eqn" 603 "SHIFT + language: C, Pascal, Fortran; TeX, LaTeX, Eqn"
604 "SHIFT + language: Yacas, X=Maxima, A=Giac"
604 "SHIFT + language: Mathematica, W=Maple") 605 "SHIFT + language: Mathematica, W=Maple")
605 "display" ?d)) 606 "display" ?d))
606 607
diff --git a/lisp/calc/calc-lang.el b/lisp/calc/calc-lang.el
index 8d01914a06e..3c7a22b5ff0 100644
--- a/lisp/calc/calc-lang.el
+++ b/lisp/calc/calc-lang.el
@@ -1164,6 +1164,624 @@
1164 (if (memq (nth 1 a) '(0 2)) ")" "]"))) 1164 (if (memq (nth 1 a) '(0 2)) ")" "]")))
1165 1165
1166 1166
1167;;; Yacas
1168
1169(defun calc-yacas-language ()
1170 "Change the Calc language to be Yacas-like."
1171 (interactive)
1172 (calc-wrapper
1173 (calc-set-language 'yacas)
1174 (message "`Yacas' language mode")))
1175
1176(put 'yacas 'math-vector-brackets "{}")
1177
1178(put 'yacas 'math-complex-format 'I)
1179
1180(add-to-list 'calc-lang-brackets-are-subscripts 'yacas)
1181
1182(put 'yacas 'math-variable-table
1183 '(( Infinity . var-inf)
1184 ( Infinity . var-uinf)
1185 ( Undefined . var-nan)
1186 ( Pi . var-pi)
1187 ( E . var-e) ;; Not really in Yacas
1188 ( GoldenRatio . var-phi)
1189 ( Gamma . var-gamma)))
1190
1191(put 'yacas 'math-parse-table
1192 '((("Deriv(" 0 ")" 0)
1193 calcFunc-deriv (var ArgB var-ArgB) (var ArgA var-ArgA))
1194 (("D(" 0 ")" 0)
1195 calcFunc-deriv (var ArgB var-ArgB) (var ArgA var-ArgA))
1196 (("Integrate(" 0 ")" 0)
1197 calcFunc-integ (var ArgB var-ArgB)(var ArgA var-ArgA))
1198 (("Integrate(" 0 "," 0 "," 0 ")" 0)
1199 calcFunc-integ (var ArgD var-ArgD) (var ArgA var-ArgA)
1200 (var ArgB var-ArgB) (var ArgC var-ArgC))
1201 (("Subst(" 0 "," 0 ")" 0)
1202 calcFunc-subst (var ArgC var-ArgC) (var ArgA var-ArgA)
1203 (var ArgB var-ArgB))
1204 (("Taylor(" 0 "," 0 "," 0 ")" 0)
1205 calcFunc-taylor (var ArgD var-ArgD)
1206 (calcFunc-eq (var ArgA var-ArgA) (var ArgB var-ArgB))
1207 (var ArgC var-ArgC))))
1208
1209(put 'yacas 'math-oper-table
1210 '(("+" + 30 30)
1211 ("-" - 30 60)
1212 ("*" * 60 60)
1213 ("/" / 70 70)
1214 ("u-" neg -1 60)
1215 ("^" ^ 80 80)
1216 ("u+" ident -1 30)
1217 ("<<" calcFunc-lsh 80 80)
1218 (">>" calcFunc-rsh 80 80)
1219 ("!" calcFunc-fact 80 -1)
1220 ("!!" calcFunc-dfact 80 -1)
1221 ("X" calcFunc-cross 70 70)
1222 ("=" calcFunc-eq 10 10)
1223 ("!=" calcFunc-neq 10 10)
1224 ("<" calcFunc-lt 10 10)
1225 (">" calcFunc-gt 10 10)
1226 ("<=" calcFunc-leq 10 10)
1227 (">=" calcFunc-geq 10 10)
1228 ("And" calcFunc-land 5 5)
1229 ("Or" calcFunc-or 4 4)
1230 ("Not" calcFunc-lnot -1 3)
1231 (":=" calcFunc-assign 1 1)))
1232
1233(put 'yacas 'math-function-table
1234 '(( Div . calcFunc-idiv)
1235 ( Mod . calcFunc-mod)
1236 ( Abs . calcFunc-abs)
1237 ( Sign . calcFunc-sign)
1238 ( Sqrt . calcFunc-sqrt)
1239 ( Max . calcFunc-max)
1240 ( Min . calcFunc-min)
1241 ( Floor . calcFunc-floor)
1242 ( Ceil . calcFunc-ceil)
1243 ( Round . calcFunc-round)
1244 ( Conjugate . calcFunc-conj)
1245 ( Arg . calcFunc-arg)
1246 ( Re . calcFunc-re)
1247 ( Im . calcFunc-im)
1248 ( Rationalize . calcFunc-pfrac)
1249 ( Sin . calcFunc-sin)
1250 ( Cos . calcFunc-cos)
1251 ( Tan . calcFunc-tan)
1252 ( Sec . calcFunc-sec)
1253 ( Csc . calcFunc-csc)
1254 ( Cot . calcFunc-cot)
1255 ( ArcSin . calcFunc-arcsin)
1256 ( ArcCos . calcFunc-arccos)
1257 ( ArcTan . calcFunc-arctan)
1258 ( Sinh . calcFunc-sinh)
1259 ( Cosh . calcFunc-cosh)
1260 ( Tanh . calcFunc-tanh)
1261 ( Sech . calcFunc-sech)
1262 ( Csch . calcFunc-csch)
1263 ( Coth . calcFunc-coth)
1264 ( ArcSinh . calcFunc-arcsinh)
1265 ( ArcCosh . calcFunc-arccosh)
1266 ( ArcTanh . calcFunc-arctanh)
1267 ( Ln . calcFunc-ln)
1268 ( Exp . calcFunc-exp)
1269 ( Gamma . calcFunc-gamma)
1270 ( Gcd . calcFunc-gcd)
1271 ( Lcm . calcFunc-lcm)
1272 ( Bin . calcFunc-choose)
1273 ( Bernoulli . calcFunc-bern)
1274 ( Euler . calcFunc-euler)
1275 ( StirlingNumber1 . calcFunc-stir1)
1276 ( StirlingNumber2 . calcFunc-stir2)
1277 ( IsPrime . calcFunc-prime)
1278 ( Factors . calcFunc-prfac)
1279 ( NextPrime . calcFunc-nextprime)
1280 ( Moebius . calcFunc-moebius)
1281 ( Random . calcFunc-random)
1282 ( Concat . calcFunc-vconcat)
1283 ( Head . calcFunc-head)
1284 ( Tail . calcFunc-tail)
1285 ( Length . calcFunc-vlen)
1286 ( Reverse . calcFunc-rev)
1287 ( CrossProduct . calcFunc-cross)
1288 ( Dot . calcFunc-mul)
1289 ( DiagonalMatrix . calcFunc-diag)
1290 ( Transpose . calcFunc-trn)
1291 ( Inverse . calcFunc-inv)
1292 ( Determinant . calcFunc-det)
1293 ( Trace . calcFunc-tr)
1294 ( RemoveDuplicates . calcFunc-rdup)
1295 ( Union . calcFunc-vunion)
1296 ( Intersection . calcFunc-vint)
1297 ( Difference . calcFunc-vdiff)
1298 ( Apply . calcFunc-apply)
1299 ( Map . calcFunc-map)
1300 ( Simplify . calcFunc-simplify)
1301 ( ExpandBrackets . calcFunc-expand)
1302 ( Solve . calcFunc-solve)
1303 ( Degree . calcFunc-pdeg)
1304 ( If . calcFunc-if)
1305 ( Contains . (math-lang-switch-args calcFunc-in))
1306 ( Sum . (math-yacas-parse-Sum calcFunc-sum))
1307 ( Factorize . (math-yacas-parse-Sum calcFunc-prod))))
1308
1309(put 'yacas 'math-special-function-table
1310 '(( calcFunc-sum . (math-yacas-compose-sum "Sum"))
1311 ( calcFunc-prod . (math-yacas-compose-sum "Factorize"))
1312 ( calcFunc-deriv . (math-yacas-compose-deriv "Deriv"))
1313 ( calcFunc-integ . (math-yacas-compose-deriv "Integrate"))
1314 ( calcFunc-taylor . math-yacas-compose-taylor)
1315 ( calcFunc-in . (math-lang-compose-switch-args "Contains"))))
1316
1317(put 'yacas 'math-compose-subscr
1318 (function
1319 (lambda (a)
1320 (let ((args (cdr (cdr a))))
1321 (list 'horiz
1322 (math-compose-expr (nth 1 a) 1000)
1323 "["
1324 (math-compose-vector args ", " 0)
1325 "]")))))
1326
1327(defun math-yacas-parse-Sum (f val)
1328 "Read in the arguments to \"Sum\" in Calc's Yacas mode."
1329 (let ((args (math-read-expr-list)))
1330 (math-read-token)
1331 (list (nth 2 f)
1332 (nth 3 args)
1333 (nth 0 args)
1334 (nth 1 args)
1335 (nth 2 args))))
1336
1337(defun math-yacas-compose-sum (a fn)
1338 "Compose the \"Sum\" function in Calc's Yacas mode."
1339 (list 'horiz
1340 (nth 1 fn)
1341 "("
1342 (math-compose-expr (nth 2 a) -1)
1343 ","
1344 (math-compose-expr (nth 3 a) -1)
1345 ","
1346 (math-compose-expr (nth 4 a) -1)
1347 ","
1348 (math-compose-expr (nth 1 a) -1)
1349 ")"))
1350
1351(defun math-yacas-compose-deriv (a fn)
1352 "Compose the \"Deriv\" function in Calc's Yacas mode."
1353 (list 'horiz
1354 (nth 1 fn)
1355 "("
1356 (math-compose-expr (nth 2 a) -1)
1357 (if (not (nth 3 a))
1358 ")"
1359 (concat
1360 ","
1361 (math-compose-expr (nth 3 a) -1)
1362 ","
1363 (math-compose-expr (nth 4 a) -1)
1364 ")"))
1365 " "
1366 (math-compose-expr (nth 1 a) -1)))
1367
1368(defun math-yacas-compose-taylor (a)
1369 "Compose the \"Taylor\" function in Calc's Yacas mode."
1370 (list 'horiz
1371 "Taylor("
1372 (if (eq (car-safe (nth 2 a)) 'calcFunc-eq)
1373 (concat (math-compose-expr (nth 1 (nth 2 a)) -1)
1374 ","
1375 (math-compose-expr (nth 2 (nth 2 a)) -1))
1376 (concat (math-compose-expr (nth 2 a) -1) ",0"))
1377 ","
1378 (math-compose-expr (nth 3 a) -1)
1379 ") "
1380 (math-compose-expr (nth 1 a) -1)))
1381
1382
1383;;; Maxima
1384
1385(defun calc-maxima-language ()
1386 "Change the Calc language to be Maxima-like."
1387 (interactive)
1388 (calc-wrapper
1389 (calc-set-language 'maxima)
1390 (message "`Maxima' language mode")))
1391
1392(put 'maxima 'math-oper-table
1393 '(("+" + 100 100)
1394 ("-" - 100 134)
1395 ("*" * 120 120)
1396 ("." * 130 129)
1397 ("/" / 120 120)
1398 ("u-" neg -1 180)
1399 ("u+" ident -1 180)
1400 ("^" ^ 140 139)
1401 ("**" ^ 140 139)
1402 ("!" calcFunc-fact 160 -1)
1403 ("!!" calcFunc-dfact 160 -1)
1404 ("=" calcFunc-eq 80 80)
1405 ("#" calcFunc-neq 80 80)
1406 ("<" calcFunc-lt 80 80)
1407 (">" calcFunc-gt 80 80)
1408 ("<=" calcFunc-leq 80 80)
1409 (">=" calcFunc-geq 80 80)
1410 ("and" calcFunc-land 65 65)
1411 ("or" calcFunc-or 60 60)
1412 ("not" calcFunc-lnot -1 70)
1413 (":" calcFunc-assign 180 20)))
1414
1415
1416(put 'maxima 'math-function-table
1417 '(( matrix . vec)
1418 ( abs . calcFunc-abs)
1419 ( cabs . calcFunc-abs)
1420 ( signum . calcFunc-sign)
1421 ( floor . calcFunc-floor)
1422 ( entier . calcFunc-floor)
1423 ( fix . calcFunc-floor)
1424 ( conjugate . calcFunc-conj )
1425 ( carg . calcFunc-arg)
1426 ( realpart . calcFunc-re)
1427 ( imagpart . calcFunc-im)
1428 ( rationalize . calcFunc-pfrac)
1429 ( asin . calcFunc-arcsin)
1430 ( acos . calcFunc-arccos)
1431 ( atan . calcFunc-arctan)
1432 ( atan2 . calcFunc-arctan2)
1433 ( asinh . calcFunc-arcsinh)
1434 ( acosh . calcFunc-arccosh)
1435 ( atanh . calcFunc-arctanh)
1436 ( log . calcFunc-ln)
1437 ( plog . calcFunc-ln)
1438 ( bessel_j . calcFunc-besJ)
1439 ( bessel_y . calcFunc-besY)
1440 ( factorial . calcFunc-fact)
1441 ( binomial . calcFunc-choose)
1442 ( primep . calcFunc-prime)
1443 ( next_prime . calcFunc-nextprime)
1444 ( prev_prime . calcFunc-prevprime)
1445 ( append . calcFunc-vconcat)
1446 ( rest . calcFunc-tail)
1447 ( reverse . calcFunc-rev)
1448 ( innerproduct . calcFunc-mul)
1449 ( inprod . calcFunc-mul)
1450 ( row . calcFunc-mrow)
1451 ( columnvector . calcFunc-mcol)
1452 ( covect . calcFunc-mcol)
1453 ( transpose . calcFunc-trn)
1454 ( invert . calcFunc-inv)
1455 ( determinant . calcFunc-det)
1456 ( mattrace . calcFunc-tr)
1457 ( member . calcFunc-in)
1458 ( lmax . calcFunc-vmax)
1459 ( lmin . calcFunc-vmin)
1460 ( distrib . calcFunc-expand)
1461 ( partfrac . calcFunc-apart)
1462 ( rat . calcFunc-nrat)
1463 ( product . calcFunc-prod)
1464 ( diff . calcFunc-deriv)
1465 ( integrate . calcFunc-integ)
1466 ( quotient . calcFunc-pdiv)
1467 ( remainder . calcFunc-prem)
1468 ( divide . calcFunc-pdivrem)
1469 ( equal . calcFunc-eq)
1470 ( notequal . calcFunc-neq)
1471 ( rhs . calcFunc-rmeq)
1472 ( subst . (math-maxima-parse-subst))
1473 ( substitute . (math-maxima-parse-subst))
1474 ( taylor . (math-maxima-parse-taylor))))
1475
1476(defun math-maxima-parse-subst (f val)
1477 "Read in the arguments to \"subst\" in Calc's Maxima mode."
1478 (let ((args (math-read-expr-list)))
1479 (math-read-token)
1480 (list 'calcFunc-subst
1481 (nth 1 args)
1482 (nth 2 args)
1483 (nth 0 args))))
1484
1485(defun math-maxima-parse-taylor (f val)
1486 "Read in the arguments to \"taylor\" in Calc's Maxima mode."
1487 (let ((args (math-read-expr-list)))
1488 (math-read-token)
1489 (list 'calcFunc-taylor
1490 (nth 0 args)
1491 (list 'calcFunc-eq
1492 (nth 1 args)
1493 (nth 2 args))
1494 (nth 3 args))))
1495
1496(put 'maxima 'math-parse-table
1497 '((("if" 0 "then" 0 "else" 0)
1498 calcFunc-if
1499 (var ArgA var-ArgA)
1500 (var ArgB var-ArgB)
1501 (var ArgC var-ArgC))))
1502
1503(put 'maxima 'math-special-function-table
1504 '(( calcFunc-taylor . math-maxima-compose-taylor)
1505 ( calcFunc-subst . math-maxima-compose-subst)
1506 ( calcFunc-if . math-maxima-compose-if)))
1507
1508(defun math-maxima-compose-taylor (a)
1509 "Compose the \"taylor\" function in Calc's Maxima mode."
1510 (list 'horiz
1511 "taylor("
1512 (math-compose-expr (nth 1 a) -1)
1513 ","
1514 (if (eq (car-safe (nth 2 a)) 'calcFunc-eq)
1515 (concat (math-compose-expr (nth 1 (nth 2 a)) -1)
1516 ","
1517 (math-compose-expr (nth 2 (nth 2 a)) -1))
1518 (concat (math-compose-expr (nth 2 a) -1) ",0"))
1519 ","
1520 (math-compose-expr (nth 3 a) -1)
1521 ")"))
1522
1523(defun math-maxima-compose-subst (a)
1524 "Compose the \"subst\" function in Calc's Maxima mode."
1525 (list 'horiz
1526 "substitute("
1527 (math-compose-expr (nth 2 a) -1)
1528 ","
1529 (math-compose-expr (nth 3 a) -1)
1530 ","
1531 (math-compose-expr (nth 1 a) -1)
1532 ")"))
1533
1534(defun math-maxima-compose-if (a)
1535 "Compose the \"if\" function in Calc's Maxima mode."
1536 (list 'horiz
1537 "if "
1538 (math-compose-expr (nth 1 a) -1)
1539 " then "
1540 (math-compose-expr (nth 2 a) -1)
1541 " else "
1542 (math-compose-expr (nth 3 a) -1)))
1543
1544(put 'maxima 'math-variable-table
1545 '(( infinity . var-uinf)
1546 ( %pi . var-pi)
1547 ( %e . var-e)
1548 ( %i . var-i)
1549 ( %phi . var-phi)
1550 ( %gamma . var-gamma)))
1551
1552(put 'maxima 'math-complex-format '%i)
1553
1554(add-to-list 'calc-lang-allow-underscores 'maxima)
1555
1556(add-to-list 'calc-lang-allow-percentsigns 'maxima)
1557
1558(add-to-list 'calc-lang-brackets-are-subscripts 'maxima)
1559
1560(put 'maxima 'math-compose-subscr
1561 (function
1562 (lambda (a)
1563 (let ((args (cdr (cdr a))))
1564 (list 'horiz
1565 (math-compose-expr (nth 1 a) 1000)
1566 "["
1567 (math-compose-vector args ", " 0)
1568 "]")))))
1569
1570(put 'maxima 'math-matrix-formatter
1571 (function
1572 (lambda (a)
1573 (list 'horiz
1574 "matrix("
1575 (math-compose-vector (cdr a)
1576 (concat math-comp-comma " ")
1577 math-comp-vector-prec)
1578 ")"))))
1579
1580
1581;;; Giac
1582
1583(defun calc-giac-language ()
1584 "Change the Calc language to be Giac-like."
1585 (interactive)
1586 (calc-wrapper
1587 (calc-set-language 'giac)
1588 (message "`Giac' language mode")))
1589
1590(put 'giac 'math-oper-table
1591 '( ( "[" (math-read-giac-subscr) 250 -1 )
1592 ( "+" + 180 181 )
1593 ( "-" - 180 181 )
1594 ( "/" / 191 192 )
1595 ( "*" * 191 192 )
1596 ( "^" ^ 201 200 )
1597 ( "u+" ident -1 197 )
1598 ( "u-" neg -1 197 )
1599 ( "!" calcFunc-fact 210 -1 )
1600 ( ".." (math-read-maple-dots) 165 165 )
1601 ( "\\dots" (math-read-maple-dots) 165 165 )
1602 ( "intersect" calcFunc-vint 191 192 )
1603 ( "union" calcFunc-vunion 180 181 )
1604 ( "minus" calcFunc-vdiff 180 181 )
1605 ( "<" calcFunc-lt 160 160 )
1606 ( ">" calcFunc-gt 160 160 )
1607 ( "<=" calcFunc-leq 160 160 )
1608 ( ">=" calcFunc-geq 160 160 )
1609 ( "=" calcFunc-eq 160 160 )
1610 ( "==" calcFunc-eq 160 160 )
1611 ( "!=" calcFunc-neq 160 160 )
1612 ( "and" calcFunc-land 110 111 )
1613 ( "or" calcFunc-lor 100 101 )
1614 ( "&&" calcFunc-land 110 111 )
1615 ( "||" calcFunc-lor 100 101 )
1616 ( "not" calcFunc-lnot -1 121 )
1617 ( ":=" calcFunc-assign 51 50 )))
1618
1619
1620(put 'giac 'math-function-table
1621 '(( rdiv . calcFunc-div)
1622 ( iquo . calcFunc-idiv)
1623 ( irem . calcFunc-mod)
1624 ( remain . calcFunc-mod)
1625 ( floor . calcFunc-floor)
1626 ( iPart . calcFunc-floor)
1627 ( ceil . calcFunc-ceil)
1628 ( ceiling . calcFunc-ceil)
1629 ( re . calcFunc-re)
1630 ( real . calcFunc-re)
1631 ( im . calcFunc-im)
1632 ( imag . calcFunc-im)
1633 ( float2rational . calcFunc-pfrac)
1634 ( exact . calcFunc-pfrac)
1635 ( evalf . calcFunc-pfloat)
1636 ( bitand . calcFunc-and)
1637 ( bitor . calcFunc-or)
1638 ( bitxor . calcFunc-xor)
1639 ( asin . calcFunc-arcsin)
1640 ( acos . calcFunc-arccos)
1641 ( atan . calcFunc-arctan)
1642 ( asinh . calcFunc-arcsinh)
1643 ( acosh . calcFunc-arccosh)
1644 ( atanh . calcFunc-arctanh)
1645 ( log . calcFunc-ln)
1646 ( logb . calcFunc-log)
1647 ( factorial . calcFunc-fact)
1648 ( comb . calcFunc-choose)
1649 ( binomial . calcFunc-choose)
1650 ( nCr . calcFunc-choose)
1651 ( perm . calcFunc-perm)
1652 ( nPr . calcFunc-perm)
1653 ( bernoulli . calcFunc-bern)
1654 ( is_prime . calcFunc-prime)
1655 ( isprime . calcFunc-prime)
1656 ( isPrime . calcFunc-prime)
1657 ( ifactors . calcFunc-prfac)
1658 ( euler . calcFunc-totient)
1659 ( phi . calcFunc-totient)
1660 ( rand . calcFunc-random)
1661 ( concat . calcFunc-vconcat)
1662 ( augment . calcFunc-vconcat)
1663 ( mid . calcFunc-subvec)
1664 ( length . calcFunc-length)
1665 ( size . calcFunc-length)
1666 ( nops . calcFunc-length)
1667 ( SortA . calcFunc-sort)
1668 ( SortB . calcFunc-rsort)
1669 ( revlist . calcFunc-rev)
1670 ( cross . calcFunc-cross)
1671 ( crossP . calcFunc-cross)
1672 ( crossproduct . calcFunc-cross)
1673 ( mul . calcFunc-mul)
1674 ( dot . calcFunc-mul)
1675 ( dotprod . calcFunc-mul)
1676 ( dotP . calcFunc-mul)
1677 ( scalar_product . calcFunc-mul)
1678 ( scalar_Product . calcFunc-mul)
1679 ( row . calcFunc-mrow)
1680 ( col . calcFunc-mcol)
1681 ( dim . calcFunc-mdims)
1682 ( tran . calcFunc-trn)
1683 ( transpose . calcFunc-trn)
1684 ( lu . calcFunc-lud)
1685 ( trace . calcFunc-tr)
1686 ( member . calcFunc-in)
1687 ( sum . calcFunc-vsum)
1688 ( add . calcFunc-vsum)
1689 ( product . calcFunc-vprod)
1690 ( mean . calcFunc-vmean)
1691 ( median . calcFunc-vmedian)
1692 ( stddev . calcFunc-vsdev)
1693 ( stddevp . calcFunc-vpsdev)
1694 ( variance . calcFunc-vpvar)
1695 ( map . calcFunc-map)
1696 ( apply . calcFunc-map)
1697 ( of . calcFunc-map)
1698 ( zip . calcFunc-map)
1699 ( expand . calcFunc-expand)
1700 ( fdistrib . calcFunc-expand)
1701 ( partfrac . calcFunc-apart)
1702 ( ratnormal . calcFunc-nrat)
1703 ( diff . calcFunc-deriv)
1704 ( derive . calcFunc-deriv)
1705 ( integrate . calcFunc-integ)
1706 ( int . calcFunc-integ)
1707 ( Int . calcFunc-integ)
1708 ( romberg . calcFunc-ninteg)
1709 ( nInt . calcFunc-ninteg)
1710 ( lcoeff . calcFunc-plead)
1711 ( content . calcFunc-pcont)
1712 ( primpart . calcFunc-pprim)
1713 ( quo . calcFunc-pdiv)
1714 ( rem . calcFunc-prem)
1715 ( quorem . calcFunc-pdivrem)
1716 ( divide . calcFunc-pdivrem)
1717 ( equal . calcFunc-eq)
1718 ( ifte . calcFunc-if)
1719 ( not . calcFunc-lnot)
1720 ( rhs . calcFunc-rmeq)
1721 ( right . calcFunc-rmeq)
1722 ( prepend . (math-lang-switch-args calcFunc-cons))
1723 ( contains . (math-lang-switch-args calcFunc-in))
1724 ( has . (math-lang-switch-args calcFunc-refers))))
1725
1726(defun math-lang-switch-args (f val)
1727 "Read the arguments to a Calc function in reverse order.
1728This is used for various language modes which have functions in reverse
1729order to Calc's."
1730 (let ((args (math-read-expr-list)))
1731 (math-read-token)
1732 (list (nth 2 f)
1733 (nth 1 args)
1734 (nth 0 args))))
1735
1736(put 'giac 'math-parse-table
1737 '((("set" 0)
1738 calcFunc-rdup
1739 (var ArgA var-ArgA))))
1740
1741(put 'giac 'math-special-function-table
1742 '((calcFunc-cons . (math-lang-compose-switch-args "prepend"))
1743 (calcFunc-in . (math-lang-compose-switch-args "contains"))
1744 (calcFunc-refers . (math-lang-compose-switch-args "has"))
1745 (intv . math-compose-maple-intv)))
1746
1747(defun math-lang-compose-switch-args (a fn)
1748 "Compose the arguments to a Calc function in reverse order.
1749This is used for various language modes which have functions in reverse
1750order to Calc's."
1751 (list 'horiz (nth 1 fn)
1752 "("
1753 (math-compose-expr (nth 2 a) 0)
1754 ","
1755 (math-compose-expr (nth 1 a) 0)
1756 ")"))
1757
1758(put 'giac 'math-variable-table
1759 '(( infinity . var-inf)
1760 ( infinity . var-uinf)))
1761
1762(add-to-list 'calc-lang-allow-underscores 'giac)
1763
1764(put 'giac 'math-compose-subscr
1765 (function
1766 (lambda (a)
1767 (let ((args (cdr (cdr a))))
1768 (list 'horiz
1769 (math-compose-expr (nth 1 a) 1000)
1770 "["
1771 (math-compose-expr
1772 (calc-normalize (list '- (nth 2 a) 1)) 0)
1773 "]")))))
1774
1775(defun math-read-giac-subscr (x op)
1776 (let ((idx (math-read-expr-level 0)))
1777 (or (equal math-expr-data "]")
1778 (throw 'syntax "Expected ']'"))
1779 (math-read-token)
1780 (list 'calcFunc-subscr x (calc-normalize (list '+ idx 1)))))
1781
1782(add-to-list 'calc-lang-c-type-hex 'giac)
1783
1784
1167(defun calc-mathematica-language () 1785(defun calc-mathematica-language ()
1168 (interactive) 1786 (interactive)
1169 (calc-wrapper 1787 (calc-wrapper
diff --git a/lisp/calc/calc-menu.el b/lisp/calc/calc-menu.el
index 22c42adc124..dd9ec9a2542 100644
--- a/lisp/calc/calc-menu.el
+++ b/lisp/calc/calc-menu.el
@@ -1157,7 +1157,28 @@
1157 (call-interactively 'calc-eqn-language)) 1157 (call-interactively 'calc-eqn-language))
1158 :keys "d E" 1158 :keys "d E"
1159 :style radio 1159 :style radio
1160 :selected (eq calc-language 'eqn)]) 1160 :selected (eq calc-language 'eqn)]
1161 ["Yacas"
1162 (progn
1163 (require 'calc-lang)
1164 (call-interactively 'calc-yacas-language))
1165 :keys "d Y"
1166 :style radio
1167 :selected (eq calc-language 'yacas)]
1168 ["Maxima"
1169 (progn
1170 (require 'calc-lang)
1171 (call-interactively 'calc-maxima-language))
1172 :keys "d X"
1173 :style radio
1174 :selected (eq calc-language 'maxima)]
1175 ["Giac"
1176 (progn
1177 (require 'calc-lang)
1178 (call-interactively 'calc-giac-language))
1179 :keys "d A"
1180 :style radio
1181 :selected (eq calc-language 'giac)])
1161 "----" 1182 "----"
1162 ["Save mode settings" calc-save-modes :keys "m m"] 1183 ["Save mode settings" calc-save-modes :keys "m m"]
1163 "----" 1184 "----"
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 76b01a61ec4..3b3e308eb18 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -685,6 +685,9 @@ If `C' is present, display outer brackets for matrices (centered).")
685 tex Use TeX notation. 685 tex Use TeX notation.
686 latex Use LaTeX notation. 686 latex Use LaTeX notation.
687 eqn Use eqn notation. 687 eqn Use eqn notation.
688 yacas Use Yacas notation.
689 maxima Use Maxima notation.
690 giac Use Giac notation.
688 math Use Mathematica(tm) notation. 691 math Use Mathematica(tm) notation.
689 maple Use Maple notation.") 692 maple Use Maple notation.")
690 693
diff --git a/lisp/calc/calccomp.el b/lisp/calc/calccomp.el
index 2b81363af47..e54d86dc296 100644
--- a/lisp/calc/calccomp.el
+++ b/lisp/calc/calccomp.el
@@ -781,6 +781,9 @@
781 ( tex . math-compose-tex ) 781 ( tex . math-compose-tex )
782 ( latex . math-compose-latex ) 782 ( latex . math-compose-latex )
783 ( eqn . math-compose-eqn ) 783 ( eqn . math-compose-eqn )
784 ( yacas . math-compose-yacas )
785 ( maxima . math-compose-maxima )
786 ( giac . math-compose-giac )
784 ( math . math-compose-math ) 787 ( math . math-compose-math )
785 ( maple . math-compose-maple )))) 788 ( maple . math-compose-maple ))))
786 (setq op (get (car a) (cdr op))) 789 (setq op (get (car a) (cdr op)))
diff --git a/lisp/vc-hg.el b/lisp/vc-hg.el
index 592bccaf517..41cc883c0a4 100644
--- a/lisp/vc-hg.el
+++ b/lisp/vc-hg.el
@@ -147,7 +147,9 @@
147(defun vc-hg-registered (file) 147(defun vc-hg-registered (file)
148 "Return non-nil if FILE is registered with hg." 148 "Return non-nil if FILE is registered with hg."
149 (when (vc-hg-root file) ; short cut 149 (when (vc-hg-root file) ; short cut
150 (vc-file-setprop file 'vc-state (vc-hg-state file)))) ; expensive 150 (let ((state (vc-hg-state file))) ; expensive
151 (vc-file-setprop file 'vc-state state)
152 (not (memq state '(ignored unregistered))))))
151 153
152(defun vc-hg-state (file) 154(defun vc-hg-state (file)
153 "Hg-specific version of `vc-state'." 155 "Hg-specific version of `vc-state'."
@@ -162,26 +164,26 @@
162 ;; Ignore all errors. 164 ;; Ignore all errors.
163 (call-process 165 (call-process
164 "hg" nil t nil "--cwd" (file-name-directory file) 166 "hg" nil t nil "--cwd" (file-name-directory file)
165 "status" (file-name-nondirectory file)) 167 "status" "-A" (file-name-nondirectory file))
166 ;; Some problem happened. E.g. We can't find an `hg' 168 ;; Some problem happened. E.g. We can't find an `hg'
167 ;; executable. 169 ;; executable.
168 (error nil))))))) 170 (error nil)))))))
169 (when (eq 0 status) 171 (when (eq 0 status)
170 (if (eq 0 (length out)) 'up-to-date
171 (when (null (string-match ".*: No such file or directory$" out)) 172 (when (null (string-match ".*: No such file or directory$" out))
172 (let ((state (aref out 0))) 173 (let ((state (aref out 0)))
173 (cond 174 (cond
175 ((eq state ?C) 'up-to-date)
174 ((eq state ?A) 'edited) 176 ((eq state ?A) 'edited)
175 ((eq state ?M) 'edited) 177 ((eq state ?M) 'edited)
176 ((eq state ?I) 'ignored) 178 ((eq state ?I) 'ignored)
177 ((eq state ?R) 'unregistered) 179 ((eq state ?R) 'unregistered)
178 ((eq state ??) 'unregistered) 180 ((eq state ??) 'unregistered)
179 (t 'up-to-date)))))))) 181 (t 'up-to-date)))))))
180 182
181(defun vc-hg-dir-state (dir) 183(defun vc-hg-dir-state (dir)
182 (with-temp-buffer 184 (with-temp-buffer
183 (buffer-disable-undo) ;; Because these buffers can get huge 185 (buffer-disable-undo) ;; Because these buffers can get huge
184 (vc-hg-command (current-buffer) nil nil "status") 186 (vc-hg-command (current-buffer) nil nil "status" "-A")
185 (goto-char (point-min)) 187 (goto-char (point-min))
186 (let ((status-char nil) 188 (let ((status-char nil)
187 (file nil)) 189 (file nil))
diff --git a/src/ChangeLog b/src/ChangeLog
index be2c5824f51..aca22996d14 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,8 +1,5 @@
12007-12-24 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 12007-12-24 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2 2
3 * process.c (make_process): Initialize pty_flag to Qnil instead of 0
4 as it is not a bit field on Emacs 22 yet.
5
6 * xdisp.c (phys_cursor_in_rect_p): Check if cursor is in fringe area. 3 * xdisp.c (phys_cursor_in_rect_p): Check if cursor is in fringe area.
7 4
82007-12-22 Eli Zaretskii <eliz@gnu.org> 52007-12-22 Eli Zaretskii <eliz@gnu.org>
diff --git a/src/process.c b/src/process.c
index 542bf4fdda5..c2f0c82a6a8 100644
--- a/src/process.c
+++ b/src/process.c
@@ -631,7 +631,7 @@ make_process (name)
631 p->tick = 0; 631 p->tick = 0;
632 p->update_tick = 0; 632 p->update_tick = 0;
633 p->pid = 0; 633 p->pid = 0;
634 p->pty_flag = Qnil; 634 p->pty_flag = 0;
635 p->raw_status_new = 0; 635 p->raw_status_new = 0;
636 p->status = Qrun; 636 p->status = Qrun;
637 p->mark = Fmake_marker (); 637 p->mark = Fmake_marker ();