summaryrefslogtreecommitdiff
path: root/lisp/calc/calc-yank.el
diff options
context:
space:
mode:
authorJay Belanger <jay.p.belanger@gmail.com>2005-01-02 17:04:37 +0000
committerJay Belanger <jay.p.belanger@gmail.com>2005-01-02 17:04:37 +0000
commitf57a09620622809ecddcc571765f1b1b7eb9e563 (patch)
tree5e514e4d58eadc1ce2c20fb836fceccb1afce64d /lisp/calc/calc-yank.el
parent72e53dcd4198a717d3ae7488500396d05ccb5e69 (diff)
downloademacs-f57a09620622809ecddcc571765f1b1b7eb9e563.tar.gz
(calc-edit-top): New variable.
(calc-edit-mode): Set calc-edit-top to be the beginning of the edited object. Change header properties. (calc-edit-finish, calc-edit-finish-stack-object) (calc-edit-show-buffer): Use calc-edit-top to find the beginning of the edited object.
Diffstat (limited to 'lisp/calc/calc-yank.el')
-rw-r--r--lisp/calc/calc-yank.el16
1 files changed, 7 insertions, 9 deletions
diff --git a/lisp/calc/calc-yank.el b/lisp/calc/calc-yank.el
index 6f75613b014..53d5946e073 100644
--- a/lisp/calc/calc-yank.el
+++ b/lisp/calc/calc-yank.el
@@ -430,6 +430,7 @@
(defvar calc-edit-handler)
(defvar calc-restore-trail)
(defvar calc-allow-ret)
+(defvar calc-edit-top)
(defun calc-edit-mode (&optional handler allow-ret title)
"Calculator editing mode. Press RET, LFD, or C-c C-c to finish.
@@ -470,7 +471,9 @@ To cancel the edit, simply kill the *Calc Edit* buffer."
"Press `C-c C-c'"
(if allow-ret "" " or RET")
" to finish, `C-x k RET' to cancel.\n\n")
- 'font-lock-face 'italic))))
+ 'font-lock-face 'italic 'read-only t 'rear-nonsticky t 'front-sticky t))
+ (make-local-variable 'calc-edit-top)
+ (setq calc-edit-top (point))))
(put 'calc-edit-mode 'mode-class 'special)
(defun calc-show-edit-buffer ()
@@ -487,8 +490,7 @@ To cancel the edit, simply kill the *Calc Edit* buffer."
(if win
(delete-window win))))
(set-buffer-modified-p nil)
- (goto-char (point-min))
- (forward-line 2)))
+ (goto-char calc-edit-top)))
(defun calc-edit-return ()
(interactive)
@@ -522,11 +524,7 @@ To cancel the edit, simply kill the *Calc Edit* buffer."
(set-buffer original)
(not (eq major-mode 'calc-mode))))
(error "Original calculator buffer has been corrupted")))
- (goto-char (point-min))
- (when (looking-at "Calc Edit\\|Editing ")
- (forward-line 1))
- (if (looking-at "^ *$")
- (forward-line 1))
+ (goto-char calc-edit-top)
(if (buffer-modified-p)
(eval calc-edit-handler))
(if one-window
@@ -551,7 +549,7 @@ To cancel the edit, simply kill the *Calc Edit* buffer."
(defun calc-finish-stack-edit (num)
(let ((buf (current-buffer))
- (str (buffer-substring (point) (point-max)))
+ (str (buffer-substring calc-edit-top (point-max)))
(start (point))
pos)
(if (and (integerp num) (> num 1))