diff options
| author | Lars Ingebrigtsen | 2018-04-14 22:38:53 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2018-04-14 22:38:53 +0200 |
| commit | 196dc887d8ba324df01d594d5eda61591e251ff0 (patch) | |
| tree | b4e086e493f5f4e496cde71ef24652aae8d7cd98 | |
| parent | 56c4ce266d395a5940576bea3e69b636fb549b1e (diff) | |
| download | emacs-196dc887d8ba324df01d594d5eda61591e251ff0.tar.gz emacs-196dc887d8ba324df01d594d5eda61591e251ff0.zip | |
Further shr line folding/link continuation tweaks
* lisp/net/shr.el (shr-fill-line): Tweak the link continuations
further when folding lines.
| -rw-r--r-- | lisp/net/shr.el | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/lisp/net/shr.el b/lisp/net/shr.el index d12ee684937..5eb35b74dd1 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el | |||
| @@ -734,18 +734,25 @@ size, and full-buffer size." | |||
| 734 | (skip-chars-forward " ") | 734 | (skip-chars-forward " ") |
| 735 | (search-forward " " (line-end-position) 'move))) | 735 | (search-forward " " (line-end-position) 'move))) |
| 736 | ;; Success; continue. | 736 | ;; Success; continue. |
| 737 | (let ((props (copy-sequence (text-properties-at (point)))) | 737 | (when (= (preceding-char) ?\s) |
| 738 | (gap-start (point))) | 738 | (delete-char -1)) |
| 739 | (when (= (preceding-char) ?\s) | 739 | (let ((gap-start (point))) |
| 740 | (delete-char -1)) | ||
| 741 | ;; We don't want to use the faces on the indentation, because | ||
| 742 | ;; that's ugly, but we want all the other properties to be | ||
| 743 | ;; continuous so that links do not split up into many links | ||
| 744 | ;; (which makes navigation awkward). | ||
| 745 | (setq props (plist-put props 'face nil)) | ||
| 746 | (insert "\n") | 740 | (insert "\n") |
| 747 | (shr-indent) | 741 | (shr-indent) |
| 748 | (add-text-properties gap-start (point) props)) | 742 | (when (and (> (1- gap-start) (point-min)) |
| 743 | ;; The link on both sides of the newline are the | ||
| 744 | ;; same... | ||
| 745 | (equal (get-text-property (point) 'shr-url) | ||
| 746 | (get-text-property (1- gap-start) 'shr-url))) | ||
| 747 | ;; ... so we join the two bits into one link logically, but | ||
| 748 | ;; not visually. This makes navigation between links work | ||
| 749 | ;; well, but avoids underscores before the link on the next | ||
| 750 | ;; line when indented. | ||
| 751 | (let ((props (copy-sequence (text-properties-at (point))))) | ||
| 752 | ;; We don't want to use the faces on the indentation, because | ||
| 753 | ;; that's ugly. | ||
| 754 | (setq props (plist-put props 'face nil)) | ||
| 755 | (add-text-properties gap-start (point) props)))) | ||
| 749 | (setq start (point)) | 756 | (setq start (point)) |
| 750 | (shr-vertical-motion shr-internal-width) | 757 | (shr-vertical-motion shr-internal-width) |
| 751 | (when (looking-at " $") | 758 | (when (looking-at " $") |