diff options
| author | Richard M. Stallman | 1995-07-28 02:38:16 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-07-28 02:38:16 +0000 |
| commit | a0170800bbed088ae545143873fdff058a3350eb (patch) | |
| tree | 127553cf475936d1f122b58a1001efcb609cecc5 | |
| parent | e064a4f982aa3904aa2488a7c1fccf1dd8bfa783 (diff) | |
| download | emacs-a0170800bbed088ae545143873fdff058a3350eb.tar.gz emacs-a0170800bbed088ae545143873fdff058a3350eb.zip | |
(do-auto-fill): Handle adaptive-fill-regexp.
| -rw-r--r-- | lisp/simple.el | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index eae4cb1b482..031aefd4349 100644 --- a/lisp/simple.el +++ b/lisp/simple.el | |||
| @@ -2300,7 +2300,8 @@ Setting this variable automatically makes it local to the current buffer.") | |||
| 2300 | "*Regexp to match lines which should not be auto-filled.") | 2300 | "*Regexp to match lines which should not be auto-filled.") |
| 2301 | 2301 | ||
| 2302 | (defun do-auto-fill () | 2302 | (defun do-auto-fill () |
| 2303 | (let (fc justify bol give-up) | 2303 | (let (fc justify bol give-up |
| 2304 | (fill-prefix fill-prefix)) | ||
| 2304 | (if (or (not (setq justify (current-justification))) | 2305 | (if (or (not (setq justify (current-justification))) |
| 2305 | (null (setq fc (current-fill-column))) | 2306 | (null (setq fc (current-fill-column))) |
| 2306 | (and (eq justify 'left) | 2307 | (and (eq justify 'left) |
| @@ -2312,6 +2313,26 @@ Setting this variable automatically makes it local to the current buffer.") | |||
| 2312 | nil ;; Auto-filling not required | 2313 | nil ;; Auto-filling not required |
| 2313 | (if (memq justify '(full center right)) | 2314 | (if (memq justify '(full center right)) |
| 2314 | (save-excursion (unjustify-current-line))) | 2315 | (save-excursion (unjustify-current-line))) |
| 2316 | |||
| 2317 | ;; Choose a fill-prefix automatically. | ||
| 2318 | (if (and adaptive-fill-mode | ||
| 2319 | (or (null fill-prefix) (string= fill-prefix ""))) | ||
| 2320 | (let (start end) | ||
| 2321 | (save-excursion | ||
| 2322 | (end-of-line) | ||
| 2323 | (setq end (point)) | ||
| 2324 | (beginning-of-line) | ||
| 2325 | (setq start (point)) | ||
| 2326 | (move-to-left-margin) | ||
| 2327 | ;; Don't do it if this line is a paragraph-starter line | ||
| 2328 | ;; because then the next line will probably also become one. | ||
| 2329 | ;; In text mode, when the user indents the first line of a | ||
| 2330 | ;; paragraph, we don't want all the lines to be indented. | ||
| 2331 | (and (not (looking-at paragraph-start)) | ||
| 2332 | (re-search-forward adaptive-fill-regexp end t) | ||
| 2333 | (setq fill-prefix | ||
| 2334 | (buffer-substring-no-properties start (point))))))) | ||
| 2335 | |||
| 2315 | (while (and (not give-up) (> (current-column) fc)) | 2336 | (while (and (not give-up) (> (current-column) fc)) |
| 2316 | ;; Determine where to split the line. | 2337 | ;; Determine where to split the line. |
| 2317 | (let ((fill-point | 2338 | (let ((fill-point |