Subject: bug#50241: flyspell doesn't work with multiple dictionaries

From: Eli Zaretskii <[email-masked]>
Date: Sun, 29 Aug 2021 16:07:08 +0300

> From: Konstantin Kharlamov <[email-masked]>
> Cc: [email-masked]
> Date: Sun, 29 Aug 2021 15:43:30 +0300
> 
> > I'm not sure I agree.  These are commands that are supposed to be
> > invoked interactively, in the order I've shown, which works.  If you
> > want to make this part of your initialization, you need to figure out
> > the required sequence of calls, which you did.
> 
> Would you agree if I say that a good user interface means that a function invoked interactively should behave same way when it's invoked non-interactively (barring the fact that it won't show the prompt)?

No, I don't agree.  And neither does Emacs: the 'interactive' form is
not necessarily a no-op.  As a trivial example, consider:

  describe-char is an autoloaded interactive compiled Lisp function in
  ‘descr-text.el’.

  (describe-char POS &optional BUFFER)

    Probably introduced at or before Emacs version 22.1.

  Describe position POS (interactively, point) and the char after POS.
                        ^^^^^^^^^^^^^^^^^^^^^^
As you see, there's some magic happening in interactive invocations
that doesn't happen when you call this function from Lisp.

A less trivial example:

  previous-line is an interactive compiled Lisp function in ‘simple.el’.

  It is bound to C-p, <up>.

  (previous-line &optional ARG TRY-VSCROLL)

    This function is for interactive use only;
    in Lisp code use `forward-line' with negative argument instead.

  Move cursor vertically up ARG lines.
  Interactively, vscroll tall lines if ‘auto-window-vscroll’ is enabled.
  Non-interactively, use TRY-VSCROLL to control whether to vscroll tall
  lines: if either ‘auto-window-vscroll’ or TRY-VSCROLL is nil, this
  function will not vscroll.

Again, the behavior in interactive and non-interactive calls is
different.

> So I would say, at least the (ispell-set-spellchecker-params) needs to be added into one of them, so the same order as if they were called interactively would work when they are invoked from a Emacs Lisp file.

Maybe, I need to think about it.  But the general principle still
stands: it is okay for interactive and non-interactive invocations to
behave differently.  We do it all the time in Emacs.