Function: haskell-indentation-common-electric-command

haskell-indentation-common-electric-command is an interactive and natively compiled function defined in haskell-indentation.el.

Signature

(haskell-indentation-common-electric-command ARG)

Documentation

Call self-insert-command to insert the character typed ARG times and indent when all of the following are true:
1) The character is the first non-whitespace character on the line.
2) There is only one possible indentation position.
3) The variable electric-indent-mode(var)/electric-indent-mode(fun) or haskell-indentation-electric-flag
   is non-nil.
4) The point is not in a comment, string, or quasiquote.

Key Bindings

haskell-indentation-mode-map ) haskell-indentation-mode-map , haskell-indentation-mode-map ; haskell-indentation-mode-map ] haskell-indentation-mode-map }

Source Code

;; Defined in /nix/store/9lz2mhw95f9fqxr9mnq46k3f6qz3aq83-emacs-packages-deps/share/emacs/site-lisp/elpa/haskell-mode-20260904.1042/haskell-indentation.el
(defun haskell-indentation-common-electric-command (arg)
  "Call `self-insert-command' to insert the character typed ARG times
and indent when all of the following are true:
1) The character is the first non-whitespace character on the line.
2) There is only one possible indentation position.
3) The variable `electric-indent-mode' or `haskell-indentation-electric-flag'
   is non-nil.
4) The point is not in a comment, string, or quasiquote."
  (interactive "*p")
  (let ((col (current-column))
        ind)
    (self-insert-command arg)
    (when (and (or haskell-indentation-electric-flag
                   electric-indent-mode)
               (= (haskell-indentation-current-indentation)
                  col)
               (> arg 0)
               (not (nth 8 (syntax-ppss)))
               (= 1 (save-excursion
                      (move-to-column col)
                      (length (setq ind (haskell-indentation-find-indentations))))))
      (haskell-indentation-reindent-to (car ind)))))