Commit graph

317 commits

Author SHA1 Message Date
Eli Zaretskii
0abf01402b Merge from origin/emacs-28
f1c9286 ; * doc/misc/org.org: fix capture context example
af67ce6 Merge branch 'emacs-28' of git.savannah.gnu.org:/srv/git/emac...
610680a Fix rendering of title-less <abbr> tags in shr
2ba4ccf ; * lisp/files.el (make-nearby-temp-file): Doc fix.
2021-10-31 18:46:29 +02:00
Lars Ingebrigtsen
610680a8d3 Fix rendering of title-less <abbr> tags in shr
* lisp/net/shr.el (shr-tag-abbr): Render <abbr> tags that have no
title (bug#51525).
2021-10-31 16:20:18 +01:00
Lars Ingebrigtsen
4103123806 Change the call convention for `defvar-keymap'
* doc/lispref/keymaps.texi (Changing Key Bindings): Adjust
documentation.

* lisp/simple.el (special-mode-map):
* lisp/net/shr.el (shr-map):
* lisp/net/eww.el (eww-link-keymap):
(eww-mode-map):
(eww-submit-map):
(eww-textarea-map):
(eww-bookmark-mode-map):
(eww-history-mode-map):
(eww-buffers-mode-map):
* lisp/gnus/message.el (message-mode-map):
* lisp/gnus/gnus-html.el (gnus-html-image-map):
* lisp/gnus/gnus-eform.el (gnus-edit-form-mode-map):
* lisp/gnus/gnus-dired.el (gnus-dired-mode-map):
* lisp/gnus/gnus-bookmark.el (gnus-bookmark-bmenu-mode-map):
Adjust usage of `defvar-keymap'.

* lisp/subr.el (define-keymap, define-keymap--define): Change how
these functions call each other.
(defvar-keymap): Change interface to be more like `define-keymap'.

* lisp/emacs-lisp/lisp-mode.el (lisp-indent--defvar-keymap): Remove.
(lisp-indent-function): Don't use it.
2021-10-05 10:34:37 +02:00
Lars Ingebrigtsen
859190f03e Convert some keymaps to defvar-keymap
* lisp/simple.el (special-mode-map):
* lisp/net/shr.el (shr-map):
* lisp/net/eww.el (eww-link-keymap):
(eww-mode-map):
(eww-submit-map):
(eww-bookmark-mode-map):
(eww-history-mode-map):
(eww-buffers-mode-map):
* lisp/gnus/message.el (message-mode-map): Use defvar-keymap.

* lisp/gnus/gnus-eform.el (gnus-edit-form-mode-map):
* lisp/gnus/gnus-dired.el (gnus-dired-mode-map):
* lisp/gnus/gnus-bookmark.el (gnus-bookmark-bmenu-mode-map): Use
defvar-keymap.

* lisp/gnus/gnus-group.el (gnus-group-mode-map): Use define-keymap.

* lisp/gnus/gnus-html.el (gnus-html-image-map): Use defvar-keymap.

* lisp/gnus/gnus.el: Autoload gnus-score-edit-all-score.
2021-10-04 10:15:11 +02:00
Stefan Kangas
63f419f133 ; Minor stylistic fixes found by checkdoc 2021-09-16 19:37:07 +02:00
Protesilaos Stavrou
1431fd91b4 Add faces for shr heading elements (bug#49433)
* etc/NEWS: Document new faces.
* lisp/net/shr.el (shr-h1, shr-h2, shr-h3, shr-h4, shr-h5, shr-h6):
Define new faces.
(shr-tag-h1): Remove inclusion of 'variable-pitch' face.  Fix
bug#49433 by applying a new face directly.
(shr-tag-h2, shr-tag-h3, shr-tag-h4, shr-tag-h5, shr-tag-h6): Apply
new faces.
2021-07-06 17:06:17 +02:00
Stefan Monnier
26041ec8d5 * lisp/net/shr.el (shr-image-displayer): Use proper closures 2021-05-18 19:15:04 -04:00
Ralph Schleicher
9dc28e1fca Add command in eww to toggle images
* lisp/net/eww.el (eww-toggle-images): New function.
(eww-mode-map): Add key binding and menu entry.
* lisp/net/shr.el (shr-inhibit-images): Make it customizable.
* doc/misc/eww.texi (Basics): Document eww-toggle-images.
Fix index entries for shr-use-fonts and shr-use-colors.
(Advanced): Document shr-inhibit-images
(bug#47705).
2021-04-12 10:31:46 +02:00
Eli Zaretskii
0f494760d3 ; * lisp/net/shr.el (shr-insert-document): Fix last change. 2021-04-11 09:35:09 +03:00
Stefan Monnier
d55d07af70 * lisp/net/shr.el (shr-insert-document): Explain why bidi-display-reordering 2021-04-10 20:06:35 -04:00
Stefan Monnier
dc083ebc4e * lisp/net/*.el: Use lexical-binding
Also remove some redundant `:group` arguments.

* lisp/net/eudc-export.el: Use lexical-binding.
(eudc-create-bbdb-record): Use `cl-progv` and `apply` to avoid `eval`.

* lisp/net/eudc-hotlist.el: Use lexical-binding.

* lisp/net/eudc.el (eudc-print-attribute-value): Use `funcall` to avoid
`eval`.

* lisp/net/eudcb-bbdb.el: Use lexical-binding.
(eudc-bbdb-filter-non-matching-record): Use `funcall` to avoid `eval`.
Move `bbdb-val` binding to avoid `setq`.
Use `seq-some` instead of `eval+or`.
(eudc-bbdb-format-record-as-result): Use `dolist` and `pcase`.
Use `funcall` to avoid `eval`.
(eudc-bbdb-query-internal): Simplify a bit.

* lisp/net/eudcb-ldap.el: Use lexical-binding.
(eudc-ldap-get-host-parameter): Use `defalias` to avoid `eval-and-compile`.

* lisp/net/telnet.el: Use lexical-binding.
* lisp/net/quickurl.el: Use lexical-binding.
* lisp/net/newst-ticker.el: Use lexical-binding.
* lisp/net/newst-reader.el: Use lexical-binding.
* lisp/net/goto-addr.el: Use lexical-binding.
* lisp/net/gnutls.el: Use lexical-binding.
* lisp/net/eudcb-macos-contacts.el: Use lexical-binding.
* lisp/net/eudcb-mab.el: Use lexical-binding.

* lisp/net/net-utils.el: Use lexical-binding.
(finger): Remove unused var `found`.

* lisp/net/network-stream.el (open-protocol-stream): Remove redundant
`defalias`.

* lisp/net/newst-plainview.el: Use lexical-binding.
(newsticker-hide-entry, newsticker-show-entry): Remove unused var
`is-invisible`.
(w3m-fill-column, w3-maximum-line-length): Declare vars.

* lisp/net/tramp.el (tramp-compute-multi-hops):
* lisp/net/tramp-compat.el (tramp-compat-temporary-file-directory):
* lisp/net/tramp-cmds.el (tramp-default-rename-file):
* lisp/net/webjump.el (webjump): Don't forget lexical-binding for `eval`.
2021-03-08 10:11:22 -05:00
Basil L. Contovounesios
cccd701ac9 ; Finish recent rename of completion-* predicates. 2021-02-17 13:27:56 +00:00
Lars Ingebrigtsen
2594162b23 Make the button completion predicate be more useful
* lisp/simple.el (completion-button-p): Rework from
`completion-at-point-p'.

* lisp/net/shr.el (shr-show-alt-text): It should be possible to
complete to commands that aren't bound to a key.
2021-02-15 04:42:32 +01:00
Lars Ingebrigtsen
f02c93ae7a Add a possible completion predicate for buttons
* lisp/simple.el (completion-at-point-p): New predicate.

* lisp/net/shr.el (shr-show-alt-text): Mark up as a button.
2021-02-14 20:34:03 +01:00
Paul Eggert
ba05d005e5 Update copyright year to 2021
Run "TZ=UTC0 admin/update-copyright".
2021-01-01 01:13:56 -08:00
Łukasz Stelmach
1e11f6f59d Handle gracefully href="" in base tags in shr
* net/shr.el (shr-tag-base): shr-parse-base can't handle empty
strings gracefully.  Don't call it unless href is a non-empty
string (bug#45355).
2020-12-23 06:26:06 +01:00
Richard M Stallman
7e3a95d8fd Add way to prevent asking "increase specpdl size?"
* net/shr.el (shr-offer-extend-specpdl): New option, default t.
(shr-descend): If shr-offer-extend-specpdl is nil, don't even ask
whether to extend the specpdl, just signal error.
2020-10-15 22:32:41 -04:00
Lars Ingebrigtsen
096f5956be Speed up shr-insert slightly
* lisp/net/shr.el (shr-insert): Speed up regularising spaces --
the vast majority of the spaces are already OK, so transforming
" " to " " just takes time.
2020-09-22 16:02:42 +02:00
Lars Ingebrigtsen
69b5d54311 Fix filling problem in shr due to zero-width id tagging
* lisp/net/shr.el (shr-descend): Fix problem with filling lines
that have a zero-width ID tag at the start.
2020-09-22 16:02:42 +02:00
Lars Ingebrigtsen
163ff19cf3 Fix bug out when indenting inserted images in shr
* lisp/net/shr.el (shr-fill-line): We may not have a
shr-indentation text property here.  In that case, default to the
dynamically bound value.
2020-09-20 13:03:20 +02:00
Lars Ingebrigtsen
7222e975be Fix problem with spurious extra paragraphs in shr
* lisp/net/shr.el (shr-ensure-paragraph): Don't regard <div
id=foo></div> (empty placeholders) as occupying any space (bug#43510).
2020-09-19 19:11:09 +02:00
Lars Ingebrigtsen
9d10a8ca05 Tweak background colours in shr when there's indentation
* lisp/net/shr.el (shr-fill-line): Get the background colour right
for the indentation, too.
2020-08-30 17:03:11 +02:00
Lars Ingebrigtsen
1064b2f65e Extend background colours in shr
* lisp/net/shr.el (shr-colorize-region): Extend backgrounds to the
end (bug#43031).  This avoid ragged edges to the right when, for
instance, the <body> has a bgcolor.
(shr-face-background): Ditto.
2020-08-25 13:57:00 +02:00
Alan Third
8f42b94fe4 Set basic SVG attributes (bug#40845)
* test/manual/image-transforms-tests.el: Replace hard-coded colors
with defaults.
* src/dispextern.h (struct image):
* src/image.c (search_image_cache):
(xbm_load_image):
(xbm_load):
(pbm_load): Rename from frame to face where relevant.
(svg_load_image): Parse the image to find out the size, then wrap it
in another SVG to set a new size and colors, etc.
(lookup_image): Use the face colors instead of the frame colors.
(search_image_cache): Add ability to ignore the face colors.
(uncache_image): Uncache all copies of the image that share the spec,
even if the face colors don't match.
* etc/NEWS: Describe the changes.
2020-08-23 16:28:17 +01:00
Eli Zaretskii
58c7dc69db Fix documentation of a recent change in shr.el
* lisp/net/shr.el (shr-max-width, shr-width): Fix typo and wording
of the doc strings.

* etc/NEWS: Fix the wording of the 'shr-max-width's entry, and
move it to the SHR section.
2020-07-18 17:40:44 +03:00
Lars Ingebrigtsen
02bad11288 Add support for a shr-max-width variable
* doc/misc/eww.texi (Advanced): Document it.

* lisp/net/shr.el (shr-max-width): Add new variable (bug#40909).
(shr-insert-document): Use it.
2020-07-17 15:45:04 +02:00
Lars Ingebrigtsen
c7b112b13f Clarify shr width computation
* lisp/net/shr.el (shr-insert-document): Clarify width
computation: shr-width was checked again in the `else' part where
we already knew it was nil.
2020-07-17 15:30:29 +02:00
Basil L. Contovounesios
bcb58180c7 ; Simplify last change in shr.el
* lisp/net/shr.el (shr-max-columns): Simplify some function calls.
2020-07-17 12:04:09 +01:00
Lars Ingebrigtsen
510da73b4a Fix problems with not rendering shr tables with rowspan
* lisp/net/shr.el (shr-max-columns): When rowspans were in effect,
columns would go missing from subsequent lines (bug#42194).
2020-07-17 03:13:05 +02:00
Basil L. Contovounesios
3dd6b23cdf Propertize all shr fragment IDs as shr-target-id
* lisp/net/shr.el (shr-target-id): Add docstring.
(shr-descend, shr-tag-a): Display dummy anchor characters as the
empty string.  Give all relevant 'id' or 'name' fragment identifier
attributes the shr-target-id text property.  This ensures that
cached content, such as tables, retains the property across
renders.  (Bug#40532)

* lisp/net/eww.el: (eww-display-html): Adapt shr-target-id property
search accordingly.
2020-06-18 16:16:49 +01:00
Basil L. Contovounesios
3a7894ecd1 Improve shr/eww handling of mailto URLs
* lisp/net/eww.el (eww): Use function-put in place of put, as
recommended in "(elisp) Symbol Plists".
(eww-follow-link):
* lisp/net/shr.el (shr-browse-url): Rather than call browse-url-mail
directly, call browse-url which respects the user options
browse-url-handlers and browse-url-mailto-function.  (Bug#41133)
(shr--current-link-region): Return nil if there is no link at point.
(shr--blink-link): Adapt accordingly.
(shr-fill-line, shr-indent, shr-table-body): Refactor to avoid some
unnecessary allocations.
* etc/NEWS: Announce that eww-follow-link and shr-browse-url support
custom URL handlers.
2020-05-22 16:28:20 +01:00
Lars Ingebrigtsen
17691ad2d3 shr comment typo fix
* lisp/net/shr.el (shr-parse-base): Comment typo fix.
2020-02-20 15:15:07 +01:00
Kévin Le Gouguec
b7d5a64f40 Introduce face for <code> elements in shr
* lisp/net/shr.el (shr-tag-code): Don't use the `default' font,
because it has properties that will override surrounding elements
(like <a...>) (bug#39504).
2020-02-20 14:30:54 +01:00
Lars Ingebrigtsen
d9385acac2 Make links in shr use separate mouse highlight regions
* lisp/net/shr.el (shr-urlify): Make adjacent links have separate
mouse hightlights (bug#39115).
2020-01-24 16:26:34 +01:00
Paul Eggert
365e01cc9f Update copyright year to 2020
Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
2020-01-01 00:59:52 +00:00
Robert Pluim
a9fe6dfa90 Fix problem with emacs -nw / eww / svg
* lisp/net/shr.el (shr-parse-image-data): Don't bug out on
non-visual Emacs versions on SVG images (bug#38507).
2019-12-24 17:21:06 +01:00
Lars Ingebrigtsen
0956a65e6f Make shr scale images on all frames
* lisp/net/shr.el (shr-rescale-image): Rescale images even if the
window isn't on the current frame.
2019-10-29 13:56:49 +01:00
Lars Ingebrigtsen
e4a4aa3057 Don't have shr bug out if svg support isn't available
* lisp/net/shr.el (shr-put-image): Don't bug out if SVG support
isn't available.
2019-10-19 10:23:19 +02:00
Juri Linkov
d24a197790 Use tabs in EWW (bug#37592)
* lisp/net/eww.el (eww-open-in-new-buffer): Call tab-new when tab-bar-mode
is enabled.
(eww-browse-url): Add docstring.  Call tab-new when tab-bar-mode
is enabled.

* lisp/net/shr.el (shr-map): Bind [C-down-mouse-1] to
shr-mouse-browse-url-new-window.
(shr-mouse-browse-url-new-window): New command.
(shr-browse-url): Add optional arg new-window.

* doc/misc/eww.texi (Basics): Mention opening tabs on M-RET.
2019-10-07 00:08:10 +03:00
Lars Ingebrigtsen
cbe3f5f720 Touch up previous shr-dom-to-xml encoding change
* lisp/net/shr.el (shr-dom-to-xml): Include an XML declaration if
we're encoding the data.
(shr-parse-image-data): Add comment about why encoding is necessary.
2019-10-03 16:15:22 +02:00
Lars Ingebrigtsen
0b5fe611e9 Fix up previous SVG-multibyte fix
* lisp/net/shr.el (shr-dom-to-xml): For SVG images, take an
optional charset parameter to return unibyte data.
(shr-parse-image-data): Use it.
(shr-tag-svg): Ditto.
(svg--wrap-svg): Revert previous kludge.
2019-10-03 16:15:22 +02:00
Lars Ingebrigtsen
25f45d710e Avoid bugging out on multibyte SVG data in shr
* lisp/net/shr.el (svg--wrap-svg): Ensure that the SVG data is
unibyte.
2019-10-01 21:51:23 +02:00
Lars Ingebrigtsen
542b78edde Fix rendering of degenerate tables some more in shr.el
* lisp/net/shr.el (shr--fix-tbody): New function (bug#31665).
(shr--fix-table): Use it to fix the
<table><tbody>foo</tbody></table> case.
2019-09-30 07:27:46 +02:00
Lars Ingebrigtsen
9f9dca57c6 shr table fix refactoring
* lisp/net/shr.el (shr--fix-table): Refactor out into own function
from...
(shr-tag-table): ... this function.
2019-09-30 07:17:12 +02:00
Lars Ingebrigtsen
7823dcf2fb Slight shr-put-image clean up
* lisp/net/shr.el (shr-put-image): Use image-multi-frame-p
directly, and remove outdated comments (image-multi-frame-p
returns the delay).
2019-09-24 19:38:21 +02:00
Lars Ingebrigtsen
ea5c79f657 Allow controlling when to send cookies when retrieving images in shr
* lisp/net/shr.el (shr--use-cookies-p): New function.
(shr-tag-img): Use it.
(shr-cookie-policy): New variable.
(shr-save-contents): Use cookies.

* doc/misc/eww.texi (Advanced): Document it.
2019-09-24 17:48:41 +02:00
Lars Ingebrigtsen
bdc222b268 Tweak how much <sup>/<sub> raises/lowers text in shr
* lisp/net/shr.el (shr-tag-sup, shr-tag-sub): Raising by 0.5 gives
very ugly displays.  0.2 seems sufficient for legibility.
2019-09-23 16:05:16 +02:00
Lars Ingebrigtsen
7156b0efc7 Minor svg wrap tweak
* lisp/net/shr.el (svg--wrap-svg): Add the size to the wrapper to
avoid having the SVG images shrink (bug#37159).
2019-09-19 16:07:58 +02:00
Lars Ingebrigtsen
2d8c8950b9 Further fix-ups for SVG wrapping in shr
* lisp/net/shr.el (svg--wrap-svg): Add the size to the wrapper to
avoid having the SVG images shrink (bug#37159).
2019-09-19 15:58:34 +02:00
Juanma Barranquero
79a01866a0 lisp/*.el, src/*.c: Fix typos in docstrings
* lisp/apropos.el (apropos-do-all):
* lisp/auth-source-pass.el (auth-source-pass--select-from-entries):
* lisp/auth-source.el (auth-source-user-or-password):
* lisp/calc/calc-forms.el (math-tzone-names):
* lisp/calendar/diary-lib.el (diary-face-attrs)
(diary-mark-entries-1):
* lisp/cedet/cedet-files.el (cedet-files-list-recursively):
* lisp/cedet/ede.el (ede-constructing, ede-deep-rescan):
* lisp/cedet/ede/cpp-root.el (ede-cpp-root-header-file-p):
* lisp/cedet/ede/proj.el (ede-proj-target-makefile):
* lisp/cedet/inversion.el (inversion-check-version)
(inversion-test):
* lisp/cedet/mode-local.el (mode-local-map-file-buffers):
* lisp/cedet/semantic/complete.el (semantic-displayer-ghost):
* lisp/cedet/semantic/db-find.el (semanticdb-find-translate-path-default):
* lisp/cedet/semantic/db.el (semanticdb-table)
(semanticdb-search-system-databases):
* lisp/cedet/semantic/imenu.el (semantic-imenu-index-directory):
* lisp/cedet/semantic/java.el (semantic-java-doc-keywords-map):
* lisp/cedet/semantic/lex-spp.el (semantic-lex-spp-use-headers-flag):
* lisp/cedet/semantic/lex.el (semantic-lex-make-keyword-table)
(semantic-lex-make-type-table, semantic-lex-debug-analyzers):
* lisp/cedet/semantic/tag-ls.el (semantic-tag-abstract-p)
(semantic-tag-leaf-p, semantic-tag-static-p)
(semantic-tag-prototype-p):
* lisp/dnd.el (dnd-open-remote-file-function, dnd-open-local-file):
* lisp/emacs-lisp/eieio-opt.el (eieio-build-class-alist)
(eieio-read-class, eieio-read-subclass):
* lisp/emacs-lisp/generator.el (cps--replace-variable-references)
(cps--handle-loop-for):
* lisp/erc/erc-dcc.el (erc-dcc-list, erc-dcc-member, erc-dcc-server)
(erc-dcc-auto-mask-p, erc-dcc-get-file, erc-dcc-chat-accept):
* lisp/eshell/em-pred.el (eshell-pred-file-type):
* lisp/faces.el (defined-colors-with-face-attributes):
* lisp/font-core.el (font-lock-mode):
* lisp/frame.el (frame-restack):
* lisp/net/shr.el (shr-image-animate):
* lisp/org/org-agenda.el (org-agenda-change-all-lines)
(org-agenda-today-p):
* lisp/org/org-id.el (org-id-get):
* lisp/org/org.el (org-highlight-latex-and-related)
(org--valid-property-p):
* lisp/org/ox-beamer.el (org-beamer--get-label):
* lisp/org/ox-latex.el (org-latex--caption-above-p):
* lisp/org/ox-odt.el (org-odt--copy-image-file)
(org-odt--copy-formula-file):
* lisp/org/ox.el (org-export-with-timestamps):
* lisp/progmodes/verilog-mode.el (verilog-indent-declaration-macros):
* lisp/ses.el (ses-file-format-extend-parameter-list):
* lisp/term.el (ansi-term):
* lisp/textmodes/bibtex.el (bibtex-no-opt-remove-re)
(bibtex-beginning-of-first-entry, bibtex-autokey-get-title)
(bibtex-read-key, bibtex-initialize):
* lisp/textmodes/flyspell.el (flyspell-word):
* lisp/view.el (view-mode-exit):
* src/composite.c:
* src/floatfns.c (Fisnan): Fix typos in docstrings.
2019-09-19 04:32:25 +02:00