Function: so-long

so-long is an autoloaded, interactive and byte-compiled function defined in so-long.el.gz.

Signature

(so-long &optional ACTION)

Documentation

Invoke so-long-action and run so-long-hook.

This command is called automatically when long lines are detected, when global-so-long-mode(var)/global-so-long-mode(fun) is enabled.

The effects of the action can be undone by calling so-long-revert.

If ACTION is provided, it is used instead of so-long-action.

With a prefix argument, select the action to use interactively.

If an action was already active in the buffer, it will be reverted before invoking the new action.

Probably introduced at or before Emacs version 27.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/so-long.el.gz
;;;###autoload
(defun so-long (&optional action)
  "Invoke `so-long-action' and run `so-long-hook'.

This command is called automatically when long lines are detected, when
`global-so-long-mode' is enabled.

The effects of the action can be undone by calling `so-long-revert'.

If ACTION is provided, it is used instead of `so-long-action'.

With a prefix argument, select the action to use interactively.

If an action was already active in the buffer, it will be reverted before
invoking the new action."
  (interactive
   (list (and current-prefix-arg
              (intern
               (completing-read "Action (none): "
                                (mapcar #'car so-long-action-alist)
                                nil :require-match)))))
  ;; Ensure that `so-long-deferred' only triggers `so-long' once (at most).
  (remove-hook 'window-configuration-change-hook #'so-long :local)
  (unless so-long--calling
    ;; Revert the existing action, if any.
    (when so-long--active
      (so-long-revert))
    ;; Invoke the new action.
    (let ((so-long--calling t))
      (so-long--ensure-enabled)
      ;; ACTION takes precedence if supplied.
      (when action
        (setq so-long-function nil
              so-long-revert-function nil))
      ;; Some of these settings need to be duplicated in `so-long-mode' to cover
      ;; the case when that mode is invoked directly.
      (setq so-long-detected-p t) ;; ensure menu is present.
      (unless so-long-function
        (setq so-long-function (so-long-function action)))
      (unless so-long-revert-function
        (setq so-long-revert-function (so-long-revert-function action)))
      ;; Remember original settings.
      (so-long-remember-all :reset)
      ;; Call the configured `so-long-function'.
      (when so-long-function
        (funcall so-long-function)
        ;; Set `so-long--active' last, as it isn't permanent-local.
        (setq so-long--active t))
      ;; Display mode line info, unless we are in `so-long-mode' (which provides
      ;; equivalent information in the mode line construct for the major mode).
      (unless (derived-mode-p 'so-long-mode)
        (setq so-long-mode-line-info (so-long-mode-line-info)))
      ;; Run `so-long-hook'.
      ;; By default we set `buffer-read-only', which can cause problems if hook
      ;; functions need to modify the buffer.  We use `inhibit-read-only' to
      ;; side-step the issue (and likewise in `so-long-revert').
      (let ((inhibit-read-only t))
        (run-hooks 'so-long-hook)))))