aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Belanger2010-08-07 22:04:57 -0500
committerJay Belanger2010-08-07 22:04:57 -0500
commit2c695727e092f051b17846c0897fd541cefbdf8a (patch)
tree6f72607d95778ef73ffaff06018fccfd6baca509
parentb93d4f22cbb28c4efbb65fa4927e8b42b41ba00f (diff)
downloademacs-2c695727e092f051b17846c0897fd541cefbdf8a.tar.gz
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.
-rw-r--r--doc/misc/ChangeLog6
-rw-r--r--doc/misc/calc.texi34
-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
6 files changed, 92 insertions, 13 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 2d67aec0eab..566fab45fbf 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,9 @@
12010-08-08 Jay Belanger <jay.p.belanger@gmail.com>
2
3 * calc.texi (Making Selections, Selecting Subformulas)
4 (Customizing Calc): Mention how to use faces to emphasize selected
5 sub-formulas.
6
12010-08-05 Michael Albinus <michael.albinus@gmx.de> 72010-08-05 Michael Albinus <michael.albinus@gmx.de>
2 8
3 * tramp.texi (External packages): File attributes cache flushing 9 * tramp.texi (External packages): File attributes cache flushing
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi
index ab81cf1bca2..5e4fc5c8486 100644
--- a/doc/misc/calc.texi
+++ b/doc/misc/calc.texi
@@ -21513,7 +21513,11 @@ to
21513 21513
21514@noindent 21514@noindent
21515Every character not part of the sub-formula @samp{b} has been changed 21515Every character not part of the sub-formula @samp{b} has been changed
21516to a dot. The @samp{*} next to the line number is to remind you that 21516to a dot. (If the customizable variable
21517@code{calc-highlight-selections-with-faces} is non-nil, then the characters
21518not part of the sub-formula are de-emphasized by using a less
21519noticeable face instead of using dots. @pxref{Displaying Selections}.)
21520The @samp{*} next to the line number is to remind you that
21517the formula has a portion of it selected. (In this case, it's very 21521the formula has a portion of it selected. (In this case, it's very
21518obvious, but it might not always be. If Embedded mode is enabled, 21522obvious, but it might not always be. If Embedded mode is enabled,
21519the word @samp{Sel} also appears in the mode line because the stack 21523the word @samp{Sel} also appears in the mode line because the stack
@@ -21726,6 +21730,9 @@ of the hierarchy simply by pointing to it with the cursor.
21726@noindent 21730@noindent
21727@kindex j d 21731@kindex j d
21728@pindex calc-show-selections 21732@pindex calc-show-selections
21733@vindex calc-highlight-selections-with-faces
21734@vindex calc-selected-face
21735@vindex calc-nonselected-face
21729The @kbd{j d} (@code{calc-show-selections}) command controls how 21736The @kbd{j d} (@code{calc-show-selections}) command controls how
21730selected sub-formulas are displayed. One of the alternatives is 21737selected sub-formulas are displayed. One of the alternatives is
21731illustrated in the above examples; if we press @kbd{j d} we switch 21738illustrated in the above examples; if we press @kbd{j d} we switch
@@ -21740,6 +21747,13 @@ by @samp{#} signs:
21740 . . . . 2 x + 1 21747 . . . . 2 x + 1
21741@end group 21748@end group
21742@end smallexample 21749@end smallexample
21750If the customizable variable
21751@code{calc-highlight-selections-with-faces} is non-nil, then the
21752non-selected portion of the formula will be de-emphasized by using a
21753less noticeable face (@code{calc-nonselected-face}) instead of dots
21754and the selected sub-formula will be highlighted by using a more
21755noticeable face (@code{calc-selected-face}) instead of @samp{#}
21756signs. (@pxref{Customizing Calc}.)
21743 21757
21744@node Operating on Selections, Rearranging with Selections, Displaying Selections, Selecting Subformulas 21758@node Operating on Selections, Rearranging with Selections, Displaying Selections, Selecting Subformulas
21745@subsection Operating on Selections 21759@subsection Operating on Selections
@@ -34911,7 +34925,7 @@ character of the prefix can simply be typed twice.
34911 34925
34912Calc is controlled by many variables, most of which can be reset 34926Calc is controlled by many variables, most of which can be reset
34913from within Calc. Some variables are less involved with actual 34927from within Calc. Some variables are less involved with actual
34914calculation, and can be set outside of Calc using Emacs's 34928calculation and can be set outside of Calc using Emacs's
34915customization facilities. These variables are listed below. 34929customization facilities. These variables are listed below.
34916Typing @kbd{M-x customize-variable RET @var{variable-name} RET} 34930Typing @kbd{M-x customize-variable RET @var{variable-name} RET}
34917will bring up a buffer in which the variable's value can be redefined. 34931will bring up a buffer in which the variable's value can be redefined.
@@ -35197,6 +35211,22 @@ should also be added to @code{calc-embedded-announce-formula-alist}
35197and @code{calc-embedded-open-close-plain-alist}. 35211and @code{calc-embedded-open-close-plain-alist}.
35198@end defvar 35212@end defvar
35199 35213
35214@defvar calc-highlight-selections-with-faces
35215@defvarx calc-selected-face
35216@defvarx calc-nonselected-face
35217The variable @code{calc-highlight-selections-with-faces}
35218determines how selected sub-formulas are distinguished.
35219If @code{calc-highlight-selections-with-faces} is nil, then
35220a selected sub-formula is distinguished either by changing every
35221character not part of the sub-formula with a dot or by changing every
35222character in the sub-formula with a @samp{#} sign.
35223If @code{calc-highlight-selections-with-faces} is t,
35224then a selected sub-formula is distinguished either by displaying the
35225non-selected portion of the formula with @code{calc-nonselected-face}
35226or by displaying the selected sub-formula with
35227@code{calc-nonselected-face}. (@pxref{Displaying Selections}.)
35228@end defvar
35229
35200@defvar calc-multiplication-has-precedence 35230@defvar calc-multiplication-has-precedence
35201The variable @code{calc-multiplication-has-precedence} determines 35231The variable @code{calc-multiplication-has-precedence} determines
35202whether multiplication has precedence over division in algebraic 35232whether multiplication has precedence over division in algebraic
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e457317c84a..701a9cc52c8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,17 @@
12010-08-08 Jay Belanger <jay.p.belanger@gmail.com>
2
3 * calc/calc.el (calc-trail-mode,calc-refresh): Use `face' property
4 to italicize headers.
5 (calc-highlight-selections-with-faces): New variable.
6 (calc-selected-face, calc-nonselected-face): New faces.
7
8 * calc/calccomp.el (math-comp-highlight-string): Use
9 `calc-highlight-selections-with-faces' to determine how to highlight
10 sub-formulas.
11
12 * calc/calc-sel.el (calc-show-selections): Change message to when
13 using faces to highlight selections.
14
12010-08-07 Michael R. Mauger <mmaug@yahoo.com> 152010-08-07 Michael R. Mauger <mmaug@yahoo.com>
2 16
3 * progmodes/sql.el (sql-mode-sqlite-font-lock-keywords): Added 17 * 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 @@
309 (setq n (1+ n)))) 309 (setq n (1+ n))))
310 (calc-clear-command-flag 'position-point))) 310 (calc-clear-command-flag 'position-point)))
311 311
312(defvar calc-highlight-selections-with-faces)
313
312(defun calc-show-selections (arg) 314(defun calc-show-selections (arg)
313 (interactive "P") 315 (interactive "P")
314 (calc-wrapper 316 (calc-wrapper
@@ -330,8 +332,12 @@
330 (setcar (nthcdr 2 calc-selection-cache-entry) nil) 332 (setcar (nthcdr 2 calc-selection-cache-entry) nil)
331 (calc-change-current-selection sel))))) 333 (calc-change-current-selection sel)))))
332 (message (if calc-show-selections 334 (message (if calc-show-selections
333 "Displaying only selected part of formulas" 335 (if calc-highlight-selections-with-faces
334 "Displaying all but selected part of formulas")))) 336 "De-emphasizing all but selected part of formulas"
337 "Displaying only selected part of formulas")
338 (if calc-highlight-selections-with-faces
339 "Emphasizing selected part of formulas"
340 "Displaying all but selected part of formulas")))))
335 341
336;; The variables calc-final-point-line and calc-final-point-column 342;; The variables calc-final-point-line and calc-final-point-column
337;; are declared in calc.el, and are used throughout. 343;; 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."
425 :group 'calc 425 :group 'calc
426 :type 'integer) 426 :type 'integer)
427 427
428(defcustom calc-highlight-selections-with-faces
429 nil
430 "If non-nil, use a separate face to indicate selected sub-formulas.
431If `calc-show-selections' is non-nil, then selected sub-formulas are shown
432by displaying the rest of the formula in `calc-nonselected-face'.
433If `calc-show-selections' is nil, then selected sub-formulas are shown
434by displaying the sub-formula in `calc-selected-face'."
435 :group 'calc
436 :type 'boolean)
437
438(defface calc-nonselected-face
439 '((t :inherit shadow
440 :slant italic))
441 "Face used to show the non-selected portion of a formula."
442 :group 'calc)
443
444(defface calc-selected-face
445 '((t :weight bold))
446 "Face used to show the selected portion of a formula."
447 :group 'calc)
448
428(defvar calc-bug-address "jay.p.belanger@gmail.com" 449(defvar calc-bug-address "jay.p.belanger@gmail.com"
429 "Address of the maintainer of Calc, for use by `report-calc-bug'.") 450 "Address of the maintainer of Calc, for use by `report-calc-bug'.")
430 451
@@ -1385,8 +1406,7 @@ commands given here will actually operate on the *Calculator* stack."
1385 (set (make-local-variable 'calc-main-buffer) buf)) 1406 (set (make-local-variable 'calc-main-buffer) buf))
1386 (when (= (buffer-size) 0) 1407 (when (= (buffer-size) 0)
1387 (let ((buffer-read-only nil)) 1408 (let ((buffer-read-only nil))
1388 (insert (propertize (concat "Emacs Calculator Trail\n") 1409 (insert (propertize "Emacs Calculator Trail\n" 'face 'italic))))
1389 'font-lock-face 'italic))))
1390 (run-mode-hooks 'calc-trail-mode-hook)) 1410 (run-mode-hooks 'calc-trail-mode-hook))
1391 1411
1392(defun calc-create-buffer () 1412(defun calc-create-buffer ()
@@ -1976,7 +1996,7 @@ See calc-keypad for details."
1976 (erase-buffer) 1996 (erase-buffer)
1977 (when calc-show-banner 1997 (when calc-show-banner
1978 (insert (propertize "--- Emacs Calculator Mode ---\n" 1998 (insert (propertize "--- Emacs Calculator Mode ---\n"
1979 'font-lock-face 'italic))) 1999 'face 'italic)))
1980 (while thing 2000 (while thing
1981 (goto-char (point-min)) 2001 (goto-char (point-min))
1982 (when calc-show-banner 2002 (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 @@
1339 1339
1340(defun math-comp-highlight-string (s) 1340(defun math-comp-highlight-string (s)
1341 (setq s (copy-sequence s)) 1341 (setq s (copy-sequence s))
1342 (let ((i (length s))) 1342 (if calc-highlight-selections-with-faces
1343 (while (>= (setq i (1- i)) 0) 1343 (if (not calc-show-selections)
1344 (or (memq (aref s i) '(32 ?\n)) 1344 (propertize s 'face 'calc-selected-face)
1345 (aset s i (if calc-show-selections ?\. ?\#))))) 1345 (propertize s 'face 'calc-nonselected-face))
1346 s) 1346 (let ((i (length s)))
1347 1347 (while (>= (setq i (1- i)) 0)
1348 (or (memq (aref s i) '(32 ?\n))
1349 (aset s i (if calc-show-selections ?\. ?\#)))))
1350 s))
1348 1351
1349;; The variable math-comp-sel-tag is local to calc-find-selected-part 1352;; The variable math-comp-sel-tag is local to calc-find-selected-part
1350;; in calc-sel.el, but is used by math-comp-sel-flat-term and 1353;; in calc-sel.el, but is used by math-comp-sel-flat-term and