emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/calc/calc-aent.el,v


From: Jay Belanger
Subject: [Emacs-diffs] Changes to emacs/lisp/calc/calc-aent.el,v
Date: Wed, 12 Dec 2007 04:53:27 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Jay Belanger <jpb>      07/12/12 04:53:27

Index: calc-aent.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calc/calc-aent.el,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- calc-aent.el        2 Dec 2007 03:13:28 -0000       1.41
+++ calc-aent.el        12 Dec 2007 04:53:27 -0000      1.42
@@ -1015,6 +1015,19 @@
        (concat (math-match-substring x 1) "-" (math-match-substring x 2)))
     x))
 
+(defun math-restore-underscores (x)
+  "Replace pound signs by underscores in the symbol x.
+If the current Calc language does not allow underscores, return nil."
+  (if (memq calc-language calc-lang-allow-underscores)
+      (intern-soft (math-string-restore-underscores (symbol-name x)))))
+
+(defun math-string-restore-underscores (x)
+  "Replace pound signs by underscores in the string x."
+  (if (string-match "\\`\\(.*\\)#\\(.*\\)\\'" x)
+      (math-string-restore-underscores
+       (concat (math-match-substring x 1) "_" (math-match-substring x 2)))
+    x))
+
 (defun math-read-if (cond op)
   (let ((then (math-read-expr-level 0)))
     (or (equal math-expr-data ":")
@@ -1116,7 +1129,10 @@
                                      sym
                                    (intern (concat "var-"
                                                    (symbol-name sym)))))))
-                  (let ((v (assq (nth 1 val) math-expr-variable-mapping)))
+                  (let ((v (or
+                             (assq (nth 1 val) math-expr-variable-mapping)
+                             (assq (math-restore-underscores (nth 1 val))
+                                   math-expr-variable-mapping))))
                     (and v (setq val (if (consp (cdr v))
                                          (funcall (car (cdr v)) v val)
                                        (list 'var




reply via email to

[Prev in Thread] Current Thread [Next in Thread]