Eric Abrahamsen [Wed, 3 Jul 2019 19:53:43 +0000 (12:53 -0700)]
Small fix to writing Gnus dribble change-level entries
* lisp/gnus/gnus-start.el (gnus-group-change-level): PREVIOUS needs to
still be a string when the dribble entry is written, so don't
convert it to an entry until after that's done. Also, we're not
meant to write PREVIOUS itself, we're meant to write the group that
comes _after_ it in the sort-order of gnus-group-list, so do that
instead.
Stefan Kangas [Sun, 30 Jun 2019 23:21:47 +0000 (01:21 +0200)]
Add tests for bookmark.el (Bug#36452)
* test/lisp/bookmark-resources/example.txt:
* test/lisp/bookmark-resources/test.bmk:
* test/lisp/bookmark-tests.el: New files.
* lisp/bookmark.el: Minor cleanups.
(bookmark-insert-annotation): Signal error on invalid bookmark.
(bookmark-write-file): Add newline at end of file.
Eli Zaretskii [Wed, 3 Jul 2019 07:31:48 +0000 (10:31 +0300)]
Fix rotation validity test in image.c
* src/image.c (compute_image_rotation): Fix the validity test
for :rotation values. This avoids logging error messages when
no :rotation was provided in the image spec.
Paul Eggert [Tue, 2 Jul 2019 23:09:46 +0000 (16:09 -0700)]
Replace TRACE with redisplay_trace, etc.
This simplifies callers and catches trace printf format errors
even with typical (non-debugging) compiles.
* src/dispextern.h (TRACE) [GLYPH_DEBUG]:
Move definitions to xdisp.c if it’s used only there.
* src/xdisp.c (redisplay_trace): New function, replacing TRACE macro.
(move_trace): New function, replacing TRACE_MOVE macro.
All uses changed.
(dump_glyph): When tracing, don’t use %d to format ptrdiff_t,
or %x to format a pointer.
(expose_frame): Redo trace printfs to avoid interleaved output
on GNU/Linux.
João Távora [Wed, 15 May 2019 12:10:22 +0000 (13:10 +0100)]
Correctly reindent previous line in electric-indent-mode
Fixes: bug#35254
Do this even when electric-indent-inhibit is t, except when the
newline insertion is being performed by electric-layout-mode.
* lisp/electric.el (electric-indent-post-self-insert-function):
Reindent previous line unless operating under
electric-layout-mode.
(electric-layout-post-self-insert-function-1): Bind
electric-indent-inhibit to 'electric-layout-mode.
* test/lisp/electric-tests.el
(electric-layout-control-reindentation): New test.
João Távora [Fri, 29 Mar 2019 12:27:11 +0000 (12:27 +0000)]
Protect Flymake from being corrupted by backends
A backend building a diagnostic with a nil :type would cause Flymake
to create a diagnostic without an overlay, confusing Flymake's
accounting of overlays and diagnostics
João Távora [Thu, 28 Mar 2019 18:04:35 +0000 (18:04 +0000)]
More carefully cleanup Flymake C/C++ backend's temp buffers
Sometimes the Flymake process dies by some means that doesn't involve
a sentinel call for the "exit" status, so we clean up the temporary
buffer as soon as we notice it's not process-alive-p anymore.
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).