X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/6ccb9cab43613632ece4f62d9ee28d694bc1d666..af1c6c8493c84d7d5321b20ebd4a1c00bcfc2670:/lisp/net/shr.el diff --git a/lisp/net/shr.el b/lisp/net/shr.el index 6ddf8d2af9..bc45429236 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -59,7 +59,7 @@ fit these criteria." "Character used to draw horizontal table lines. If nil, don't draw horizontal table lines." :group 'shr - :type 'character) + :type '(choice (const nil) character)) (defcustom shr-table-vertical-line ?\s "Character used to draw vertical table lines." @@ -143,7 +143,7 @@ cid: URL as the argument.") (define-key map [tab] 'shr-next-link) (define-key map [backtab] 'shr-previous-link) (define-key map [follow-link] 'mouse-face) - (define-key map [mouse-2] 'shr-mouse-browse-url) + (define-key map [mouse-2] 'shr-browse-url) (define-key map "I" 'shr-insert-image) (define-key map "w" 'shr-copy-url) (define-key map "u" 'shr-copy-url) @@ -664,10 +664,11 @@ size, and full-buffer size." (mouse-set-point ev) (shr-browse-url)) -(defun shr-browse-url (&optional external) +(defun shr-browse-url (&optional external mouse-event) "Browse the URL under point. If EXTERNAL, browse the URL using `shr-external-browser'." - (interactive "P") + (interactive (list current-prefix-arg last-nonmenu-event)) + (mouse-set-point mouse-event) (let ((url (get-text-property (point) 'shr-url))) (cond ((not url) @@ -832,6 +833,8 @@ START, and END. Note that START and END should be markers." start (point) (list 'shr-url url 'help-echo (if title (format "%s (%s)" url title) url) + 'follow-link t + 'mouse-face 'highlight 'keymap shr-map))) (defun shr-encode-url (url) @@ -1485,7 +1488,11 @@ ones, in case fg and bg are nil." 10)) (when (and fill (setq colspan (cdr (assq :colspan (cdr column))))) - (setq colspan (string-to-number colspan)) + (setq colspan (min (string-to-number colspan) + ;; The colspan may be wrong, so + ;; truncate it to the length of the + ;; remaining columns. + (- (length widths) i))) (dotimes (j (1- colspan)) (if (> (+ i 1 j) (1- (length widths))) (setq width (aref widths (1- (length widths)))) @@ -1495,9 +1502,6 @@ ones, in case fg and bg are nil." (setq width-column (+ width-column (1- colspan)))) (when (or column (not fill)) - ;; Sanity check for degenerate tables. - (when (zerop width) - (setq width 10)) (push (shr-render-td (cdr column) width fill) tds)) (setq i (1+ i) @@ -1506,7 +1510,6 @@ ones, in case fg and bg are nil." (nreverse trs))) (defun shr-render-td (cont width fill) - (when (= width 0) (debug)) (with-temp-buffer (let ((bgcolor (cdr (assq :bgcolor cont))) (fgcolor (cdr (assq :fgcolor cont)))