changeset 102788:b5ba1407f9a1

(calc-embedded-restore-original-modes): Add argument for Calculator buffer. (calc-do-embedded): Use specific Calculator buffer when cancelling embedded mode.
author Jay Belanger <jay.p.belanger@gmail.com>
date Mon, 30 Mar 2009 02:17:40 +0000
parents 45170edd0f4f
children 9b97f51b2e82
files lisp/calc/calc-embed.el
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calc/calc-embed.el	Mon Mar 30 01:52:26 2009 +0000
+++ b/lisp/calc/calc-embed.el	Mon Mar 30 02:17:40 2009 +0000
@@ -159,10 +159,9 @@
         (message "Current modes will be preserved when leaving embedded mode."))
     (message "Not in embedded mode.")))
 
-(defun calc-embedded-restore-original-modes ()
+(defun calc-embedded-restore-original-modes (calcbuf)
   "Restore the original Calc modes when leaving embedded mode."
-  (let ((calcbuf (get-buffer "*Calculator*"))
-        (changed nil)
+  (let ((changed nil)
         (lang (car calc-embedded-original-modes))
         (modes (cdr calc-embedded-original-modes)))
     (if (and calcbuf calc-embedded-original-modes)
@@ -232,7 +231,8 @@
 
 	    ((eq (current-buffer) (aref calc-embedded-info 0))
 	     (let* ((info calc-embedded-info)
-		    (mode calc-embedded-modes))
+		    (mode calc-embedded-modes)
+                    (calcbuf (aref calc-embedded-info 1)))
 	       (save-excursion
 		 (set-buffer (aref info 1))
 		 (if (and (> (calc-stack-size) 0)
@@ -253,7 +253,7 @@
                (setq minor-mode-overriding-map-alist
                      (remq calc-override-minor-modes minor-mode-overriding-map-alist))
 	       (set-buffer-modified-p (buffer-modified-p))
-               (calc-embedded-restore-original-modes)
+               (calc-embedded-restore-original-modes calcbuf)
 	       (or calc-embedded-quiet
 		   (message "Back to %s mode" (format-mode-line mode-name)))))