emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r102530: shr.el (shr-insert): Revert


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102530: shr.el (shr-insert): Revert last change.
Date: Fri, 26 Nov 2010 07:35:42 +0000
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102530
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Fri 2010-11-26 07:35:42 +0000
message:
  shr.el (shr-insert): Revert last change.
  shr.el (shr-find-fill-point): Never leave point being at bol; relax the 
kinsoku limitation when rendering tables.
modified:
  lisp/gnus/ChangeLog
  lisp/gnus/shr.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2010-11-26 02:37:23 +0000
+++ b/lisp/gnus/ChangeLog       2010-11-26 07:35:42 +0000
@@ -1,3 +1,9 @@
+2010-11-26  Katsumi Yamaoka  <address@hidden>
+
+       * shr.el (shr-insert): Revert last change.
+       (shr-find-fill-point): Never leave point being at bol;
+       relax the kinsoku limitation when rendering tables.
+
 2010-11-26  Lars Magne Ingebrigtsen  <address@hidden>
 
        * nnmail.el (nnmail-expiry-target-group): Protect against degenerate

=== modified file 'lisp/gnus/shr.el'
--- a/lisp/gnus/shr.el  2010-11-25 14:51:51 +0000
+++ b/lisp/gnus/shr.el  2010-11-26 07:35:42 +0000
@@ -254,7 +254,7 @@
        (while (and (> (current-column) shr-width)
                    (progn
                      (setq found (shr-find-fill-point))
-                     (not (or (bolp) (eolp)))))
+                     (not (eolp))))
          (when (eq (preceding-char) ? )
            (delete-char -1))
          (insert "\n")
@@ -278,7 +278,8 @@
            (or (setq failed (= (current-column) shr-indentation))
                (eq (preceding-char) ? )
                (eq (following-char) ? )
-               (aref fill-find-break-point-function-table (preceding-char))))
+               (aref fill-find-break-point-function-table (preceding-char))
+               (aref (char-category-set (preceding-char)) ?>)))
       (backward-char 1))
     (if failed
        ;; There's no breakable point, so we give it up.
@@ -287,30 +288,52 @@
          (while (aref fill-find-break-point-function-table (preceding-char))
            (backward-char 1))
          nil)
-      (or (eolp)
-         ;; Don't put kinsoku-bol characters at the beginning of a line,
-         ;; or kinsoku-eol characters at the end of a line,
-         (let ((count 4))
-           (if (or shr-kinsoku-shorten
-                   (and (aref (char-category-set (preceding-char)) ?<)
-                        (progn
-                          (setq count (1- count))
-                          (backward-char 1)
-                          t)))
-               (while (and
-                       (>= (setq count (1- count)) 0)
-                       (not (memq (preceding-char) (list ?\C-@ ?\n ? )))
-                       (or (aref (char-category-set (preceding-char)) ?<)
-                           (aref (char-category-set (following-char)) ?>)))
-                 (backward-char 1))
-             (while (and (>= (setq count (1- count)) 0)
-                         (aref (char-category-set (following-char)) ?>)
-                         (aref fill-find-break-point-function-table
-                               (following-char)))
-               (forward-char 1)))
-           (when (eq (following-char) ? )
-             (forward-char 1))
-           t)))))
+      (or
+       (eolp)
+       (progn
+        ;; Don't put kinsoku-bol characters at the beginning of a line,
+        ;; or kinsoku-eol characters at the end of a line.
+        (cond
+         (shr-kinsoku-shorten
+          (while (and
+                  (not (memq (preceding-char) (list ?\C-@ ?\n ? )))
+                  (not (or (aref (char-category-set (preceding-char)) ?>)
+                           (aref (char-category-set (following-char)) ?<)))
+                  (or (aref (char-category-set (preceding-char)) ?<)
+                      (aref (char-category-set (following-char)) ?>)))
+            (backward-char 1)))
+         ((aref (char-category-set (preceding-char)) ?<)
+          (let ((count 3))
+            (while (progn
+                     (backward-char 1)
+                     (and
+                      (> (setq count (1- count)) 0)
+                      (not (memq (preceding-char) (list ?\C-@ ?\n ? )))
+                      (or (aref (char-category-set (preceding-char)) ?<)
+                          (aref (char-category-set (following-char)) ?>))))))
+          (if (and (setq failed (= (current-column) shr-indentation))
+                   (re-search-forward "\\c|" (line-end-position) 'move))
+              ;; There's no breakable point that doesn't violate kinsoku,
+              ;; so we look for the second best position.
+              (let (bp)
+                (while (and (<= (current-column) shr-width)
+                            (progn
+                              (setq bp (point))
+                              (not (eolp)))
+                            (aref fill-find-break-point-function-table
+                                  (following-char)))
+                  (forward-char 1))
+                (goto-char (or bp (line-end-position))))))
+         (t
+          (let ((count 4))
+            (while (and (>= (setq count (1- count)) 0)
+                        (aref (char-category-set (following-char)) ?>)
+                        (aref fill-find-break-point-function-table
+                              (following-char)))
+              (forward-char 1)))))
+        (when (eq (following-char) ? )
+          (forward-char 1))
+        (not failed))))))
 
 (defun shr-ensure-newline ()
   (unless (zerop (current-column))


reply via email to

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