emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/textmodes/fill.el


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/textmodes/fill.el
Date: Wed, 30 Apr 2003 17:01:08 -0400

Index: emacs/lisp/textmodes/fill.el
diff -c emacs/lisp/textmodes/fill.el:1.162 emacs/lisp/textmodes/fill.el:1.163
*** emacs/lisp/textmodes/fill.el:1.162  Mon Apr 21 12:22:08 2003
--- emacs/lisp/textmodes/fill.el        Wed Apr 30 17:01:05 2003
***************
*** 406,411 ****
--- 406,417 ----
        (goto-char (match-end 0)))
      (setq from (point))))
  
+ ;; The `fill-space' property carries the string with which a newline
+ ;; should be replaced when unbreaking a line (in fill-delete-newlines).
+ ;; It is added to newline characters by fill-newline when the default
+ ;; behavior of fill-delete-newlines is not what we want.
+ (add-to-list 'text-property-default-nonsticky '(fill-space . t))
+ 
  (defun fill-delete-newlines (from to justify nosqueeze squeeze-after)
    (goto-char from)
    ;; Make sure sentences ending at end of line get an extra space.
***************
*** 434,448 ****
        ;; character preceding a newline has text property
        ;; `nospace-between-words'.
        (while (search-forward "\n" to t)
!       (let ((prev (char-before (match-beginning 0)))
!             (next (following-char)))
!         (if (and (or (aref (char-category-set next) ?|)
!                      (aref (char-category-set prev) ?|))
!                  (or (get-charset-property (char-charset prev)
!                                            'nospace-between-words)
!                      (get-text-property (1- (match-beginning 0))
!                                         'nospace-between-words)))
!             (delete-char -1)))))
  
    (goto-char from)
    (skip-chars-forward " \t")
--- 440,456 ----
        ;; character preceding a newline has text property
        ;; `nospace-between-words'.
        (while (search-forward "\n" to t)
!       (if (get-text-property (match-beginning 0) 'fill-space)
!           (replace-match (get-text-property (match-beginning 0) 'fill-space))
!         (let ((prev (char-before (match-beginning 0)))
!               (next (following-char)))
!           (if (and (or (aref (char-category-set next) ?|)
!                        (aref (char-category-set prev) ?|))
!                    (or (get-charset-property (char-charset prev)
!                                              'nospace-between-words)
!                        (get-text-property (1- (match-beginning 0))
!                                           'nospace-between-words)))
!               (delete-char -1))))))
  
    (goto-char from)
    (skip-chars-forward " \t")
***************
*** 520,538 ****
    ;; Replace whitespace here with one newline, then
    ;; indent to left margin.
    (skip-chars-backward " \t")
-   (if (and (= (following-char) ?\ )
-          (or (aref (char-category-set (preceding-char)) ?|)
-              (looking-at "[ \t]+\\c|")))
-       ;; We need one space at end of line so that
-       ;; further filling won't delete it.  NOTE: We
-       ;; intentionally leave this one space to
-       ;; distinguish the case that user wants to put
-       ;; space between \c| characters.
-       (forward-char 1))
    (insert ?\n)
    ;; Give newline the properties of the space(s) it replaces
    (set-text-properties (1- (point)) (point)
                       (text-properties-at (point)))
    ;; If we don't want breaks in invisible text, don't insert
    ;; an invisible newline.
    (if fill-nobreak-invisible
--- 528,544 ----
    ;; Replace whitespace here with one newline, then
    ;; indent to left margin.
    (skip-chars-backward " \t")
    (insert ?\n)
    ;; Give newline the properties of the space(s) it replaces
    (set-text-properties (1- (point)) (point)
                       (text-properties-at (point)))
+   (and (looking-at "\\( [ \t]*\\)\\(\\c|\\)?")
+        (or (aref (char-category-set (or (char-before (1- (point))) ?\000)) ?|)
+          (match-end 2))
+        ;; When refilling later on, this newline would normally not be replaced
+        ;; by a space, so we need to mark it specially to re-install the space
+        ;; when we unfill.
+        (put-text-property (1- (point)) (point) 'fill-space (match-string 1)))
    ;; If we don't want breaks in invisible text, don't insert
    ;; an invisible newline.
    (if fill-nobreak-invisible




reply via email to

[Prev in Thread] Current Thread [Next in Thread]