Commit graph

217 commits

Author SHA1 Message Date
Eli Zaretskii
e5bff696bc Revert last change in 'shr-descend'
* lisp/net/shr.el (shr-descend): Revert the part of the last
change which introduced calls to shr-indirect-call into this
function.  Add a comment explaining the rationale for that.
(Bug#28402)
2017-10-06 15:42:22 +03:00
Vasilij Schneidermann
e3f4b71c9d Support indirection for all shr-tag-* calls
The 'shr-external-rendering-functions' variable was previously only
honored in the shr-descend function, now all direct calls to the
shr-tag-* functions have been replaced by a call to
'shr-indirect-call' which tries using an alternative rendering
function first.

* lisp/net/shr.el (shr-indirect-call): New helper function.
(shr-descend, shr-tag-object, shr-tag-video):
(shr-collect-extra-strings-in-table): Fix callers to call via
shr-indirect-call.  (Bug#28402)
2017-10-05 13:00:13 +03:00
Paul Eggert
bc511a64f6 Prefer HTTPS to FTP and HTTP in documentation
Most of this change is to boilerplate commentary such as license URLs.
This change was prompted by ftp://ftp.gnu.org's going-away party,
planned for November.  Change these FTP URLs to https://ftp.gnu.org
instead.  Make similar changes for URLs to other organizations moving
away from FTP.  Also, change HTTP to HTTPS for URLs to gnu.org and
fsf.org when this works, as this will further help defend against
man-in-the-middle attacks (for this part I omitted the MS-DOS and
MS-Windows sources and the test tarballs to keep the workload down).
HTTPS is not fully working to lists.gnu.org so I left those URLs alone
for now.
2017-09-13 15:54:37 -07:00
Mark Oteiza
370d0e7aa7 Update uses of if-let and when-let
* lisp/dom.el (dom-previous-sibling):
* lisp/emacs-lisp/package.el (package--with-work-buffer):
(package--sort-deps-in-alist, package--sort-by-dependence):
(package-install-from-archive, package-install):
(package-menu-execute, package-menu--populate-new-package-list):
* lisp/filenotify.el (file-notify--rm-descriptor):
(file-notify--event-watched-file, file-notify--event-file-name):
(file-notify--event-file1-name, file-notify-rm-watch):
(file-notify-valid-p):
* lisp/gnus/message.el (message-toggle-image-thumbnails):
* lisp/gnus/nnimap.el (nnimap-request-move-article):
* lisp/ibuf-ext.el (ibuffer-repair-saved-filters):
* lisp/mpc.el (mpc-format):
* lisp/net/eww.el (eww-tag-meta, eww-process-text-input):
(eww-save-history):
* lisp/net/shr.el (shr-tag-base, shr-tag-object, shr-make-table-1):
* lisp/progmodes/prog-mode.el (prettify-symbols--post-command-hook):
* lisp/svg.el (svg-remove):
* lisp/textmodes/css-mode.el (css--named-color):
(css--colon-inside-funcall):
* lisp/textmodes/sgml-mode.el (html-current-buffer-classes):
(html-current-buffer-ids): Use if-let* and when-let* instead.
2017-09-12 13:18:10 -04:00
Grégoire Jadi
fe25d0ce8e Ensure that we parse images right in shr.el
* lisp/net/shr.el (shr-image-fetched): Go back to the
beginning of the buffer before trying to parse the image
fetched.
2017-07-24 17:29:28 +02:00
Lars Ingebrigtsen
e33ddda3bf Fix image/svg+xml display in shr
* lisp/net/shr.el (shr-put-image): Display svg images as svg
(bug#27799).  I suspect the previous change was checked in by
accident in conjuction with some other svg changes.
2017-07-23 15:23:14 +02:00
Noam Postavsky
1b4f0a92ff Split shr-copy-url dwim behavior into separate functions (Bug#26826)
* lisp/net/shr.el (shr-url-at-point, shr-probe-url)
(shr-probe-and-copy-url, shr-maybe-probe-and-copy-url): New functions,
split out from `shr-copy-url'.
(shr-copy-url): Only copy the url, don't fetch it.
(shr-map): Bind 'w' and 'u' to `shr-maybe-probe-and-copy-url', which
has the same behavior as the old `shr-copy-url'.
* etc/NEWS: Announce changes.
2017-07-02 16:19:58 -04:00
Glenn Morris
18896f7913 * lisp/net/shr.el (shr-fill-text): Actually fill the text. (Bug#27399) 2017-06-22 14:11:29 -04:00
Stefan Monnier
a8d0a91841 * lisp/net/shr.el: Use cl-lib instead of cl. 2017-05-23 09:09:28 -04:00
Glenn Morris
0f83433946 Avoid unnecessary loading of subr-x at run-time
* lisp/doc-view.el, lisp/filenotify.el, lisp/info-look.el:
* lisp/svg.el, lisp/emacs-lisp/byte-opt.el, lisp/net/shr.el:
* lisp/textmodes/sgml-mode.el, test/lisp/dom-tests.el:
No need to load subr-x at run-time.
* lisp/gnus/nnheader.el: No need to load subr-x.
; * lisp/emacs-lisp/subr-x.el, lisp/gnus/message.el, lisp/net/nsm.el:
; Comments.
2017-04-18 19:07:28 -04:00
Katsumi Yamaoka
8ce827426e shr-image-fetched: Work for narrowed Gnus article
See <8737e3msun.fsf@gmail.com> of bug#26231 in the bug-gnu-emacs list.

* lisp/net/shr.el (shr-image-fetched): Work for narrowed article.
2017-03-27 09:05:41 +00:00
David Bremner
43e792cd7f Fix issues with dedicated windows in shr.el
* lisp/net/shr.el (shr-pixel-buffer-width, shr-render-td-1): Make
the window not dedicated, to avoid errors if it was, before
setting its buffer temporarily.  (Bug#25828)

Copyright-paperwork-exempt: yes
2017-03-04 12:19:32 +02:00
Lars Ingebrigtsen
267c98ae48 Fix rendering of some complex SVG images
* lisp/net/shr.el (shr-parse-image-data): Don't transform
SVG->DOM->XML unless we're blocking images, as this is apt to
destroy the SVG (bug#24111).
2017-01-24 22:21:45 +01:00
Lars Ingebrigtsen
3180deacf5 Clarify the last clarification
* lisp/net/shr.el (shr-width): Clarify the interaction with
`shr-use-fonts' (bug#24928).
2017-01-24 21:33:51 +01:00
Lars Ingebrigtsen
253fdf799b shr-width doc clarification
* lisp/net/shr.el (shr-width): Clarify the interaction with
`shr-use-fonts' (bug#24928).
2017-01-24 21:31:17 +01:00
Lars Ingebrigtsen
37567393a0 Allow passing in max-width/height
* lisp/net/shr.el (shr-rescale-image): Allow passing in
max-width/height (bug#25287).
2017-01-24 21:17:45 +01:00
Paul Eggert
bcf244ef9b Merge from origin/emacs-25
2e2a806 Fix copyright years by hand
5badc81 Update copyright year to 2017
2017-01-01 01:10:47 -08:00
Paul Eggert
5badc81c1c Update copyright year to 2017
Run admin/update-copyright.
2016-12-31 19:42:26 -08:00
Paul Eggert
c26605861e Merge from origin/emacs-25
3d63b48 Update ChangeLog files and authors.el
9d30264 Fix menu bindings of Dired 'A' and 'Q' commands
a725592 Avoid errors in shr-pixel-column due to dedicated windows
3138598 Update format-time-string documentation
2016-12-07 12:36:38 -08:00
Katsumi Yamaoka
e42b964c12 shr.el: Don't render a normal table twice
* lisp/net/shr.el (shr-collect-extra-strings-in-table):
Don't render a table if it is called for the first time,
IOW, recognize it to never be invalid (bug#25051).
2016-11-29 10:20:51 +00:00
Katsumi Yamaoka
b13d6f2c39 Don't collect strings existing out of <tr>...</tr>
* lisp/net/shr.el (shr-collect-extra-strings-in-table):
Don't collect strings existing out of <tr>...</tr> to avoid
duplication with what `shr-tag-table' renders.
2016-11-21 08:21:27 +00:00
Eli Zaretskii
a725592db8 Avoid errors in shr-pixel-column due to dedicated windows
* lisp/net/shr.el (shr-pixel-column): If we are switching to
another buffer in the selected window, make that window
temporarily non-dedicated.  (Bug#24950)
2016-11-20 21:08:47 +02:00
Tino Calancha
5ffdbe0a5e Update parameter :version to 26.1 in several defcustom
Following defcustom where added or modified for 25.2 release.
In fact all these changes belong to 26.1 release.
* lisp/battery.el (battery-linux-sysfs-regexp)
* lisp/comint.el (comint-password-prompt-regexp)
* lisp/dired.el (dired-always-read-filesystem)
* lisp/image.el (image-scaling-factor)
* lisp/ibuf-ext.el (ibuffer-never-search-content-name)
(ibuffer-never-search-content-mode)
* lisp/mouse.el (mouse-select-region-move-to-beginning)
* lisp/net/net-utils.el (iwconfig-program, iwconfig-program-options)
(netstat-program, route-program, route-program-options)
* lisp/net/sieve-manage.el (sieve-manage-default-stream)
* lisp/progmodes/grep.el (grep-save-buffers)
* lisp/vc/add-log.el (change-log-directory-files)
* lisp/url/url-vars.el (url-user-agent)
* lisp/vc/vc-hg.el (vc-hg-symbolic-revision-styles)
(vc-hg-use-file-version-for-mode-line-version)
(vc-hg-parse-hg-data-structures)
* lisp/wdired.el (wdired-create-parent-directories)
* lisp/faces.el (homoglyph, nobreak-hyphen, read-multiple-choice-face)
* lisp/gnus/gnus-art.el (gnus-article-encrypt-protocol)
(gnus-button-url-regexp)
* lisp/window.el (switch-to-buffer-preserve-window-point)
* lisp/ibuffer.el (ibuffer-formats, ibuffer-locked-char)
(ibuffer-locked-buffer)
* lisp/textmodes/flyspell.el (flyspell-sort-corrections-function)
* lisp/emacs-lisp/edebug.el (edebug-sit-on-break)
* lisp/gnus/message.el (message-user-fqdn)
* lisp/simple.el (shell-command-dont-erase-buffer)
(extended-command-suggest-shorter)
* lisp/net/shr.el (shr-use-fonts)
* lisp/files.el (mounted-file-systems, kill-emacs-query-functions)
2016-11-17 00:39:43 +09:00
Katsumi Yamaoka
0bf888422d * lisp/net/shr.el (shr-collect-extra-strings-in-table): Fix indentation. 2016-11-14 06:56:01 +00:00
Katsumi Yamaoka
99e7b99e43 * lisp/net/shr.el (shr-tag-table): Avoid duplication of images.
(shr-collect-extra-strings-in-table): Render images as well.
2016-11-14 06:48:06 +00:00
Katsumi Yamaoka
06b7e73b3e * lisp/net/shr.el (shr--preferred-image): Add CR to whitespace regexps.
(shr-collect-extra-strings-in-table):
Render extra tables in an invalid html as well.
2016-11-11 08:17:41 +00:00
Katsumi Yamaoka
dd91362565 * lisp/net/shr.el (shr--preferred-image): Ignore whitespace (bug#24893). 2016-11-11 00:27:48 +00:00
Katsumi Yamaoka
6ccb5f19f6 * lisp/net/shr.el (shr-collect-extra-strings-in-table) New function
that gathers extra strings in an invalid html.  (bug#24831)
(shr-tag-table): Use it.
2016-11-04 10:33:26 +00:00
Mark Oteiza
d3c2d3ca45 Turn on lexical-binding in some net libs
* lisp/net/dbus.el: Turn on lexical-binding.
(dbus-list-hash-table, dbus-list-known-names):
(dbus-introspect-get-node-names, dbus-introspect-get-interface-names):
(dbus-introspect-get-method-names, dbus-introspect-get-signal-names):
(dbus-introspect-get-property-names):
(dbus-introspect-get-argument-names, dbus-get-all-properties):
(dbus-property-handler, dbus-get-all-managed-objects):
(dbus-managed-object-handler): Replace add-to-list with push. Add
nreverse in some places where the APPEND argument of add-to-list was
used.
* lisp/net/network-stream.el: Turn on lexical-binding.
* lisp/net/newsticker.el: Turn on lexical-binding.
* lisp/net/shr.el: Turn on lexical-binding.
(shr-make-placeholder-image): Remove unused variable binding.
(shr-inspect-table): Replace ignored bindings with underscore.
2016-10-31 20:19:21 -04:00
Lars Ingebrigtsen
9345e638f1 Don't bug out on all-whitespace URLs
* lisp/net/shr.el (shr-expand-url): Don't bug out on
degenerate all-whitespace URLs.
2016-09-14 11:11:34 +02:00
Katsumi Yamaoka
9eb028f886 * lisp/net/shr.el (shr-fill-line):
Preserve text properties in folded lines (bug#24034).
2016-07-21 08:36:17 +00:00
Katsumi Yamaoka
eb9d461a8e * lisp/net/shr.el (shr-fill-line): Withdraw the last commit (4157159). 2016-07-21 08:33:41 +00:00
Katsumi Yamaoka
4157159a37 * lisp/net/shr.el (shr-fill-line):
Preserve text properties in folded lines (bug#24034).
2016-07-20 22:56:42 +00:00
Lars Ingebrigtsen
90fb0b2d13 Fix shr.el/image build problem
Fixes: bug#24035

* lisp/net/shr.el: Require image, since some builds seem to
break without it (bug#24035).
2016-07-20 16:47:47 +02:00
Lars Magne Ingebrigtsen
1bd7455497 Fix the prefix action of shr-copy-url
* lisp/net/shr.el (shr-copy-url): Make the command really copy
the image url if given a prefix.
2016-06-27 22:26:02 +02:00
Lars Ingebrigtsen
f2b16e4472 :max-width/height fixes for shr after the scaling changes
* lisp/net/shr.el (shr-rescale-image): Ensure that we respect
max-width and max-height even after the scaling changes done
earlier this year.
2016-05-14 22:57:53 +02:00
Lars Ingebrigtsen
73071b4cdb Support srcset in <img>
* lisp/net/shr.el (shr--preferred-image): Allow <img> tags
with srcset specifiers (bug#23459).
2016-05-12 17:45:27 +02:00
Lars Ingebrigtsen
43bb4305c5 (shr-rescale-image): Clarify logic slightly
* lisp/net/shr.el (shr-rescale-image): Clarify logic slightly.
2016-05-03 17:27:04 +02:00
Lars Magne Ingebrigtsen
2a28ba3db9 Use Unicode literals instead of hex values
* lisp/net/shr.el (shr-tag-bdo): Use Unicode literals instead
of hex values for greater readability.
(shr-tag-bdi): Ditto.
2016-04-24 14:13:22 +02:00
Lars Magne Ingebrigtsen
7570b35740 (shr-insert): Respect non-breaking space in non-<pre> text
* lisp/net/shr.el (shr-insert): Respect non-breaking space in
non-<pre> text.
2016-03-25 16:57:35 +01:00
Lars Magne Ingebrigtsen
78bcd42857 Further empty <li> tweaks
* lisp/net/shr.el (shr-tag-li): When showing several empty
<li> elements, ensure that they really get inserted on a new line.
2016-03-20 15:15:32 +01:00
Lars Magne Ingebrigtsen
61b2e837d8 Don't remove too much white space at the end of documents
* lisp/net/shr.el (shr--remove-blank-lines-at-the-end): Don't
remove too much white space -- leave it on the last line (in
case there's a background color).
2016-03-20 14:47:30 +01:00
Lars Magne Ingebrigtsen
8a35f83c6c Render empty <ul><li><ul> correctly
* lisp/net/shr.el (shr-tag-ul): Render empty <ul><li><ul>
correctly (bug#22964).
(cherry picked from commit 4f6ea3988b)

Backport:
2016-03-20 13:58:26 +01:00
Lars Magne Ingebrigtsen
d8b2ce5f8a Ignore invalid base64 encoded embedded images
* lisp/net/shr.el (shr-image-from-data): Ignore invalid base64
encoded embedded images (bug#22928).
(cherry picked from commit f2da80d0e1)

Backport:
2016-03-20 13:58:04 +01:00
Lars Magne Ingebrigtsen
f2da80d0e1 Ignore invalid base64 encoded embedded images
* lisp/net/shr.el (shr-image-from-data): Ignore invalid base64
encoded embedded images (bug#22928).
2016-03-20 13:57:11 +01:00
Lars Magne Ingebrigtsen
4f6ea3988b Render empty <ul><li><ul> correctly
* lisp/net/shr.el (shr-tag-ul): Render empty <ul><li><ul>
correctly (bug#22964).
2016-03-20 13:52:36 +01:00
Lars Magne Ingebrigtsen
52ba24bdd9 Fix <p> and <div> newlines with or without <li> in shr
* lisp/net/shr.el (shr-ensure-newline): Respect that we're in
a <li>, if we are, and don't insert newlines there.
(shr-ensure-paragraph): When mixing newlines and paragraph
ensurements, don't insert too many blank lines.
(shr-tag-div): A <div> shouldn't introduce a paragraph, but a
new line.
(cherry picked from commit 292921faca)

Backport:
2016-03-20 13:45:09 +01:00
Lars Magne Ingebrigtsen
292921faca Fix <p> and <div> newlines with or without <li> in shr
* lisp/net/shr.el (shr-ensure-newline): Respect that we're in
a <li>, if we are, and don't insert newlines there.
(shr-ensure-paragraph): When mixing newlines and paragraph
ensurements, don't insert too many blank lines.
(shr-tag-div): A <div> shouldn't introduce a paragraph, but a
new line.
2016-03-20 13:43:42 +01:00
Lars Magne Ingebrigtsen
c688c44ddf Remove code left over from when overlays were used for padding
* lisp/net/shr.el (shr-previous-newline-padding-width): Remove.
(shr-remove-trailing-whitespace): Ditto.
(shr-insert-document): Don't call them.
2016-03-20 12:54:24 +01:00
Lars Magne Ingebrigtsen
35d58020b6 Remove trailing blank lines in shr
* lisp/net/shr.el (shr--remove-blank-lines-at-the-end): New function.
(shr-insert-document): Use it to remove trailing blank lines
at the end of documents, since these never seem to be very useful.
2016-03-20 12:52:28 +01:00