Alan Mackenzie [Tue, 2 Jul 2019 12:33:01 +0000 (12:33 +0000)]
CC Mode: Improve handling of unbalanced strings
* lisp/progmodes/cc-fonts.el (c-before-font-lock-functions): Add function
c-after-change-escape-NL-in-string into value for most languages.
* lisp/progmodes/cc-mode.el (c-after-change-escape-NL-in-string): New
function.
(c-before-change-check-unbalanced-strings): Handle the making and breaking of
escaped newlines, by removal or addition of text.
Paul Eggert [Tue, 2 Jul 2019 04:42:58 +0000 (21:42 -0700)]
Fix regex-emacs debug format glitches
These patches affect behavior only if REGEX_EMACS_DEBUG.
* src/regex-emacs.c (debug_putchar): Use unsigned for %x.
(print_compiled_pattern, ENSURE_FAIL_STACK, PUSH_FAILURE_POINT)
(POP_FAILURE_POINT): Use %td for ptrdiff_t.
(print_compiled_pattern, regex_compile, re_match_2_internal):
Put newlines at ends of lines, not at starts of next lines.
Omit white space at line ends.
Eli Zaretskii [Mon, 1 Jul 2019 14:54:15 +0000 (17:54 +0300)]
Adjust return value of image-transforms-p
* src/image.c (Fimage_transforms_p):
* doc/lispref/display.texi (Image Descriptors):
image-transforms-p now returns at most (scale rotate90), even
if ImageMagick is available.
Sam Steingold [Fri, 28 Jun 2019 21:22:55 +0000 (17:22 -0400)]
Extract gnus-collect-urls from gnus-summary-browse-url
* lisp/gnus/gnus-sum.el (gnus-collect-urls): Extract from ...
(gnus-summary-browse-url): Use it here.
Extracting URLs from an article will be useful in BBDB interaction.
* src/hbfont.c: Include hb-ot.h.
[HAVE_NTGUI]: Add DEF_DLL_FN and #define for hb_tag_to_string,
hb_font_get_face, hb_ot_layout_table_get_script_tags,
hb_ot_layout_table_get_feature_tags, hb_ot_layout_script_get_language_tags,
and hb_ot_layout_language_get_feature_tags.
(hbfont_init_w32_funcs) [HAVE_NTGUI]: Add LOAD_DLL_FN for them.
(hbfont_otf_features, hbfont_otf_capability): New functions.
Paul Eggert [Sun, 30 Jun 2019 15:08:02 +0000 (08:08 -0700)]
Remove divide_double
* src/image.c (divide_double): Remove. All uses replaced
with inline equivalents. Suggested by Eli Zaretskii in:
https://lists.gnu.org/r/emacs-devel/2019-06/msg01067.html
Alan Mackenzie [Sun, 30 Jun 2019 15:02:13 +0000 (15:02 +0000)]
C++ Mode: change the default doc comment style from nothing to gtkdoc
Also amend a pertinent regular expression. This fixes bug #11865.
* lisp/progmodes/cc-vars.el (c-doc-comment-style): Insert an entry for
c++-mode, namely gtkdoc.
* lisp/progmodes/cc-fonts.el (gtkdoc-font-lock-keywords): Amend the regexp
recognizing the introductory "/**" to allow subsequent characters on that
line.
Michael Albinus [Sun, 30 Jun 2019 09:23:06 +0000 (11:23 +0200)]
Release Tramp 2.4.2
* lisp/net/tramp.el: Bump version.
* test/lisp/net/tramp-tests.el (tramp--test-instrument-test-case):
Add `add-name-to-file' error message.
(tramp--test-ignore-add-name-to-file-error): Make error handler
more explicit about the error.
Fix error in mouse-set-font on GTK 3 with Harfbuzz (Bug#36288)
* src/gtkutil.c (xg_get_font) [HAVE_GTK3]: Remove type property from font
spec. This effectively undoes the fix for Bug#3228, but gives consistent
results overall.
Paul Eggert [Sat, 29 Jun 2019 23:46:16 +0000 (16:46 -0700)]
Pacify gcc and other image rotation tweaks
* src/image.c: No need to include <float.h> as lisp.h does that.
(matrix3x3_copy): Remove; no longer needed.
(divide_double): New function, to avoid undefined behavior
when dividing by zero on non-IEEE hosts.
(image_set_transform): Simplify transformation computation
by avoiding the need to copy a matrix. Pacify
gcc 9 -Wdouble-promotion and -Wmaybe-uninitialized.
Avoid unnecessary assignment of width and height.
Improve error reporting for unsupported native image rotation.
Ken Brown [Sat, 29 Jun 2019 19:03:34 +0000 (15:03 -0400)]
Simplify workaround for Cygwin O_PATH bug
Suggested by Paul Eggert (Bug#36405#22).
* configure.ac (HAVE_CYGWIN_O_PATH_BUG): New AC_DEFINE, for Cygwin
versions 3.0.0 through 3.0.7.
* src/dired.c (O_PATH) [__CYGWIN__]: Remove #undef.
(file_attributes) [HAVE_CYGWIN_O_PATH_BUG]: Don't use O_PATH.
Eli Zaretskii [Sat, 29 Jun 2019 11:51:41 +0000 (14:51 +0300)]
Support native image transforms on MS-Windows
This changeset also rearranges native image transform code
for other platforms to make it cleaner, and also removes
the support for native cropping. For the discussions, see
https://lists.gnu.org/archive/html/emacs-devel/2019-06/msg00242.html
* src/w32term.c (w32_image_rotations_p, transform): New functions.
(w32_draw_image_foreground): If image rotation is requested
and supported, call PlgBlt to transform the image.
(w32_initialize): Populate the PlgBlt function pointer if it
is supported.
* src/w32term.h (w32_image_rotations_p): Add prototype.
* src/dispextern.h (struct image) [HAVE_NTGUI]: New member xform.
* src/image.c (compute_image_rotation): Renamed from
image_set_rotation. Only compute and returns the rotation
angle; leave the matrix calculation for later. Log an error
message if the :rotation parameter is not a number.
(image_set_crop): Function deleted. We no longer support
native cropping, as one can display an image slice instead.
(image_set_transform): Compute the transform matrix in its
entirety here, in two variants: one for XRender and Cairo, the
other for NS and MS-Windows. call compute_image_size and
compute_image_rotation internally.
(lookup_image) [HAVE_NATIVE_TRANSFORMS]: Call only
image_set_transform. No need to pass the transform matrix to
image_set_transform.
(Fimage_transforms_p): Return a list of transform capabilities
rather than a simple boolean. Support TTY frames as well.
* src/nsimage.m (setTransform:): Don't invert the matrix, as
it is already inverted in image.c.
* test/manual/image-transforms-tests.el (test-cropping): State
in the text that only ImageMagick supports cropping.
* doc/lispref/display.texi (Image Descriptors): Update the
documentation of native image transforms.
(ImageMagick Images): Move the description of ':crop' here.
* etc/NEWS: Minor copyedits of the feature announcement.
Eli Zaretskii [Sat, 29 Jun 2019 09:48:15 +0000 (12:48 +0300)]
Fix display of fringe bitmaps for tooltips in echo area
* src/xdisp.c (display_line): Force redrawing of fringe
bitmaps when redisplaying a minibuffer window with
truncate-lines set to a non-nil value. (Bug#36308)
Make regexp matching of raw bytes work in all combination of unibyte
and multibyte patterns and targets, as exact strings and in character
alternatives (bug#3687).
* src/regex-emacs.c (analyze_first):
Include raw byte in fastmap when pattern is a multibyte exact string.
Include leading byte in fastmap for raw bytes in character alternatives.
(re_match_2_internal):
Decrement the byte count by the number of bytes in the pattern character,
not 1.
* test/src/regex-emacs-tests.el (regexp-unibyte-unibyte)
(regexp-multibyte-unibyte, regexp-unibyte-mutibyte)
(regexp-multibyte-multibyte): New tests.
Paul Eggert [Thu, 27 Jun 2019 22:39:04 +0000 (15:39 -0700)]
Improve ‘equal’ and array doc
* doc/lispref/objects.texi (Array Type): Array sizes are
nonnegative fixnums, not arbitrary integers.
(Equality Predicates): Do not say that ‘eq’ equals ‘=’ on bignums.
Do not imply that ‘equal’ must signal an error on circular lists.
Paul Eggert [Thu, 27 Jun 2019 19:31:27 +0000 (12:31 -0700)]
Omit a few minor unnecessary range checks
Based on Pip Cet’s review (Bug#36370#19).
* src/fileio.c (Fdo_auto_save):
* src/image.c (lookup_image):
* src/textprop.c (Fnext_single_char_property_change):
Prefer XFIXNUM to XFIXNAT for clarity and consistency with
neighboring code, and to avoid unnecessary range checks.
* src/image.c (lookup_image): Omit unnecessary range checks.
Paul Eggert [Thu, 27 Jun 2019 19:31:27 +0000 (12:31 -0700)]
Improve XFIXNUM cleanup a bit
Based on Pip Cet’s review (Bug#36370#13).
* src/ccl.c (Fccl_execute_on_string): Use clearer indexing.
* src/dosfns.c (Fint86, Fdos_memput):
Avoid runtime checks for negative fixnums when debugging.
This restores the earlier machine code.
* src/lisp.h (XFIXNUM, XUFIXNUM): Use eassert, not eassume.
(XFIXNAT): At the start, merely eassert FIXNUMP rather
than eassuming FIXNATP. At the end, eassume that the
result is nonnegative. This restores help to the compiler
that the previous patch mistakenly removed.
Paul Eggert [Thu, 27 Jun 2019 19:31:27 +0000 (12:31 -0700)]
Clean up use of XFIXNUM etc.
A few bits of the code were relying on the fact that XFIXNUM,
XFIXNAT, and XUFIXNUM do something even with arguments that
are not fixnums/fixnats. Separate these rare uses out into
XFIXNUM_RAW and XUFIXNUM_RAW.
Problem and original patch reported by Pip Cet (Bug#36370).
* src/ccl.c (Fccl_execute_on_string):
* src/fileio.c (Finsert_file_contents, a_write)
(Fdo_auto_save):
* src/process.c (conv_lisp_to_sockaddr):
* src/textprop.c (Fnext_single_char_property_change)
(Fprevious_single_char_property_change)
(Fnext_property_change, Fnext_single_property_change)
(Fprevious_property_change)
(Fprevious_single_property_change):
Don’t assume fixnums are nonnegative.
* src/ccl.c (Fccl_execute_on_string):
Fix range-checking bug if AREF (status, i) is out of int range.
* src/data.c (arith_driver): Use XFIXNUM_RAW as we want
efficient garbage if the value is not a fixnum.
* src/dosfns.c (Fint86, Fdos_memput):
Check that args are nonnegative.
* src/image.c (lookup_image): Check that args are in range.
* src/lisp.h (lisp_h_XHASH): Use XUFIXNUM_RAW, since this
is for hashing.
(lisp_h_XFIXNAT, XFIXNAT) [USE_LSB_TAG]: Remove macros.
(lisp_h_XFIXNUM_RAW, XFIXNUM_RAW) [USE_LSB_TAG]: New macros, with
the semantics of the old macros without _RAW.
(XFIXNUM_RAW, XUFIXNUM_RAW): New inline functions, with the
semantics of the old functions without _RAW.
(FIXNUMP): Move definition up to avoid forward use.
(XFIXNUM, XFIXNAT, XUFIXNUM): Use eassume to add a runtime
check (when debugging) that the argument has the proper form.
(XFIXNUM, XFIXNAT): Now inline functions only, since they
refer to their arguments more than once now that they use eassume.
* src/textprop.c (Fprevious_single_char_property_change):
Avoid fixnum overflow with invalid input.
(set_text_properties): Fix unlikely failure
to validate arguments, by using EQ instead of XFIXNAT.
* src/w32term.c (w32_draw_glyph_string):
* src/xterm.c (x_draw_glyph_string):
Treat negative minimums as 0 rather than as garbage patterns.
Paul Eggert [Thu, 27 Jun 2019 19:21:20 +0000 (12:21 -0700)]
Catch duplicate keywords in image specs
* src/image.c (struct image_keyword.count): Now bool, not int,
since it is either 0 or 1.
(parse_image_spec, xpm_image_p): Use bool for boolean.
(parse_image_spec): Fix a bug introduced in
2011-09-21T17:41:20!eggert@cs.ucla.edu that reported only
triplicate (or more) keywords, not duplicates.
emacsclient: ignore --eval parameters when starting alternate editor
* lib-src/emacsclient.c (fail): If the user said --eval, don't
pass those arguments to the alternate editor as file names.
Suggested by a patch from Scott Turner (bug#11474).
* lisp/profiler.el (profiler-cpu-log, profiler-memory-log): New
variables.
(profiler-cpu-profile): Work even if the profiler is no longer
running (bug#22114).
(profiler-memory-profile): Ditto.
(profiler-stop): Save the data.
(profiler-reset): Clear the saved data.
(profiler-report-cpu, profiler-report-memory): Report on the saved
data.
(profiler-report): Save the data here, too.
Dan Nicolaescu [Thu, 27 Jun 2019 18:13:14 +0000 (20:13 +0200)]
Include the date in the bzr annotation buffer
* lisp/vc/vc-bzr.el (vc-bzr-annotate-command)
(vc-bzr-annotate-time)
(vc-bzr-annotate-extract-revision-at-line): Include a date in the
bzr annotation buffer (bug#5428).
Lennart Borgman [Thu, 27 Jun 2019 17:08:42 +0000 (19:08 +0200)]
Add more fontification to regexp builder mode
* lisp/emacs-lisp/re-builder.el (reb-copy): Work in the presence
of newlines in the regexps.
(reb-change-syntax): Use a dedicated history variable.
(reb-fontify-string-re): Fontify sub-matches.
(reb-regexp-grouping-backslash, reb-regexp-grouping-construct):
New faces.
(reb-string-font-lock-keywords): New variable.
(reb-mark-non-matching-parenthesis): Match parenthesis.
(reb-restart-font-lock): New function.
* lisp/emacs-lisp/re-builder.el (reb-mode-map): Add divider some
dividers (bug#6347).
* lisp/textmodes/refill.el (refill-post-command-function): Make
default-indent-new-line work as indent-new-comment-line.
* lisp/textmodes/refill.el (refill-post-command-function): Bind
`M-C-j' and `M-j' to default-indent-new-line instead of
indent-new-comment-line to allow overriding via
`comment-line-break-function' (bug#12413).
Paul Eggert [Thu, 27 Jun 2019 09:33:36 +0000 (02:33 -0700)]
Tweak ‘error’ and ‘user-error’ doc strings
* lisp/net/tramp.el (tramp-user-error):
* lisp/subr.el (user-error):
Say that user errors are sometimes called pilot errors.
* lisp/subr.el (error, user-error):
Reorder wording to discuss mechanism first, then formatting advice,
rather than going back and forth between the two topics.
Tighten up the wording a bit.
For discussion, see the following thread:
https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg01196.html
https://lists.gnu.org/archive/html/emacs-devel/2019-06/msg00967.html
* etc/TODO: Remove gnus-bug from list of obsolete bug-reporting
commands now that it is implemented in terms of report-emacs-bug.
`replace-regexp-in-string' omits the first START characters of the
input string in its return value. This is a clear bug, but fixing it
probably causes more trouble; document the behaviour instead (bug#36372).
* doc/lispref/searching.texi (Search and Replace)
* lisp/subr.el (replace-regexp-in-string):
Document current behaviour.
Reported by Marco Wahl <marcowahlsoft@gmail.com>.
Update `Commentary:` to use the new command names.
(pages--ctl-x-ctl-p-map): Fix `mark-page` binding.
(pages-directory-mode-map): Update `add-new-page` => `pages-add-new-page`.
Eli Zaretskii [Wed, 26 Jun 2019 16:23:34 +0000 (19:23 +0300)]
Support invoking Emacs via a symlink on MS-Windows
* src/w32.c (w32_my_exename): Resolve symlinks in the
executable name, to support searching for the pdumper file
when the executable is found via a symlink.
* src/emacs.c (load_pdump): Add a comment about symlink
resolution on Windows.
Fdocumentation_property: Return doc string for indirect variables
* src/doc.c (Fdocumentation_property): When dealing with indirect
variables (i.e., aliases), also check the symbol being pointed to
for the doc string (bug #17180).
* lisp/emacs-lisp/rx.el (rx-regexp, rx-literal): Check the cadr of the
form for stringness, not the form itself.
* test/lisp/emacs-lisp/rx-tests.el (rx-to-string-lisp-forms): New test.
Noam Postavsky [Wed, 26 Jun 2019 02:04:13 +0000 (22:04 -0400)]
Merge from emacs-26
e62ad04963 Fix sgml-mode handling of quotes within parens (Bug#36347) 06b35b2f92 ; * lisp/frame.el: Enhance add-variable-watcher commentary. 572e34bb6f Rename 'make-symbolic-link' argument NEWNAME to LINKNAME 04477adedc Check that length of data returned by sysctl is non-zero 81535eeadb * test/lisp/progmodes/python-tests.el (python-virt-bin): D... 9d48979ca8 Fix Python tests depending on system-type fcf6cc3177 Fix problem with wdired test when symlinks cannot be created. 4701e0663e Improve wording of documentation of click events
Noam Postavsky [Fri, 21 Jun 2019 11:09:44 +0000 (07:09 -0400)]
Don't bind search-spaces-regexp around possible autoload (Bug#35802)
* lisp/isearch.el (isearch-search-fun-default): Move possible autoload
trigger outside let-binding of search-spaces-regexp.
* lisp/char-fold.el (char-fold-make-table): Remove no longer needed
workaround.
* lisp/info.el (Info-search-whitespace-regexp):
* lisp/isearch.el (search-whitespace-regexp):
* src/search.c (syms_of_search) <search-spaces-regexp>: Add warning
about adding capturing groups to the value.
* test/lisp/char-fold-tests.el: Remove, binding search-spaces-regexp
to a different should be considered a bug.
Noam Postavsky [Fri, 14 Jun 2019 12:43:17 +0000 (08:43 -0400)]
Support (rx (and (regexp EXPR) (literal EXPR))) (Bug#36237)
* lisp/emacs-lisp/rx.el (rx-regexp): Allow non-string forms.
(rx-constituents): Add literal constituent, which is like a plain
STRING form, but allows arbitrary lisp expressions.
(rx-literal): New function.
(rx-compile-to-lisp): New variable.
(rx--subforms): New helper function for handling subforms, including
non-constant case.
(rx-group-if, rx-and, rx-or, rx-=, rx->=, rx-repeat, rx-submatch)
(rx-submatch-n, rx-kleene, rx-atomic-p): Use it to handle non-constant
subforms.
(rx): Document new form, wrap non-constant forms with concat call.
* test/lisp/emacs-lisp/rx-tests.el (rx-tests--match): New macro.
(rx-nonstring-expr, rx-nonstring-expr-non-greedy): New tests.
* etc/NEWS: Announce changes.
Noam Postavsky [Mon, 24 Jun 2019 01:27:43 +0000 (21:27 -0400)]
Fix sgml-mode handling of quotes within parens (Bug#36347)
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize): Use
syntax-ppss-table if set. This is only needed on the release branch,
on master the caller (syntax-propertize) already does this.
(sgml-mode): Set syntax-ppss-table to sgml-tag-syntax-table. This
correctly classifies parens as punctuation, so they won't confuse the
parser.
* test/lisp/textmodes/sgml-mode-tests.el (sgml-tests--quotes-syntax):
New test copied from master, with two cases added for this bug.
Paul Eggert [Tue, 25 Jun 2019 22:54:37 +0000 (15:54 -0700)]
Prefer PATH_MAX to MAXPATHLEN
PATH_MAX is standardized, MAXPATHLEN is not.
Also, the Gnulib pathmax module fixes some rare bugs with PATH_MAX.
So prefer PATH_MAX to MAXPATHLEN unless we know the latter is
also correct (for some platform-specific code).
* admin/merge-gnulib (GNULIB_MODULES): Add pathmax.
This module was already present, as a dependency of canonicalize-lgpl,
but now Emacs is using it directly. Sort.
* lib-src/emacsclient.c: Include stdint.h, pathmax.h.
(get_current_dir_name): Sync to current src/sysdep.c.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* src/sysdep.c: Include pathmax.h.
(get_current_dir_name_or_unreachable):
Use PATH_MAX instead of MAXPATHLEN.
Dima Kogan [Tue, 25 Jun 2019 22:49:24 +0000 (00:49 +0200)]
View-search-... now hit all the matches, regardless of window position
* lisp/view.el (view-search): Jump to the next/prev occurrence of
the search, even if it's displayed in the buffer (bug#18131).
This seems more logical than the previous (undocumented) behaviour.
Emilio C. Lopes [Tue, 25 Jun 2019 21:40:22 +0000 (23:40 +0200)]
Support opening a new connection when reverting a telnet buffer
* net/telnet.el (telnet-connect-command): New variable.
(telnet-revert-buffer): New function.
(telnet-mode): Use `telnet-revert-buffer' as `revert-buffer-function'.
(telnet, rsh): Set `telnet-connect-command' accordingly (bug#18312).