emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/calc/calc.el


From: Colin Walters
Subject: [Emacs-diffs] Changes to emacs/lisp/calc/calc.el
Date: Wed, 12 Jun 2002 01:11:22 -0400

Index: emacs/lisp/calc/calc.el
diff -c emacs/lisp/calc/calc.el:1.13 emacs/lisp/calc/calc.el:1.14
*** emacs/lisp/calc/calc.el:1.13        Wed May 29 21:04:15 2002
--- emacs/lisp/calc/calc.el     Wed Jun 12 01:11:22 2002
***************
*** 680,692 ****
               (while (and p2 (not (file-exists-p
                                    (expand-file-name name2 (car p2)))))
                 (setq p2 (cdr p2)))
!              (if p2
!                  (setq load-path (nconc load-path
!                                         (list
!                                          (directory-file-name
!                                           (file-name-directory
!                                            (expand-file-name
!                                             name (car p2))))))))))
  
        ;; If calc-autoload-directory is given, use that (and hope it works!).
        (and calc-autoload-directory
--- 680,692 ----
               (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))))))))))
  
        ;; If calc-autoload-directory is given, use that (and hope it works!).
        (and calc-autoload-directory
***************
*** 867,876 ****
      (mapcar (function
             (lambda (x)
               (define-key calc-dispatch-map (char-to-string (car x)) (cdr x))
!              (if (string-match "abcdefhijklnopqrstuwxyz"
!                                (char-to-string (car x)))
!                  (define-key calc-dispatch-map
!                    (char-to-string (- (car x) ?a -1)) (cdr x)))
               (define-key calc-dispatch-map (format "\e%c" (car x)) (cdr x))))
            '( ( ?a . calc-embedded-activate )
               ( ?b . calc-big-or-small )
--- 867,876 ----
      (mapcar (function
             (lambda (x)
               (define-key calc-dispatch-map (char-to-string (car x)) (cdr x))
!              (when (string-match "abcdefhijklnopqrstuwxyz"
!                                  (char-to-string (car x)))
!                (define-key calc-dispatch-map
!                  (char-to-string (- (car x) ?a -1)) (cdr x)))
               (define-key calc-dispatch-map (format "\e%c" (car x)) (cdr x))))
            '( ( ?a . calc-embedded-activate )
               ( ?b . calc-big-or-small )
***************
*** 961,975 ****
    (sit-for echo-keystrokes)
    (condition-case err   ; look for other keys bound to calc-dispatch
        (let ((keys (this-command-keys)))
!       (or (not (stringp keys))
!           (string-match "\\`\C-u\\|\\`\e[-0-9#]\\|`[\M--\M-0-\M-9]" keys)
!           (eq (lookup-key calc-dispatch-map keys) 'calc-same-interface)
!           (progn
!             (and (string-match "address@hidden" keys)
!                  (symbolp
!                   (lookup-key calc-dispatch-map (substring keys 0 1)))
!                  (define-key calc-dispatch-map (substring keys 0 1) nil))
!             (define-key calc-dispatch-map keys 'calc-same-interface))))
      (error nil))
    (calc-do-dispatch arg))
  
--- 961,974 ----
    (sit-for echo-keystrokes)
    (condition-case err   ; look for other keys bound to calc-dispatch
        (let ((keys (this-command-keys)))
!       (unless (or (not (stringp keys))
!                   (string-match "\\`\C-u\\|\\`\e[-0-9#]\\|`[\M--\M-0-\M-9]" 
keys)
!                   (eq (lookup-key calc-dispatch-map keys) 
'calc-same-interface))
!         (when (and (string-match "address@hidden" keys)
!                    (symbolp
!                     (lookup-key calc-dispatch-map (substring keys 0 1))))
!           (define-key calc-dispatch-map (substring keys 0 1) nil))
!         (define-key calc-dispatch-map keys 'calc-same-interface)))
      (error nil))
    (calc-do-dispatch arg))
  
***************
*** 1079,1092 ****
    (calc-refresh t)
    (calc-set-mode-line)
    ;; The calc-defs variable is a relic.  Use calc-define properties instead.
!   (if (and (boundp 'calc-defs)
!          calc-defs)
!       (progn
!       (message "Evaluating calc-defs...")
!       (calc-need-macros)
!       (eval (cons 'progn calc-defs))
!       (setq calc-defs nil)
!       (calc-set-mode-line)))
    (calc-check-defines))
  
  (defvar calc-check-defines 'calc-check-defines)  ; suitable for run-hooks
--- 1078,1090 ----
    (calc-refresh t)
    (calc-set-mode-line)
    ;; The calc-defs variable is a relic.  Use calc-define properties instead.
!   (when (and (boundp 'calc-defs)
!            calc-defs)
!     (message "Evaluating calc-defs...")
!     (calc-need-macros)
!     (eval (cons 'progn calc-defs))
!     (setq calc-defs nil)
!     (calc-set-mode-line))
    (calc-check-defines))
  
  (defvar calc-check-defines 'calc-check-defines)  ; suitable for run-hooks
***************
*** 1127,1139 ****
    (setq buffer-read-only t)
    (make-local-variable 'overlay-arrow-position)
    (make-local-variable 'overlay-arrow-string)
!   (if buf
!       (progn
!       (make-local-variable 'calc-main-buffer)
!       (setq calc-main-buffer buf)))
!   (if (= (buffer-size) 0)
!       (let ((buffer-read-only nil))
!       (insert "Emacs Calculator v" calc-version " by Dave Gillespie\n")))
    (run-hooks 'calc-trail-mode-hook))
  
  (defun calc-create-buffer ()
--- 1125,1139 ----
    (setq buffer-read-only t)
    (make-local-variable 'overlay-arrow-position)
    (make-local-variable 'overlay-arrow-string)
!   (set (make-local-variable 'font-lock-defaults)
!        '(nil t nil nil nil (font-lock-core-only . t)))
!   (when buf
!     (set (make-local-variable 'calc-main-buffer) buf))
!   (when (= (buffer-size) 0)
!     (let ((buffer-read-only nil))
!       (insert (propertize (concat "Emacs Calculator v" calc-version
!                                 " by Dave Gillespie\n")
!                         'font-lock-face 'italic))))
    (run-hooks 'calc-trail-mode-hook))
  
  (defun calc-create-buffer ()
***************
*** 1141,1169 ****
    (or (eq major-mode 'calc-mode)
        (calc-mode))
    (setq max-lisp-eval-depth (max max-lisp-eval-depth 1000))
!   (if calc-always-load-extensions
!       (calc-extensions))
!   (if calc-language
!       (progn
!       (calc-extensions)
!       (calc-set-language calc-language calc-language-option t))))
  
  ;;;###autoload
  (defun calc (&optional arg full-display interactive)
    "The Emacs Calculator.  Full documentation is listed under \"calc-mode\"."
    (interactive "P")
    (if arg
!       (or (eq arg 0)
!         (progn
!           (calc-extensions)
!           (if (= (prefix-numeric-value arg) -1)
!               (calc-grab-region (region-beginning) (region-end) nil)
!             (if (= (prefix-numeric-value arg) -2)
!                 (calc-keypad)))))
!     (if (get-buffer-window "*Calc Keypad*")
!       (progn
!         (calc-keypad)
!         (set-buffer (window-buffer (selected-window)))))
      (if (eq major-mode 'calc-mode)
        (calc-quit)
        (let ((oldbuf (current-buffer)))
--- 1141,1166 ----
    (or (eq major-mode 'calc-mode)
        (calc-mode))
    (setq max-lisp-eval-depth (max max-lisp-eval-depth 1000))
!   (when calc-always-load-extensions
!     (calc-extensions))
!   (when calc-language
!     (calc-extensions)
!     (calc-set-language calc-language calc-language-option t)))
  
  ;;;###autoload
  (defun calc (&optional arg full-display interactive)
    "The Emacs Calculator.  Full documentation is listed under \"calc-mode\"."
    (interactive "P")
    (if arg
!       (unless (eq arg 0)
!       (calc-extensions)
!       (if (= (prefix-numeric-value arg) -1)
!           (calc-grab-region (region-beginning) (region-end) nil)
!         (when (= (prefix-numeric-value arg) -2)
!           (calc-keypad))))
!     (when (get-buffer-window "*Calc Keypad*")
!       (calc-keypad)
!       (set-buffer (window-buffer (selected-window))))
      (if (eq major-mode 'calc-mode)
        (calc-quit)
        (let ((oldbuf (current-buffer)))
***************
*** 1199,1209 ****
             (window-point full-display)
             (select-window full-display))
        (calc-check-defines)
!       (and calc-said-hello
!            (or (interactive-p) interactive)
!            (progn
!              (sit-for 2)
!              (message "")))
        (setq calc-said-hello t)))))
  
  ;;;###autoload
--- 1196,1205 ----
             (window-point full-display)
             (select-window full-display))
        (calc-check-defines)
!       (when (and calc-said-hello
!                  (or (interactive-p) interactive))
!         (sit-for 2)
!         (message ""))
        (setq calc-said-hello t)))))
  
  ;;;###autoload
***************
*** 1707,1713 ****
               calc-any-evaltos nil)
         (erase-buffer)
         (when calc-show-banner
!          (insert "--- Emacs Calculator Mode ---\n"))
         (while thing
           (goto-char (point-min))
           (when calc-show-banner
--- 1703,1710 ----
               calc-any-evaltos nil)
         (erase-buffer)
         (when calc-show-banner
!          (insert (propertize "--- Emacs Calculator Mode ---\n"
!                              'font-lock-face 'italic)))
         (while thing
           (goto-char (point-min))
           (when calc-show-banner
***************
*** 2977,2983 ****
         (c (cond ((null a) "<nil>")
                  ((eq calc-display-raw t) (format "%s" a))
                  ((stringp a) a)
!                 ((eq a 'top-of-stack) ".")
                  (calc-prepared-composition
                   calc-prepared-composition)
                  ((and (Math-scalarp a)
--- 2974,2980 ----
         (c (cond ((null a) "<nil>")
                  ((eq calc-display-raw t) (format "%s" a))
                  ((stringp a) a)
!                 ((eq a 'top-of-stack) (propertize "." 'font-lock-face 'bold))
                  (calc-prepared-composition
                   calc-prepared-composition)
                  ((and (Math-scalarp a)
***************
*** 2991,3031 ****
      (and math-comp-selected (setq calc-any-selections t))
      (setq w (cdr off)
          off (car off))
!     (if (> off 0)
!       (setq c (math-comp-concat (make-string off ? ) c)))
      (or (equal calc-left-label "")
        (setq c (math-comp-concat (if (eq a 'top-of-stack)
                                      (make-string (length calc-left-label) ? )
                                    calc-left-label)
                                  c)))
!     (if calc-line-numbering
!       (setq c (math-comp-concat (if (eq calc-language 'big)
!                                     (if math-comp-selected
!                                         '(tag t "1:  ") "1:  ")
!                                   "    ")
!                                 c)))
!     (or (equal calc-right-label "")
!       (eq a 'top-of-stack)
!       (progn
!         (calc-extensions)
!         (setq c (list 'horiz c
!                       (make-string (max (- w (math-comp-width c)
!                                            (length calc-right-label)) 0) ? )
!                       '(break -1)
!                       calc-right-label))))
      (setq s (if (stringp c)
                (if calc-display-raw
                    (prin1-to-string c)
                  c)
              (math-composition-to-string c w)))
!     (if calc-language-output-filter
!       (setq s (funcall calc-language-output-filter s)))
      (if (eq calc-language 'big)
        (setq s (concat s "\n"))
!       (if calc-line-numbering
!         (progn
!           (aset s 0 ?1)
!           (aset s 1 ?:))))
      (setcar (cdr entry) (calc-count-lines s))
      s))
  
--- 2988,3026 ----
      (and math-comp-selected (setq calc-any-selections t))
      (setq w (cdr off)
          off (car off))
!     (when (> off 0)
!       (setq c (math-comp-concat (make-string off ? ) c)))
      (or (equal calc-left-label "")
        (setq c (math-comp-concat (if (eq a 'top-of-stack)
                                      (make-string (length calc-left-label) ? )
                                    calc-left-label)
                                  c)))
!     (when calc-line-numbering
!       (setq c (math-comp-concat (if (eq calc-language 'big)
!                                   (when math-comp-selected
!                                     '(tag t "1:  ") "1:  ")
!                                 "    ")
!                               c)))
!     (unless (or (equal calc-right-label "")
!               (eq a 'top-of-stack))
!       (calc-extensions)
!       (setq c (list 'horiz c
!                   (make-string (max (- w (math-comp-width c)
!                                        (length calc-right-label)) 0) ? )
!                   '(break -1)
!                   calc-right-label)))
      (setq s (if (stringp c)
                (if calc-display-raw
                    (prin1-to-string c)
                  c)
              (math-composition-to-string c w)))
!     (when calc-language-output-filter
!       (setq s (funcall calc-language-output-filter s)))
      (if (eq calc-language 'big)
        (setq s (concat s "\n"))
!       (when calc-line-numbering
!       (aset s 0 ?1)
!       (aset s 1 ?:)))
      (setcar (cdr entry) (calc-count-lines s))
      s))
  
***************
*** 3038,3045 ****
          (calc-extensions)
          (math-stack-value-offset-fancy))
        (setq off (or calc-display-origin 0))
!       (if (integerp calc-line-breaking)
!         (setq wid calc-line-breaking)))
      (cons (max (- off (length calc-left-label)) 0)
          (+ wid num))))
  
--- 3033,3040 ----
          (calc-extensions)
          (math-stack-value-offset-fancy))
        (setq off (or calc-display-origin 0))
!       (when (integerp calc-line-breaking)
!       (setq wid calc-line-breaking)))
      (cons (max (- off (length calc-left-label)) 0)
          (+ wid num))))
  
***************
*** 3154,3166 ****
              (when calc-group-digits
                (require 'calc-ext)
                (setq str (math-group-float str))))
!         (if (< figs 0)
!             (setq figs (+ calc-internal-prec figs)))
!         (if (> figs 0)
!             (let ((adj (- figs (math-numdigs mant))))
!               (if (< adj 0)
!                   (setq mant (math-scale-rounding mant adj)
!                         exp (- exp adj)))))
          (setq str (if (integerp mant)
                        (int-to-string mant)
                      (math-format-bignum-decimal (cdr mant))))
--- 3149,3161 ----
              (when calc-group-digits
                (require 'calc-ext)
                (setq str (math-group-float str))))
!         (when (< figs 0)
!           (setq figs (+ calc-internal-prec figs)))
!         (when (> figs 0)
!           (let ((adj (- figs (math-numdigs mant))))
!             (when (< adj 0)
!               (setq mant (math-scale-rounding mant adj)
!                     exp (- exp adj)))))
          (setq str (if (integerp mant)
                        (int-to-string mant)
                      (math-format-bignum-decimal (cdr mant))))
***************
*** 3400,3415 ****
    (interactive "P")
    (calc-do-embedded-activate arg cbuf))
  
- 
  (defun calc-user-invocation ()
    (interactive)
!   (or (stringp calc-invocation-macro)
!       (error "Use `Z I' inside Calc to define a `M-# Z' keyboard macro"))
    (execute-kbd-macro calc-invocation-macro nil))
  
- 
- 
- 
  ;;; User-programmability.
  
  ;;;###autoload
--- 3395,3406 ----
    (interactive "P")
    (calc-do-embedded-activate arg cbuf))
  
  (defun calc-user-invocation ()
    (interactive)
!   (unless (stringp calc-invocation-macro)
!     (error "Use `Z I' inside Calc to define a `M-# Z' keyboard macro"))
    (execute-kbd-macro calc-invocation-macro nil))
  
  ;;; User-programmability.
  
  ;;;###autoload
***************
*** 3417,3423 ****
    (calc-extensions)
    (math-do-defmath func args body))
  
- 
  ;;; Functions needed for Lucid Emacs support.
  
  (defun calc-read-key (&optional optkey)
--- 3408,3413 ----
***************
*** 3445,3454 ****
        (calc-emacs-type-lucid (setq unread-command-event nil))
      (setq unread-command-events nil)))
  
! (if calc-always-load-extensions
!     (progn
!       (calc-extensions)
!       (calc-load-everything)))
  
  
  (run-hooks 'calc-load-hook)
--- 3435,3443 ----
        (calc-emacs-type-lucid (setq unread-command-event nil))
      (setq unread-command-events nil)))
  
! (when calc-always-load-extensions
!   (calc-extensions)
!   (calc-load-everything))
  
  
  (run-hooks 'calc-load-hook)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]