Add `regexp-unmatchable' as a standard unmatchable regexp, defined as
"\\`a\\`". Use it where such a regexp is needed, replacing slower
expressions in several places.
From a suggestion by Philippe Schnoebelen.
John Shahid [Wed, 15 May 2019 14:29:58 +0000 (16:29 +0200)]
Avoid infinitly looping in tramp-interrupt-process (bug#35506)
* lisp/net/tramp.el (tramp-interrupt-process): Remove with-timeout.
Instead pass a timeout to tramp-accept-process-output.
tramp-accept-process-output stops timers from running which makes the
with-timeout ineffective.
Don't have url-basic-auth bug out when called with an URL string
* lisp/url/url-auth.el (url-basic-auth): Pass the parsed URL
object to the prompting function instead of the parameter that's
possibly a string (bug#26708). Passing url-basic-auth with a
string parameter would fail if passed a non-parsed URL.
* lisp/url/url-http.el
(url-http-chunked-encoding-after-change-function): Ensure that we
parse the entire initial chunked header as the length (bug#35658).
Glenn Morris [Wed, 15 May 2019 00:18:18 +0000 (17:18 -0700)]
Merge from origin/emacs-26
02bee78 Let dir locals for more specific modes override those from less b1235f9 Improve documentation of Hexl mode 32d1813 Fix description of (move-to-column <n> t) when column <n> is ... 0397b7c ; Fix smtpmail-stream-type docstring 7dab3ee Recognize single quote attribute values in nxml and sgml (Bug... e4cde42 Disable extra display of in nxml-mode (Bug#32897) ca14dd1 Fix nxml-get-inside (Bug#32003) e7ab351 Fix positioning client buffer as instructed by emacsclient
Paul Eggert [Mon, 13 May 2019 19:43:13 +0000 (12:43 -0700)]
Backport: fix broken build on m68k
The GCC + valgrind fix caused the m68k build to fail (Bug#35711).
Simplify string allocation a bit to make similar problems less
likely in the future.
* src/alloc.c (sdata, SDATA_NBYTES, SDATA_DATA) [GC_CHECK_STRING_BYTES]:
Use the same implementation as with !GC_CHECK_STRING_BYTES,
as the special case is no longer needed.
(SDATA_ALIGN): New constant.
(SDATA_SIZE): Remove this macro, replacing with ...
(sdata_size): ... this new function. All uses changed.
Properly account for sizes and alignments even in the m68k case,
and even if GC_CHECK_STRING_BYTES is not defined.
Paul Eggert [Tue, 14 May 2019 05:59:29 +0000 (22:59 -0700)]
Default to disabling ImageMagick (Bug#33587)
ImageMagick has continuing stability and security problems, suggesting
that 'configure' should disable it by default. See Glenn Morris's notes
at: https://lists.gnu.org/r/emacs-devel/2018-12/msg00036.html
* INSTALL, etc/NEWS, nt/INSTALL.W64: Mention this.
* configure.ac (imagemagick): Default to off.
Dmitry Gutov [Tue, 14 May 2019 02:09:19 +0000 (05:09 +0300)]
Allow customizing the display of project file names when reading
To hopefully resolve a long-running discussion
(https://lists.gnu.org/archive/html/emacs-devel/2019-05/msg00162.html).
* lisp/progmodes/project.el (project-read-file-name-function):
New variable.
(project--read-file-absolute, project--read-file-cpd-relative):
New functions, possible values for the above.
(project-find-file-in): Use the introduced variable.
(project--completing-read-strict): Retain just the logic that fits
the name.
Avoid artifacts in ftx and ftcr font backend drivers
* src/ftcrfont.c (ftcrfont_open):
* src/ftfont.c (ftfont_open2): Make font->height equal to sum of font->ascent
and font->descent. Respect :minspace property.
(ftfont_open2): Remove redundant assignment.
(syms_of_ftfont) <QCminspace>: New DEFSYM.
Kévin Le Gouguec [Sun, 12 May 2019 16:36:09 +0000 (18:36 +0200)]
Stop splicing anonymous faces in font-lock-append-text-property
This is the same fix as 2019-04-29 "Refrain from splicing anonymous
faces in text properties", which was only applied to
font-lock-prepend-text-property.
* lisp/font-lock.el (font-lock-append-text-property): Distinguish list
of faces from property list.
* test/lisp/font-lock-tests.el: New test suite.
Noam Postavsky [Mon, 6 May 2019 23:55:17 +0000 (19:55 -0400)]
Handle GNUTLS_E_AGAIN in emacs_gnutls_read (Bug#34341)
Don't merge to master, this has already been fixed there by 2019-01-15
"Fix unlikely races with GnuTLS, datagrams".
* src/gnutls.c (emacs_gnutls_read): Similar to emacs_gnutls_write,
when gnutls_record_recv returns GNUTLS_E_AGAIN set errno to EGAIN.
Robert Pluim [Mon, 13 May 2019 20:45:16 +0000 (16:45 -0400)]
Document nil value of message-signature and mail-signature
* lisp/gnus/message.el (message-signature): Allow nil as a
customizable value, and describe its effect.
* lisp/mail/sendmail.el (mail-signature): Describe effect of nil
value (bug#32680).
Make eww understand #fragment URLs at point interactively
* lisp/net/eww.el (eww-suggest-uris): Use
thing-at-point-url-at-point instead of url-get-url-at-point
(bug#31927) because it's much better at guessing what the URL
actually is (especially with #fragments).
Paul Eggert [Mon, 13 May 2019 19:43:13 +0000 (12:43 -0700)]
Fix broken build on m68k
The GCC + valgrind fix caused the m68k build to fail (Bug#35711).
Simplify string allocation a bit to make similar problems less
likely in the future.
* src/alloc.c (sdata, SDATA_NBYTES, SDATA_DATA) [GC_CHECK_STRING_BYTES]:
Use the same implementation as with !GC_CHECK_STRING_BYTES,
as the special case is no longer needed.
(SDATA_ALIGN): New constant.
(SDATA_SIZE): Remove this macro, replacing with ...
(sdata_size): ... this new function. All uses changed.
Properly account for sizes and alignments even in the m68k case,
and even if GC_CHECK_STRING_BYTES is not defined.
* lisp/net/shr.el (shr-mark-fill, shr-insert-table): Fix problems
when block-quoting/<li>-ing a table -- the indentation/prefix was
inserted twice (bug#32277).
Neil Roberts [Fri, 10 May 2019 10:57:28 +0000 (12:57 +0200)]
Let dir locals for more specific modes override those from less
The list of dir local variables to apply is now sorted by the number
of parent modes of the mode used as the key in the association list.
That way when the variables are applied in order the variables from
more specific modes will override those from less specific modes.
If there are directory entries in the list then they are sorted in
order of name length. The list of modes for that dir is then
recursively sorted with the same mechanism. That way variables tied
to a particular subdirectory override those in in a parent directory.
Previously the behaviour didn’t seem to be well defined anyway and was
dependent on the order they appeared in the file. However this order
was changed in version 26.1 and it probably also depended on the
number of dir-local files that are merged.
Bug#33400
* lisp/files.el (dir-locals-get-sort-score, dir-locals-sort-variables)
(dir-locals-read-from-dir): Sort the dir locals so that more precise
modes and directory-specific entries have override lesser ones.
* doc/emacs/custom.texi (Directory Variables): Document the priority.
Noam Postavsky [Sun, 5 May 2019 17:24:15 +0000 (13:24 -0400)]
Improve printing for named keyboard macros (Bug#35486)
* lisp/macros.el (macros--insert-vector-macro): New function,
extracted from insert-kbd-macro.
(insert-kbd-macro): Use it and kmacro-extract-lambda to produce nicer
expressions for macros produced by kmacro-lambda-form.
Noam Postavsky [Sun, 5 May 2019 13:13:19 +0000 (09:13 -0400)]
Use remapping in ffap-bindings (Bug#35577)
* lisp/ffap.el (ffap-bindings): Bind to the [remap COMMAND] instead of
hardcoding the default keybindings. This better adapts better if
non-default are used. And lets the original keybindings be
remembered, so that, e.g., \[find-file] in docstrings will still be
substituted with C-x C-f (even though that binding has been remapped
to find-file-at-point.
* lisp/gnus/gnus-sum.el (gnus-summary-widget-forward)
(gnus-summary-widget-backward): Signal more informative error if
article window is not found. Consider other frames displaying
article buffer, and raise its frame before navigating its
widgets. (bug#35565)
* lisp/gnus/gnus-win.el (gnus-get-buffer-window): Simplify and add
docstring.
Make application/x-patch inlinable in mm-decode.el
* lisp/gnus/mm-decode.el (mm-inline-media-tests, mm-inlined-types):
Include application/x-patch as a synonym of text/x-patch and
text/x-diff. (bug#35236)
* lisp/gnus/gnus-msg.el (gnus-gcc-externalize-attachments):
Fix custom :type.
(gnus-debug-files, gnus-debug-exclude-variables): Mark variables
that have been unused since Emacs 24.1 as obsolete.
(gnus-check-before-posting): Remove unused variable.
If you do `C-h k ... mouse-1 in other frame` (at least if you have a focus
that follows the mouse), then additionally to the down-mouse-1 and mouse-1
events, a `switch-frame` event (and `select-window` event as well sometimes)
is generated. When `read-key-sequence` is called with nil for
`can-return-switch-frame`, this event is not returned but kept for later,
which causes a subsequent `sit-for` to return nil immediately.
This interfered without our "wait for double-click" which in turn prevented
us from stopping after the mouse-1 click, getting stuck waiting for something
else instead.
(help--read-key-sequence): Pass a non-nil `can-return-switch-frame`, so the
subsequent `sit-for` returns more trustworthy information.
Noam Postavsky [Tue, 7 May 2019 12:18:49 +0000 (08:18 -0400)]
Stop using message-default-charset (Bug#35370)
In 2016-02-14 "Remove compat code for older Emacsen",
message-default-charset was obsoleted, and a couple of uses were
removed, but others were left behind.
* lisp/gnus/message.el (message-send-mail)
(message-send-news, message-do-fcc)
(message-encode-message-body):
* lisp/gnus/mml.el (mml-to-mime): Stop using message-default-charset.
Alan Mackenzie [Fri, 10 May 2019 10:21:09 +0000 (10:21 +0000)]
Optimize CC Mode a bit for repetitive insertion and replace-regexp
This is mainly by enhancing a parse-partial-sexp cache to retain recently
calculated values. Also, there are several miscellaneous optimizations and
bug fixes.
* lisp/progmodes/cc-engine.el (c-state-semi-nonlit-near-cache): New buffer
local variable.
(c-state-semi-trim-near-cache, c-state-semi-get-near-cache-entry)
(c-state-semi-put-near-cache-entry, c-state-semi-trim-cache): New functions.
(c-state-semi-pp-to-literal, c-state-full-pp-to-literal): Use the new "near"
cache.
(c-parse-ps-state-below): Use the new function c-state-semi-trim-cache.
(c-before-change-check-<>-operators): Check simply for < or > in the
neighbourhood before doing more expensive processing.
(c-maybe-re-mark-raw-string): Give a backward search limit to an operation
which was needlessly lacking one.
* lisp/progmodes/cc-mode.el (c-doc-fl-decl-start, c-doc-fl-decl-end): Check a
certain regexp is valid before performing the (somewhat expensive) actions of
these functions.
(c-fl-decl-start): In the search for a C++ lambda capture list, replace (slow)
calculation of c-parse-state by a (less slow) c-go-up-list-backward.
Recognize single quote attribute values in nxml and sgml (Bug#35381)
* lisp/textmodes/sgml-mode.el (sgml-specials): Add single quote.
(sgml-syntax-propertize-rules): Handle single quote.
* test/lisp/nxml/nxml-mode-tests.el (nxml-mode-font-lock-quotes): New
test.
* test/lisp/textmodes/sgml-mode-tests.el
(sgml-delete-tag-bug-8203-should-not-delete-apostrophe): Now passes.
The change from 2016-01-16 "lisp/nxml: Use syntax-tables for comments"
made nxml-get-inside return non-nil for any string or comment,
including attribute strings. This caused incorrect and therefore
indentation.
* lisp/nxml/nxml-rap.el: Update commentary to reflect changes to
nxml-mode parsing.
(nxml-get-inside): Only return non-nil when inside comments and
generic strings, not normal quote-delimited strings.
* test/lisp/nxml/nxml-mode-tests.el: New tests.
Stefan Monnier [Wed, 8 May 2019 19:18:32 +0000 (15:18 -0400)]
* lisp/emacs-lisp/syntax.el (syntax-propertize): `ignore` is like nil
(syntax-ppss-after-change-function): Mark it as obsolete.
* lisp/font-lock.el (font-lock-apply-syntactic-highlight):
Use syntax-ppss-flush-cache instead.
Eli Zaretskii [Wed, 8 May 2019 17:34:09 +0000 (20:34 +0300)]
Fix positioning client buffer as instructed by emacsclient
* lisp/server.el (server-switch-buffer): Let-bind
switch-to-buffer-preserve-window-point to nil when switching
to the client buffer, when the client requested a specific
position. (Bug#35602)
Paul Eggert [Wed, 8 May 2019 15:37:40 +0000 (08:37 -0700)]
Port LIBRSVG_CHECK_VERSION fix to picky cpp
* src/image.c (LIBRSVG_CHECK_VERSION): Define to yield false
if it isn’t already defined.
(svg_load_image): Port to C preprocessors that check the
syntax of the entire preprocessing expression before
evaluating any of it.
Vitalie Spinu [Wed, 8 May 2019 09:12:29 +0000 (11:12 +0200)]
Fix incorrect cloning of eieio-instance-inheritor objects (Bug#34840)
* lisp/emacs-lisp/eieio-base.el (clone): Unbound slots of
eieio-instance-inheritor objects as documented in the docs string
and implemented in the original eieio implementation.
Eli Zaretskii [Wed, 8 May 2019 06:29:20 +0000 (09:29 +0300)]
Add an assertion to xdisp.c
* src/xdisp.c (display_mode_element): Add an assertion where
we assume that 'string' returned by decode_mode_spec is always
either a Lisp string or nil.
(flymake-start-syntax-check-on-newline): Mark it obsolete.
(flymake-after-change-function): Remove obsolete variable
flymake-start-syntax-check-on-newline (temporarily renamed to
flymake-start-on-newline). (Bug#34294)
Paul Eggert [Tue, 7 May 2019 19:26:40 +0000 (12:26 -0700)]
Pacify GCC 9.1
* src/intervals.c (set_intervals_multibyte_1): Omit unused temps.
* src/xdisp.c (display_mode_element): Use !NILP instead of
STRINGP. This convinces GCC we’re not dereferencing a
possibly-null pointer, and should be a bit faster anyway.
John Shahid [Mon, 29 Apr 2019 17:53:38 +0000 (13:53 -0400)]
Fix setting and resetting of scroll-with-delete
The start and end lines of the scroll region must to be in the range
[0,term-height). There are few placees that incorrectly set the end
line of the scroll region to term-height which is outside the valid
range. Combined with another off-by-one error in
term-set-scroll-region's clamping logic, this would cause
term-scroll-with-delete to be unnecessarily turned on.
* lisp/term.el (term-scroll-start,term-scroll-end): Use defvar-local
to define the variables and document the valid range of values that
the variables can take.
(term--last-line): New function to calculate the 0-based index of the
last line.
(term--reset-scroll-region): New function to reset the scroll region
to the full height of the terminal.
(term-mode,term-reset-size,term-reset-terminal): Call
term--reset-scroll-region to reset the scroll region.
(term-set-scroll-region): Fix the off-by-one error in the clamping
logic which allowed term-scroll-end to have values outside the valid
range [0,term-height).
Stefan Monnier [Tue, 7 May 2019 17:41:54 +0000 (13:41 -0400)]
* src/marker.c (buf_bytepos_to_charpos): Re-add the CHAR_HEAD_P assertion
This assertion was removed in 1c349c62305d432abf0fa2b6e3f5d754fe4cab79
because the assumption was invalid during set_intervals_multibyte_1.
So we change set_intervals_multibyte_1 to solve the problem in the same
way as in the rest of Fset_buffer_multibyte, which actually simplifies
the code.
* src/buffer.c (advance_to_char_boundary): Not static any more.
* src/buffer.h (advance_to_char_boundary): Add prototype.
* src/intervals.c (set_intervals_multibyte_1): Use it.
* doc/lispref/commands.texi (Input Events): Specify that events are
non-nil and remove vestiges of bug#10190.
* doc/lispref/os.texi (Recording Input): Document optional argument
of recent-keys.
* lisp/subr.el (eventp): Check that the car of conses is non-nil.
* etc/NEWS: Announce it as an incompatible change.
* src/keyboard.c (Frecent_keys): Clarify that returned "events" are
not real events.
John Shahid [Sun, 28 Apr 2019 19:59:50 +0000 (15:59 -0400)]
Prevent accidental edits in the ansi-term buffer from breaking resizing
* lisp/term.el (term-unwrap-line, term-emulate-terminal): Prevent the
`term-line-wrap` property of newlines from spreading accidentally
when inserting text next to it.
* lisp/progmodes/cc-engine.el (c-beginning-of-statement-1): The variable
before-sws-pos should record the position of a closing paren/brace/bracket
before moving backwards over a sexp. When there is a syntactic WS macro
between the starting point and the closing p/b/b, setq before-sws-pos again
after moving backward over the macro.
Stefan Monnier [Mon, 6 May 2019 16:37:00 +0000 (12:37 -0400)]
* lisp/custom.el: Avoid adding vars to load-history multiple times
Avoid the abuse of (eval `(defvar ...)) which tends to end up
adding redundant entries in `load-history`, as discussed in
https://lists.gnu.org/r/help-gnu-emacs/2019-03/msg00237.html
(custom-initialize-default): Don't add to load-history.
(custom-declare-variable): Use internal--define-uninitialized-variable
and only add the var to load-history once. Do it before calling
`initialize` so the special-variable-p flag is set.
* src/eval.c (Finternal__define_uninitialized_variable): New function.
(Fdefvar, Fdefconst): Use it.
(syms_of_eval): Defsubr' it.
Paul Eggert [Mon, 6 May 2019 00:35:05 +0000 (17:35 -0700)]
Use simpler way to print function pointers
The module code can’t possibly work on weird platforms where
function pointers are wider than data pointers, so there’s no need
to bother with the stackoverflow-like approach that is intended
only for portability to such platforms. Besides, the
stackoverflow-like approach does not work well on weird platforms
where CHAR_BIT is not a multiple of 4.
* src/lisp.h (pMx): New macro.
* src/print.c (data_from_funcptr) [HAVE_MODULES]: New function.
(print_vectorlike) [HAVE_MODULES]: Use it.
(print_object): Make sure buf is big enough for this.
Strip possible source/destination prefixes such as a/ and b/
from directory names. (Bug#35420)
(ediff-fixup-patch-map, ediff-dispatch-file-patching-job)
(ediff-patch-file-internal): Replace string-match with string-match-p.