1

In calc, I can switch to the engineering notation by pressing d e. But how do I make that a default?

I can store the calc defaults in the file specified in the calc-settings-file variable but I can't find the elisp required to change the default notation to engineering.

2

Found the solution as soon as I posted the question ..

Solution

In my init.el:

(require 'calc)
(setq calc-settings-file (concat user-emacs-directory "/setup-calc-defaults.el"))

In my setup-calc-defaults.el:

(setq calc-float-format '(eng 0))

The defaults don't become effective right-away. Without worrying about what all packages I might need to require once again, I simply restarted emacs.


From lisp/calc/calc.el

(defcalcmodevar calc-float-format '(float 0)
  "Format to use for display of floating-point numbers in calc-mode.
Must be a list of one of the following forms:
 (float 0)      Floating point format, display full precision.
 (float N)      N > 0: Floating point format, at most N significant figures.
 (float -N)     -N < 0: Floating point format, calc-internal-prec - N figs.
 (fix N)        N >= 0: Fixed point format, N places after decimal point.
 (sci 0)        Scientific notation, full precision.
 (sci N)        N > 0: Scientific notation, N significant figures.
 (sci -N)       -N < 0: Scientific notation, calc-internal-prec - N figs.
 (eng 0)        Engineering notation, full precision.
 (eng N)        N > 0: Engineering notation, N significant figures.
 (eng -N)       -N < 0: Engineering notation, calc-internal-prec - N figs.")
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.