Mercurial > emacs
changeset 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 | 36855e43119a |
children | c0fe31fb3833 |
files | lisp/ChangeLog lisp/calc/calc-aent.el lisp/calc/calc-embed.el lisp/calc/calc-misc.el lisp/calc/calc-yank.el lisp/calc/calc.el |
diffstat | 6 files changed, 291 insertions(+), 231 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Tue Apr 08 21:23:36 2008 +0000 +++ b/lisp/ChangeLog Tue Apr 08 22:07:55 2008 +0000 @@ -1,3 +1,13 @@ +2008-04-08 Stefan Monnier <monnier@iro.umontreal.ca> + + * 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. + 2008-04-08 Michael Albinus <michael.albinus@gmx.de> * ps-samp.el (ps-add-printer, ps-remove-printer)
--- a/lisp/calc/calc-aent.el Tue Apr 08 21:23:36 2008 +0000 +++ b/lisp/calc/calc-aent.el Tue Apr 08 22:07:55 2008 +0000 @@ -54,6 +54,7 @@ (defvar calc-quick-calc-history nil "The history list for quick-calc.") +;;;###autoload (defun calc-do-quick-calc () (require 'calc-ext) (calc-check-defines) @@ -114,6 +115,7 @@ (insert shortbuf) (kill-new shortbuf))))) +;;;###autoload (defun calc-do-calc-eval (str separator args) (calc-check-defines) (catch 'calc-error @@ -268,10 +270,12 @@ ;;;; Reading an expression in algebraic form. +;;;###autoload (defun calc-auto-algebraic-entry (&optional prefix) (interactive "P") (calc-algebraic-entry prefix t)) +;;;###autoload (defun calc-algebraic-entry (&optional prefix auto) (interactive "P") (calc-wrapper @@ -282,6 +286,7 @@ (defvar calc-alg-entry-history nil "History for algebraic entry.") +;;;###autoload (defun calc-alg-entry (&optional initial prompt) (let* ((sel-mode nil) (calc-dollar-values (mapcar 'calc-get-stack-element @@ -319,6 +324,7 @@ (defvar calc-alg-exp) +;;;###autoload (defun calc-do-alg-entry (&optional initial prompt no-normalize history) (let* ((calc-buffer (current-buffer)) (blink-paren-function 'calcAlg-blink-matching-open) @@ -461,6 +467,7 @@ (aset (syntax-table) rightchar rightsaved))) (blink-matching-open)))) +;;;###autoload (defun calc-alg-digit-entry () (calc-alg-entry (cond ((eq last-command-char ?e) @@ -474,6 +481,7 @@ ;; but can be set by calcDigit-algebraic and calcDigit-edit. (defvar calc-digit-value) +;;;###autoload (defun calcDigit-algebraic () (interactive) (if (calc-minibuffer-contains ".*[@oh] *[^'m ]+[^'m]*\\'") @@ -481,6 +489,7 @@ (setq calc-digit-value (minibuffer-contents)) (exit-minibuffer))) +;;;###autoload (defun calcDigit-edit () (interactive) (calc-unread-command) @@ -563,6 +572,7 @@ "₀₁₂₃₄₅₆₇₈₉₊₋₍₎" ; 0123456789+-() "A string consisting of the subscripts allowed by Calc.") +;;;###autoload (defun math-read-preprocess-string (str) "Replace some substrings of STR by Calc equivalents." (setq str @@ -589,6 +599,7 @@ (defvar math-exp-keep-spaces) (defvar math-expr-data) +;;;###autoload (defun math-read-exprs (math-exp-str) (let ((math-exp-pos 0) (math-exp-old-pos 0) @@ -613,6 +624,7 @@ val (list 'error math-exp-old-pos "Syntax error")))))) +;;;###autoload (defun math-read-expr-list () (let* ((math-exp-keep-spaces nil) (val (list (math-read-expr-level 0))) @@ -634,6 +646,7 @@ (defvar math-toks nil "Tokens to pass between math-build-parse-table and math-find-user-tokens.") +;;;###autoload (defun math-build-parse-table () (let ((mtab (cdr (assq nil calc-user-parse-tables))) (ltab (cdr (assq calc-language calc-user-parse-tables))) @@ -658,6 +671,7 @@ calc-last-user-lang-parse-table ltab calc-last-lang-parse-table lltab))))) +;;;###autoload (defun math-find-user-tokens (p) (while p (cond ((and (stringp (car p)) @@ -682,6 +696,7 @@ (math-find-user-tokens (nth 2 (car p)))))) (setq p (cdr p)))) +;;;###autoload (defun math-read-token () (if (>= math-exp-pos (length math-exp-str)) (setq math-exp-old-pos math-exp-pos @@ -867,6 +882,7 @@ ;; calc-arg-values is defined in calc-ext.el, but is used here. (defvar calc-arg-values) +;;;###autoload (defun calc-check-user-syntax (&optional x prec) (let ((p calc-user-parse-table) (matches nil) @@ -953,6 +969,7 @@ (setq p (cdr p))) (and p match))) +;;;###autoload (defun calc-match-user-syntax (p &optional term) (let ((matches nil) (save-exp-pos math-exp-pos) @@ -1013,6 +1030,7 @@ matches "Failed")) matches)) +;;;###autoload (defun math-remove-dashes (x) (if (string-match "\\`\\(.*\\)-\\(.*\\)\\'" x) (math-remove-dashes @@ -1052,6 +1070,7 @@ (concat (math-match-substring x 1) "_" (math-match-substring x 2))) x)) +;;;###autoload (defun math-read-if (cond op) (let ((then (math-read-expr-level 0))) (or (equal math-expr-data ":") @@ -1263,5 +1282,9 @@ (provide 'calc-aent) -;;; arch-tag: 5599e45d-e51e-44bb-9a20-9f4ed8c96c32 +;; Local variables: +;; generated-autoload-file: "calc-loaddefs.el" +;; End: + +;; arch-tag: 5599e45d-e51e-44bb-9a20-9f4ed8c96c32 ;;; calc-aent.el ends here
--- a/lisp/calc/calc-embed.el Tue Apr 08 21:23:36 2008 +0000 +++ b/lisp/calc/calc-embed.el Tue Apr 08 22:07:55 2008 +0000 @@ -96,29 +96,29 @@ )) -;;; Format of calc-embedded-info vector: -;;; 0 Editing buffer. -;;; 1 Calculator buffer. -;;; 2 Top of current formula (marker). -;;; 3 Bottom of current formula (marker). -;;; 4 Top of current formula's delimiters (marker). -;;; 5 Bottom of current formula's delimiters (marker). -;;; 6 String representation of current formula. -;;; 7 Non-nil if formula is embedded within a single line. -;;; 8 Internal representation of current formula. -;;; 9 Variable assigned by this formula, or nil. -;;; 10 List of variables upon which this formula depends. -;;; 11 Evaluated value of the formula, or nil. -;;; 12 Mode settings for current formula. -;;; 13 Local mode settings for current formula. -;;; 14 Permanent mode settings for current formula. -;;; 15 Global mode settings for editing buffer. +;; Format of calc-embedded-info vector: +;; 0 Editing buffer. +;; 1 Calculator buffer. +;; 2 Top of current formula (marker). +;; 3 Bottom of current formula (marker). +;; 4 Top of current formula's delimiters (marker). +;; 5 Bottom of current formula's delimiters (marker). +;; 6 String representation of current formula. +;; 7 Non-nil if formula is embedded within a single line. +;; 8 Internal representation of current formula. +;; 9 Variable assigned by this formula, or nil. +;; 10 List of variables upon which this formula depends. +;; 11 Evaluated value of the formula, or nil. +;; 12 Mode settings for current formula. +;; 13 Local mode settings for current formula. +;; 14 Permanent mode settings for current formula. +;; 15 Global mode settings for editing buffer. -;;; calc-embedded-active is an a-list keyed on buffers; each cdr is a -;;; sorted list of calc-embedded-infos in that buffer. We do this -;;; rather than using buffer-local variables because the latter are -;;; thrown away when a buffer changes major modes. +;; calc-embedded-active is an a-list keyed on buffers; each cdr is a +;; sorted list of calc-embedded-infos in that buffer. We do this +;; rather than using buffer-local variables because the latter are +;; thrown away when a buffer changes major modes. (defvar calc-embedded-original-modes nil "The mode settings for Calc buffer when put in embedded mode.") @@ -414,6 +414,7 @@ (aset info 8 val) (calc-embedded-update info 14 t t)))) +;;;###autoload (defun calc-do-embedded-activate (calc-embed-arg cbuf) (calc-plain-buffer-only) (if calc-embed-arg @@ -1374,5 +1375,9 @@ (provide 'calc-embed) +;; Local variables: +;; generated-autoload-file: "calc-loaddefs.el" +;; End: + ;; arch-tag: 1b8f311e-fba1-40d3-b8c3-1d6f68fd26fc ;;; calc-embed.el ends here
--- a/lisp/calc/calc-misc.el Tue Apr 08 21:23:36 2008 +0000 +++ b/lisp/calc/calc-misc.el Tue Apr 08 22:07:55 2008 +0000 @@ -61,6 +61,7 @@ (declare-function math-pow-fancy "calc-arith" (a b)) +;;;###autoload (defun calc-dispatch-help (arg) "C-x* is a prefix key sequence; follow it with one of these letters: @@ -131,6 +132,7 @@ (calc-do-dispatch arg)))) +;;;###autoload (defun calc-big-or-small (arg) "Toggle Calc between full-screen and regular mode." (interactive "P") @@ -157,6 +159,7 @@ "Now using full screen for Calc" "Now using partial screen for Calc")))) +;;;###autoload (defun calc-other-window (&optional interactive) "Invoke the Calculator in another window." (interactive "p") @@ -170,6 +173,7 @@ (let ((win (selected-window))) (calc nil win interactive))))) +;;;###autoload (defun another-calc () "Create another, independent Calculator buffer." (interactive) @@ -181,18 +185,21 @@ (pop-to-buffer (current-buffer)) (calc-mode)) +;;;###autoload (defun calc-info () "Run the Emacs Info system on the Calculator documentation." (interactive) (select-window (get-largest-window)) (info "Calc")) +;;;###autoload (defun calc-info-goto-node (node) "Go to a node in the Calculator info documentation." (interactive) (select-window (get-largest-window)) (info (concat "(Calc)" node))) +;;;###autoload (defun calc-tutorial () "Run the Emacs Info system on the Calculator Tutorial." (interactive) @@ -202,11 +209,13 @@ (calc-other-window) (message "Welcome to the Calc Tutorial!")) +;;;###autoload (defun calc-info-summary () "Run the Emacs Info system on the Calculator Summary." (interactive) (calc-info-goto-node "Summary")) +;;;###autoload (defun calc-help () (interactive) (let ((msgs (append @@ -263,6 +272,7 @@ ;; and used in calc-why (in calc-stuff.el). (defvar calc-last-why-command) +;;;###autoload (defun calc-do-handle-whys () (setq calc-why (sort calc-next-why (function @@ -282,6 +292,7 @@ (setq calc-last-why-command this-command) (calc-clear-command-flag 'clear-message)))) +;;;###autoload (defun calc-record-why (&rest stuff) (if (eq (car stuff) 'quiet) (setq stuff (cdr stuff)) @@ -299,7 +310,8 @@ (setq calc-next-why (cons stuff calc-next-why)) nil) -;;; True if A is a constant or vector of constants. [P x] [Public] +;; True if A is a constant or vector of constants. [P x] [Public] +;;;###autoload (defun math-constp (a) (or (Math-scalarp a) (and (memq (car a) '(sdev intv mod vec)) @@ -310,6 +322,7 @@ (null a))))) +;;;###autoload (defun calc-roll-down-stack (n &optional m) (if (< n 0) (calc-roll-up-stack (- n) m) @@ -324,6 +337,7 @@ (append (calc-top-list m 1) (calc-top-list (- n m) (1+ m)))))))) +;;;###autoload (defun calc-roll-up-stack (n &optional m) (if (< n 0) (calc-roll-down-stack (- n) m) @@ -339,6 +353,7 @@ (calc-top-list m (- n m -1)))))))) +;;;###autoload (defun calc-do-refresh () (if calc-hyperbolic-flag (progn @@ -348,6 +363,7 @@ t)) +;;;###autoload (defun calc-record-list (vals &optional prefix) (while vals (or (eq (car vals) 'top-of-stack) @@ -357,12 +373,14 @@ (setq vals (cdr vals)))) +;;;###autoload (defun calc-last-args-stub (arg) (interactive "p") (require 'calc-ext) (calc-last-args arg)) +;;;###autoload (defun calc-power (arg) (interactive "P") (calc-slow-wrapper @@ -371,16 +389,19 @@ (calc-binary-op "root" 'calcFunc-nroot arg nil nil) (calc-binary-op "^" 'calcFunc-pow arg nil nil '^)))) +;;;###autoload (defun calc-mod (arg) (interactive "P") (calc-slow-wrapper (calc-binary-op "%" 'calcFunc-mod arg nil nil '%))) +;;;###autoload (defun calc-inv (arg) (interactive "P") (calc-slow-wrapper (calc-unary-op "inv" 'calcFunc-inv arg))) +;;;###autoload (defun calc-percent () (interactive) (calc-slow-wrapper @@ -388,6 +409,7 @@ 1 "%" (list (list 'calcFunc-percent (calc-top-n 1)))))) +;;;###autoload (defun calc-over (n) (interactive "P") (if n @@ -395,12 +417,14 @@ (calc-enter -2))) +;;;###autoload (defun calc-pop-above (n) (interactive "P") (if n (calc-pop (- (prefix-numeric-value n))) (calc-pop -2))) +;;;###autoload (defun calc-roll-down (n) (interactive "P") (calc-wrapper @@ -416,6 +440,7 @@ (t (calc-roll-down-stack (calc-stack-size) (- nn))))))) +;;;###autoload (defun calc-roll-up (n) (interactive "P") (calc-wrapper @@ -436,6 +461,7 @@ ;;; Other commands. +;;;###autoload (defun calc-num-prefix-name (n) (cond ((eq n '-) "- ") ((equal n '(4)) "C-u ") @@ -443,6 +469,7 @@ ((integerp n) (format "%d " n)) (t ""))) +;;;###autoload (defun calc-missing-key (n) "This is a placeholder for a command which needs to be loaded from calc-ext. When this key is used, calc-ext (the Calculator extensions module) will be @@ -454,6 +481,7 @@ (calc-unread-command) (setq prefix-arg n)) +;;;###autoload (defun calc-shift-Y-prefix-help () (interactive) (require 'calc-ext) @@ -462,6 +490,7 @@ +;;;###autoload (defun calcDigit-letter () (interactive) (if (calc-minibuffer-contains "[-+]?\\(1[1-9]\\|[2-9][0-9]\\)#.*") @@ -472,6 +501,7 @@ ;; A Lisp version of temp_minibuffer_message from minibuf.c. +;;;###autoload (defun calc-temp-minibuffer-message (m) (let ((savemax (point-max))) (save-excursion @@ -491,7 +521,8 @@ (put 'math-with-extra-prec 'lisp-indent-hook 1) -;;; Concatenate two vectors, or a vector and an object. [V O O] [Public] +;; Concatenate two vectors, or a vector and an object. [V O O] [Public] +;;;###autoload (defun math-concat (v1 v2) (if (stringp v1) (concat v1 v2) @@ -511,7 +542,8 @@ (list '| v1 v2)))) -;;; True if A is zero. Works for un-normalized values. [P n] [Public] +;; True if A is zero. Works for un-normalized values. [P n] [Public] +;;;###autoload (defun math-zerop (a) (if (consp a) (cond ((memq (car a) '(bigpos bigneg)) @@ -528,8 +560,9 @@ (eq a 0))) -;;; True if A is real and negative. [P n] [Public] +;; True if A is real and negative. [P n] [Public] +;;;###autoload (defun math-negp (a) (if (consp a) (cond ((eq (car a) 'bigpos) nil) @@ -551,7 +584,8 @@ ((equal a '(neg (var inf var-inf))) t)) (< a 0))) -;;; True if A is a negative number or an expression the starts with '-'. +;; True if A is a negative number or an expression the starts with '-'. +;;;###autoload (defun math-looks-negp (a) ; [P x] [Public] (or (Math-negp a) (eq (car-safe a) 'neg) @@ -562,7 +596,8 @@ (math-looks-negp (nth 1 a))))) -;;; True if A is real and positive. [P n] [Public] +;; True if A is real and positive. [P n] [Public] +;;;###autoload (defun math-posp (a) (if (consp a) (cond ((eq (car a) 'bigpos) (cdr a)) @@ -586,19 +621,23 @@ ((equal a '(var inf var-inf)) t)) (> a 0))) +;;;###autoload (defalias 'math-fixnump 'integerp) +;;;###autoload (defalias 'math-fixnatnump 'natnump) -;;; True if A is an even integer. [P R R] [Public] +;; True if A is an even integer. [P R R] [Public] +;;;###autoload (defun math-evenp (a) (if (consp a) (and (memq (car a) '(bigpos bigneg)) (= (% (nth 1 a) 2) 0)) (= (% a 2) 0))) -;;; Compute A / 2, for small or big integer A. [I i] -;;; If A is negative, type of truncation is undefined. +;; Compute A / 2, for small or big integer A. [I i] +;; If A is negative, type of truncation is undefined. +;;;###autoload (defun math-div2 (a) (if (consp a) (if (cdr a) @@ -606,6 +645,7 @@ 0) (/ a 2))) +;;;###autoload (defun math-div2-bignum (a) ; [l l] (if (cdr a) (cons (+ (/ (car a) 2) (* (% (nth 1 a) 2) (/ math-bignum-digit-size 2))) @@ -613,7 +653,8 @@ (list (/ (car a) 2)))) -;;; Reject an argument to a calculator function. [Public] +;; Reject an argument to a calculator function. [Public] +;;;###autoload (defun math-reject-arg (&optional a p option) (if option (calc-record-why option p a) @@ -622,11 +663,12 @@ (signal 'wrong-type-argument (and a (if p (list p a) (list a))))) -;;; Coerce A to be an integer (by truncation toward zero). [I N] [Public] +;; Coerce A to be an integer (by truncation toward zero). [I N] [Public] ;; The variable math-trunc-prec is local to math-trunc, but used by ;; math-trunc-fancy in calc-arith.el, which is called by math-trunc. +;;;###autoload (defun math-trunc (a &optional math-trunc-prec) (cond (math-trunc-prec (require 'calc-ext) @@ -638,13 +680,15 @@ (math-scale-int (nth 1 a) (nth 2 a))) (t (require 'calc-ext) (math-trunc-fancy a)))) +;;;###autoload (defalias 'calcFunc-trunc 'math-trunc) -;;; Coerce A to be an integer (by truncation toward minus infinity). [I N] +;; Coerce A to be an integer (by truncation toward minus infinity). [I N] ;; The variable math-floor-prec is local to math-floor, but used by ;; math-floor-fancy in calc-arith.el, which is called by math-floor. +;;;###autoload (defun math-floor (a &optional math-floor-prec) ; [Public] (cond (math-floor-prec (require 'calc-ext) @@ -657,9 +701,11 @@ (math-trunc a))) (t (require 'calc-ext) (math-floor-fancy a)))) +;;;###autoload (defalias 'calcFunc-floor 'math-floor) +;;;###autoload (defun math-imod (a b) ; [I I I] [Public] (if (and (not (consp a)) (not (consp b))) (if (= b 0) @@ -668,6 +714,7 @@ (cdr (math-idivmod a b)))) +;;;###autoload (defun calcFunc-inv (m) (if (Math-vectorp m) (progn @@ -682,6 +729,7 @@ (math-pow m -1) (math-div 1 m)))) +;;;###autoload (defun math-do-working (msg arg) (or executing-kbd-macro (progn @@ -695,7 +743,8 @@ (math-showing-full-precision (math-format-number arg)))))) -;;; Compute A modulo B, defined in terms of truncation toward minus infinity. +;; Compute A modulo B, defined in terms of truncation toward minus infinity. +;;;###autoload (defun math-mod (a b) ; [R R R] [Public] (cond ((and (Math-zerop a) (not (eq (car-safe a) 'mod))) a) ((Math-zerop b) @@ -711,6 +760,7 @@ ;;; General exponentiation. +;;;###autoload (defun math-pow (a b) ; [O O N] [Public] (cond ((equal b '(var nan var-nan)) b) @@ -736,6 +786,7 @@ (require 'calc-ext) (math-pow-fancy a b)))) +;;;###autoload (defun math-ipow (a n) ; [O O I] [Public] (cond ((Math-integer-negp n) (math-ipow (math-div 1 a) (Math-integer-neg n))) @@ -766,6 +817,7 @@ val)) +;;;###autoload (defun math-read-radix-digit (dig) ; [D S; Z S] (if (> dig ?9) (if (< dig ?A) @@ -778,6 +830,7 @@ ;;; Bug reporting +;;;###autoload (defun report-calc-bug () "Report a bug in Calc, the GNU Emacs calculator. Prompts for bug subject. Leaves you in a mail buffer." @@ -789,9 +842,14 @@ precise symptoms of the bug. If possible, include a backtrace by doing 'M-x toggle-debug-on-error', then reproducing the bug. " ))) +;;;###autoload (defalias 'calc-report-bug 'report-calc-bug) (provide 'calc-misc) -;;; arch-tag: 7984d9d0-62e5-41dc-afb8-e904b975f250 +;; Local variables: +;; generated-autoload-file: "calc-loaddefs.el" +;; End: + +;; arch-tag: 7984d9d0-62e5-41dc-afb8-e904b975f250 ;;; calc-misc.el ends here
--- a/lisp/calc/calc-yank.el Tue Apr 08 21:23:36 2008 +0000 +++ b/lisp/calc/calc-yank.el Tue Apr 08 22:07:55 2008 +0000 @@ -103,9 +103,10 @@ (interactive "r") (calc-kill-region top bot t)) -;;; This function uses calc-last-kill if possible to get an exact result, -;;; otherwise it just parses the yanked string. -;;; Modified to use Emacs 19 extended concept of kill-ring. -- daveg 12/15/96 +;; This function uses calc-last-kill if possible to get an exact result, +;; otherwise it just parses the yanked string. +;; Modified to use Emacs 19 extended concept of kill-ring. -- daveg 12/15/96 +;;;###autoload (defun calc-yank () (interactive) (calc-wrapper @@ -373,8 +374,8 @@ (self-insert-command 1)) (setq i (1+ i)))))) -;;; First, require that buffer is visible and does not begin with "*" -;;; Second, require only that it not begin with "*Calc" +;; First, require that buffer is visible and does not begin with "*" +;; Second, require only that it not begin with "*Calc" (defun calc-find-writable-buffer (buf mode) (and buf (if (or (string-match "\\`\\( .*\\|\\*Calc.*\\)" @@ -417,13 +418,13 @@ (backward-char 1) (calc-set-command-flag 'do-edit)) -(defvar calc-edit-mode-map nil "Keymap for use by the calc-edit command.") -(if calc-edit-mode-map - () - (setq calc-edit-mode-map (make-sparse-keymap)) - (define-key calc-edit-mode-map "\n" 'calc-edit-finish) - (define-key calc-edit-mode-map "\r" 'calc-edit-return) - (define-key calc-edit-mode-map "\C-c\C-c" 'calc-edit-finish)) +(defvar calc-edit-mode-map + (let ((map (make-sparse-keymap))) + (define-key map "\n" 'calc-edit-finish) + (define-key map "\r" 'calc-edit-return) + (define-key map "\C-c\C-c" 'calc-edit-finish) + map) + "Keymap for use by the calc-edit command.") (defvar calc-original-buffer) (defvar calc-return-buffer) @@ -583,5 +584,9 @@ (provide 'calc-yank) -;;; arch-tag: ca61019e-caca-4daa-b32c-b6afe372d5b5 +;; Local variables: +;; generated-autoload-file: "calc-loaddefs.el" +;; End: + +;; arch-tag: ca61019e-caca-4daa-b32c-b6afe372d5b5 ;;; calc-yank.el ends here
--- a/lisp/calc/calc.el Tue Apr 08 21:23:36 2008 +0000 +++ b/lisp/calc/calc.el Tue Apr 08 22:07:55 2008 +0000 @@ -862,32 +862,32 @@ ;; Set up the autoloading linkage. (let ((name (and (fboundp 'calc-dispatch) - (eq (car-safe (symbol-function 'calc-dispatch)) 'autoload) - (nth 1 (symbol-function 'calc-dispatch)))) - (p load-path)) - - ;; If Calc files exist on the load-path, we're all set. - (while (and p (not (file-exists-p - (expand-file-name "calc-misc.elc" (car p))))) - (setq p (cdr p))) - (or p - - ;; If Calc is autoloaded using a path name, look there for Calc files. - ;; This works for both relative ("calc/calc.elc") and absolute paths. - (and name (file-name-directory name) - (let ((p2 load-path) - (name2 (concat (file-name-directory name) - "calc-misc.elc"))) - (while (and p2 (not (file-exists-p - (expand-file-name name2 (car p2))))) - (setq p2 (cdr p2))) - (when p2 - (setq load-path (nconc load-path - (list - (directory-file-name - (file-name-directory - (expand-file-name - name (car p2)))))))))))) + (eq (car-safe (symbol-function 'calc-dispatch)) 'autoload) + (nth 1 (symbol-function 'calc-dispatch)))) + (p load-path)) + + ;; If Calc files exist on the load-path, we're all set. + (while (and p (not (file-exists-p + (expand-file-name "calc-misc.elc" (car p))))) + (setq p (cdr p))) + (or p + + ;; If Calc is autoloaded using a path name, look there for Calc files. + ;; This works for both relative ("calc/calc.elc") and absolute paths. + (and name (file-name-directory name) + (let ((p2 load-path) + (name2 (concat (file-name-directory name) + "calc-misc.elc"))) + (while (and p2 (not (file-exists-p + (expand-file-name name2 (car p2))))) + (setq p2 (cdr p2))) + (when p2 + (setq load-path (nconc load-path + (list + (directory-file-name + (file-name-directory + (expand-file-name + name (car p2)))))))))))) ;; The following modes use specially-formatted data. (put 'calc-mode 'mode-class 'special) @@ -1001,77 +1001,75 @@ (mapc (lambda (v) (or (boundp v) (set v nil))) calc-local-var-list) -(defvar calc-mode-map nil - "The key map for Calc.") - -(or calc-mode-map - (let ((map (make-keymap))) - (suppress-keymap map t) - (define-key map "+" 'calc-plus) - (define-key map "-" 'calc-minus) - (define-key map "*" 'calc-times) - (define-key map "/" 'calc-divide) - (define-key map "%" 'calc-mod) - (define-key map "&" 'calc-inv) - (define-key map "^" 'calc-power) - (define-key map "\M-%" 'calc-percent) - (define-key map "e" 'calcDigit-start) - (define-key map "i" 'calc-info) - (define-key map "n" 'calc-change-sign) - (define-key map "q" 'calc-quit) - (define-key map "Y" 'nil) - (define-key map "Y?" 'calc-shift-Y-prefix-help) - (define-key map "?" 'calc-help) - (define-key map " " 'calc-enter) - (define-key map "'" 'calc-algebraic-entry) - (define-key map "$" 'calc-auto-algebraic-entry) - (define-key map "\"" 'calc-auto-algebraic-entry) - (define-key map "\t" 'calc-roll-down) - (define-key map "\M-\t" 'calc-roll-up) - (define-key map "\C-m" 'calc-enter) - (define-key map "\M-\C-m" 'calc-last-args-stub) - (define-key map "\C-j" 'calc-over) - (define-key map "\C-y" 'calc-yank) - (define-key map [mouse-2] 'calc-yank) +(defvar calc-mode-map + (let ((map (make-keymap))) + (suppress-keymap map t) + (define-key map "+" 'calc-plus) + (define-key map "-" 'calc-minus) + (define-key map "*" 'calc-times) + (define-key map "/" 'calc-divide) + (define-key map "%" 'calc-mod) + (define-key map "&" 'calc-inv) + (define-key map "^" 'calc-power) + (define-key map "\M-%" 'calc-percent) + (define-key map "e" 'calcDigit-start) + (define-key map "i" 'calc-info) + (define-key map "n" 'calc-change-sign) + (define-key map "q" 'calc-quit) + (define-key map "Y" 'nil) + (define-key map "Y?" 'calc-shift-Y-prefix-help) + (define-key map "?" 'calc-help) + (define-key map " " 'calc-enter) + (define-key map "'" 'calc-algebraic-entry) + (define-key map "$" 'calc-auto-algebraic-entry) + (define-key map "\"" 'calc-auto-algebraic-entry) + (define-key map "\t" 'calc-roll-down) + (define-key map "\M-\t" 'calc-roll-up) + (define-key map "\C-m" 'calc-enter) + (define-key map "\M-\C-m" 'calc-last-args-stub) + (define-key map "\C-j" 'calc-over) + (define-key map "\C-y" 'calc-yank) + (define-key map [mouse-2] 'calc-yank) - (mapc (lambda (x) (define-key map (char-to-string x) 'undefined)) - "lOW") - (mapc (lambda (x) (define-key map (char-to-string x) 'calc-missing-key)) - (concat "ABCDEFGHIJKLMNPQRSTUVXZabcdfghjkmoprstuvwxyz" - ":\\|!()[]<>{},;=~`\C-k\M-k\C-w\M-w\C-y\C-_")) - (mapc (lambda (x) (define-key map (char-to-string x) 'calcDigit-start)) - "_0123456789.#@") - (setq calc-mode-map map))) - -(defvar calc-digit-map nil + (mapc (lambda (x) (define-key map (char-to-string x) 'undefined)) + "lOW") + (mapc (lambda (x) (define-key map (char-to-string x) 'calc-missing-key)) + (concat "ABCDEFGHIJKLMNPQRSTUVXZabcdfghjkmoprstuvwxyz" + ":\\|!()[]<>{},;=~`\C-k\M-k\C-w\M-w\C-y\C-_")) + (mapc (lambda (x) (define-key map (char-to-string x) 'calcDigit-start)) + "_0123456789.#@") + map) + "The key map for Calc.") + + + +(defvar calc-digit-map + (let ((map (make-keymap))) + (if (featurep 'xemacs) + (map-keymap (function + (lambda (keys bind) + (define-key map keys + (if (eq bind 'undefined) + 'undefined 'calcDigit-nondigit)))) + calc-mode-map) + (let ((cmap (nth 1 calc-mode-map)) + (dmap (nth 1 map)) + (i 0)) + (while (< i 128) + (aset dmap i + (if (eq (aref cmap i) 'undefined) + 'undefined 'calcDigit-nondigit)) + (setq i (1+ i))))) + (mapc (lambda (x) (define-key map (char-to-string x) 'calcDigit-key)) + "_0123456789.e+-:n#@oh'\"mspM") + (mapc (lambda (x) (define-key map (char-to-string x) 'calcDigit-letter)) + "abcdfgijklqrtuvwxyzABCDEFGHIJKLNOPQRSTUVWXYZ") + (define-key map "'" 'calcDigit-algebraic) + (define-key map "`" 'calcDigit-edit) + (define-key map "\C-g" 'abort-recursive-edit) + map) "The key map for entering Calc digits.") -(or calc-digit-map - (let ((map (make-keymap))) - (if (featurep 'xemacs) - (map-keymap (function - (lambda (keys bind) - (define-key map keys - (if (eq bind 'undefined) - 'undefined 'calcDigit-nondigit)))) - calc-mode-map) - (let ((cmap (nth 1 calc-mode-map)) - (dmap (nth 1 map)) - (i 0)) - (while (< i 128) - (aset dmap i - (if (eq (aref cmap i) 'undefined) - 'undefined 'calcDigit-nondigit)) - (setq i (1+ i))))) - (mapc (lambda (x) (define-key map (char-to-string x) 'calcDigit-key)) - "_0123456789.e+-:n#@oh'\"mspM") - (mapc (lambda (x) (define-key map (char-to-string x) 'calcDigit-letter)) - "abcdfgijklqrtuvwxyzABCDEFGHIJKLNOPQRSTUVWXYZ") - (define-key map "'" 'calcDigit-algebraic) - (define-key map "`" 'calcDigit-edit) - (define-key map "\C-g" 'abort-recursive-edit) - (setq calc-digit-map map))) - (mapc (lambda (x) (condition-case err (progn @@ -1096,98 +1094,59 @@ '("\C-d")) '("\177" "\C-d"))) -(defvar calc-dispatch-map nil +(defvar calc-dispatch-map + (let ((map (make-keymap))) + (mapc (lambda (x) + (define-key map (char-to-string (car x)) (cdr x)) + (when (string-match "abcdefhijklnopqrstuwxyz" + (char-to-string (car x))) + (define-key map (char-to-string (- (car x) ?a -1)) (cdr x))) + (define-key map (format "\e%c" (car x)) (cdr x))) + '( ( ?a . calc-embedded-activate ) + ( ?b . calc-big-or-small ) + ( ?c . calc ) + ( ?d . calc-embedded-duplicate ) + ( ?e . calc-embedded ) + ( ?f . calc-embedded-new-formula ) + ( ?g . calc-grab-region ) + ( ?h . calc-dispatch-help ) + ( ?i . calc-info ) + ( ?j . calc-embedded-select ) + ( ?k . calc-keypad ) + ( ?l . calc-load-everything ) + ( ?m . read-kbd-macro ) + ( ?n . calc-embedded-next ) + ( ?o . calc-other-window ) + ( ?p . calc-embedded-previous ) + ( ?q . quick-calc ) + ( ?r . calc-grab-rectangle ) + ( ?s . calc-info-summary ) + ( ?t . calc-tutorial ) + ( ?u . calc-embedded-update-formula ) + ( ?w . calc-embedded-word ) + ( ?x . calc-quit ) + ( ?y . calc-copy-to-buffer ) + ( ?z . calc-user-invocation ) + ( ?\' . calc-embedded-new-formula ) + ( ?\` . calc-embedded-edit ) + ( ?: . calc-grab-sum-down ) + ( ?_ . calc-grab-sum-across ) + ( ?0 . calc-reset ) + ( ?? . calc-dispatch-help ) + ( ?# . calc-same-interface ) + ( ?& . calc-same-interface ) + ( ?\\ . calc-same-interface ) + ( ?= . calc-same-interface ) + ( ?* . calc-same-interface ) + ( ?/ . calc-same-interface ) + ( ?+ . calc-same-interface ) + ( ?- . calc-same-interface ) )) + map) "The key map for starting Calc.") -(or calc-dispatch-map - (let ((map (make-keymap))) - (mapc (lambda (x) - (define-key map (char-to-string (car x)) (cdr x)) - (when (string-match "abcdefhijklnopqrstuwxyz" - (char-to-string (car x))) - (define-key map (char-to-string (- (car x) ?a -1)) (cdr x))) - (define-key map (format "\e%c" (car x)) (cdr x))) - '( ( ?a . calc-embedded-activate ) - ( ?b . calc-big-or-small ) - ( ?c . calc ) - ( ?d . calc-embedded-duplicate ) - ( ?e . calc-embedded ) - ( ?f . calc-embedded-new-formula ) - ( ?g . calc-grab-region ) - ( ?h . calc-dispatch-help ) - ( ?i . calc-info ) - ( ?j . calc-embedded-select ) - ( ?k . calc-keypad ) - ( ?l . calc-load-everything ) - ( ?m . read-kbd-macro ) - ( ?n . calc-embedded-next ) - ( ?o . calc-other-window ) - ( ?p . calc-embedded-previous ) - ( ?q . quick-calc ) - ( ?r . calc-grab-rectangle ) - ( ?s . calc-info-summary ) - ( ?t . calc-tutorial ) - ( ?u . calc-embedded-update-formula ) - ( ?w . calc-embedded-word ) - ( ?x . calc-quit ) - ( ?y . calc-copy-to-buffer ) - ( ?z . calc-user-invocation ) - ( ?\' . calc-embedded-new-formula ) - ( ?\` . calc-embedded-edit ) - ( ?: . calc-grab-sum-down ) - ( ?_ . calc-grab-sum-across ) - ( ?0 . calc-reset ) - ( ?? . calc-dispatch-help ) - ( ?# . calc-same-interface ) - ( ?& . calc-same-interface ) - ( ?\\ . calc-same-interface ) - ( ?= . calc-same-interface ) - ( ?* . calc-same-interface ) - ( ?/ . calc-same-interface ) - ( ?+ . calc-same-interface ) - ( ?- . calc-same-interface ) )) - (setq calc-dispatch-map map))) ;;;; (Autoloads here) -(mapc - (lambda (x) (dolist (func (cdr x)) (autoload func (car x)))) - '( - - ("calc-aent" calc-alg-digit-entry calc-alg-entry - calc-check-user-syntax calc-do-alg-entry calc-do-calc-eval - calc-do-quick-calc calc-match-user-syntax math-build-parse-table - math-find-user-tokens math-read-expr-list math-read-exprs math-read-if - math-read-token math-remove-dashes math-read-preprocess-string) - - ("calc-embed" calc-do-embedded-activate) - - ("calc-misc" - calc-do-handle-whys calc-do-refresh calc-num-prefix-name - calc-record-list calc-record-why calc-report-bug calc-roll-down-stack - calc-roll-up-stack calc-temp-minibuffer-message calcFunc-floor - calcFunc-inv calcFunc-trunc math-concat math-constp math-div2 - math-div2-bignum math-do-working math-evenp math-fixnatnump - math-fixnump math-floor math-imod math-ipow math-looks-negp math-mod - math-negp math-posp math-pow math-read-radix-digit math-reject-arg - math-trunc math-zerop))) - -(mapc - (lambda (x) (dolist (cmd (cdr x)) (autoload cmd (car x) nil t))) - '( - - ("calc-aent" calc-algebraic-entry calc-auto-algebraic-entry - calcDigit-algebraic calcDigit-edit) - - ("calc-misc" another-calc calc-big-or-small calc-dispatch-help - calc-help calc-info calc-info-goto-node calc-info-summary calc-inv - calc-last-args-stub - calc-missing-key calc-mod calc-other-window calc-over calc-percent - calc-pop-above calc-power calc-roll-down calc-roll-up - calc-shift-Y-prefix-help calc-tutorial calcDigit-letter - report-calc-bug) - - ("calc-yank" calc-yank))) - +(load "calc-loaddefs.el" nil t) ;;;###autoload (define-key ctl-x-map "*" 'calc-dispatch)