[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: <nobr> injection
- From: Katsumi Yamaoka <yamaoka@xxxxxxx>
- Date: Mon, 31 Mar 2014 11:42:27 +0900
- X-ml-name: emacs-w3m
- X-mail-count: 12310
- References: <87bnwpr394.fsf@xxxxxxxxxxx> <b4mmwg75fgx.fsf@xxxxxxx>
In [emacs-w3m : No.12309] Katsumi Yamaoka wrote:
> Fixed in emacs-w3m CVS.
Please check it out again if you've done already. I've fixed
the last check-in so that it may work with Gnus.
> The patch is below.
Here's a revised one:
--- w3m.el~ 2014-03-26 07:28:01.000000000 +0000
+++ w3m.el 2014-03-31 02:33:59.000000000 +0000
@@ -6174,8 +6174,9 @@
(defun w3m-markup-urls-nobreak ()
"Make things that look like urls unbreakable.
This function prevents non-link long urls from being broken (w3m tries
-to fold them)."
+to fold them). Things in textarea won't be modified."
(let ((case-fold-search t)
+ (beg (point-min))
(regexp
(eval-when-compile
;; A copy of `gnus-button-url-regexp'.
@@ -6201,25 +6202,40 @@
"\\)")))
(nd (make-marker))
st)
- (goto-char (point-min))
- (while (re-search-forward regexp nil t)
- (set-marker nd (match-end 0))
- (setq st (goto-char (match-beginning 0)))
- (if (and (re-search-backward "\\(<\\)\\|>" nil t)
- (match-beginning 1))
- (goto-char nd)
- (goto-char st)
- (skip-chars-backward "\t\f ")
- (if (string-match "<" (buffer-substring (max (- (point) 4)
- (point-min))
- (point)))
- (forward-char -4)
- (goto-char st))
- (insert "<nobr>")
- (goto-char nd)
- (when (looking-at "[\t\f ]*>")
- (goto-char (match-end 0)))
- (insert "</nobr>")))
+ (goto-char beg)
+ (while beg
+ (save-restriction
+ (narrow-to-region
+ beg
+ (if (re-search-forward "[\t\n ]*\\(<textarea[\t\n ]\\)" nil t)
+ (prog1
+ (match-beginning 0)
+ (goto-char beg)
+ (setq beg (match-beginning 1)))
+ (point-max)))
+ (while (re-search-forward regexp nil t)
+ (set-marker nd (match-end 0))
+ (setq st (goto-char (match-beginning 0)))
+ (if (and (re-search-backward "\\(<\\)\\|>" nil t)
+ (match-beginning 1))
+ (goto-char nd)
+ (goto-char st)
+ (skip-chars-backward "\t\f ")
+ (if (string-match "<" (buffer-substring (max (- (point) 4)
+ (point-min))
+ (point)))
+ (forward-char -4)
+ (goto-char st))
+ (insert "<nobr>")
+ (goto-char nd)
+ (when (looking-at "[\t\f ]*>")
+ (goto-char (match-end 0)))
+ (insert "</nobr>")))
+ (goto-char (point-max)))
+ (setq beg (and (not (eobp))
+ (progn
+ (goto-char beg)
+ (w3m-end-of-tag "textarea")))))
(set-marker nd nil)))
(defun w3m-rendering-buffer (&optional charset)