bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#13949: 24.4.1; `fill-paragraph' should not always put the buffer as


From: Jaakov
Subject: bug#13949: 24.4.1; `fill-paragraph' should not always put the buffer as modified
Date: Tue, 22 Mar 2016 18:52:14 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0

Another implementation to fill paragraph in text mode could have as well scanned through the text linewise as suggested by Stefan Monnier.

I would implement just line splitting along the following idea for text-mode (not in LISP - please excuse me):

FOR EACH line l in the current paragraph
  REMARK space = whitespace or TAB
  c := rightmost column of l with space or -1 if none found
  IF c >= fill-column => 0 THEN
    REPEAT
      c' := c
      c := rightmost column of l|_{[0,c'[} with space
           or -1 if none found
    UNTIL c < fill-column
    IF c<0 THEN
      split line l at column c'
    ELSE
      split line l at column c
    ENDIF
    modifies := true
  END IF
END FOR

Of course, fill-paragraph needs to be much more than line splitting, so don't take my terrible piece of code too seriously, i.e., for anything except the initial idea.





reply via email to

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