diff options
| author | Eli Zaretskii | 2021-09-04 13:34:32 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2021-09-04 13:34:32 +0300 |
| commit | 0daad767047be33c0189d5e0131b126b49d35e6d (patch) | |
| tree | 892219cf9da45802f0e31184f5459d6a29525fad | |
| parent | a8de88e3300464eb382a65ea96da69f23d21ead2 (diff) | |
| download | emacs-0daad767047be33c0189d5e0131b126b49d35e6d.tar.gz emacs-0daad767047be33c0189d5e0131b126b49d35e6d.zip | |
Improve documentation of line truncation and wrapping
* doc/emacs/display.texi (Line Truncation, Visual Line Mode):
* doc/lispref/display.texi (Truncation): Document that turning on
line truncation disables wrapping, and vice versa.
* src/buffer.c (syms_of_buffer) <truncate-lines>:
* src/xdisp.c (syms_of_xdisp) <truncate-partial-width-windows>:
Warn against turning on when 'visual-line-mode' is in effect.
* lisp/simple.el (visual-line-mode): Document that this mode
disables line truncation. (Bug#29664)
| -rw-r--r-- | doc/emacs/display.texi | 8 | ||||
| -rw-r--r-- | doc/lispref/display.texi | 3 | ||||
| -rw-r--r-- | lisp/simple.el | 4 | ||||
| -rw-r--r-- | src/buffer.c | 5 | ||||
| -rw-r--r-- | src/xdisp.c | 5 |
5 files changed, 22 insertions, 3 deletions
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi index ae345c11df5..996c5a66547 100644 --- a/doc/emacs/display.texi +++ b/doc/emacs/display.texi | |||
| @@ -1767,6 +1767,10 @@ multiple screen lines. Setting the variable @code{truncate-lines} in | |||
| 1767 | any way makes it local to the current buffer; until that time, the | 1767 | any way makes it local to the current buffer; until that time, the |
| 1768 | default value, which is normally @code{nil}, is in effect. | 1768 | default value, which is normally @code{nil}, is in effect. |
| 1769 | 1769 | ||
| 1770 | Since line truncation and word wrap (described in the next section) | ||
| 1771 | are contradictory, @code{toggle-truncate-lines} disables word wrap | ||
| 1772 | when it turns on line truncation. | ||
| 1773 | |||
| 1770 | If a split window becomes too narrow, Emacs may automatically enable | 1774 | If a split window becomes too narrow, Emacs may automatically enable |
| 1771 | line truncation. @xref{Split Window}, for the variable | 1775 | line truncation. @xref{Split Window}, for the variable |
| 1772 | @code{truncate-partial-width-windows} which controls this. | 1776 | @code{truncate-partial-width-windows} which controls this. |
| @@ -1797,6 +1801,10 @@ mode is enabled, the mode line shows the string @samp{wrap} in the | |||
| 1797 | mode display. The command @kbd{M-x global-visual-line-mode} toggles | 1801 | mode display. The command @kbd{M-x global-visual-line-mode} toggles |
| 1798 | Visual Line mode in all buffers. | 1802 | Visual Line mode in all buffers. |
| 1799 | 1803 | ||
| 1804 | Since word wrap and line truncation (described in the previous | ||
| 1805 | section) are contradictory, turning on @code{visual-line-mode} | ||
| 1806 | disables line truncation. | ||
| 1807 | |||
| 1800 | @findex beginning-of-visual-line | 1808 | @findex beginning-of-visual-line |
| 1801 | @findex end-of-visual-line | 1809 | @findex end-of-visual-line |
| 1802 | @findex next-logical-line | 1810 | @findex next-logical-line |
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index ca438c10ce2..510efaf2719 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -152,6 +152,9 @@ truncation; a @samp{\} on the rightmost column indicates a line that | |||
| 152 | wraps. (The display table can specify alternate characters to use | 152 | wraps. (The display table can specify alternate characters to use |
| 153 | for this; @pxref{Display Tables}). | 153 | for this; @pxref{Display Tables}). |
| 154 | 154 | ||
| 155 | Since wrapping and truncation of text contradict each other, Emacs | ||
| 156 | turns off line truncation when wrapping is requested, and vice versa. | ||
| 157 | |||
| 155 | @defopt truncate-lines | 158 | @defopt truncate-lines |
| 156 | If this buffer-local variable is non-@code{nil}, lines that extend | 159 | If this buffer-local variable is non-@code{nil}, lines that extend |
| 157 | beyond the right edge of the window are truncated; otherwise, they are | 160 | beyond the right edge of the window are truncated; otherwise, they are |
diff --git a/lisp/simple.el b/lisp/simple.el index 37952a5bf44..800a9279037 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -7777,7 +7777,9 @@ other purposes." | |||
| 7777 | When Visual Line mode is enabled, `word-wrap' is turned on in | 7777 | When Visual Line mode is enabled, `word-wrap' is turned on in |
| 7778 | this buffer, and simple editing commands are redefined to act on | 7778 | this buffer, and simple editing commands are redefined to act on |
| 7779 | visual lines, not logical lines. See Info node `Visual Line | 7779 | visual lines, not logical lines. See Info node `Visual Line |
| 7780 | Mode' for details." | 7780 | Mode' for details. |
| 7781 | Turning on this mode disables line truncation set up by | ||
| 7782 | variables `truncate-lines' and `truncate-partial-width-windows'." | ||
| 7781 | :keymap visual-line-mode-map | 7783 | :keymap visual-line-mode-map |
| 7782 | :group 'visual-line | 7784 | :group 'visual-line |
| 7783 | :lighter " Wrap" | 7785 | :lighter " Wrap" |
diff --git a/src/buffer.c b/src/buffer.c index 100ebc7e2de..4eb7ab6d6ba 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -5805,7 +5805,10 @@ Note that this is overridden by the variable | |||
| 5805 | `truncate-partial-width-windows' if that variable is non-nil | 5805 | `truncate-partial-width-windows' if that variable is non-nil |
| 5806 | and this buffer is not full-frame width. | 5806 | and this buffer is not full-frame width. |
| 5807 | 5807 | ||
| 5808 | Minibuffers set this variable to nil. */); | 5808 | Minibuffers set this variable to nil. |
| 5809 | |||
| 5810 | Don't set this to a non-nil value when `visual-line-mode' is | ||
| 5811 | turned on, as it could produce confusing results. */); | ||
| 5809 | 5812 | ||
| 5810 | DEFVAR_PER_BUFFER ("word-wrap", &BVAR (current_buffer, word_wrap), Qnil, | 5813 | DEFVAR_PER_BUFFER ("word-wrap", &BVAR (current_buffer, word_wrap), Qnil, |
| 5811 | doc: /* Non-nil means to use word-wrapping for continuation lines. | 5814 | doc: /* Non-nil means to use word-wrapping for continuation lines. |
diff --git a/src/xdisp.c b/src/xdisp.c index e853c8c2232..b2fcc165a9f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -35136,7 +35136,10 @@ not span the full frame width. | |||
| 35136 | 35136 | ||
| 35137 | A value of nil means to respect the value of `truncate-lines'. | 35137 | A value of nil means to respect the value of `truncate-lines'. |
| 35138 | 35138 | ||
| 35139 | If `word-wrap' is enabled, you might want to reduce this. */); | 35139 | If `word-wrap' is enabled, you might want to reduce the value of this. |
| 35140 | |||
| 35141 | Don't set this to a non-nil value when `visual-line-mode' is | ||
| 35142 | turned on, as it could produce confusing results. */); | ||
| 35140 | Vtruncate_partial_width_windows = make_fixnum (50); | 35143 | Vtruncate_partial_width_windows = make_fixnum (50); |
| 35141 | 35144 | ||
| 35142 | DEFVAR_BOOL("word-wrap-by-category", word_wrap_by_category, doc: /* | 35145 | DEFVAR_BOOL("word-wrap-by-category", word_wrap_by_category, doc: /* |