Adjust the line according to the screen width
I copied a long sentence to org-mode
As I mentioned in the last section, Richard Stallman, the founder of the Free Software Foundation, was more than a programmer. He was an educated social critic, and his vision of the future was to have an enormous impact on the world.
I tried to achieve line-break automatically with auto-fill-mode, but get a result as
How could I enable it to extend and shrink according the the screen width rather than the line limitation of 80 words.
org-mode
add a comment |
I copied a long sentence to org-mode
As I mentioned in the last section, Richard Stallman, the founder of the Free Software Foundation, was more than a programmer. He was an educated social critic, and his vision of the future was to have an enormous impact on the world.
I tried to achieve line-break automatically with auto-fill-mode, but get a result as
How could I enable it to extend and shrink according the the screen width rather than the line limitation of 80 words.
org-mode
add a comment |
I copied a long sentence to org-mode
As I mentioned in the last section, Richard Stallman, the founder of the Free Software Foundation, was more than a programmer. He was an educated social critic, and his vision of the future was to have an enormous impact on the world.
I tried to achieve line-break automatically with auto-fill-mode, but get a result as
How could I enable it to extend and shrink according the the screen width rather than the line limitation of 80 words.
org-mode
I copied a long sentence to org-mode
As I mentioned in the last section, Richard Stallman, the founder of the Free Software Foundation, was more than a programmer. He was an educated social critic, and his vision of the future was to have an enormous impact on the world.
I tried to achieve line-break automatically with auto-fill-mode, but get a result as
How could I enable it to extend and shrink according the the screen width rather than the line limitation of 80 words.
org-mode
org-mode
asked yesterday
user10726006user10726006
194
194
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
It sounds like you don't want "hard" returns at the end of lines, and you instead just want "soft" returns. That is, you don't want to insert end-of-line characters, such as newline
. You just want lines to appear broken, and you want the apparent line breaks to be just before the window edge. Is that right?
If so, what you want is to just turn on visual-line-mode
in a given buffer -- or global-visual-line-mode
, if you want this behavior in all buffers. (And turn off auto-fill-mode
.)
C-h f visual-line-mode
tells you this:
visual-line-mode
is an interactive compiled Lisp function in
simple.el
.
(visual-line-mode &optional ARG)
Toggle visual line based editing (Visual Line mode) in the current buffer.
Interactively, with a prefix argument, enable
Visual Line mode if the prefix argument is positive,
and disable it otherwise. If called from Lisp, toggle
the mode ifARG
istoggle
, disable the mode ifARG
is
a non-positive integer, and enable the mode otherwise
(including ifARG
is omitted ornil
or a positive integer).
When Visual Line mode is enabled,
word-wrap
is turned on in
this buffer, and simple editing commands are redefined to act on
visual lines, not logical lines. See Info node Visual Line Mode for details.
add a comment |
create a function that sets the fill-mode width to (window-width) and add it to the post-command-hook
3
An example would make this answer much more useful.
– Stefan
yesterday
add a comment |
C-x f to set a fill-column
variable.
M-q to fill paragraph or selection to that width.
As a minor mode:
(defun dynamic-fill-column-set-var (frame)
(when dynamic-fill-column-mode
(setq fill-column (- (window-total-width) 3))))
(defun dynamic-fill-column-buffer-list-change ()
(when dynamic-fill-column-mode
(setq fill-column (- (window-total-width) 3))))
(define-minor-mode dynamic-fill-column-mode
"Sets `fill-column' when buffer's window is resized"
:lighter " DFC"
(if dynamic-fill-column-mode
(progn
(add-hook 'window-size-change-functions 'dynamic-fill-column-set-var nil t)
(add-hook 'buffer-list-update-hook 'dynamic-fill-column-buffer-list-change nil t))
(remove-hook 'window-size-change-functions 'dynamic-fill-column-set-var t)
(remove-hook 'buffer-list-update-hook 'dynamic-fill-column-buffer-list-change t)))
after resizing M-q(executes fill-paragraph
function).
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "583"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f46935%2fadjust-the-line-according-to-the-screen-width%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
It sounds like you don't want "hard" returns at the end of lines, and you instead just want "soft" returns. That is, you don't want to insert end-of-line characters, such as newline
. You just want lines to appear broken, and you want the apparent line breaks to be just before the window edge. Is that right?
If so, what you want is to just turn on visual-line-mode
in a given buffer -- or global-visual-line-mode
, if you want this behavior in all buffers. (And turn off auto-fill-mode
.)
C-h f visual-line-mode
tells you this:
visual-line-mode
is an interactive compiled Lisp function in
simple.el
.
(visual-line-mode &optional ARG)
Toggle visual line based editing (Visual Line mode) in the current buffer.
Interactively, with a prefix argument, enable
Visual Line mode if the prefix argument is positive,
and disable it otherwise. If called from Lisp, toggle
the mode ifARG
istoggle
, disable the mode ifARG
is
a non-positive integer, and enable the mode otherwise
(including ifARG
is omitted ornil
or a positive integer).
When Visual Line mode is enabled,
word-wrap
is turned on in
this buffer, and simple editing commands are redefined to act on
visual lines, not logical lines. See Info node Visual Line Mode for details.
add a comment |
It sounds like you don't want "hard" returns at the end of lines, and you instead just want "soft" returns. That is, you don't want to insert end-of-line characters, such as newline
. You just want lines to appear broken, and you want the apparent line breaks to be just before the window edge. Is that right?
If so, what you want is to just turn on visual-line-mode
in a given buffer -- or global-visual-line-mode
, if you want this behavior in all buffers. (And turn off auto-fill-mode
.)
C-h f visual-line-mode
tells you this:
visual-line-mode
is an interactive compiled Lisp function in
simple.el
.
(visual-line-mode &optional ARG)
Toggle visual line based editing (Visual Line mode) in the current buffer.
Interactively, with a prefix argument, enable
Visual Line mode if the prefix argument is positive,
and disable it otherwise. If called from Lisp, toggle
the mode ifARG
istoggle
, disable the mode ifARG
is
a non-positive integer, and enable the mode otherwise
(including ifARG
is omitted ornil
or a positive integer).
When Visual Line mode is enabled,
word-wrap
is turned on in
this buffer, and simple editing commands are redefined to act on
visual lines, not logical lines. See Info node Visual Line Mode for details.
add a comment |
It sounds like you don't want "hard" returns at the end of lines, and you instead just want "soft" returns. That is, you don't want to insert end-of-line characters, such as newline
. You just want lines to appear broken, and you want the apparent line breaks to be just before the window edge. Is that right?
If so, what you want is to just turn on visual-line-mode
in a given buffer -- or global-visual-line-mode
, if you want this behavior in all buffers. (And turn off auto-fill-mode
.)
C-h f visual-line-mode
tells you this:
visual-line-mode
is an interactive compiled Lisp function in
simple.el
.
(visual-line-mode &optional ARG)
Toggle visual line based editing (Visual Line mode) in the current buffer.
Interactively, with a prefix argument, enable
Visual Line mode if the prefix argument is positive,
and disable it otherwise. If called from Lisp, toggle
the mode ifARG
istoggle
, disable the mode ifARG
is
a non-positive integer, and enable the mode otherwise
(including ifARG
is omitted ornil
or a positive integer).
When Visual Line mode is enabled,
word-wrap
is turned on in
this buffer, and simple editing commands are redefined to act on
visual lines, not logical lines. See Info node Visual Line Mode for details.
It sounds like you don't want "hard" returns at the end of lines, and you instead just want "soft" returns. That is, you don't want to insert end-of-line characters, such as newline
. You just want lines to appear broken, and you want the apparent line breaks to be just before the window edge. Is that right?
If so, what you want is to just turn on visual-line-mode
in a given buffer -- or global-visual-line-mode
, if you want this behavior in all buffers. (And turn off auto-fill-mode
.)
C-h f visual-line-mode
tells you this:
visual-line-mode
is an interactive compiled Lisp function in
simple.el
.
(visual-line-mode &optional ARG)
Toggle visual line based editing (Visual Line mode) in the current buffer.
Interactively, with a prefix argument, enable
Visual Line mode if the prefix argument is positive,
and disable it otherwise. If called from Lisp, toggle
the mode ifARG
istoggle
, disable the mode ifARG
is
a non-positive integer, and enable the mode otherwise
(including ifARG
is omitted ornil
or a positive integer).
When Visual Line mode is enabled,
word-wrap
is turned on in
this buffer, and simple editing commands are redefined to act on
visual lines, not logical lines. See Info node Visual Line Mode for details.
answered yesterday
DrewDrew
47.1k462104
47.1k462104
add a comment |
add a comment |
create a function that sets the fill-mode width to (window-width) and add it to the post-command-hook
3
An example would make this answer much more useful.
– Stefan
yesterday
add a comment |
create a function that sets the fill-mode width to (window-width) and add it to the post-command-hook
3
An example would make this answer much more useful.
– Stefan
yesterday
add a comment |
create a function that sets the fill-mode width to (window-width) and add it to the post-command-hook
create a function that sets the fill-mode width to (window-width) and add it to the post-command-hook
answered yesterday
Zypps987Zypps987
111
111
3
An example would make this answer much more useful.
– Stefan
yesterday
add a comment |
3
An example would make this answer much more useful.
– Stefan
yesterday
3
3
An example would make this answer much more useful.
– Stefan
yesterday
An example would make this answer much more useful.
– Stefan
yesterday
add a comment |
C-x f to set a fill-column
variable.
M-q to fill paragraph or selection to that width.
As a minor mode:
(defun dynamic-fill-column-set-var (frame)
(when dynamic-fill-column-mode
(setq fill-column (- (window-total-width) 3))))
(defun dynamic-fill-column-buffer-list-change ()
(when dynamic-fill-column-mode
(setq fill-column (- (window-total-width) 3))))
(define-minor-mode dynamic-fill-column-mode
"Sets `fill-column' when buffer's window is resized"
:lighter " DFC"
(if dynamic-fill-column-mode
(progn
(add-hook 'window-size-change-functions 'dynamic-fill-column-set-var nil t)
(add-hook 'buffer-list-update-hook 'dynamic-fill-column-buffer-list-change nil t))
(remove-hook 'window-size-change-functions 'dynamic-fill-column-set-var t)
(remove-hook 'buffer-list-update-hook 'dynamic-fill-column-buffer-list-change t)))
after resizing M-q(executes fill-paragraph
function).
New contributor
add a comment |
C-x f to set a fill-column
variable.
M-q to fill paragraph or selection to that width.
As a minor mode:
(defun dynamic-fill-column-set-var (frame)
(when dynamic-fill-column-mode
(setq fill-column (- (window-total-width) 3))))
(defun dynamic-fill-column-buffer-list-change ()
(when dynamic-fill-column-mode
(setq fill-column (- (window-total-width) 3))))
(define-minor-mode dynamic-fill-column-mode
"Sets `fill-column' when buffer's window is resized"
:lighter " DFC"
(if dynamic-fill-column-mode
(progn
(add-hook 'window-size-change-functions 'dynamic-fill-column-set-var nil t)
(add-hook 'buffer-list-update-hook 'dynamic-fill-column-buffer-list-change nil t))
(remove-hook 'window-size-change-functions 'dynamic-fill-column-set-var t)
(remove-hook 'buffer-list-update-hook 'dynamic-fill-column-buffer-list-change t)))
after resizing M-q(executes fill-paragraph
function).
New contributor
add a comment |
C-x f to set a fill-column
variable.
M-q to fill paragraph or selection to that width.
As a minor mode:
(defun dynamic-fill-column-set-var (frame)
(when dynamic-fill-column-mode
(setq fill-column (- (window-total-width) 3))))
(defun dynamic-fill-column-buffer-list-change ()
(when dynamic-fill-column-mode
(setq fill-column (- (window-total-width) 3))))
(define-minor-mode dynamic-fill-column-mode
"Sets `fill-column' when buffer's window is resized"
:lighter " DFC"
(if dynamic-fill-column-mode
(progn
(add-hook 'window-size-change-functions 'dynamic-fill-column-set-var nil t)
(add-hook 'buffer-list-update-hook 'dynamic-fill-column-buffer-list-change nil t))
(remove-hook 'window-size-change-functions 'dynamic-fill-column-set-var t)
(remove-hook 'buffer-list-update-hook 'dynamic-fill-column-buffer-list-change t)))
after resizing M-q(executes fill-paragraph
function).
New contributor
C-x f to set a fill-column
variable.
M-q to fill paragraph or selection to that width.
As a minor mode:
(defun dynamic-fill-column-set-var (frame)
(when dynamic-fill-column-mode
(setq fill-column (- (window-total-width) 3))))
(defun dynamic-fill-column-buffer-list-change ()
(when dynamic-fill-column-mode
(setq fill-column (- (window-total-width) 3))))
(define-minor-mode dynamic-fill-column-mode
"Sets `fill-column' when buffer's window is resized"
:lighter " DFC"
(if dynamic-fill-column-mode
(progn
(add-hook 'window-size-change-functions 'dynamic-fill-column-set-var nil t)
(add-hook 'buffer-list-update-hook 'dynamic-fill-column-buffer-list-change nil t))
(remove-hook 'window-size-change-functions 'dynamic-fill-column-set-var t)
(remove-hook 'buffer-list-update-hook 'dynamic-fill-column-buffer-list-change t)))
after resizing M-q(executes fill-paragraph
function).
New contributor
edited yesterday
New contributor
answered yesterday
Alex KarbivnichiyAlex Karbivnichiy
1113
1113
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Emacs Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2femacs.stackexchange.com%2fquestions%2f46935%2fadjust-the-line-according-to-the-screen-width%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown