(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.
+2010-08-08 Jay Belanger <jay.p.belanger@gmail.com>
+
+ * calc.texi (Making Selections, Selecting Subformulas)
+ (Customizing Calc): Mention how to use faces to emphasize selected
+ sub-formulas.
+
2010-08-05 Michael Albinus <michael.albinus@gmx.de>
* tramp.texi (External packages): File attributes cache flushing
@noindent
Every character not part of the sub-formula @samp{b} has been changed
-to a dot. The @samp{*} next to the line number is to remind you that
+to a dot. (If the customizable variable
+@code{calc-highlight-selections-with-faces} is non-nil, then the characters
+not part of the sub-formula are de-emphasized by using a less
+noticeable face instead of using dots. @pxref{Displaying Selections}.)
+The @samp{*} next to the line number is to remind you that
the formula has a portion of it selected. (In this case, it's very
obvious, but it might not always be. If Embedded mode is enabled,
the word @samp{Sel} also appears in the mode line because the stack
@noindent
@kindex j d
@pindex calc-show-selections
+@vindex calc-highlight-selections-with-faces
+@vindex calc-selected-face
+@vindex calc-nonselected-face
The @kbd{j d} (@code{calc-show-selections}) command controls how
selected sub-formulas are displayed. One of the alternatives is
illustrated in the above examples; if we press @kbd{j d} we switch
. . . . 2 x + 1
@end group
@end smallexample
+If the customizable variable
+@code{calc-highlight-selections-with-faces} is non-nil, then the
+non-selected portion of the formula will be de-emphasized by using a
+less noticeable face (@code{calc-nonselected-face}) instead of dots
+and the selected sub-formula will be highlighted by using a more
+noticeable face (@code{calc-selected-face}) instead of @samp{#}
+signs. (@pxref{Customizing Calc}.)
@node Operating on Selections, Rearranging with Selections, Displaying Selections, Selecting Subformulas
@subsection Operating on Selections
Calc is controlled by many variables, most of which can be reset
from within Calc. Some variables are less involved with actual
-calculation, and can be set outside of Calc using Emacs's
+calculation and can be set outside of Calc using Emacs's
customization facilities. These variables are listed below.
Typing @kbd{M-x customize-variable RET @var{variable-name} RET}
will bring up a buffer in which the variable's value can be redefined.
and @code{calc-embedded-open-close-plain-alist}.
@end defvar
+@defvar calc-highlight-selections-with-faces
+@defvarx calc-selected-face
+@defvarx calc-nonselected-face
+The variable @code{calc-highlight-selections-with-faces}
+determines how selected sub-formulas are distinguished.
+If @code{calc-highlight-selections-with-faces} is nil, then
+a selected sub-formula is distinguished either by changing every
+character not part of the sub-formula with a dot or by changing every
+character in the sub-formula with a @samp{#} sign.
+If @code{calc-highlight-selections-with-faces} is t,
+then a selected sub-formula is distinguished either by displaying the
+non-selected portion of the formula with @code{calc-nonselected-face}
+or by displaying the selected sub-formula with
+@code{calc-nonselected-face}. (@pxref{Displaying Selections}.)
+@end defvar
+
@defvar calc-multiplication-has-precedence
The variable @code{calc-multiplication-has-precedence} determines
whether multiplication has precedence over division in algebraic
+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
(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
(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.
: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'.")
(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 ()
(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
(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