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-prog.el


From: Jay Belanger
Subject: [Emacs-diffs] Changes to emacs/lisp/calc/calc-prog.el
Date: Sun, 02 Jan 2005 12:20:10 -0500

Index: emacs/lisp/calc/calc-prog.el
diff -c emacs/lisp/calc/calc-prog.el:1.19 emacs/lisp/calc/calc-prog.el:1.20
*** emacs/lisp/calc/calc-prog.el:1.19   Sun Jan  2 07:29:41 2005
--- emacs/lisp/calc/calc-prog.el        Sun Jan  2 17:08:31 2005
***************
*** 684,704 ****
                    (eq (car-safe (nth 3 cmd)) 'calc-execute-kbd-macro)))
             (let* ((mac (elt (nth 1 (nth 3 cmd)) 1))
                    (str (edmacro-format-keys mac t))
-                   (macbeg)
                    (kys (nth 3 (nth 3 cmd))))
               (calc-edit-mode 
                (list 'calc-edit-macro-finish-edit cmdname kys)
!               t (format "Editing keyboard macro (%s, bound to %s).\n" 
!                         cmdname kys))
!              (goto-char (point-max))
!              (insert "Original keys: " (elt (nth 1 (nth 3 cmd)) 0)  "\n" )
!              (setq macbeg (point))
               (insert str "\n")
               (calc-edit-format-macro-buffer)
!              (calc-show-edit-buffer)
!              (goto-char (point-min))
!              (search-forward "Original")
!              (forward-line 2)))
          (t (let* ((func (calc-stack-command-p cmd))
                    (defn (and func
                               (symbolp func)
--- 684,699 ----
                    (eq (car-safe (nth 3 cmd)) 'calc-execute-kbd-macro)))
             (let* ((mac (elt (nth 1 (nth 3 cmd)) 1))
                    (str (edmacro-format-keys mac t))
                    (kys (nth 3 (nth 3 cmd))))
               (calc-edit-mode 
                (list 'calc-edit-macro-finish-edit cmdname kys)
!               t (format (concat 
!                          "Editing keyboard macro (%s, bound to %s).\n" 
!                          "Original keys: %s \n")
!                         cmdname kys (elt (nth 1 (nth 3 cmd)) 0)))
               (insert str "\n")
               (calc-edit-format-macro-buffer)
!              (calc-show-edit-buffer)))
          (t (let* ((func (calc-stack-command-p cmd))
                    (defn (and func
                               (symbolp func)
***************
*** 717,731 ****
                      (insert  (math-showing-full-precision
                                  (math-format-nice-expr defn (frame-width)))
                                 "\n"))
!                    (calc-show-edit-buffer)
!                      (goto-char (point-min))
!                      (forward-line 3))
                 (error "That command's definition cannot be edited")))))))
  
  ;; Formatting the macro buffer
  
  (defun calc-edit-macro-repeats ()
!   (goto-char (point-min))
    (while
        (re-search-forward "^\\([0-9]+\\)\\*" nil t)
      (setq num (string-to-int (match-string 1)))
--- 712,724 ----
                      (insert  (math-showing-full-precision
                                  (math-format-nice-expr defn (frame-width)))
                                 "\n"))
!                    (calc-show-edit-buffer))
                 (error "That command's definition cannot be edited")))))))
  
  ;; Formatting the macro buffer
  
  (defun calc-edit-macro-repeats ()
!   (goto-char calc-edit-top)
    (while
        (re-search-forward "^\\([0-9]+\\)\\*" nil t)
      (setq num (string-to-int (match-string 1)))
***************
*** 738,747 ****
  
  (defun calc-edit-macro-adjust-buffer ()
    (calc-edit-macro-repeats)
!   (goto-char (point-min))
    (while (re-search-forward "^RET$" nil t)
      (delete-char 1))
!   (goto-char (point-min))
    (while (and (re-search-forward "^$" nil t)
                (not (= (point) (point-max))))
      (delete-char 1)))
--- 731,740 ----
  
  (defun calc-edit-macro-adjust-buffer ()
    (calc-edit-macro-repeats)
!   (goto-char calc-edit-top)
    (while (re-search-forward "^RET$" nil t)
      (delete-char 1))
!   (goto-char calc-edit-top)
    (while (and (re-search-forward "^$" nil t)
                (not (= (point) (point-max))))
      (delete-char 1)))
***************
*** 869,879 ****
  (defun calc-edit-format-macro-buffer ()
    "Rewrite the Calc macro editing buffer."
    (calc-edit-macro-adjust-buffer)
!   (goto-char (point-min))
!   (search-forward "Original keys:")
!   (forward-line 1)
!   (insert "\n")
!   (skip-chars-forward " \t\n")
    (let ((type (calc-edit-macro-command-type)))
      (while (not (string-equal type ""))
        (cond
--- 862,868 ----
  (defun calc-edit-format-macro-buffer ()
    "Rewrite the Calc macro editing buffer."
    (calc-edit-macro-adjust-buffer)
!   (goto-char calc-edit-top)
    (let ((type (calc-edit-macro-command-type)))
      (while (not (string-equal type ""))
        (cond
***************
*** 913,939 ****
          (calc-edit-macro-combine-var-name))
         (t (forward-line 1)))
        (setq type (calc-edit-macro-command-type))))
!   (goto-char (point-min)))
  
  ;; Finish editing the macro
  
  (defun calc-edit-macro-pre-finish-edit ()
!   (goto-char (point-min))
    (while (re-search-forward "\\(^\\| \\)RET\\($\\|\t\\| \\)" nil t)
      (search-backward "RET")
      (delete-char 3)
      (insert "<return>")))
  
  (defun calc-edit-macro-finish-edit (cmdname key)
    "Finish editing a Calc macro.
  Redefine the corresponding command."
    (interactive)
    (let ((cmd (intern cmdname)))
      (calc-edit-macro-pre-finish-edit)
!     (goto-char (point-max))
!     (re-search-backward "^Original keys:")
!     (forward-line 1)
!     (let* ((str (buffer-substring (point) (point-max)))
             (mac (edmacro-parse-keys str t)))
        (if (= (length mac) 0)
            (fmakunbound cmd)
--- 902,926 ----
          (calc-edit-macro-combine-var-name))
         (t (forward-line 1)))
        (setq type (calc-edit-macro-command-type))))
!   (goto-char calc-edit-top))
  
  ;; Finish editing the macro
  
  (defun calc-edit-macro-pre-finish-edit ()
!   (goto-char calc-edit-top)
    (while (re-search-forward "\\(^\\| \\)RET\\($\\|\t\\| \\)" nil t)
      (search-backward "RET")
      (delete-char 3)
      (insert "<return>")))
  
+ (defvar calc-edit-top)
  (defun calc-edit-macro-finish-edit (cmdname key)
    "Finish editing a Calc macro.
  Redefine the corresponding command."
    (interactive)
    (let ((cmd (intern cmdname)))
      (calc-edit-macro-pre-finish-edit)
!     (let* ((str (buffer-substring calc-edit-top (point-max)))
             (mac (edmacro-parse-keys str t)))
        (if (= (length mac) 0)
            (fmakunbound cmd)
***************
*** 946,955 ****
                            'arg key)))))))
  
  (defun calc-finish-formula-edit (func)
-   (goto-char (point-min))
-   (forward-line 3)
    (let ((buf (current-buffer))
!       (str (buffer-substring (point) (point-max)))
        (start (point))
        (body (calc-valid-formula-func func)))
      (set-buffer calc-original-buffer)
--- 933,940 ----
                            'arg key)))))))
  
  (defun calc-finish-formula-edit (func)
    (let ((buf (current-buffer))
!       (str (buffer-substring calc-edit-top (point-max)))
        (start (point))
        (body (calc-valid-formula-func func)))
      (set-buffer calc-original-buffer)




reply via email to

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