summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJay Belanger <jay.p.belanger@gmail.com>2010-08-07 22:04:57 -0500
committerJay Belanger <jay.p.belanger@gmail.com>2010-08-07 22:04:57 -0500
commit2c695727e092f051b17846c0897fd541cefbdf8a (patch)
tree6f72607d95778ef73ffaff06018fccfd6baca509 /lisp
parentb93d4f22cbb28c4efbb65fa4927e8b42b41ba00f (diff)
downloademacs-2c695727e092f051b17846c0897fd541cefbdf8a.tar.gz
emacs-2c695727e092f051b17846c0897fd541cefbdf8a.tar.bz2
emacs-2c695727e092f051b17846c0897fd541cefbdf8a.zip
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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog14
-rw-r--r--lisp/calc/calc-sel.el10
-rw-r--r--lisp/calc/calc.el26
-rw-r--r--lisp/calc/calccomp.el15
4 files changed, 54 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e457317c84a..701a9cc52c8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,17 @@
+2010-08-08 Jay Belanger <jay.p.belanger@gmail.com>
+
+ * calc/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.
+
+ * calc/calccomp.el (math-comp-highlight-string): Use
+ `calc-highlight-selections-with-faces' to determine how to highlight
+ sub-formulas.
+
+ * calc/calc-sel.el (calc-show-selections): Change message to when
+ using faces to highlight selections.
+
2010-08-07 Michael R. Mauger <mmaug@yahoo.com>
* progmodes/sql.el (sql-mode-sqlite-font-lock-keywords): Added
diff --git a/lisp/calc/calc-sel.el b/lisp/calc/calc-sel.el
index 084b9ea2b6a..c485fdd168a 100644
--- a/lisp/calc/calc-sel.el
+++ b/lisp/calc/calc-sel.el
@@ -309,6 +309,8 @@
(setq n (1+ n))))
(calc-clear-command-flag 'position-point)))
+(defvar calc-highlight-selections-with-faces)
+
(defun calc-show-selections (arg)
(interactive "P")
(calc-wrapper
@@ -330,8 +332,12 @@
(setcar (nthcdr 2 calc-selection-cache-entry) nil)
(calc-change-current-selection sel)))))
(message (if calc-show-selections
- "Displaying only selected part of formulas"
- "Displaying all but selected part of formulas"))))
+ (if calc-highlight-selections-with-faces
+ "De-emphasizing all but selected part of formulas"
+ "Displaying only selected part of formulas")
+ (if calc-highlight-selections-with-faces
+ "Emphasizing selected part of formulas"
+ "Displaying all but selected part of formulas")))))
;; The variables calc-final-point-line and calc-final-point-column
;; are declared in calc.el, and are used throughout.
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 7ea371dd16e..e0560465a99 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -425,6 +425,27 @@ in normal mode."
: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 @@ commands given here will actually operate on the *Calculator* stack."
(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 @@ See calc-keypad for details."
(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
diff --git a/lisp/calc/calccomp.el b/lisp/calc/calccomp.el
index 7aeb31c7719..6923cd7693a 100644
--- a/lisp/calc/calccomp.el
+++ b/lisp/calc/calccomp.el
@@ -1339,12 +1339,15 @@
(defun math-comp-highlight-string (s)
(setq s (copy-sequence s))
- (let ((i (length s)))
- (while (>= (setq i (1- i)) 0)
- (or (memq (aref s i) '(32 ?\n))
- (aset s i (if calc-show-selections ?\. ?\#)))))
- s)
-
+ (if calc-highlight-selections-with-faces
+ (if (not calc-show-selections)
+ (propertize s 'face 'calc-selected-face)
+ (propertize s 'face 'calc-nonselected-face))
+ (let ((i (length s)))
+ (while (>= (setq i (1- i)) 0)
+ (or (memq (aref s i) '(32 ?\n))
+ (aset s i (if calc-show-selections ?\. ?\#)))))
+ s))
;; The variable math-comp-sel-tag is local to calc-find-selected-part
;; in calc-sel.el, but is used by math-comp-sel-flat-term and