Function: toggle-truncate-lines
toggle-truncate-lines is an interactive and byte-compiled function
defined in simple.el.gz.
Signature
(toggle-truncate-lines &optional ARG)
Documentation
Toggle truncating of long lines for the current buffer.
When truncating is off, long lines are folded.
With prefix argument ARG, truncate long lines if ARG is positive,
otherwise fold them. Note that in side-by-side windows, this
command has no effect if truncate-partial-width-windows is
non-nil.
Probably introduced at or before Emacs version 28.1.
Key Bindings
Aliases
gnus-summary-toggle-truncation (obsolete since 26.1)
Source Code
;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun toggle-truncate-lines (&optional arg)
"Toggle truncating of long lines for the current buffer.
When truncating is off, long lines are folded.
With prefix argument ARG, truncate long lines if ARG is positive,
otherwise fold them. Note that in side-by-side windows, this
command has no effect if `truncate-partial-width-windows' is
non-nil."
(interactive "P")
(setq truncate-lines
(if (null arg)
(not truncate-lines)
(> (prefix-numeric-value arg) 0)))
(force-mode-line-update)
(unless truncate-lines
(let ((buffer (current-buffer)))
(walk-windows (lambda (window)
(if (eq buffer (window-buffer window))
(set-window-hscroll window 0)))
nil t)))
(message "Truncate long lines %s%s"
(if truncate-lines "enabled" "disabled")
(if (and truncate-lines visual-line-mode)
(progn
(visual-line-mode -1)
(format-message " and `visual-line-mode' disabled"))
"")))