Mercurial > emacs
comparison lisp/calc/calc-aent.el @ 93880:c6152337e4ad
* calc/calc.el: Load "cal-loaddefs" rather than set up autoloads manually.
(calc-mode-map, calc-digit-map, calc-dispatch-map):
Move initialization into declaration.
* calc/calc-yank.el:
* calc/calc-misc.el:
* calc/calc-embed.el:
* calc/calc-aent.el: Add autoload cookies and set generated-autoload-file.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 08 Apr 2008 22:07:55 +0000 |
parents | 107ccd98fa12 |
children | 6c9af2bfcfee |
comparison
equal
deleted
inserted
replaced
93879:36855e43119a | 93880:c6152337e4ad |
---|---|
52 (declare-function math-to-percentsigns "calccomp" (x)) | 52 (declare-function math-to-percentsigns "calccomp" (x)) |
53 | 53 |
54 (defvar calc-quick-calc-history nil | 54 (defvar calc-quick-calc-history nil |
55 "The history list for quick-calc.") | 55 "The history list for quick-calc.") |
56 | 56 |
57 ;;;###autoload | |
57 (defun calc-do-quick-calc () | 58 (defun calc-do-quick-calc () |
58 (require 'calc-ext) | 59 (require 'calc-ext) |
59 (calc-check-defines) | 60 (calc-check-defines) |
60 (if (eq major-mode 'calc-mode) | 61 (if (eq major-mode 'calc-mode) |
61 (calc-algebraic-entry t) | 62 (calc-algebraic-entry t) |
112 (message "Result: %s" buf))) | 113 (message "Result: %s" buf))) |
113 (if (eq last-command-char 10) | 114 (if (eq last-command-char 10) |
114 (insert shortbuf) | 115 (insert shortbuf) |
115 (kill-new shortbuf))))) | 116 (kill-new shortbuf))))) |
116 | 117 |
118 ;;;###autoload | |
117 (defun calc-do-calc-eval (str separator args) | 119 (defun calc-do-calc-eval (str separator args) |
118 (calc-check-defines) | 120 (calc-check-defines) |
119 (catch 'calc-error | 121 (catch 'calc-error |
120 (save-excursion | 122 (save-excursion |
121 (calc-create-buffer) | 123 (calc-create-buffer) |
266 msg)) | 268 msg)) |
267 | 269 |
268 | 270 |
269 ;;;; Reading an expression in algebraic form. | 271 ;;;; Reading an expression in algebraic form. |
270 | 272 |
273 ;;;###autoload | |
271 (defun calc-auto-algebraic-entry (&optional prefix) | 274 (defun calc-auto-algebraic-entry (&optional prefix) |
272 (interactive "P") | 275 (interactive "P") |
273 (calc-algebraic-entry prefix t)) | 276 (calc-algebraic-entry prefix t)) |
274 | 277 |
278 ;;;###autoload | |
275 (defun calc-algebraic-entry (&optional prefix auto) | 279 (defun calc-algebraic-entry (&optional prefix auto) |
276 (interactive "P") | 280 (interactive "P") |
277 (calc-wrapper | 281 (calc-wrapper |
278 (let ((calc-language (if prefix nil calc-language)) | 282 (let ((calc-language (if prefix nil calc-language)) |
279 (math-expr-opers (if prefix (math-standard-ops) (math-expr-ops)))) | 283 (math-expr-opers (if prefix (math-standard-ops) (math-expr-ops)))) |
280 (calc-alg-entry (and auto (char-to-string last-command-char)))))) | 284 (calc-alg-entry (and auto (char-to-string last-command-char)))))) |
281 | 285 |
282 (defvar calc-alg-entry-history nil | 286 (defvar calc-alg-entry-history nil |
283 "History for algebraic entry.") | 287 "History for algebraic entry.") |
284 | 288 |
289 ;;;###autoload | |
285 (defun calc-alg-entry (&optional initial prompt) | 290 (defun calc-alg-entry (&optional initial prompt) |
286 (let* ((sel-mode nil) | 291 (let* ((sel-mode nil) |
287 (calc-dollar-values (mapcar 'calc-get-stack-element | 292 (calc-dollar-values (mapcar 'calc-get-stack-element |
288 (nthcdr calc-stack-top calc-stack))) | 293 (nthcdr calc-stack-top calc-stack))) |
289 (calc-dollar-used 0) | 294 (calc-dollar-used 0) |
317 (defvar calc-alg-ent-esc-map nil | 322 (defvar calc-alg-ent-esc-map nil |
318 "The keymap used for escapes in algebraic entry.") | 323 "The keymap used for escapes in algebraic entry.") |
319 | 324 |
320 (defvar calc-alg-exp) | 325 (defvar calc-alg-exp) |
321 | 326 |
327 ;;;###autoload | |
322 (defun calc-do-alg-entry (&optional initial prompt no-normalize history) | 328 (defun calc-do-alg-entry (&optional initial prompt no-normalize history) |
323 (let* ((calc-buffer (current-buffer)) | 329 (let* ((calc-buffer (current-buffer)) |
324 (blink-paren-function 'calcAlg-blink-matching-open) | 330 (blink-paren-function 'calcAlg-blink-matching-open) |
325 (calc-alg-exp 'error)) | 331 (calc-alg-exp 'error)) |
326 (unless calc-alg-ent-map | 332 (unless calc-alg-ent-map |
459 (blink-matching-open)) | 465 (blink-matching-open)) |
460 (aset (syntax-table) leftchar leftsaved) | 466 (aset (syntax-table) leftchar leftsaved) |
461 (aset (syntax-table) rightchar rightsaved))) | 467 (aset (syntax-table) rightchar rightsaved))) |
462 (blink-matching-open)))) | 468 (blink-matching-open)))) |
463 | 469 |
470 ;;;###autoload | |
464 (defun calc-alg-digit-entry () | 471 (defun calc-alg-digit-entry () |
465 (calc-alg-entry | 472 (calc-alg-entry |
466 (cond ((eq last-command-char ?e) | 473 (cond ((eq last-command-char ?e) |
467 (if (> calc-number-radix 14) (format "%d.^" calc-number-radix) "1e")) | 474 (if (> calc-number-radix 14) (format "%d.^" calc-number-radix) "1e")) |
468 ((eq last-command-char ?#) (format "%d#" calc-number-radix)) | 475 ((eq last-command-char ?#) (format "%d#" calc-number-radix)) |
472 | 479 |
473 ;; The variable calc-digit-value is initially declared in calc.el, | 480 ;; The variable calc-digit-value is initially declared in calc.el, |
474 ;; but can be set by calcDigit-algebraic and calcDigit-edit. | 481 ;; but can be set by calcDigit-algebraic and calcDigit-edit. |
475 (defvar calc-digit-value) | 482 (defvar calc-digit-value) |
476 | 483 |
484 ;;;###autoload | |
477 (defun calcDigit-algebraic () | 485 (defun calcDigit-algebraic () |
478 (interactive) | 486 (interactive) |
479 (if (calc-minibuffer-contains ".*[@oh] *[^'m ]+[^'m]*\\'") | 487 (if (calc-minibuffer-contains ".*[@oh] *[^'m ]+[^'m]*\\'") |
480 (calcDigit-key) | 488 (calcDigit-key) |
481 (setq calc-digit-value (minibuffer-contents)) | 489 (setq calc-digit-value (minibuffer-contents)) |
482 (exit-minibuffer))) | 490 (exit-minibuffer))) |
483 | 491 |
492 ;;;###autoload | |
484 (defun calcDigit-edit () | 493 (defun calcDigit-edit () |
485 (interactive) | 494 (interactive) |
486 (calc-unread-command) | 495 (calc-unread-command) |
487 (setq calc-digit-value (minibuffer-contents)) | 496 (setq calc-digit-value (minibuffer-contents)) |
488 (exit-minibuffer)) | 497 (exit-minibuffer)) |
561 | 570 |
562 (defvar math-read-subscripts | 571 (defvar math-read-subscripts |
563 "₀₁₂₃₄₅₆₇₈₉₊₋₍₎" ; 0123456789+-() | 572 "₀₁₂₃₄₅₆₇₈₉₊₋₍₎" ; 0123456789+-() |
564 "A string consisting of the subscripts allowed by Calc.") | 573 "A string consisting of the subscripts allowed by Calc.") |
565 | 574 |
575 ;;;###autoload | |
566 (defun math-read-preprocess-string (str) | 576 (defun math-read-preprocess-string (str) |
567 "Replace some substrings of STR by Calc equivalents." | 577 "Replace some substrings of STR by Calc equivalents." |
568 (setq str | 578 (setq str |
569 (replace-regexp-in-string (concat "[" math-read-superscripts "]+") | 579 (replace-regexp-in-string (concat "[" math-read-superscripts "]+") |
570 "^(\\&)" str)) | 580 "^(\\&)" str)) |
587 (defvar math-exp-old-pos) | 597 (defvar math-exp-old-pos) |
588 (defvar math-exp-token) | 598 (defvar math-exp-token) |
589 (defvar math-exp-keep-spaces) | 599 (defvar math-exp-keep-spaces) |
590 (defvar math-expr-data) | 600 (defvar math-expr-data) |
591 | 601 |
602 ;;;###autoload | |
592 (defun math-read-exprs (math-exp-str) | 603 (defun math-read-exprs (math-exp-str) |
593 (let ((math-exp-pos 0) | 604 (let ((math-exp-pos 0) |
594 (math-exp-old-pos 0) | 605 (math-exp-old-pos 0) |
595 (math-exp-keep-spaces nil) | 606 (math-exp-keep-spaces nil) |
596 math-exp-token math-expr-data) | 607 math-exp-token math-expr-data) |
611 (list 'error math-exp-old-pos val) | 622 (list 'error math-exp-old-pos val) |
612 (if (equal math-exp-token 'end) | 623 (if (equal math-exp-token 'end) |
613 val | 624 val |
614 (list 'error math-exp-old-pos "Syntax error")))))) | 625 (list 'error math-exp-old-pos "Syntax error")))))) |
615 | 626 |
627 ;;;###autoload | |
616 (defun math-read-expr-list () | 628 (defun math-read-expr-list () |
617 (let* ((math-exp-keep-spaces nil) | 629 (let* ((math-exp-keep-spaces nil) |
618 (val (list (math-read-expr-level 0))) | 630 (val (list (math-read-expr-level 0))) |
619 (last val)) | 631 (last val)) |
620 (while (equal math-expr-data ",") | 632 (while (equal math-expr-data ",") |
632 (defvar calc-user-token-chars nil) | 644 (defvar calc-user-token-chars nil) |
633 | 645 |
634 (defvar math-toks nil | 646 (defvar math-toks nil |
635 "Tokens to pass between math-build-parse-table and math-find-user-tokens.") | 647 "Tokens to pass between math-build-parse-table and math-find-user-tokens.") |
636 | 648 |
649 ;;;###autoload | |
637 (defun math-build-parse-table () | 650 (defun math-build-parse-table () |
638 (let ((mtab (cdr (assq nil calc-user-parse-tables))) | 651 (let ((mtab (cdr (assq nil calc-user-parse-tables))) |
639 (ltab (cdr (assq calc-language calc-user-parse-tables))) | 652 (ltab (cdr (assq calc-language calc-user-parse-tables))) |
640 (lltab (get calc-language 'math-parse-table))) | 653 (lltab (get calc-language 'math-parse-table))) |
641 (or (and (eq mtab calc-last-main-parse-table) | 654 (or (and (eq mtab calc-last-main-parse-table) |
656 "\\|") | 669 "\\|") |
657 calc-last-main-parse-table mtab | 670 calc-last-main-parse-table mtab |
658 calc-last-user-lang-parse-table ltab | 671 calc-last-user-lang-parse-table ltab |
659 calc-last-lang-parse-table lltab))))) | 672 calc-last-lang-parse-table lltab))))) |
660 | 673 |
674 ;;;###autoload | |
661 (defun math-find-user-tokens (p) | 675 (defun math-find-user-tokens (p) |
662 (while p | 676 (while p |
663 (cond ((and (stringp (car p)) | 677 (cond ((and (stringp (car p)) |
664 (or (> (length (car p)) 1) (equal (car p) "$") | 678 (or (> (length (car p)) 1) (equal (car p) "$") |
665 (equal (car p) "\"")) | 679 (equal (car p) "\"")) |
680 (math-find-user-tokens (nth 1 (car p))) | 694 (math-find-user-tokens (nth 1 (car p))) |
681 (or (eq (car (car p)) '\?) | 695 (or (eq (car (car p)) '\?) |
682 (math-find-user-tokens (nth 2 (car p)))))) | 696 (math-find-user-tokens (nth 2 (car p)))))) |
683 (setq p (cdr p)))) | 697 (setq p (cdr p)))) |
684 | 698 |
699 ;;;###autoload | |
685 (defun math-read-token () | 700 (defun math-read-token () |
686 (if (>= math-exp-pos (length math-exp-str)) | 701 (if (>= math-exp-pos (length math-exp-str)) |
687 (setq math-exp-old-pos math-exp-pos | 702 (setq math-exp-old-pos math-exp-pos |
688 math-exp-token 'end | 703 math-exp-token 'end |
689 math-expr-data "\000") | 704 math-expr-data "\000") |
865 x)) | 880 x)) |
866 | 881 |
867 ;; calc-arg-values is defined in calc-ext.el, but is used here. | 882 ;; calc-arg-values is defined in calc-ext.el, but is used here. |
868 (defvar calc-arg-values) | 883 (defvar calc-arg-values) |
869 | 884 |
885 ;;;###autoload | |
870 (defun calc-check-user-syntax (&optional x prec) | 886 (defun calc-check-user-syntax (&optional x prec) |
871 (let ((p calc-user-parse-table) | 887 (let ((p calc-user-parse-table) |
872 (matches nil) | 888 (matches nil) |
873 match rule) | 889 match rule) |
874 (while (and p | 890 (while (and p |
951 math-expr-data save-exp-data | 967 math-expr-data save-exp-data |
952 math-exp-pos save-exp-pos))))))) | 968 math-exp-pos save-exp-pos))))))) |
953 (setq p (cdr p))) | 969 (setq p (cdr p))) |
954 (and p match))) | 970 (and p match))) |
955 | 971 |
972 ;;;###autoload | |
956 (defun calc-match-user-syntax (p &optional term) | 973 (defun calc-match-user-syntax (p &optional term) |
957 (let ((matches nil) | 974 (let ((matches nil) |
958 (save-exp-pos math-exp-pos) | 975 (save-exp-pos math-exp-pos) |
959 (save-exp-old-pos math-exp-old-pos) | 976 (save-exp-old-pos math-exp-old-pos) |
960 (save-exp-token math-exp-token) | 977 (save-exp-token math-exp-token) |
1011 math-exp-token save-exp-token | 1028 math-exp-token save-exp-token |
1012 math-expr-data save-exp-data | 1029 math-expr-data save-exp-data |
1013 matches "Failed")) | 1030 matches "Failed")) |
1014 matches)) | 1031 matches)) |
1015 | 1032 |
1033 ;;;###autoload | |
1016 (defun math-remove-dashes (x) | 1034 (defun math-remove-dashes (x) |
1017 (if (string-match "\\`\\(.*\\)-\\(.*\\)\\'" x) | 1035 (if (string-match "\\`\\(.*\\)-\\(.*\\)\\'" x) |
1018 (math-remove-dashes | 1036 (math-remove-dashes |
1019 (concat (math-match-substring x 1) "#" (math-match-substring x 2))) | 1037 (concat (math-match-substring x 1) "#" (math-match-substring x 2))) |
1020 x)) | 1038 x)) |
1050 (if (string-match "\\`\\(.*\\)#\\(.*\\)\\'" x) | 1068 (if (string-match "\\`\\(.*\\)#\\(.*\\)\\'" x) |
1051 (math-string-restore-underscores | 1069 (math-string-restore-underscores |
1052 (concat (math-match-substring x 1) "_" (math-match-substring x 2))) | 1070 (concat (math-match-substring x 1) "_" (math-match-substring x 2))) |
1053 x)) | 1071 x)) |
1054 | 1072 |
1073 ;;;###autoload | |
1055 (defun math-read-if (cond op) | 1074 (defun math-read-if (cond op) |
1056 (let ((then (math-read-expr-level 0))) | 1075 (let ((then (math-read-expr-level 0))) |
1057 (or (equal math-expr-data ":") | 1076 (or (equal math-expr-data ":") |
1058 (throw 'syntax "Expected ':'")) | 1077 (throw 'syntax "Expected ':'")) |
1059 (math-read-token) | 1078 (math-read-token) |
1261 (math-read-angle-brackets)) | 1280 (math-read-angle-brackets)) |
1262 (t (throw 'syntax "Expected a number"))))) | 1281 (t (throw 'syntax "Expected a number"))))) |
1263 | 1282 |
1264 (provide 'calc-aent) | 1283 (provide 'calc-aent) |
1265 | 1284 |
1266 ;;; arch-tag: 5599e45d-e51e-44bb-9a20-9f4ed8c96c32 | 1285 ;; Local variables: |
1286 ;; generated-autoload-file: "calc-loaddefs.el" | |
1287 ;; End: | |
1288 | |
1289 ;; arch-tag: 5599e45d-e51e-44bb-9a20-9f4ed8c96c32 | |
1267 ;;; calc-aent.el ends here | 1290 ;;; calc-aent.el ends here |