Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
a0d8840a
Commit
a0d8840a
authored
Mar 09, 1998
by
Richard M. Stallman
Browse files
(fill-nobreak-predicate): New variable.
(fill-region-as-paragraph): Obey fill-nobreak-predicate.
parent
dbe524b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
lisp/textmodes/fill.el
lisp/textmodes/fill.el
+20
-8
No files found.
lisp/textmodes/fill.el
View file @
a0d8840a
...
...
@@ -247,6 +247,11 @@ act as a paragraph-separator."
(
concat
result
"a"
))))
result
)))))))
(
defvar
fill-nobreak-predicate
nil
"If non-nil, a predicate for recognizing places not to break a line.
The predicate is called with no arguments, with point at the place
to be tested. If it returns t, fill commands do not break the line there."
)
(
defun
fill-region-as-paragraph
(
from
to
&optional
justify
nosqueeze
squeeze-after
)
"Fill the region as one paragraph.
...
...
@@ -421,14 +426,17 @@ space does not end a sentence, so don't break a line there."
;; further fills will assume it ends a sentence.
;; If we now know it does not end a sentence,
;; avoid putting it at the end of the line.
(
if
sentence-end-double-space
(
while
(
and
(
>
(
point
)
(
+
linebeg
2
))
(
while
(
or
(
and
sentence-end-double-space
(
>
(
point
)
(
+
linebeg
2
))
(
eq
(
preceding-char
)
?\
)
(
not
(
eq
(
following-char
)
?\
))
(
eq
(
char-after
(
-
(
point
)
2
))
?\.
))
(
forward-char
-2
)
(
if
(
re-search-backward
" \\|\\c|.\\|.\\c|"
linebeg
0
)
(
forward-char
1
))))
(
eq
(
char-after
(
-
(
point
)
2
))
?\.
)
(
progn
(
forward-char
-2
)
t
))
(
and
fill-nobreak-predicate
(
funcall
fill-nobreak-predicate
)
(
goto-char
(
match-beginning
0
))))
(
if
(
re-search-backward
" \\|\\c|.\\|.\\c|"
linebeg
0
)
(
forward-char
1
)))
;; If the left margin and fill prefix by themselves
;; pass the fill-column. or if they are zero
;; but we have no room for even one word,
...
...
@@ -450,7 +458,9 @@ space does not end a sentence, so don't break a line there."
sentence-end-double-space
(
save-excursion
(
forward-char
-1
)
(
and
(
looking-at
"\\. "
)
(
not
(
looking-at
"\\. "
)))))))
(
not
(
looking-at
"\\. "
)))))
(
and
fill-nobreak-predicate
(
funcall
fill-nobreak-predicate
))))
;; Find a breakable point while ignoring the
;; following spaces.
(
skip-chars-forward
" \t"
)
...
...
@@ -495,7 +505,9 @@ space does not end a sentence, so don't break a line there."
sentence-end-double-space
(
save-excursion
(
forward-char
-1
)
(
and
(
looking-at
"\\. "
)
(
not
(
looking-at
"\\. "
)))))))
(
not
(
looking-at
"\\. "
)))))
(
and
fill-nobreak-predicate
(
funcall
fill-nobreak-predicate
))))
;; Find a breakable point while ignoring the
;; following spaces.
(
skip-chars-forward
" \t"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment