Eli Zaretskii [Sat, 18 May 2019 07:15:19 +0000 (10:15 +0300)]
Fix visiting and saving UTF-16 encoded XML files
* lisp/international/mule.el (sgml-xml-auto-coding-function):
When the 'enncoding' tag specifies a UTF-16 encoding, enforce
saving the buffer with BOM, per the XML spec.
(xml-find-file-coding-system): Recognize UTF-16 encodings with
BOM. (Bug#35766) (Bug#8282)
* lisp/international/mule-cmds.el (select-safe-coding-system):
Don't consider UTF-16 encodings with and without BOM as
"different", so as not to annoy users with redundant questions
about mismatch between the XML/SGML header and the selected
explicit encoding.
* lisp/arc-mode.el (byte-after): Remove defsubst.
Replace all calls to byte-after with get-byte throughout the file,
because byte-after gave compilation warnings.
Paul Eggert [Sat, 18 May 2019 01:41:22 +0000 (18:41 -0700)]
Clean up and simplify image-type setup
This also fixes an unlikely hang involving a circular image
description.
* src/dispextern.h (struct image.type): Now pointer-to-const.
* src/image.c (struct image_type.init) [!WINDOWSNT]: Omit.
(IMAGE_TYPE_INIT): New macro.
(image_types): Now a small array-of-const, not a pointer.
(CACHE_IMAGE_TYPE): Remove; the code’s simpler without it.
(ADD_IMAGE_TYPE): Remove this macro, replacing with ...
(add_image_type): ... this equivalent function. All uses changed.
(define_image_type): Remove. All uses removed.
(valid_image_p): Use FOR_EACH_TAIL_SAFE to avoid Emacs hanging
if the user creates a circular description of an image.
(xbm_type, xpm_type, pbm_type, png_type, jpeg_type, tiff_type)
(gif_type, imagemagick_type, svg_type, gs_type):
Remove; now done by image_types.
(init_imagemagick_functions): Remove decl of nonexistent function.
(gs_clear_image): Remove; all uses replaced by image_clear_image.
(initialize_image_type): New function, which captures a lot
of the previously-scattered WINDOWSNT ifdefs.
(lookup_image_type): Use it.
(reset_image_types): Remove. All uses removed.
(syms_of_image): Don’t worry about ignoring image_types for
pdumper, since it’s a constant now.
Stefan Monnier [Fri, 17 May 2019 18:42:36 +0000 (14:42 -0400)]
* lisp/gnus/gnus-sum.el (gnus-tmp-thread): New var
The recent change to use lexical-binding introduced a bug because
gnus-summary-line-format-alist refers to variable `thread` which is now
lexical and hence not available there any more. Replace it with
a dynamically scoped var `gnus-tmp-thread` as was already done with
all other vars.
(gnus-summary-line-format-alist): Use it instead of `thread`.
(gnus-summary-prepare-threads): Bind it around call to (eval
gnus-summary-line-format-spec).
Eli Zaretskii [Fri, 17 May 2019 08:01:20 +0000 (11:01 +0300)]
Fix a recent commit in select.el
* lisp/select.el (gui-get-selection): Revert a recent
incorrect change. Add a comment explaining what we are trying
to do with C_STRING and why.
(xselect--encode-string): Add a comment explaining what we are
trying to do with C_STRING and why.
* lisp/imenu.el (imenu-example--create-c-index)
(imenu-example--function-name-regexp-c)
(imenu-example--create-lisp-index)
(imenu-example--lisp-extract-index-name): Remove functions (and
internal variables used by those functions) declared obsolete in
Emacs 23.2. The functions gave compilation warnings.
Stefan Monnier [Fri, 17 May 2019 04:09:16 +0000 (00:09 -0400)]
* lisp/gnus: Remove assumptions about mail-header being a vector
Use `mail-header-p` and `make-full-mail-header` instead of `vectorp` and
`vector`, respectively.
* lisp/gnus/message.el (message-cite-original-1, message-reply)
(message-followup):
* lisp/gnus/gnus-sum.el (gnus-get-newsgroup-headers):
Use make-full-mail-header instead of `vector`.
(gnus--dummy-mail-header): New const, using make-full-mail-header.
(gnus-update-summary-mark-positions): Use it instead of
an immediate vector.
(gnus-set-mode-line, gnus-summary-article-pseudo-p)
(gnus-summary-article-subject, gnus-summary-insert-subject)
(gnus-summary-find-subject, gnus-summary-goto-subject)
(gnus-summary-limit-to-age, gnus-summary-find-matching)
(gnus-summary-mark-article-as-unread, gnus-summary-mark-article)
(gnus-summary-save-article):
* lisp/gnus/gnus.el (gnus-news-group-p): Use mail-header-p instead
of vectorp.
Declare fileloop-continue in dired-aux to avoid warning
* lisp/dired-aux.el (fileloop-continue): Declare to avoid
compilation warning. `fileloop-initialize-search' (used before
-continue) will load fileloop.el.
Declare two w32 functions to avoid byte compilation warnings
* lisp/w32-fns.el (w32-version, w32-read-registry): Declare these
functions to avoid byte compilation warnings. The functions
should be loaded when `w32--os-description' is called, as far as I
can tell.
Declare rectangle functions in mouse.el to avoid warnings
* lisp/mouse.el (rectangle-dimensions)
(rectangle-position-as-coordinates, rectangle-intersect-p):
Declare these functions from rect.el to avoid compilation warnings.
For discussion, see thread starting at:
https://lists.gnu.org/archive/html/emacs-devel/2019-05/msg00460.html
* lisp/progmodes/project.el (project--read-file-cpd-relative):
Describe arglist as promised by user option
project-read-file-name-function.
The previous code had 2 problems:
- It converted `setq` to `setf` in unrelated cases such as
(cl-symbol-macrolet ((x 1)) (setq (car foo) bar))
- It macroexpanded places before `setf` had a chance to see if they
have a gv-expander.
Paul Eggert [Thu, 16 May 2019 17:42:27 +0000 (10:42 -0700)]
Distribute test cases in tarballs by default
* INSTALL, INSTALL.REPO, admin/make-tarball.txt:
Mention ‘make check’.
* configure.ac: Update comment.
* etc/NEWS: Say that tarballs have a test directory.
* make-dist (with_tests): Default to "yes".
Add an option --no-tests to make it "no".
Ivan Shmakov [Fri, 14 Sep 2018 19:05:12 +0000 (19:05 +0000)]
Improve user convenience of the rcirc debug buffer
* lisp/net/rcirc.el (rcirc-debug): Ignore rcirc-debug-buffer read-only
status. Restore point after insertion unless it was at the end.
Ensure a newline before each [lead]. Replace %Y-%m-%d with the
equivalent %F in format-time-string; remove useless concat. (Bug#32470)
Noam Postavsky [Wed, 15 May 2019 22:51:30 +0000 (18:51 -0400)]
Fix merge of sgml-syntax-propertize-rules
During the merge of emacs-26, the sgml-syntax-propertize-rules part of
2019-01-17 "* lisp/textmodes/sgml-mode.el: Try and fix bug#33887." got
lost in the conflict against 2019-05-09 "Recognize single quote
attribute values in nxml and sgml (Bug#35381)".
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize-rules): Reapply
the 2019-01-17 change to speed up sgml-syntax-propertize-rules, taking
into account the 2019-05-09 which means we have to handle single
quotes as well.
Anders Lindgren [Wed, 15 May 2019 19:00:49 +0000 (21:00 +0200)]
Fix diff-mode face problem when used in terminals (Bug#35695)
In a terminal supporting 256 colors, both diff-added and diff-removed
was mapped to the same greyish color.
* lisp/vc/diff-mode.el: Modify the colors of diff-removed,
diff-added, diff-refine-removed, and diff-refine-added when
used in a 256 color environment.
Stefan Monnier [Wed, 15 May 2019 17:53:13 +0000 (13:53 -0400)]
* lisp/gnus/gnus-sum.el: Use lexical-binding
(gnus-summary-make-menu-bar, gnus-summary-display-make-predicate)
(gnus-summary-refer-thread, gnus-summary-find-matching)
(gnus-summary-edit-article, gnus-summary-sort):
Replace backquoted lambda with closure.
(gnus-summary-article-header): Use define-inline rather than defmacro,
so it's also a function.
(gnus-save-hidden-threads, gnus-summary-iterate, gnus-with-article):
Use `declare`.
(gnus-thread-sort-by-random): Simplify.
(gnus-summary-display-article, gnus-summary-limit-to-address):
Hoist common code outside of `if`.
Paul Eggert [Wed, 15 May 2019 17:26:54 +0000 (10:26 -0700)]
Tune reading of radix integers
This improves the performance of (read "%xFF") by about 25%
on my platform.
* src/lread.c: Include <vla.h>, so that we can better document
buffer sizes of arguments.
(invalid_radix_integer_format, stackbufsize): New constants.
(free_contents): Remove. All uses removed.
(invalid_radix_integer): New function.
(read_integer): New arg STACKBUF. Assume radix is in range.
All uses changed. Use STACKBUF to avoid calling malloc in the
usual case. Use grow_read_buffer to simplify.
(read1): Tune. Improve quality of diagnostic when
MOST_POSITIVE_FIXNUM < radix <= EMACS_INT_MAX.
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.