> >> --- >> etc/NEWS | 4 ++++ >> lisp/calc/calc.el | 21 ++++++++++++++------- >> test/lisp/calc/calc-tests.el | 15 +++++++++++++++ >> 3 files changed, 33 insertions(+), 7 deletions(-) >> >> diff --git a/etc/NEWS b/etc/NEWS >> index f4e64c0851f..aa1936fe7fc 100644 >> --- a/etc/NEWS >> +++ b/etc/NEWS >> @@ -2305,6 +2305,10 @@ Latin-1 range 0-255. This hard-coded maximum is replaced by >> the display of matching vectors as Unicode strings. The default value >> is 0xFF or 255 to preserve the existing behavior. >> >> +*** New user option 'calc-inhibit-startup-message'. >> +If it is non-nil, inhibit Calc from printing its startup message. The >> +default value is nil to preserve the existing behavior. >> + >> ** Time >> >> *** New user option 'world-clock-sort-order'. >> diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el >> index a350419b320..d4fb8776c6c 100644 >> --- a/lisp/calc/calc.el >> +++ b/lisp/calc/calc.el >> @@ -1473,6 +1473,11 @@ calc-create-buffer >> (require 'calc-ext) >> (calc-set-language calc-language calc-language-option t))) >> >> +(defcustom calc-inhibit-startup-message nil >> + "If non-nil, inhibit the Calc startup message." >> + :version "31.1" >> + :type 'boolean) >> + >> (defcustom calc-make-windows-dedicated nil >> "If non-nil, windows displaying Calc buffers will be marked dedicated. >> See `window-dedicated-p' for what that means." >> @@ -1524,9 +1529,10 @@ calc >> (with-current-buffer (calc-trail-buffer) >> (and calc-display-trail >> (calc-trail-display 1 t))) >> - (message (substitute-command-keys >> - (concat "Welcome to the GNU Emacs Calculator! \\" >> - "Press \\[calc-help] or \\[calc-help-prefix] for help, \\[calc-quit] to quit"))) >> + (unless calc-inhibit-startup-message >> + (message (substitute-command-keys >> + (concat "Welcome to the GNU Emacs Calculator! \\" >> + "Press \\[calc-help] or \\[calc-help-prefix] for help, \\[calc-quit] to quit")))) >> (run-hooks 'calc-start-hook) >> (and (windowp full-display) >> (window-point full-display) >> @@ -1534,10 +1540,11 @@ calc >> (and calc-make-windows-dedicated >> (set-window-dedicated-p nil t)) >> (calc-check-defines) >> - (when (and calc-said-hello interactive) >> - (sit-for 2) >> - (message "")) >> - (setq calc-said-hello t))))) >> + (unless calc-inhibit-startup-message >> + (when (and calc-said-hello interactive) >> + (sit-for 2) >> + (message "")) >> + (setq calc-said-hello t)))))) >> >> ;;;###autoload >> (defun full-calc (&optional interactive) >> diff --git a/test/lisp/calc/calc-tests.el b/test/lisp/calc/calc-tests.el >> index 2fd6a6be45e..49762e146a5 100644 >> --- a/test/lisp/calc/calc-tests.el >> +++ b/test/lisp/calc/calc-tests.el >> @@ -26,6 +26,7 @@ >> >> (require 'cl-lib) >> (require 'ert) >> +(require 'ert-x) >> (require 'calc) >> (require 'calc-ext) >> (require 'calc-units) >> @@ -946,5 +947,19 @@ calc-math-vector-is-string >> (should-error (math-vector-is-string cplx-vec) >> :type 'wrong-type-argument)))) >> >> +(ert-deftest calc-inhibit-startup-message () >> + "Test user option `calc-inhibit-startup-message'." >> + (let ((welcome-message "Welcome to the GNU Emacs Calculator!")) >> + (ert-with-message-capture messages >> + (let ((calc-inhibit-startup-message t)) >> + (calc)) >> + (should-not (string-match-p welcome-message messages)) >> + (calc-quit)) >> + (ert-with-message-capture messages >> + (let ((calc-inhibit-startup-message nil)) >> + (calc)) >> + (should (string-match-p welcome-message messages)) >> + (calc-quit)))) >> + >> (provide 'calc-tests) >> ;;; calc-tests.el ends here >> -- >> 2.39.5 (Apple Git-154) >>