Fix intermittent rmail-summary-delete-forward problem
* lisp/mail/rmailsum.el (rmail-summary-delete-forward):
`rmail-delete-message' may apparently clear
`rmail-current-message' sometimes, so save the message number
before deleting (bug#39612).
* lisp/progmodes/gdb-mi.el (gdb-tooltip-print-1, gud-watch)
(gdb-var-list-children, gdb-edit-value)
(gdb-bind-function-to-buffer, gdb-place-breakpoints)
(gdb-preempt-existing-or-display-buffer):
Expose lambdas to the compiler as lexical closures instead of building
them the old-fashioned way. Remove #' before lambda.
Fix history problem in `M-x shell' when started twice
* lisp/comint.el (comint-input-ring-file-name): Avoid having this
variable being killed on mode restart while the other ring
variables aren't (bug#39667). This would mean that `M-x
shell'/`C-d'/`M-x shell' didn't save commands entered after the
second `M-x shell'.
ERT: escape control characters in pretty-printed error output
* lisp/emacs-lisp/ert.el (ert--pp-with-indentation-and-newline):
Escape control characters which would otherwise be blasted directly to
the terminal (when running noninteractively) with unpleasant results.
* lisp/calendar/solar.el (solar-moment): Use initial values for binary
search that won't end the loop prematurely and yield incorrect
answers.
* test/lisp/calendar/solar-tests.el: New file.
Since ntlm.el is distributed as a separate package in GNU ELPA and
should be able to run on older Emacs versions without bignums,
we cannot make use of them here. See discussion at
https://lists.gnu.org/archive/html/emacs-devel/2020-10/msg01665.html.
Instead, we add a small poor man's bignum implementation.
* lisp/net/ntlm.el (ntlm--bignat-of-int, ntlm--bignat-add)
(ntlm--bignat-shift-left, ntlm--bignat-mul-byte, ntlm--bignat-mul)
(ntlm--bignat-of-string, ntlm--bignat-of-digits)
(ntlm--bignat-to-int64): New.
(ntlm--time-to-timestamp): Use the ntlm--bignat- functions instead
of Lisp integers.
* test/lisp/net/ntlm-tests.el: New file.
Don't do compilation-transform-file-match-alist if there's no file name
* lisp/progmodes/compile.el (compilation-error-properties): There
may not be a file name (bug#40111). In that case, don't do the
`compilation-transform-file-match-alist' thing.
Don't skip empty lines when fitting mini frame to buffer (Bug#44080)
* lisp/window.el (fit-mini-frame-to-buffer,
window--resize-mini-frame, fit-frame-to-buffer,
fit-frame-to-buffer-1): By default, fit a mini frame without skipping its
buffer's leading or trailing empty lines.
* src/frame.c (resize-mini-frames): Update doc-string.
* lisp/cus-start.el (resize-mini-frames): Update for customize.
* doc/lispref/minibuf.texi (resize-mini-frames): Update description.
Paul Pogonyshev [Tue, 27 Oct 2020 08:43:55 +0000 (09:43 +0100)]
Don't leak result of nested byte-compilation to outer level
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Bind
`byte-compiler-error-flag' instead of setting it (bug#41065).
This fixes a problem of "leaking" the flag when compiling
something that then compiles something that errors out (i.e., an
"inner" compile).
mvar [Tue, 27 Oct 2020 08:27:51 +0000 (09:27 +0100)]
Fontify strings in {} better in tcl-mode
* lisp/progmodes/tcl.el (tcl-syntax-propertize-function):
Propertize {} forms after commands as strings (bug#39277).
(tcl-set-font-lock-keywords): Fontify as strings. This allows
things like puts {"foo} to be fontified correctly.
* lisp/help-mode.el (help-mode-revert-buffer): Don't require
confirmation before reverting (bug#44202). This mimics how most
other non-file reverting functions work.
Stefan Kangas [Mon, 26 Oct 2020 23:49:28 +0000 (00:49 +0100)]
Don't use obsolete variable write-contents-hooks
* lisp/mh-e/mh-show.el (mh-display-msg):
* lisp/textmodes/rst.el: Don't use obsolete variable
write-contents-hooks.
Problem reported by Stefan Monnier <monnier@iro.umontreal.ca>.
Stefan Kangas [Mon, 26 Oct 2020 23:35:46 +0000 (00:35 +0100)]
Remove XEmacs compat code from hashcash.el
* lisp/mail/hashcash.el (hashcash-point-at-bol)
(hashcash-point-at-eol): Make obsolete.
(hashcash-token-substring): Don't use the above now obsolete aliases.
Make vc-responsible-backend choose the most specific backend
* lisp/vc/vc.el (vc-responsible-backend): Search through all the
VC backends instead of the first one, and choose the one that's
most specific (bug#42966).
* lisp/emacs-lisp/shortdoc.el (shortdoc-example): Removed.
(shortdoc-section): Remove colors.
(shortdoc-separator): New face.
(shortdoc-display-group, shortdoc--display-function): Don't use
background colours, because that makes things harder to read.
Separate with a horizontal line instead.
Eli Zaretskii [Mon, 26 Oct 2020 16:14:32 +0000 (18:14 +0200)]
Avoid segfaults due to using fonts that were closed
* src/composite.c (composition_gstring_cache_clear_font): New
function.
* src/composite.h (composition_gstring_cache_clear_font): Add
prototype.
* src/font.c (font_clear_cache): When we are about to close a
font, remove from the gstring cache any lgstring that uses this
font. (Bug#42943)
Eli Zaretskii [Mon, 26 Oct 2020 16:01:13 +0000 (18:01 +0200)]
Improve documentation of display-fill-column-indicator
* lisp/display-fill-column-indicator.el
(display-fill-column-indicator-mode): Mention the globalized
version in the doc string.
* doc/emacs/display.texi (Displaying Boundaries): Improve and
clarify the documentation of display-fill-column-indicator.
Suggest using the minor mode as the primary means for turning the
feature on.
Don't consider play-sound-file to be a 'safe' function (bug#44018)
While there are currently no known security holes in play-sound-file,
the attack surface is considerable and historically audio file
processing has had more than its share of security problems; the
benefit to risk ratio is low.
* lisp/emacs-lisp/unsafep.el: Don't mark play-sound-file as safe.
Eli Zaretskii [Sun, 25 Oct 2020 16:05:37 +0000 (18:05 +0200)]
Improve support for shaping Egyptian Hieroglyphs
* src/composite.c (composition_gstring_lookup_cache): Renamed from
gstring_lookup_cache and made external. All callers changed.
* src/composite.h (composition_gstring_lookup_cache): Add
prototype.
* src/font.c (Ffont_shape_gstring): Call
composition_gstring_lookup_cache and return the cached composition
if it is already in the cache.
* lisp/language/misc-lang.el (egyptian-shape-grouping): New
function.
(composition-function-table): Use egyptian-shape-grouping in
setting up compositions for Egyptian Hieroglyphs. Fix the
composition setup for horizontal and vertical joiners.
Fix problem when replacing the final char in checkdoc
* lisp/emacs-lisp/checkdoc.el (checkdoc-autofix-ask-replace):
Ensure that the end-of-doc-string marker is really at the end,
even if we replace the final " char in the string (bug#44201).
Paul Eggert [Sat, 24 Oct 2020 22:34:12 +0000 (15:34 -0700)]
Use WebKit sandboxing
* src/xwidget.c (Fmake_xwidget): Enable sandboxing if WebKit 2.26
or later. Do this early, as required for sandboxing (Bug#43071). Co-authored-by: Qiantan Hong <qhong@mit.edu>
Copyright-paperwork-exempt: yes
Paul Eggert [Sat, 24 Oct 2020 20:41:01 +0000 (13:41 -0700)]
Improve doprnt performance
This patch implements some of my suggestions in Bug#8545,
with further changes suggested by Eli Zaretskii (Bug#43439).
* src/doprnt.c: Improve comments.
(SIZE_BOUND_EXTRA): Now at top level, for parse_format_integer.
(parse_format_integer): New static function, containing some of
the old doprnt. Fix a bug that caused doprnt to infloop on
formats like "%10s" that Emacs does not use. We could simplify
doprnt further if we dropped support for these never-used formats.
(doprnt_nul): New function.
(doprnt): Use it. Change doprnt API to exit when either it finds NUL
or reaches the character specified by FORMAT_END. In the typical case
where FORMAT_END is null, take just one pass over FORMAT, not two.
Assume C99 to make code clearer. Do not use malloc or alloca to
allocate a copy of the format FMTCPY; instead, use a small fixed-size
array FMTSTAR, and use '*' in that array to represent width and
precision, passing them as separate int arguments. Use eassume to
pacify GCC in switch statements.
Mauro Aranda [Sat, 24 Oct 2020 19:40:42 +0000 (21:40 +0200)]
Warn about a bad default value in restricted-sexp widget
* lisp/wid-edit.el (restricted-sexp widget): New :value-to-external
function. If value is not in the internal format, then we might be
dealing with a bad default value for the widget, so display a warning
about that (bug#25152).
João Távora [Sun, 4 Oct 2020 18:31:02 +0000 (19:31 +0100)]
Rework semantics of eldoc-echo-are-use-multiline-p
Per bug#43543. Now uses logical lines, not visual lines.
* lisp/emacs-lisp/eldoc.el (eldoc-echo-area-use-multiline-p): Rework
semantics.
(eldoc--echo-area-substring): New helper.
(eldoc--echo-area-prefer-doc-buffer-p): New helper.
(eldoc-display-in-echo-area): Rework using new helpers.
João Távora [Sun, 4 Oct 2020 11:19:47 +0000 (12:19 +0100)]
Rename ElDoc user option controlling display of truncation notice
The new name makes it consistent with other variables controlling the
display of ElDoc documentation in the echo area.
Per bug#43543.
* etc/NEWS (Eldoc): Rename eldoc-display-truncation-message to
eldoc-echo-area-display-truncation-message.
* lisp/emacs-lisp/eldoc.el
(eldoc-echo-area-display-truncation-message): Rename from
eldoc-display-truncation-message.
(eldoc-display-in-echo-area): Use new variable name.
Stefan Kangas [Sat, 24 Oct 2020 13:47:26 +0000 (15:47 +0200)]
Re-introduce variable for world clock timer
* lisp/time.el (world-clock--timer): New variable.
(world-clock): Save timer to above variable when it is started.
(world-clock-cancel-timer): Delete timer saved in variable instead of
searching for the function name.
This conversion to lexical-binding broke the eval specification,
documented in the ELisp manual. We will probably want to add tests
for that before we can confidently convert this to lexical-binding.
Problem reported by Mattias Engdegård <mattiase@acm.org>.
Stefan Kangas [Sat, 24 Oct 2020 01:45:48 +0000 (03:45 +0200)]
Move faces.el test data to follow our conventions
* test/lisp/faces-tests.el (ert-x): Require.
(faces--test-data-dir): Remove variable.
(faces--test-extend-with-themes): Use ert-resource-directory.
* test/lisp/faces-resources/*: Moved from test/data/themes/*.
Jared Finder [Mon, 12 Oct 2020 03:16:00 +0000 (20:16 -0700)]
Fix a bug where the wrong menu would be triggered by mouse
For layouts such as the following, clicking the "l" in Tools with the
right window focused would trigger the File menu, not the Tools menu.
This is because the event would have window coordinate (1 . 0).
Similarly, clicking the "p" in Help would trigger the Edit menu.
Example Emacs frame:
+--------------------------------------------------------+
|File Edit Options Buffers Tools Help |
|;; This buffer is for text$|;; This buffer is for text $|
|;; To create a file, visit$|;; To create a file, visit $|
| | |
| | |
|-UUU:----F1 *scratch* |-UUU:----F1 *scratch* |
| |
+--------------------------------------------------------+
* lisp/menu-bar.el (menu-bar-open-mouse): Reject clicks not on
the menu bar.
*lisp/xt-mouse.el (xterm-mouse-event): Pass the current frame to
'posn-at-x-y', to make the effect consistent with other mouse-handling
features.
Jared Finder [Wed, 7 Oct 2020 03:04:12 +0000 (20:04 -0700)]
Enable TTY menus with xterm-mouse-mode
* lisp/tmm.el: No need to bind 'tmm-menubar-mouse' to mouse clicks
on the menu bar.
* lisp/menu-bar.el (global-map): Bind 'menu-bar-open-mouse' to
mouse click on menu bar. This is needed in xt-mouse.
* etc/NEWS: Announce TTY menu support in xterm-mouse-mode.
Jared Finder [Sat, 3 Oct 2020 21:46:30 +0000 (14:46 -0700)]
Make TTY menus work with xterm-mouse-mode
* src/term.c (mouse_get_xy): Call 'mouse_position' passing it the
value of 'tty-menu-calls-mouse-position-function' as the
argument.
(syms_of_term) <tty-menu-calls-mouse-position-function>: New
DEFVAR_BOOL.
* src/frame.c (mouse_position): New function, with most of the
code from Fmouse_position, but call 'mouse-position-function' only
if called with non-zero argument.
(Fmouse_position): Call 'mouse_position' to do the job.
* lisp/xt-mouse.el (xterm-mouse-translate-1): Respect
'track-mouse'.
(xterm-mouse-mode): Set 'tty-menu-calls-mouse-position-function'
when setting 'mouse-position-function'.
(xterm-mouse-tracking-enable-sequence): Use SET_ANY_EVENT_MOUSE
(0x1003) so that mouse movement can be reported even if no buttons
are pressed. Doc fix.
* lisp/menu-bar.el (menu-bar-define-mouse-key): New function.
(tty-menu-navigation-map): Call it.
Stefan Kangas [Sat, 24 Oct 2020 00:36:33 +0000 (02:36 +0200)]
Move epg.el test data to follow our conventions
* test/lisp/epg-tests.el (ert-x): Require.
(epg-tests-data-directory): Remove variable.
(with-epg-tests): Use ert-resource-file.
* test/lisp/epg-resources/*: Moved from test/data/epg/.
Stefan Kangas [Sat, 24 Oct 2020 00:17:37 +0000 (02:17 +0200)]
Move mml-sec.el test data to follow our conventions
* test/lisp/gnus/mml-sec-tests.el (ert-x): Require.
(mml-secure-test-fixture, mml-sec-test--kill-gpg-agent):
Use ert-resource-directory.
* test/lisp/gnus/mml-sec-resources/*: Moved from test/data/mml-sec/.
* .gitignore: Update location of moved file "random_seed".
Eli Zaretskii [Fri, 23 Oct 2020 13:59:37 +0000 (16:59 +0300)]
Remove most of charset markup from etc/HELLO
For the reasons, see the discussion that started in
https://lists.gnu.org/archive/html/emacs-devel/2018-12/msg00407.html
and its conclusion in
https://lists.gnu.org/archive/html/emacs-devel/2019-01/msg00144.html.
The only markup left is in the preamble, just to show the example
of this facility.
Olivier Certner [Fri, 23 Oct 2020 12:39:04 +0000 (14:39 +0200)]
ERC: Fix ERC's IBuffer format "crash" on killed server buffer
* lisp/erc/erc-ibuffer.el (erc-server-name): Fix a crash when
displaying (or updating) an IBuffer buffer using ERC's first IBuffer
format. This happens when one ERC buffer has its associated server
buffer killed, e.g., voluntarily or automatically after server
disconnection when `erc-kill-server-buffer-on-quit' is set to t. The
culprit is the "Server" column, which returns nil in this case.
Display "(closed)" instead (bug#44156).
Copyright-paperwork-exempt: yes
Ulf Jasper [Fri, 23 Oct 2020 12:48:49 +0000 (14:48 +0200)]
Move icalendar test data to test/lisp/calendar/icalendar-resources
* test/lisp/calendar/icalendar-tests.el (ert-x): Required for
'ert-resource-file'.
(icalendar-tests--data-dir): Removed.
(icalendar-tests--get-file-contents): Use 'ert-resource-file' for
finding test data files.
* test/data/icalendar/*: Moved to test/lisp/calendar/icalendar-resources/.
* test/lisp/calendar/icalendar-resources/*: Moved from test/data/icalendar.