X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/b35f288d478ef137a4d9e8e5a6a5f368a86b01f5..acaf905b1130aae80fa59d2c861ffd4c8eb75486:/lisp/calc/calc-sel.el diff --git a/lisp/calc/calc-sel.el b/lisp/calc/calc-sel.el index bb69db6f3e..bdacf65603 100644 --- a/lisp/calc/calc-sel.el +++ b/lisp/calc/calc-sel.el @@ -1,7 +1,6 @@ ;;; calc-sel.el --- data selection functions for Calc -;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +;; Copyright (C) 1990-1993, 2001-2012 Free Software Foundation, Inc. ;; Author: David Gillespie ;; Maintainer: Jay Belanger @@ -132,7 +131,7 @@ (defun calc-select-part (num) (interactive "P") - (or num (setq num (- last-command-char ?0))) + (or num (setq num (- last-command-event ?0))) (calc-wrapper (calc-prepare-selection) (let ((sel (calc-find-nth-part (or (nth 2 calc-selection-cache-entry) @@ -309,6 +308,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 +331,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. @@ -752,11 +757,12 @@ (list (and calc-sel-reselect val)))))) (calc-handle-whys)))) -(defun calc-sel-mult-both-sides (no-simp &optional divide) +(defun calc-sel-mult-both-sides (arg &optional divide) (interactive "P") (calc-wrapper (calc-preserve-point) - (let* ((num (max 1 (calc-locate-cursor-element (point)))) + (let* ((no-simp (consp arg)) + (num (max 1 (calc-locate-cursor-element (point)))) (calc-sel-reselect calc-keep-selection) (entry (calc-top num 'entry)) (expr (car entry)) @@ -794,10 +800,14 @@ rhs (math-simplify rhs)) (and (eq func '/) (or (Math-equal (nth 1 sel) 1) - (Math-equal (nth 1 sel) -1) - (and (memq (car-safe (nth 2 sel)) '(+ -)) - (memq (car-safe alg) '(+ -)))) - (setq rhs (math-expand-term rhs))))) + (Math-equal (nth 1 sel) -1)) +; (and (memq (car-safe (nth 2 sel)) '(+ -)) +; (memq (car-safe alg) '(+ -)))) + (unless arg + (setq rhs (math-expand-term rhs)))))) + (if (and arg (not no-simp)) + (setq rhs (math-simplify + (calcFunc-expand rhs (unless (= arg 0) arg))))) (setq alg (calc-encase-atoms (calc-normalize (list func lhs rhs))))) (setq rhs (list (if divide '* '/) sel alg)) @@ -865,5 +875,4 @@ (provide 'calc-sel) -;; arch-tag: e5169792-777d-428f-bff5-acca66813fa2 ;;; calc-sel.el ends here