Don't increment array index in cl-loop twice (Bug#40727)
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): Put the temp-idx
increment in cl--loop-body, leaving just the side-effect free testing
of the index for both cl--loop-body and cl--loop-conditions.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-loop-and-arrays):
Extend test to cover this case.
Revert "cl-loop: Calculate the array length just once"
It fails when using 'and' (parallel bindings) for arrays (Bug#40727).
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): Revert to
recomputing array length.
* test/lisp/emacs-lisp/cl-macs-tests.el (cl-macs-loop-and-arrays): New
test.
* lisp/dnd.el (dnd-handle-one-url): Don't require browse-url twice
in the same function. Declare non-autoloaded browse-url-handlers to
silence byte-compiler.
Tassilo Horn [Wed, 6 May 2020 20:23:03 +0000 (22:23 +0200)]
Restore HTML rendering behavior of browse-url-of-buffer/file.
* lisp/net/browse-url.el (browse-url-default-handlers): Add a browser
handler for HTML page file:// URLs before the generic file:// handler.
(browse-url--browser): New defun.
Glenn Morris [Wed, 6 May 2020 16:28:36 +0000 (09:28 -0700)]
; Merge from origin/emacs-27
The following commits were skipped:
1e09364d67 ; Mark Bug#29799 tests as failing since we reverted the fix de1b33f5a8 Revert "cl-loop: Calculate the array length just once" caf155c463 Revert "cl-loop: Add missing guard condition" 79e133da03 Revert "Refix conditional step clauses in cl-loop"
Tassilo Horn [Wed, 6 May 2020 14:48:57 +0000 (16:48 +0200)]
Consult browse-url-{default-,}handlers in drag&drop.
* lisp/dnd.el (dnd-handle-one-url): Consult `browse-url-handlers' and
`browse-url-default-handlers' for a matching handler. Adapt
docstring.
* doc/lispref/frames.texi (Drag and Drop): Remove the docs for the
deprecated alist choice of `browse-url-browser-function' and mention
`browse-url-handlers' and `browse-url-default-handlers'.
Tassilo Horn [Mon, 4 May 2020 09:24:08 +0000 (11:24 +0200)]
Allow for custom URL handlers in browse-url.
* lisp/net/browse-url.el (browse-url-handlers): New defcustom.
(browse-url-default-handlers): New defvar.
(browse-url): Use them. Adapt docstring. Issue a warning pointing to
browse-url-handlers when browse-url-browser-function is an alist.
(browse-url--mailto, browse-url--man): New functions.
(browse-url--browser-defcustom-type): Add :doc that the alist usage is
deprecated.
(browse-url-browser-function): Remove documentation referring to the
alist usage and mention browse-url-handlers.
* doc/emacs/misc.texi: Document browse-url-handlers in Browse-URL
node.
* etc/NEWS: Mention browse-url-default-handlers and
browse-url-handlers.
Stefan Kangas [Wed, 6 May 2020 01:30:20 +0000 (03:30 +0200)]
Prefer 'strong' and 'em' to 'b' and 'i' in html-mode
* lisp/textmodes/sgml-mode.el (html-face-tag-alist): Prefer inserting
'strong' and 'em' tags to 'b' and 'i' in html-mode. (Bug#41031)
* lisp/textmodes/sgml-mode.el (html-mode): Update docstring to do the
same.
Paul Eggert [Wed, 6 May 2020 00:16:49 +0000 (17:16 -0700)]
Don’t assume __has_attribute in emacs-module.c
Problem reported by Glenn Morris in:
https://lists.gnu.org/r/emacs-devel/2020-05/msg00724.html
* src/emacs-module.c: Use HAS_ATTRIBUTE instead of assuming
the compiler supports __has_attribute.
Paul Eggert [Tue, 5 May 2020 07:48:48 +0000 (00:48 -0700)]
Fix typos in recent attribute.h simplification
Problem reported by Andreas Schwab in:
https://lists.gnu.org/r/emacs-devel/2020-05/msg00650.html
* src/conf_post.h (HAS_ATTR_no_sanitize): Define to false in case
cpp is picky, fixing a longstanding glitch here.
(ATTRIBUTE_NO_SANITIZE_ADDRESS, ATTRIBUTE_NO_SANITIZE_UNDEFINED):
Use HAS_ATTRIBUTE, not __has_attribute.
Alan Mackenzie [Mon, 4 May 2020 18:26:38 +0000 (18:26 +0000)]
Remove calls to non-existent functions from edebug.el.
Do not merge to master.
*lisp/emacs-lisp/edebug.el (edebug--display-1)
(edebug-toggle-disable-breakpoint): Remove calls to
edebug--overlay-breakpoints and edebug--overlay-breakpoints-removed which had
been overlooked in a recent changed to edebug.
Dmitry Gutov [Sun, 3 May 2020 23:56:10 +0000 (02:56 +0300)]
Honor search-upper-case
* lisp/fileloop.el (fileloop--case-fold):
Extract from existing code. Honor search-upper-case (bug#40940).
(fileloop-initialize-replace, fileloop-initialize-search): Use it.
Update the docstring.
Juri Linkov [Sun, 3 May 2020 22:31:44 +0000 (01:31 +0300)]
Revert part of recent commit 85544f8ef5 (bug#40808)
* lisp/isearch.el (isearch-lazy-highlight-search): Remove recent fix of
lazy-highlighting of hidden matches. In emacs-27 leave only the fix for
lazy-counting of hidden matches when isearch-lazy-count is non-nil.
Paul Eggert [Sun, 3 May 2020 22:06:58 +0000 (15:06 -0700)]
Simplify by using attribute.h macros
attribute.h is partly designed for C2X forward compatibility,
since C2X will add some standard attributes. Using its macros
should help insulate Emacs from C2X teething problems.
* src/conf_post.h: Include attribute.h.
(HAS_ATTRIBUTE, HAS_FEATURE): Rename from __has_attribute and
__has_feature, to avoid polluting the builtin namespace.
All uses changed.
(ATTRIBUTE_COLD, ATTRIBUTE_FORMAT, FALLTHROUGH, ATTRIBUTE_CONST)
(ATTRIBUTE_PURE, ATTRIBUTE_UNUSED, ATTRIBUTE_MAY_ALIAS)
(ATTRIBUTE_MALLOC, ATTRIBUTE_ALLOC_SIZE)
(ATTRIBUTE_RETURNS_NONNULL): Remove, as attribute.h does this now.
(NO_INLINE, EXTERNALLY_VISIBLE, ARG_NONNULL, ATTRIBUTE_UNUSED):
Simplify by defining in terms of attribute.h macros.
* src/systhread.h (ATTRIBUTE_WARN_UNUSED_RESULT): Remove.
All uses replaced by attribute.h’s NODISCARD.
Paul Eggert [Sun, 3 May 2020 21:57:10 +0000 (14:57 -0700)]
Update from Gnulib
This incorporates:
2020-05-03 attribute: new module
2020-04-13 explicit_bzero: improve code style
2020-04-13 explicit_bzero: On native Windows, use SecureZeroMemory
2020-04-13 explicit_bzero: use memset_s() when available
2020-04-04 maint: remove a stray inter-word space
* build-aux/config.guess, build-aux/config.sub:
* build-aux/gitlog-to-changelog, build-aux/update-copyright:
* doc/misc/texinfo.tex, lib/explicit_bzero.c, lib/ieee754.in.h:
* lib/nstrftime.c, m4/explicit_bzero.m4, m4/gnulib-common.m4:
Copy from Gnulib.
* lib/attribute.h: New file, copied from Gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lisp/calculator.el (calculator-string-to-number): Convert decimal
numbers input to float, fixing a regression introduced in f248292ede.
Reported by Aitor Soroa.
Glenn Morris [Sun, 3 May 2020 14:50:21 +0000 (07:50 -0700)]
Merge from origin/emacs-27
0a3731feef Make memq etc. examples more like they were ed25282b82 Document effect of 'search-upper-case' on replacement comm... 5a5d8a8ec0 * lisp/desktop.el (desktop-save): Doc fix. (Bug#41007)
Glenn Morris [Sun, 3 May 2020 14:50:20 +0000 (07:50 -0700)]
Merge from origin/emacs-27
1f17193e00 Expand file name for remote dirs as well 7a12ab5ea2 Fix project.el commands in "transient" projects 274ec97e3c Make sure alist-related functions say so in their doc
Stefan Kangas [Sun, 3 May 2020 14:19:09 +0000 (16:19 +0200)]
Improve indentation of 'loop' forms
* lisp/emacs-lisp/cl-indent.el (lisp-loop-keyword-indentation)
(lisp-loop-forms-indentation, lisp-simple-loop-indentation): Use a
more standard indentation of 'loop' forms. (Bug#2160)
Eli Zaretskii [Sun, 3 May 2020 13:53:53 +0000 (16:53 +0300)]
Improve accuracy of apropos commands that search doc strings
It is conceptually wrong for apropos commands that search doc
strings to look for matches of several words only on the same
line, because division of doc strings between lines is
ephemeral.
* lisp/apropos.el (apropos-parse-pattern): Accept an optional
argument MULTILINE-P, and if that is non-nil, produce regexps that
match words in the list even if they are separated by line
boundaries.
(apropos-value, apropos-local-value, apropos-documentation): Use
the new optional argument in apropos commands that search
multiline text, such as doc strings.
* src/search.c (Fposix_looking_at, Fposix_string_match)
(Fposix_search_backward, Fposix_search_forward): Make sure Posix
appears in the doc strings near REGEXP, for better matches.
Michael Albinus [Sun, 3 May 2020 11:59:08 +0000 (13:59 +0200)]
Improve Tramp debug messages
* lisp/net/tramp-cache.el (tramp-get-file-property)
(tramp-get-connection-property): Improve debug messages.
Suggested by Marc Herbert <marc.herbert@gmail.com>.
Paul Eggert [Sat, 2 May 2020 20:48:21 +0000 (13:48 -0700)]
Make memq etc. examples more like they were
Problem reported by Štěpán Němec in:
https://lists.gnu.org/r/emacs-devel/2020-05/msg00130.html
* doc/lispref/lists.texi (Sets And Lists, Association Lists):
Revert examples to be more like the way they were, using
self-evaluating expressions. Be more consistent about listing
unspecified results.
Stefan Kangas [Sat, 2 May 2020 20:41:20 +0000 (22:41 +0200)]
Improve Info-mode doc and menu
* lisp/info.el (Info-mode-menu): Re-arrange to be more logical, move
items into submenus, add 'Info-directory' and separators.
(Info-mode): Add 'end-of-buffer' to doc string. (Bug#39042)
Michael Albinus [Sat, 2 May 2020 10:48:55 +0000 (12:48 +0200)]
;; Revert recent change in tramp-cache.el
* lisp/net/tramp-cache.el (tramp-dump-connection-properties):
Remove compatibility code dumping the persistency file. Use
`emacs-lisp-mode' for backward compatibility.
Eli Zaretskii [Sat, 2 May 2020 08:45:05 +0000 (11:45 +0300)]
Fix 'count-screen-lines' when lines are truncated
* lisp/window.el (count-screen-lines): Fix the return value when
lines are truncated in the window, and the end of the region is
invisible due to this truncation. (Bug#40849)
Eli Zaretskii [Sat, 2 May 2020 07:54:01 +0000 (10:54 +0300)]
Document effect of 'search-upper-case' on replacement commands
* doc/emacs/search.texi (Replacement and Lax Matches): Document
the role of 'search-upper-case' in replacement commands.
(Lax Search): Document the value 'not-yanks' of
'search-upper-case' where the variable itself is documented.
* lisp/replace.el (query-replace-regexp, query-replace): Mention
'search-upper-case' and its effect in doc strings. (Bug#40940)
João Távora [Fri, 1 May 2020 12:24:56 +0000 (13:24 +0100)]
Consolidate lisp/jsonrpc.el logging in single events buffer
For inferior processes having useful stderr, it is no longer
cumbersome to switch between different buffers to correlate error
messages with transport-level JSONRPC messages.
The existing stderr and stdout buffers can still be found hidden away
from the normal buffer list.
An original idea of Tobias Rittweiler <trittweiler@gmail.com>.
* lisp/jsonrpc.el (initialize-instance jsonrpc-process-connection):
Setup after-change functions stderr buffer. Hide stderr and stdout
buffers.
(jsonrpc--log-event): Don't output extra newline. Tweak log format.
(Version): Bump to 1.0.10
* lisp/bookmark.el (bookmark-insert-file-format-version-stamp)
(save-place-alist-to-file): Delimit file-local variables on the -*-
line with semicolons.
* lisp/files.el (auto-mode-alist): Use shy regexp group.
Alan Mackenzie [Fri, 1 May 2020 12:23:15 +0000 (12:23 +0000)]
Protect non-selected face spec components in custimize-face. Fixes bug #40866
* lisp/cus-edit.el (custom-face-save): If the current face widget is only
displaying part of the face spec, temporarily set it to "display" the whole
spec around the call to custom-face-mark-to-save.
João Távora [Sat, 18 Apr 2020 01:46:04 +0000 (02:46 +0100)]
Add lisp-data-mode for editing non-code Lisp data
Fixes: bug#40573
The new mode can be used stand-alone or inherited from by modes
intended to edit programs. The existing emacs-lisp-mode and lisp-mode
are examples.
Thanks to Juri Linkov and Basil L. Contovounesios for researching some
data files in Emacs that can be automatically set to use the new mode.
* lisp/files.el (auto-mode-alist): Add entry for ".dir-locals" and
".dir-locals-2"
* lisp/emacs-lisp/lisp-mode.el: (lisp-data-mode): New major mode.
(lisp-mode): Inherit from lisp-data-mode. Set special lisp-mode
stuff here.
* lisp/progmodes/elisp-mode.el (emacs-lisp-mode): Inherit from
lisp-data-mode.
* lisp/bookmark.el (bookmark-insert-file-format-version-stamp):
Use lisp-data-mode.
* lisp/saveplace.el (save-place-alist-to-file): Use
lisp-data-mode.
* lisp/net/eww.el (eww-write-bookmarks): Use lisp-data-mode.
* lisp/net/nsm.el (nsm-write-settings): Use lisp-data-mode.
* lisp/net/tramp-cache.el (tramp-dump-connection-properties): Use
lisp-data-mode.
* etc/NEWS: Mention lisp-data-mode.
* doc/lispref/modes.texi (Example Major Modes): Update example.
* lisp/calculator.el (calculator-string-to-number): Convert decimal
numbers input to float, fixing a regression introduced in f248292ede.
Reported by Aitor Soroa.
* lisp/calculator.el (calculator-string-to-number): Convert decimal
numbers input to float, fixing a regression introduced in f248292ede.
Reported by Aitor Soroa.