Mercurial > emacs
comparison lisp/textmodes/fill.el @ 61155:801f886872c5
(fill-text-properties-at): New function.
(fill-newline): Use fill-text-properties-at instead of
text-properties-at.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 31 Mar 2005 04:44:46 +0000 |
parents | 7f57e96cf880 |
children | c905fcf5e3d9 4da4a09e8b1b |
comparison
equal
deleted
inserted
replaced
61154:81b738b4c729 | 61155:801f886872c5 |
---|---|
537 (if (not (and (eq (charset-after (1- (point))) 'ascii) | 537 (if (not (and (eq (charset-after (1- (point))) 'ascii) |
538 (eq (charset-after (point)) 'ascii))) | 538 (eq (charset-after (point)) 'ascii))) |
539 ;; Make sure we take SOMETHING after the fill prefix if any. | 539 ;; Make sure we take SOMETHING after the fill prefix if any. |
540 (fill-find-break-point linebeg))))) | 540 (fill-find-break-point linebeg))))) |
541 | 541 |
542 ;; Like text-properties-at but don't include `composition' property. | |
543 (defun fill-text-properties-at (pos) | |
544 (let ((l (text-properties-at pos)) | |
545 prop-list) | |
546 (while l | |
547 (unless (eq (car l) 'composition) | |
548 (setq prop-list | |
549 (cons (car l) (cons (cadr l) prop-list)))) | |
550 (setq l (cddr l))) | |
551 prop-list)) | |
552 | |
542 (defun fill-newline () | 553 (defun fill-newline () |
543 ;; Replace whitespace here with one newline, then | 554 ;; Replace whitespace here with one newline, then |
544 ;; indent to left margin. | 555 ;; indent to left margin. |
545 (skip-chars-backward " \t") | 556 (skip-chars-backward " \t") |
546 (insert ?\n) | 557 (insert ?\n) |
547 ;; Give newline the properties of the space(s) it replaces | 558 ;; Give newline the properties of the space(s) it replaces |
548 (set-text-properties (1- (point)) (point) | 559 (set-text-properties (1- (point)) (point) |
549 (text-properties-at (point))) | 560 (fill-text-properties-at (point))) |
550 (and (looking-at "\\( [ \t]*\\)\\(\\c|\\)?") | 561 (and (looking-at "\\( [ \t]*\\)\\(\\c|\\)?") |
551 (or (aref (char-category-set (or (char-before (1- (point))) ?\000)) ?|) | 562 (or (aref (char-category-set (or (char-before (1- (point))) ?\000)) ?|) |
552 (match-end 2)) | 563 (match-end 2)) |
553 ;; When refilling later on, this newline would normally not be replaced | 564 ;; When refilling later on, this newline would normally not be replaced |
554 ;; by a space, so we need to mark it specially to re-install the space | 565 ;; by a space, so we need to mark it specially to re-install the space |