2014-12-13 Lars Magne Ingebrigtsen <larsi@gnus.org>
+ * net/shr.el (shr-fold-text): New function.
+ (shr-show-alt-text, shr-urlify, shr-tag-img): Use it to fold long
+ alt/title texts.
+
* files.el (directory-files-recursively): Really check whether
files are symlinks.
(directory-name-p): New function.
(let ((text (get-text-property (point) 'shr-alt)))
(if (not text)
(message "No image under point")
- (message "%s" text))))
+ (message "%s" (shr-fold-text text)))))
(defun shr-browse-image (&optional copy-url)
"Browse the image under point.
(cdr (assq 'color shr-stylesheet))
(cdr (assq 'background-color shr-stylesheet))))))))
+(defun shr-fold-text (text)
+ (with-temp-buffer
+ (let ((shr-indentation 0)
+ (shr-internal-width (window-width)))
+ (shr-insert text)
+ (buffer-string))))
+
(define-inline shr-char-breakable-p (char)
"Return non-nil if a line can be broken before and after CHAR."
(inline-quote (aref fill-find-break-point-function-table ,char)))
(add-text-properties
start (point)
(list 'shr-url url
- 'help-echo (if title (format "%s (%s)" url title) url)
+ 'help-echo (if title (shr-fold-text (format "%s (%s)" url title)) url)
'follow-link t
'mouse-face 'highlight
'keymap shr-map)))
(put-text-property start (point) 'image-displayer
(shr-image-displayer shr-content-function))
(put-text-property start (point) 'help-echo
- (or (dom-attr dom 'title) alt)))
+ (shr-fold-text (or (dom-attr dom 'title) alt))))
(setq shr-state 'image)))))
(defun shr-tag-pre (dom)