1 ;;; calc-yank.el --- kill-ring functionality for Calc
3 ;; Copyright (C) 1990-1993, 2001-2017 Free Software Foundation, Inc.
5 ;; Author: David Gillespie <daveg@synaptics.com>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
26 ;; This file is autoloaded from calc-ext.el.
31 ;;; Kill ring commands.
33 (defun calc-kill (nn &optional no-delete
)
35 (if (eq major-mode
'calc-mode
)
38 (calc-set-command-flag 'no-align
)
39 (let ((num (max (calc-locate-cursor-element (point)) 1))
40 (n (prefix-numeric-value nn
)))
47 (calc-check-stack num
)
48 (let ((stuff (calc-top-list n
(- num n -
1))))
49 (calc-cursor-stack-index num
)
50 (let ((first (point)))
51 (calc-cursor-stack-index (- num n
))
53 (backward-char 1)) ; don't include newline for raw C-k
54 (copy-region-as-kill first
(point))
56 (calc-pop-stack n
(- num n -
1))))
57 (setq calc-last-kill
(cons (car kill-ring
) stuff
)))))
60 (defun calc-force-refresh ()
61 (if (or calc-executing-macro calc-display-dirty
)
62 (let ((calc-executing-macro nil
))
65 (defun calc-locate-cursor-element (pt)
67 (goto-char (point-max))
68 (calc-locate-cursor-scan (- calc-stack-top
) calc-stack pt
)))
70 (defun calc-locate-cursor-scan (n stack pt
)
71 (if (or (<= (point) pt
)
74 (forward-line (- (nth 1 (car stack
))))
75 (calc-locate-cursor-scan (1+ n
) (cdr stack
) pt
)))
77 (defun calc-kill-region (top bot
&optional no-delete
)
79 (if (eq major-mode
'calc-mode
)
82 (calc-set-command-flag 'no-align
)
83 (let* ((top-num (calc-locate-cursor-element top
))
84 (top-pos (save-excursion
85 (calc-cursor-stack-index top-num
)
87 (bot-num (calc-locate-cursor-element (1- bot
)))
88 (bot-pos (save-excursion
89 (calc-cursor-stack-index (max 0 (1- bot-num
)))
91 (num (- top-num bot-num -
1)))
92 (copy-region-as-kill top-pos bot-pos
)
93 (setq calc-last-kill
(cons (car kill-ring
)
94 (calc-top-list num bot-num
)))
96 (calc-pop-stack num bot-num
))))
98 (copy-region-as-kill top bot
)
99 (kill-region top bot
))))
101 (defun calc-copy-as-kill (n)
105 (defun calc-copy-region-as-kill (top bot
)
107 (calc-kill-region top bot t
))
109 (defun math-number-regexp (radix-num)
110 "Return a regexp which will match a Calc number base RADIX-NUM."
114 ((and (<= 2 radix-num
)
117 (number-to-string (1- radix-num
))
120 ((= 11 radix-num
) "[0-9aA]")
124 "a-" (format "%c" (+ (- ?a
11) radix-num
))
125 "A-" (format "%c" (+ (- ?A
11) radix-num
))
127 (integer-regexp (concat digit-range
"+"))
128 (decimal-regexp (concat digit-range
"+\\." digit-range
"*")))
132 "[-_+]?" decimal-regexp
"[eE][-+]?[0-9]+"
134 "[-_+]?" integer-regexp
"[eE][-+]?[0-9]+"
137 "[-_+]?" integer-regexp
"*[:/]" integer-regexp
"[:/]" integer-regexp
140 "[-_+]?" integer-regexp
"[:/]" integer-regexp
143 "[-_+]?" decimal-regexp
146 "[-_+]?" integer-regexp
147 "\\) *\\(\n\\|\\'\\)")))
149 ;; This function uses calc-last-kill if possible to get an exact result,
150 ;; otherwise it just parses the yanked string.
151 ;; Modified to use Emacs 19 extended concept of kill-ring. -- daveg 12/15/96
153 (defun calc-yank (radix)
154 "Yank a value into the Calculator buffer.
156 Valid numeric prefixes for RADIX: 0, 2, 6, 8
157 No radix notation is prepended for any other numeric prefix.
159 If RADIX is 2, prepend \"2#\" - Binary.
160 If RADIX is 8, prepend \"8#\" - Octal.
161 If RADIX is 0, prepend \"10#\" - Decimal.
162 If RADIX is 6, prepend \"16#\" - Hexadecimal.
164 If RADIX is a non-nil list (created using \\[universal-argument]), the user
165 will be prompted to enter the radix in the minibuffer.
167 If RADIX is nil or if the yanked string already has a calc radix prefix, the
168 yanked string will be passed on directly to the Calculator buffer without any
172 (calc-pop-push-record-list
178 (if (fboundp 'current-kill
)
180 (car kill-ring-yank-pointer
)))
183 ;; Match examples: -2#10, 10\n(10#10,01)
184 (string-match-p "^[-(]*[0-9]\\{1,2\\}#" thing-raw
))
191 "Set radix for yanked content (2-36): "))
192 (when (not (and (integerp radix-num
)
195 (error (concat "The radix has to be an "
196 "integer between 2 and 36."))))
198 (cond ((eq radix
2) 2)
203 (concat "No radix prepended "
204 "for invalid *numeric* "
211 (concat (number-to-string radix-num
) "#"))
212 (setq valid-num-regexp
213 (math-number-regexp radix-num
))
214 ;; Ensure that the radix-notation is prefixed
215 ;; correctly even for multi-line yanks like below,
218 (replace-regexp-in-string
220 (concat radix-notation
"\\&")
223 (if (eq (car-safe calc-last-kill
) thing-raw
)
226 (let ((val (math-read-exprs (calc-clean-newlines thing
))))
227 (if (eq (car-safe val
) 'error
)
229 (setq val
(math-read-exprs thing
))
230 (if (eq (car-safe val
) 'error
)
231 (error "Bad format in yanked data")
235 ;;; The Calc set- and get-register commands are modified versions of functions
238 (defvar calc-register-alist nil
239 "Alist of elements (NAME . (TEXT . CALCVAL)).
240 NAME is a character (a number).
241 TEXT and CALCVAL are the TEXT and internal structure of stack entries.")
243 (defun calc-set-register (register text calcval
)
244 "Set the contents of the Calc register REGISTER to (TEXT . CALCVAL),
245 as well as set the contents of the Emacs register REGISTER to TEXT."
246 (set-register register text
)
247 (setf (alist-get register calc-register-alist
) (cons text calcval
)))
249 (defun calc-get-register (reg)
250 "Return the CALCVAL portion of the contents of the Calc register REG,
251 unless the TEXT portion doesn't match the contents of the Emacs register REG,
252 in which case either return the contents of the Emacs register (if it is
254 (let ((cval (cdr (assq reg calc-register-alist
)))
255 (val (cdr (assq reg register-alist
))))
257 (if (and (stringp (car cval
))
258 (string= (car cval
) val
))
262 (defun calc-copy-to-register (register start end
&optional delete-flag
)
263 "Copy the lines in the region into register REGISTER.
264 With prefix arg, delete as well.
266 Interactively, reads the register using `register-read-with-preview'."
267 (interactive (list (register-read-with-preview "Copy to register: ")
268 (region-beginning) (region-end)
270 (if (eq major-mode
'calc-mode
)
271 (let* ((top-num (calc-locate-cursor-element start
))
272 (top-pos (save-excursion
273 (calc-cursor-stack-index top-num
)
275 (bot-num (calc-locate-cursor-element (1- end
)))
276 (bot-pos (save-excursion
277 (calc-cursor-stack-index (max 0 (1- bot-num
)))
279 (num (- top-num bot-num -
1))
280 (str (buffer-substring top-pos bot-pos
)))
281 (calc-set-register register str
(calc-top-list num bot-num
))
284 (calc-pop-stack num bot-num
))))
285 (copy-to-register register start end delete-flag
)))
287 (defun calc-insert-register (register)
288 "Insert the contents of register REGISTER.
290 Interactively, reads the register using `register-read-with-preview'."
291 (interactive (list (register-read-with-preview "Insert register: ")))
292 (if (eq major-mode
'calc-mode
)
293 (let ((val (calc-get-register register
)))
295 (calc-pop-push-record-list
298 (error "Bad format in register data")
301 (let ((nval (math-read-exprs (calc-clean-newlines val
))))
302 (if (eq (car-safe nval
) 'error
)
304 (setq nval
(math-read-exprs val
))
305 (if (eq (car-safe nval
) 'error
)
306 (error "Bad format in register data")
309 (insert-register register
)))
311 (defun calc-add-to-register (register start end prepend delete-flag
)
312 "Add the lines in the region to register REGISTER.
313 If PREPEND is non-nil, add them to the beginning of the register,
314 otherwise the end. If DELETE-FLAG is non-nil, also delete the region."
315 (let* ((top-num (calc-locate-cursor-element start
))
316 (top-pos (save-excursion
317 (calc-cursor-stack-index top-num
)
319 (bot-num (calc-locate-cursor-element (1- end
)))
320 (bot-pos (save-excursion
321 (calc-cursor-stack-index (max 0 (1- bot-num
)))
323 (num (- top-num bot-num -
1))
324 (str (buffer-substring top-pos bot-pos
))
325 (calcval (calc-top-list num bot-num
))
326 (cval (cdr (assq register calc-register-alist
))))
328 (calc-set-register register str calcval
)
332 (concat str
(car cval
))
333 (append calcval
(cdr cval
)))
336 (concat (car cval
) str
)
337 (append (cdr cval
) calcval
))))
340 (calc-pop-stack num bot-num
)))))
342 (defun calc-append-to-register (register start end
&optional delete-flag
)
343 "Copy the lines in the region to the end of register REGISTER.
344 With prefix arg, also delete the region.
346 Interactively, reads the register using `register-read-with-preview'."
347 (interactive (list (register-read-with-preview "Append to register: ")
348 (region-beginning) (region-end)
350 (if (eq major-mode
'calc-mode
)
351 (calc-add-to-register register start end nil delete-flag
)
352 (append-to-register register start end delete-flag
)))
354 (defun calc-prepend-to-register (register start end
&optional delete-flag
)
355 "Copy the lines in the region to the beginning of register REGISTER.
356 With prefix arg, also delete the region.
358 Interactively, reads the register using `register-read-with-preview'."
359 (interactive (list (register-read-with-preview "Prepend to register: ")
360 (region-beginning) (region-end)
362 (if (eq major-mode
'calc-mode
)
363 (calc-add-to-register register start end t delete-flag
)
364 (prepend-to-register register start end delete-flag
)))
368 (defun calc-clean-newlines (s)
371 ;; Omit leading/trailing whitespace
372 ((or (string-match "\\`[ \n\r]+\\([^\001]*\\)\\'" s
)
373 (string-match "\\`\\([^\001]*\\)[ \n\r]+\\'" s
))
374 (calc-clean-newlines (math-match-substring s
1)))
376 ;; Convert newlines to commas
377 ((string-match "\\`\\(.*\\)[\n\r]+\\([^\001]*\\)\\'" s
)
378 (calc-clean-newlines (concat (math-match-substring s
1) ","
379 (math-match-substring s
2))))
384 (defun calc-do-grab-region (top bot arg
)
385 (when (memq major-mode
'(calc-mode calc-trail-mode
))
386 (error "This command works only in a regular text buffer"))
387 (let* ((from-buffer (current-buffer))
388 (calc-was-started (get-buffer-window "*Calculator*"))
394 (setq arg
(prefix-numeric-value arg
))
396 (setq top
(point-at-bol)
405 (setq data
(buffer-substring top bot
))
408 (setq vals
(math-read-expr data
))
409 (setq vals
(math-read-expr (concat "[" data
"]")))
410 (and (eq (car-safe vals
) 'vec
)
412 (eq (car-safe (nth 1 vals
)) 'vec
)
413 (setq vals
(nth 1 vals
))))
414 (if (eq (car-safe vals
) 'error
)
417 (pop-to-buffer from-buffer
)
419 (switch-to-buffer from-buffer
))
421 (forward-char (+ (nth 1 vals
) (if single
0 1)))
422 (error (nth 2 vals
))))
424 (calc-enter-result 0 "grab" vals
))))
427 (defun calc-do-grab-rectangle (top bot arg
&optional reduce
)
428 (and (memq major-mode
'(calc-mode calc-trail-mode
))
429 (error "This command works only in a regular text buffer"))
430 (let* ((col1 (save-excursion (goto-char top
) (current-column)))
431 (col2 (save-excursion (goto-char bot
) (current-column)))
432 (from-buffer (current-buffer))
433 (calc-was-started (get-buffer-window "*Calculator*"))
434 data mat vals lnum pt pos
)
438 (error "Point and mark must be at beginning of line, or define a rectangle"))
440 (while (< (point) bot
)
443 (setq data
(cons (buffer-substring pt
(1- (point))) data
)))
444 (setq data
(nreverse data
)))
445 (setq data
(extract-rectangle top bot
)))
447 (setq mat
(list 'vec
)
450 (setq arg
(if (consp arg
) 0 (prefix-numeric-value arg
))))
458 (let ((w (length (car data
)))
463 (math-read-expr (substring (car data
) pos
))
464 (math-read-expr (substring (car data
) pos j
))))
465 (if (eq (car-safe v
) 'error
)
467 (setq vals
(nconc vals
(list v
))
469 (if (string-match "\\` *-?[0-9][0-9]?[0-9]?[0-9]?[0-9]?[0-9]? *\\'"
471 (setq vals
(list 'vec
(string-to-number (car data
))))
473 (string-match "[[{][^][{}]*[]}]" (car data
)))
474 (setq pos
(match-beginning 0)
475 vals
(math-read-expr (math-match-substring (car data
) 0)))
476 (let ((s (if (string-match
477 "\\`\\([0-9]+:[ \t]\\)?\\(.*[^, \t]\\)[, \t]*\\'"
479 (math-match-substring (car data
) 2)
482 vals
(math-read-expr (concat "[" s
"]")))
483 (if (eq (car-safe vals
) 'error
)
484 (let ((v2 (math-read-expr s
)))
485 (unless (eq (car-safe v2
) 'error
)
486 (setq vals
(list 'vec v2
)))))))))
487 (if (eq (car-safe vals
) 'error
)
490 (pop-to-buffer from-buffer
)
492 (switch-to-buffer from-buffer
))
495 (forward-char (+ (nth 1 vals
) (min col1 col2
) pos
))
496 (error (nth 2 vals
))))
497 (unless (equal vals
'(vec))
498 (setq mat
(cons vals mat
)))
499 (setq data
(cdr data
)
503 (calc-enter-result 0 "grb+" (list reduce
'(var add var-add
)
505 (calc-enter-result 0 "grab" (nreverse mat
))))))
508 (defun calc-copy-to-buffer (nn)
509 "Copy the top of stack into an editing buffer."
511 (let ((thebuf (and (not (memq major-mode
'(calc-mode calc-trail-mode
)))
518 (let ((n (prefix-numeric-value nn
))
519 (eat-lnums calc-line-numbering
)
520 (big-offset (if (eq calc-language
'big
) 1 0))
522 (setq oldbuf
(current-buffer)
524 (calc-find-writable-buffer (buffer-list) 0)
525 (calc-find-writable-buffer (buffer-list) 1)
526 (error "No other buffer")))
527 (cond ((and (or (null nn
)
529 (= (calc-substack-height 0)
530 (- (1- (calc-substack-height 1)) big-offset
)))
531 (calc-cursor-stack-index 1)
533 (if calc-line-numbering
"[0-9]+: *[^ \n]" " *[^ \n]"))
534 (goto-char (1- (match-end 0))))
537 (calc-cursor-stack-index 0)
538 (setq bot
(- (1- (point)) big-offset
)))
540 (calc-cursor-stack-index n
)
542 (calc-cursor-stack-index 0)
543 (setq bot
(- (point) big-offset
)))
545 (calc-cursor-stack-index (- n
))
547 (calc-cursor-stack-index (1- (- n
)))
550 (goto-char (point-min))
553 (calc-cursor-stack-index 0)
555 (with-current-buffer newbuf
557 (kill-region (region-beginning) (region-end)))
558 (push-mark (point) t
)
559 (if (and overwrite-mode
(not (consp nn
)))
560 (calc-overwrite-string (with-current-buffer oldbuf
561 (buffer-substring top bot
))
563 (or (bolp) (setq eat-lnums nil
))
564 (insert-buffer-substring oldbuf top bot
)
567 (while (and (> (point) (mark))
570 (>= (point) (mark))))
575 (setq movept
(point)))
576 (when (get-buffer-window (current-buffer))
577 (set-window-point (get-buffer-window (current-buffer))
581 (when (and (consp nn
)
584 (switch-to-buffer newbuf
))))
586 (defun calc-overwrite-string (str eat-lnums
)
587 (when (string-match "\n\\'" str
)
588 (setq str
(substring str
0 -
1)))
590 (setq str
(substring str
4)))
591 (if (and (string-match "\\`[-+]?[0-9.]+\\(e-?[0-9]+\\)?\\'" str
)
592 (looking-at "[-+]?[0-9.]+\\(e-?[0-9]+\\)?"))
594 (delete-region (point) (match-end 0))
597 (while (< i
(length str
))
598 (if (= (setq last-command-event
(aref str i
)) ?
\n)
599 (or (= i
(1- (length str
)))
602 (delete-region pt
(point))
606 (if eat-lnums
(setq i
(+ i
4)))))
607 (self-insert-command 1))
610 ;; First, require that buffer is visible and does not begin with "*"
611 ;; Second, require only that it not begin with "*Calc"
612 (defun calc-find-writable-buffer (buf mode
)
614 (if (or (string-match "\\`\\( .*\\|\\*Calc.*\\)"
615 (buffer-name (car buf
)))
617 (or (string-match "\\`\\*.*" (buffer-name (car buf
)))
618 (not (get-buffer-window (car buf
))))))
619 (calc-find-writable-buffer (cdr buf
) mode
)
627 (setq n
(calc-stack-size)))
630 (list (math-showing-full-precision
632 (function (lambda (x)
633 (math-format-flat-expr x
0)))
636 (if (math-vectorp x
) (setq allow-ret t
))
637 (math-format-nice-expr x
(frame-width)))))
640 (calc-top-list 1 (- n
)))))))
641 (calc-edit-mode (list 'calc-finish-stack-edit
(or flag n
)) allow-ret
)
643 (insert (car list
) "\n")
644 (setq list
(cdr list
)))))
645 (calc-show-edit-buffer))
647 (defun calc-alg-edit (str)
648 (calc-edit-mode '(calc-finish-stack-edit 0))
649 (calc-show-edit-buffer)
652 (calc-set-command-flag 'do-edit
))
654 (defvar calc-edit-mode-map
655 (let ((map (make-sparse-keymap)))
656 (define-key map
"\n" 'calc-edit-finish
)
657 (define-key map
"\r" 'calc-edit-return
)
658 (define-key map
"\C-c\C-c" 'calc-edit-finish
)
660 "Keymap for use by the calc-edit command.")
662 (defvar calc-original-buffer
)
663 (defvar calc-return-buffer
)
664 (defvar calc-one-window
)
665 (defvar calc-edit-handler
)
666 (defvar calc-restore-trail
)
667 (defvar calc-allow-ret
)
668 (defvar calc-edit-top
)
670 (defun calc-edit-mode (&optional handler allow-ret title
)
671 "Calculator editing mode. Press RET, LFD, or C-c C-c to finish.
672 To cancel the edit, simply kill the *Calc Edit* buffer."
675 (error "This command can be used only indirectly through calc-edit"))
676 (let ((oldbuf (current-buffer))
677 (buf (get-buffer-create "*Calc Edit*")))
679 (kill-all-local-variables)
680 (use-local-map calc-edit-mode-map
)
681 (setq buffer-read-only nil
)
682 (setq truncate-lines nil
)
683 (setq major-mode
'calc-edit-mode
)
684 (setq mode-name
"Calc Edit")
685 (run-mode-hooks 'calc-edit-mode-hook
)
686 (make-local-variable 'calc-original-buffer
)
687 (setq calc-original-buffer oldbuf
)
688 (make-local-variable 'calc-return-buffer
)
689 (setq calc-return-buffer oldbuf
)
690 (make-local-variable 'calc-one-window
)
691 (setq calc-one-window
(and (one-window-p t
) pop-up-windows
))
692 (make-local-variable 'calc-edit-handler
)
693 (setq calc-edit-handler handler
)
694 (make-local-variable 'calc-restore-trail
)
695 (setq calc-restore-trail
(get-buffer-window (calc-trail-buffer)))
696 (make-local-variable 'calc-allow-ret
)
697 (setq calc-allow-ret allow-ret
)
698 (let ((inhibit-read-only t
))
700 (add-hook 'kill-buffer-hook
(lambda ()
701 (let ((calc-edit-handler nil
))
702 (calc-edit-finish t
))
703 (message "(Canceled)")) t t
)
706 (or title title
"Calc Edit Mode. ")
707 (format-message "Press `C-c C-c'")
708 (if allow-ret
"" " or RET")
709 (format-message " to finish, `C-x k RET' to cancel.\n\n"))
710 'font-lock-face
'italic
'read-only t
'rear-nonsticky t
'front-sticky t
))
711 (make-local-variable 'calc-edit-top
)
712 (setq calc-edit-top
(point))))
713 (put 'calc-edit-mode
'mode-class
'special
)
715 (defun calc-show-edit-buffer ()
716 (let ((buf (current-buffer)))
717 (if (and (one-window-p t
) pop-up-windows
)
718 (pop-to-buffer (get-buffer-create "*Calc Edit*"))
719 (and calc-embedded-info
(get-buffer-window (aref calc-embedded-info
1))
720 (select-window (get-buffer-window (aref calc-embedded-info
1))))
721 (switch-to-buffer (get-buffer-create "*Calc Edit*")))
722 (setq calc-return-buffer buf
)
723 (if (and (< (window-width) (frame-width))
725 (let ((win (get-buffer-window (calc-trail-buffer))))
727 (delete-window win
))))
728 (set-buffer-modified-p nil
)
729 (goto-char calc-edit-top
)))
731 (defun calc-edit-return ()
733 (if (and (boundp 'calc-allow-ret
) calc-allow-ret
)
737 ;; The variable calc-edit-disp-trail is local to calc-edit finish, but
738 ;; is used by calc-finish-selection-edit and calc-finish-stack-edit.
739 (defvar calc-edit-disp-trail
)
741 (defun calc-edit-finish (&optional keep
)
742 "Finish calc-edit mode. Parse buffer contents and push them on the stack."
744 (message "Working...")
745 (or (and (boundp 'calc-original-buffer
)
746 (boundp 'calc-return-buffer
)
747 (boundp 'calc-one-window
)
748 (boundp 'calc-edit-handler
)
749 (boundp 'calc-restore-trail
)
750 (eq major-mode
'calc-edit-mode
))
751 (error "This command is valid only in buffers created by calc-edit"))
752 (let ((buf (current-buffer))
753 (original calc-original-buffer
)
754 (return calc-return-buffer
)
755 (one-window calc-one-window
)
756 (calc-edit-disp-trail calc-restore-trail
))
758 (when (or (null (buffer-name original
))
760 (set-buffer original
)
761 (not (eq major-mode
'calc-mode
))))
762 (error "Original calculator buffer has been corrupted")))
763 (goto-char calc-edit-top
)
764 (if (buffer-modified-p)
765 (eval calc-edit-handler
))
766 (if (and one-window
(not (one-window-p t
)))
768 (if (get-buffer-window return
)
769 (select-window (get-buffer-window return
))
770 (switch-to-buffer return
))
774 (if calc-edit-disp-trail
776 (calc-trail-display 1 t
)))
779 (defun calc-edit-cancel ()
780 "Cancel calc-edit mode. Ignore the Calc Edit buffer and don't change stack."
782 (let ((calc-edit-handler nil
))
784 (message "(Canceled)"))
786 (defun calc-finish-stack-edit (num)
787 (let ((buf (current-buffer))
788 (str (buffer-substring calc-edit-top
(point-max)))
791 (if (and (integerp num
) (> num
1))
792 (while (setq pos
(string-match "\n." str
))
794 (switch-to-buffer calc-original-buffer
)
795 (let ((vals (let ((calc-language nil
)
796 (math-expr-opers (math-standard-ops)))
797 (and (string-match "[^\n\t ]" str
)
798 (math-read-exprs str
)))))
799 (when (eq (car-safe vals
) 'error
)
800 (switch-to-buffer buf
)
801 (goto-char (+ start
(nth 1 vals
)))
802 (error (nth 2 vals
)))
807 (calc-refresh-evaltos num
))
808 (if calc-edit-disp-trail
809 (calc-trail-display 1 t
))
811 (let ((calc-simplify-mode (if (eq last-command-event ?\C-j
)
813 calc-simplify-mode
)))
815 (calc-enter-result num
"edit" vals
)
816 (calc-enter-result 1 "edit" vals
(- num
))))))))))
821 ;; generated-autoload-file: "calc-loaddefs.el"
824 ;;; calc-yank.el ends here