(calc-embedded-announce-formula-alist, calc-embedded-open-close-formula-alist,
[bpt/emacs.git] / lisp / calc / calc.el
index 7317c2a..90d3097 100644 (file)
   :group 'calc
   :type '(regexp))
 
+(defcustom calc-embedded-announce-formula-alist
+  '((texinfo-mode . "@c Embed\n\\(@c .*\n\\)*")
+    (nroff-mode   . "\\\\\"Embed\n\\(\\\\\" .*\n\\)*")
+    (pascal-mode  . "{Embed}\n\\({.*}\n\\)*")
+    (c-mode       . "/\\*Embed\\*/\n\\(/\\* .*\\*/\n\\)*")
+    (c++-mode     . "//Embed\n\\(// .*\n\\)*")
+    (fortran-mode . "C Embed\n\\(C .*\n\\)*")
+    (f90-mode     . "!Embed\n\\(! .*\n\\)*"))
+  "*Alist of major modes with appropriate values for `calc-embedded-announce-formula'."
+  :group 'calc
+  :type '(alist :key-type (symbol :tag "Major mode")
+                :value-type (regexp :tag "Regexp to announce formula")))
+
 (defcustom calc-embedded-open-formula 
   "\\`\\|^\n\\|\\$\\$?\\|\\\\\\[\\|^\\\\begin[^{].*\n\\|^\\\\begin{.*[^x]}.*\n\\|^@.*\n\\|^\\.EQ.*\n\\|\\\\(\\|^%\n\\|^\\.\\\\\"\n"
   "*A regular expression for the opening delimiter of a formula used by calc-embedded."
   :group 'calc
   :type '(regexp))
 
+(defcustom calc-embedded-open-close-formula-alist
+  nil
+  "*Alist of major modes with pairs of formula delimiters used by calc-embedded."
+  :group 'calc
+  :type '(alist :key-type (symbol :tag "Major mode")
+                :value-type (list (regexp :tag "Opening formula delimiter")
+                                  (regexp :tag "Closing formula delimiter"))))
+
 (defcustom calc-embedded-open-word 
   "^\\|[^-+0-9.eE]"
   "*A regular expression for the opening delimiter of a formula used by calc-embedded-word."
   :group 'calc
   :type '(regexp))
 
+(defcustom calc-embedded-open-close-word-alist
+  nil
+  "*Alist of major modes with pairs of word delimiters used by calc-embedded."
+  :group 'calc
+  :type '(alist :key-type (symbol :tag "Major mode")
+                :value-type (list (regexp :tag "Opening word delimiter")
+                                  (regexp :tag "Closing word delimiter"))))
+
 (defcustom calc-embedded-open-plain 
   "%%% "
   "*A string which is the opening delimiter for a \"plain\" formula.
@@ -280,6 +309,20 @@ See calc-embedded-open-plain."
   :group 'calc
   :type '(string))
 
+(defcustom calc-embedded-open-close-plain-alist
+  '((texinfo-mode "@c %% "   " %%\n")
+    (nroff-mode   "\\\" %% " " %%\n")
+    (pascal-mode  "{%% "    " %%}\n")
+    (c-mode       "/* %% "   " %% */\n")
+    (c++-mode     "// %% "   " %%\n")
+    (fortran-mode "C %% "    " %%\n")
+    (f90-mode     "! %% "    " %%\n"))
+  "*Alist of major modes with pairs of delimiters for \"plain\" formulas."
+  :group 'calc
+  :type '(alist :key-type (symbol :tag "Major mode")
+                :value-type (list (string :tag "Opening \"plain\" delimiter")
+                                  (string :tag "Closing \"plain\" delimiter"))))
+
 (defcustom calc-embedded-open-new-formula 
   "\n\n"
   "*A string which is inserted at front of formula by calc-embedded-new-formula."
@@ -292,6 +335,14 @@ See calc-embedded-open-plain."
   :group 'calc
   :type '(string))
 
+(defcustom calc-embedded-open-close-new-formula-alist
+  nil
+  "*Alist of major modes with pairs of new formula delimiters used by calc-embedded."
+  :group 'calc
+  :type '(alist :key-type (symbol :tag "Major mode")
+                :value-type (list (string :tag "Opening new formula delimiter")
+                                  (string :tag "Closing new formula delimiter"))))
+
 (defcustom calc-embedded-open-mode 
   "% "
   "*A string which should precede calc-embedded mode annotations.
@@ -306,6 +357,20 @@ This is not required to be present for user-written mode annotations."
   :group 'calc
   :type '(string))
 
+(defcustom calc-embedded-open-close-mode-alist
+  '((texinfo-mode "@c "   "\n")
+    (nroff-mode   "\\\" " "\n")
+    (pascal-mode  "{ "    " }\n")
+    (c-mode       "/* "   " */\n")
+    (c++-mode     "// "   "\n")
+    (fortran-mode "C "    "\n")
+    (f90-mode     "! "    "\n"))
+  "*Alist of major modes with pairs of strings to delimit annotations."
+  :group 'calc
+  :type '(alist :key-type (symbol :tag "Major mode")
+                :value-type (list (string :tag "Opening annotation delimiter")
+                                  (string :tag "Closing annotation delimiter"))))
+
 (defcustom calc-gnuplot-name 
   "gnuplot"
   "*Name of GNUPLOT program, for calc-graph features."
@@ -726,6 +791,15 @@ If nil, selections displayed but ignored.")
 (defvar calc-trail-window-hook nil
   "Hook called to create the Calc trail window.")
 
+(defvar calc-embedded-new-buffer-hook nil
+  "Hook run when starting embedded mode in a new buffer.")
+
+(defvar calc-embedded-new-formula-hook nil
+  "Hook run when starting embedded mode in a new formula.")
+
+(defvar calc-embedded-mode-hook nil
+  "Hook run when starting embedded mode.")
+
 ;; Verify that Calc is running on the right kind of system.
 (defvar calc-emacs-type-lucid (not (not (string-match "Lucid" emacs-version))))