emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r101020: calc.el (calc-trail-mode, c


From: Jay Belanger
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r101020: calc.el (calc-trail-mode, calc-refresh): Use `face' property to italicize headers.
Date: Sat, 07 Aug 2010 22:04:57 -0500
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 101020
committer: Jay Belanger <address@hidden>
branch nick: trunk
timestamp: Sat 2010-08-07 22:04:57 -0500
message:
  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. 
modified:
  doc/misc/ChangeLog
  doc/misc/calc.texi
  lisp/ChangeLog
  lisp/calc/calc-sel.el
  lisp/calc/calc.el
  lisp/calc/calccomp.el
=== modified file 'doc/misc/ChangeLog'
--- a/doc/misc/ChangeLog        2010-08-05 13:51:21 +0000
+++ b/doc/misc/ChangeLog        2010-08-08 03:04:57 +0000
@@ -1,3 +1,9 @@
+2010-08-08  Jay Belanger  <address@hidden>
+
+       * calc.texi (Making Selections, Selecting Subformulas)
+       (Customizing Calc): Mention how to use faces to emphasize selected
+       sub-formulas.
+
 2010-08-05  Michael Albinus  <address@hidden>
 
        * tramp.texi (External packages): File attributes cache flushing

=== modified file 'doc/misc/calc.texi'
--- a/doc/misc/calc.texi        2010-07-10 18:52:53 +0000
+++ b/doc/misc/calc.texi        2010-08-08 03:04:57 +0000
@@ -21513,7 +21513,11 @@
 
 @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
address@hidden 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
@@ -21726,6 +21730,9 @@
 @noindent
 @kindex j d
 @pindex calc-show-selections
address@hidden calc-highlight-selections-with-faces
address@hidden calc-selected-face
address@hidden 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
@@ -21740,6 +21747,13 @@
         . . . .                   2 x + 1
 @end group
 @end smallexample
+If the customizable variable
address@hidden 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
@@ -34911,7 +34925,7 @@
 
 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.
@@ -35197,6 +35211,22 @@
 and @code{calc-embedded-open-close-plain-alist}.
 @end defvar
 
address@hidden calc-highlight-selections-with-faces
address@hidden calc-selected-face
address@hidden 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
address@hidden (@pxref{Displaying Selections}.)
address@hidden defvar
+
 @defvar calc-multiplication-has-precedence
 The variable @code{calc-multiplication-has-precedence} determines
 whether multiplication has precedence over division in algebraic

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-08-07 23:57:07 +0000
+++ b/lisp/ChangeLog    2010-08-08 03:04:57 +0000
@@ -1,3 +1,17 @@
+2010-08-08  Jay Belanger  <address@hidden>
+
+       * 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  <address@hidden>
 
        * progmodes/sql.el (sql-mode-sqlite-font-lock-keywords): Added

=== modified file 'lisp/calc/calc-sel.el'
--- a/lisp/calc/calc-sel.el     2010-01-13 08:35:10 +0000
+++ b/lisp/calc/calc-sel.el     2010-08-08 03:04:57 +0000
@@ -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.

=== modified file 'lisp/calc/calc.el'
--- a/lisp/calc/calc.el 2010-06-22 07:41:10 +0000
+++ b/lisp/calc/calc.el 2010-08-08 03:04:57 +0000
@@ -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 "address@hidden"
   "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

=== modified file 'lisp/calc/calccomp.el'
--- a/lisp/calc/calccomp.el     2010-06-22 07:41:10 +0000
+++ b/lisp/calc/calccomp.el     2010-08-08 03:04:57 +0000
@@ -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


reply via email to

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