changeset 60507:8df8779687e1

(calc-do-embedded): Set mode line when embedded mode begins. (calc-embedded-language-alist): New variable. (calc-embedded-find-modes): Use calc-embedded-language-alist to set default language mode.
author Jay Belanger <jay.p.belanger@gmail.com>
date Tue, 08 Mar 2005 05:26:44 +0000
parents 46609ac51b44
children a17dd01f0af8
files lisp/calc/calc-embed.el
diffstat 1 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calc/calc-embed.el	Tue Mar 08 03:59:54 2005 +0000
+++ b/lisp/calc/calc-embed.el	Tue Mar 08 05:26:44 2005 +0000
@@ -244,6 +244,13 @@
       (use-local-map calc-mode-map)
       (setq calc-no-refresh-evaltos nil)
       (and chg calc-any-evaltos (calc-wrapper (calc-refresh-evaltos)))
+      (let (str)
+        (save-excursion
+          (calc-select-buffer)
+          (setq str mode-line-buffer-identification))
+        (unless (equal str mode-line-buffer-identification)
+          (setq mode-line-buffer-identification str)
+          (set-buffer-modified-p (buffer-modified-p))))
       (or (eq calc-embedded-quiet t)
 	  (message "Embedded Calc mode enabled; %s to return to normal"
 		   (if calc-embedded-quiet
@@ -670,6 +677,18 @@
     (setq calc-embedded-globals (cons t modes))
     (goto-char save-pt)))
 
+(defvar calc-embedded-language-alist
+  '((latex-mode . latex)
+    (tex-mode   . tex)
+    (plain-tex-mode . tex)
+    (context-mode . tex)
+    (nroff-mode . eqn)
+    (pascal-mode . pascal)
+    (c-mode . c)
+    (c++-mode . c)
+    (fortran-mode . fortran)
+    (f90-mode . fortran)))
+
 (defun calc-embedded-find-modes ()
   (let ((case-fold-search nil)
 	(save-pt (point))
@@ -717,6 +736,11 @@
 	       (setq no-defaults nil)))
       (backward-char 6))
     (goto-char save-pt)
+    (unless (assq 'the-language modes)
+      (let ((lang (assoc major-mode calc-embedded-language-alist)))
+        (if lang
+            (setq modes (cons (cons 'the-language (cdr lang))
+                              modes)))))
     (list modes emodes pmodes)))
 
 ;; The variable calc-embed-vars-used is local to calc-embedded-make-info,