Variable: longlines-mode
longlines-mode is a buffer-local variable defined in longlines.el.gz.
Documentation
Non-nil if Longlines mode is enabled.
Use the command longlines-mode(var)/longlines-mode(fun) to change this variable.
Probably introduced at or before Emacs version 23.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/obsolete/longlines.el.gz
;;;###autoload
(define-minor-mode longlines-mode
"Toggle Long Lines mode in this buffer.
When Long Lines mode is enabled, long lines are wrapped if they
extend beyond `fill-column'. The soft newlines used for line
wrapping will not show up when the text is yanked or saved to
disk.
If the variable `longlines-auto-wrap' is non-nil, lines are
automatically wrapped whenever the buffer is changed. You can
always call `fill-paragraph' to fill individual paragraphs.
If the variable `longlines-show-hard-newlines' is non-nil, hard
newlines are indicated with a symbol."
:lighter " ll"
(if longlines-mode
;; Turn on longlines mode
(progn
(use-hard-newlines 1 'never)
(setq-local require-final-newline nil)
(add-to-list 'buffer-file-format 'longlines)
(add-hook 'change-major-mode-hook #'longlines-mode-off nil t)
(add-hook 'before-revert-hook #'longlines-before-revert-hook nil t)
(make-local-variable 'longlines-auto-wrap)
(setq-local isearch-search-fun-function #'longlines-search-function)
(setq-local replace-search-function #'longlines-search-forward)
(setq-local replace-re-search-function #'longlines-re-search-forward)
(add-function :filter-return (local 'filter-buffer-substring-function)
#'longlines-encode-string)
(when longlines-wrap-follows-window-size
(let ((dw (if (and (integerp longlines-wrap-follows-window-size)
(>= longlines-wrap-follows-window-size 0)
(< longlines-wrap-follows-window-size
(window-width)))
longlines-wrap-follows-window-size
2)))
(setq-local fill-column (- (window-width) dw)))
(add-hook 'window-configuration-change-hook
#'longlines-window-change-function nil t))
(let ((buffer-undo-list t)
(inhibit-read-only t)
(inhibit-modification-hooks t)
(mod (buffer-modified-p))
buffer-file-name buffer-file-truename)
;; Turning off undo is OK since (separators + newlines) is
;; conserved, except for a corner case in
;; longlines-wrap-lines that we'll never encounter from here
(save-restriction
(widen)
(unless longlines-decoded
(longlines-decode-buffer)
(setq longlines-decoded t))
(longlines-wrap-region (point-min) (point-max)))
(set-buffer-modified-p mod))
(when (and longlines-show-hard-newlines
(not longlines-showing))
(longlines-show-hard-newlines))
;; Hacks to make longlines play nice with various modes.
(cond ((eq major-mode 'mail-mode)
(declare-function mail-indent-citation "sendmail" ())
(add-hook 'mail-setup-hook #'longlines-decode-buffer nil t)
(or mail-citation-hook
(add-hook 'mail-citation-hook #'mail-indent-citation nil t))
(add-hook 'mail-citation-hook #'longlines-decode-region nil t))
((eq major-mode 'message-mode)
(add-hook 'message-setup-hook #'longlines-decode-buffer nil t)
(make-local-variable 'message-indent-citation-function)
(if (not (listp message-indent-citation-function))
(setq message-indent-citation-function
(list message-indent-citation-function)))
(add-hook 'message-indent-citation-function
#'longlines-decode-region t t)))
(add-hook 'after-change-functions #'longlines-after-change-function nil t)
(add-hook 'post-command-hook #'longlines-post-command-function nil t)
(when longlines-auto-wrap
(auto-fill-mode 0)))
;; Turn off longlines mode
(setq buffer-file-format (delete 'longlines buffer-file-format))
(if longlines-showing
(longlines-unshow-hard-newlines))
(let ((buffer-undo-list t)
(inhibit-modification-hooks t)
(inhibit-read-only t)
buffer-file-name buffer-file-truename)
(if longlines-decoded
(save-restriction
(widen)
(longlines-encode-region (point-min) (point-max))
(setq longlines-decoded nil))))
(remove-hook 'change-major-mode-hook #'longlines-mode-off t)
(remove-hook 'after-change-functions #'longlines-after-change-function t)
(remove-hook 'post-command-hook #'longlines-post-command-function t)
(remove-hook 'before-revert-hook #'longlines-before-revert-hook t)
(remove-hook 'window-configuration-change-hook
#'longlines-window-change-function t)
(when longlines-wrap-follows-window-size
(kill-local-variable 'fill-column))
(kill-local-variable 'isearch-search-fun-function)
(kill-local-variable 'replace-search-function)
(kill-local-variable 'replace-re-search-function)
(kill-local-variable 'require-final-newline)
(remove-function (local 'filter-buffer-substring-function)
#'longlines-encode-string)
(kill-local-variable 'use-hard-newlines)))