diff lisp/calc/calc.el @ 109682:bc0b9af387a7

calc.el (calc-trail-mode,calc-refresh): Use `face' property to italicize headers. (calc-highlight-selections-with-faces): New variable. (calc-selected-face, calc-nonselected-face): New faces. calccomp.el (math-comp-highlight-string): Use `calc-highlight-selections-with-faces' to determine how to highlight subformulas. calc-sel.el (calc-show-selections): Change message to something appropriate. calc.texi (Making Selections, Selecting Subformulas) (Customizing Calc): Mention how to use faces to emphasize selected subformulas.
author Jay Belanger <jay.p.belanger@gmail.com>
date Sat, 07 Aug 2010 22:04:57 -0500
parents d150a25a0eb9
children 417b1e4d63cd
line wrap: on
line diff
--- a/lisp/calc/calc.el	Sat Aug 07 19:57:07 2010 -0400
+++ b/lisp/calc/calc.el	Sat Aug 07 22:04:57 2010 -0500
@@ -425,6 +425,27 @@
   :group 'calc
   :type 'integer)
 
+(defcustom calc-highlight-selections-with-faces
+  nil
+  "If non-nil, use a separate face to indicate selected sub-formulas.
+If `calc-show-selections' is non-nil, then selected sub-formulas are shown
+by displaying the rest of the formula in `calc-nonselected-face'.  
+If `calc-show-selections' is nil, then selected sub-formulas are shown
+by displaying the sub-formula in `calc-selected-face'."
+  :group 'calc
+  :type 'boolean)
+
+(defface calc-nonselected-face
+  '((t :inherit shadow       
+       :slant italic))
+  "Face used to show the non-selected portion of a formula."
+  :group 'calc)
+
+(defface calc-selected-face
+  '((t :weight bold))
+  "Face used to show the selected portion of a formula."
+  :group 'calc)
+
 (defvar calc-bug-address "jay.p.belanger@gmail.com"
   "Address of the maintainer of Calc, for use by `report-calc-bug'.")
 
@@ -1385,8 +1406,7 @@
     (set (make-local-variable 'calc-main-buffer) buf))
   (when (= (buffer-size) 0)
     (let ((buffer-read-only nil))
-      (insert (propertize (concat "Emacs Calculator Trail\n")
-			  'font-lock-face 'italic))))
+      (insert (propertize "Emacs Calculator Trail\n" 'face 'italic))))
   (run-mode-hooks 'calc-trail-mode-hook))
 
 (defun calc-create-buffer ()
@@ -1976,7 +1996,7 @@
 	 (erase-buffer)
 	 (when calc-show-banner
 	   (insert (propertize "--- Emacs Calculator Mode ---\n"
-			       'font-lock-face 'italic)))
+			       'face 'italic)))
 	 (while thing
 	   (goto-char (point-min))
 	   (when calc-show-banner