and they allow the elimination of the test internal to `while` since
we can immediately know when we return `t` or `nil` what the result
of the test will be.
`cl-labels` tends to generate this kind of code when it applies the
tail-call optimization.
Stefan Monnier [Wed, 20 Jan 2021 18:59:58 +0000 (13:59 -0500)]
* lisp/emacs-lisp/byte-opt.el (byte-optimize-lapcode): Move some opts.
This moves two optimizations from the final pass to the main loop.
Both may enable further optimizations (and the second can be applied
repeatedly but "from the end", so the loop in the final pass only gets
to apply it once).
Fix footnote-mode problem when reopening an old file
* lisp/mail/footnote.el (footnote--regenerate-alist): New function
(bug#7258).
(footnote-mode): Use it to restore footnotes after opening an old
file with footnotes.
Make symbol-at-point return nil if there's no symbols in the buffer
* lisp/thingatpt.el (thing-at-point--beginning-of-symbol): Special
op that errors out when there's no symbols in the buffer before
point (bug#14234).
(symbol): Use it.
Make `symbol-at-point' work in buffers with no symbols
* lisp/thingatpt.el (thing-at-point--end-of-symbol): New function
(bug#14234).
(symbol): Use it instead of `forward-symbol', because the latter
will move to the end of the buffer even if there is no symbol
there. Instead error out like `forward-sexp' and friends.
Stefan Monnier [Tue, 19 Jan 2021 17:10:48 +0000 (12:10 -0500)]
* lisp/startup.el: Fix bug#45857, bug#30994, and bug#45913.
(command-line): Don't re-evaluate the `custom-delayed-init-variables`
a second time after reading the `early-init.el` file.
(x-apply-session-resources): Set `blink-cursor-mode` rather than
`no-blinking-cursor`.
* lisp/frame.el (blink-cursor-start): Turn `blink-cursor-mode` off
if `blink-cursor-mode` was set to nil.
(blink-cursor-mode): Default to it being enabled regardless of
`window-system`.
* lisp/custom.el (custom-initialize-delay): Fox docstring now that
autoload.el preserves the `:initialize` info.
* lisp/calc/calc-embed.el (calc-embedded-set-modes): Prevent
the-language and the-display-just from being lexically bound here,
because they may be assigned using 'set'.
Fix slow abbrev expansion in `message-mode' in some circumstances
* lisp/gnus/message.el (message--syntax-propertize): Use the
correct Message mode syntax table to avoid having
`message-cite-prefix-regexp' trigger very heavy backtracing when
called from an abbrev context (which defines "_" as a word
constituent) (bug#45944).
* lisp/gnus/nntp.el (nntp-send-authinfo): Don't signal an
`nntp-authinfo-rejected' error, because that will stop Gnus
startup (bug#45855). Instead signal an error that will be caught
higher up.
Drew Adams [Tue, 19 Jan 2021 12:11:18 +0000 (09:11 -0300)]
Tweaks to the color widget (Bug#45829)
* lisp/wid-edit.el (widget-color-match, widget-color-validate): New
functions.
(color): Use the new functions. Base size on longest defined color
name, defaulting to the longest RGB hex string.
* etc/NEWS: Document the new face (bug#45840).
* lisp/progmodes/perl-mode.el (perl-non-scalar-variable): Define new
face.
(perl-font-lock-keywords-2): Apply 'perl-non-scalar-variable' face.
Stephen Gildea [Mon, 18 Jan 2021 21:27:22 +0000 (13:27 -0800)]
time-stamp-tests now pass in more locales
Update time-stamp-tests to use format-time-string to generate the date
words (month, day of week, AM/PM) instead of hard-coding English. Now
the tests pass in locales other than "C" and US English.
Eric Abrahamsen [Wed, 18 Mar 2020 03:53:05 +0000 (20:53 -0700)]
Allow gnus-retrieve-headers to return headers directly
Previously, all Gnus backends returned header information by writing
nov lines into the nntp-server-buffer, which was later parsed. This
commit allows the backends to return their header information as a
list of already-parsed headers, though so far none of the backends
actually do that. The agent, cache, cloud etc. now operate on parsed
headers rather than nov text, ie. they use gnus-fetch-headers instead
of gnus-retrieve-headers.
* lisp/gnus/gnus-sum.el (gnus-fetch-headers): Handle the case in which
gnus-retrieve-headers returns headers directly.
* lisp/gnus/nnvirtual.el (nnvirtual-retrieve-headers): Use
gnus-fetch-headers rather than gnus-retrieve-headers to get headers,
meaning we're operating on already-parsed headers.
(nnvirtual-convert-headers): Remove now-unnecessary function.
(nnvirtual-update-xref-header): Rewrite to operate on parsed header.
* lisp/gnus/gnus-cloud.el (gnus-cloud-available-chunks): Use
gnus-fetch-headers instead of gnus-retrieve-headers.
* lisp/gnus/gnus-cache.el (gnus-cache-retrieve-headers): Use
gnus-fetch-headers.
(gnus-cache-braid-nov, gnus-cache-braid-heads): Delete unnecessary
functions -- we now do this work on a list of parsed headers.
* lisp/gnus/gnus-agent.el (gnus-agent-retrieve-headers): Use
gnus-fetch-headers.
(gnus-agent-braid-nov): Remove unnecessary function.
(gnus-agent-fetch-headers): Use gnus-fetch-headers.
* lisp/ibuffer.el (ibuffer--abbreviate-file-name): New function.
(filename): Use it.
* lisp/ibuf-ext.el (ibuffer-mark-by-file-name-regexp): Prefer
read-regexp over read-string for reading regexps. Determine file
name using ibuffer-buffer-file-name for consistency. Abbreviate
file name using ibuffer-directory-abbrev-alist (bug#18859).
* src/nsterm.h (NS_USE_NSPasteboardTypeFileURL): New #define.
* src/nsterm.m (ns_term_init):
([EmacsView performDragOperation:]):
* src/nsselect.m (ns_string_to_symbol):
(nxatoms_of_nsselect):
NSFilenamesPboardType was deprecated in macOS 10.14; use
NSPasteboardTypeFileURL instead when available.
Eli Zaretskii [Sun, 17 Jan 2021 14:53:54 +0000 (16:53 +0200)]
Improve support for the Cham script and languages
* etc/NEWS: Announce the new 'cham' input method.
* etc/HELLO: Fix the order of letters in the Cham greeting.
Remove redundant newlines (reported by Ulrich Mueller
<ulm@gentoo.org>).
* lisp/language/cham.el ("Cham"): Add input-method entry.
* lisp/leim/quail/cham.el: New file.
* lisp/international/fontset.el (setup-default-fontset): Add an
entry for Cham.
Philipp Stephani [Sun, 17 Jan 2021 13:00:16 +0000 (14:00 +0100)]
Ensure that sentinels are called during 'accept-process-output'.
When we're trying to notify a process about a status change, we need
to ignore the SIGCHLD pipe temporarily, otherwise the code would
likely not run into the timeout case that's necessary for a status
change to happen.
* src/process.c (wait_reading_process_output): Ignore the SIGCHLD pipe
when notifying a process about a status change.
* test/src/process-tests.el (process-tests/sentinel-called)
(process-tests/sentinel-with-multiple-processes): New unit tests.
Philipp Stephani [Sun, 17 Jan 2021 10:52:40 +0000 (11:52 +0100)]
Add a bit more clarification around standard error processes.
* doc/lispref/processes.texi (Asynchronous Processes): Document
how to obtain the standard error process that Emacs creates.
(Accepting Output): Add an example how to wait for standard error in
case Emacs has created a standard error process.
Stefan Monnier [Sat, 16 Jan 2021 15:15:47 +0000 (10:15 -0500)]
* lisp/emacs-lisp/pcase.el: Add support for `not` to `pred`
(pcase--split-pred, pcase--funcall): Adjust for `not`.
(pcase--get-macroexpander): New function.
(pcase--edebug-match-macro, pcase--make-docstring)
(pcase--macroexpand): Use it.
* lisp/emacs-lisp/radix-tree.el (radix-tree-leaf): Use it!
* doc/lispref/control.texi (The @code{pcase} macro): Document it.
Philipp Stephani [Sun, 10 Jan 2021 15:31:12 +0000 (16:31 +0100)]
Fix deadlock when receiving SIGCHLD during 'pselect'.
If we receive and handle a SIGCHLD signal for a process while waiting
for that process, 'pselect' might never return. Instead, we have to
explicitly 'pselect' that the process status has changed. We do this
by writing to a pipe in the SIGCHLD handler and having
'wait_reading_process_output' select on it.
* src/process.c (child_signal_init): New helper function to create a
pipe for SIGCHLD notifications.
(child_signal_read, child_signal_notify): New helper functions to
read from/write to the child signal pipe.
(create_process): Initialize the child signal pipe on first use.
(handle_child_signal): Notify waiters that a process status has
changed.
(wait_reading_process_output): Make sure that we also catch
SIGCHLD/process status changes.
* test/src/process-tests.el
(process-tests/fd-setsize-no-crash/make-process): Remove workaround,
which is no longer needed.
Eli Zaretskii [Sat, 16 Jan 2021 18:15:17 +0000 (20:15 +0200)]
Fix two tests
* test/lisp/progmodes/elisp-mode-tests.el (xref-elisp-test-run):
Make sure file names can be compared as strings, by running them
through 'file-truename'. Reported by Vin Shelton
<acs@alumni.princeton.edu>.
* test/lisp/emacs-lisp/bytecomp-tests.el ("warn-obsolete-hook.el")
("warn-obsolete-variable.el"): Use [^z-a] to match a newline as
well. Reported by Vin Shelton <acs@alumni.princeton.edu>.
Ted Zlatanov [Sat, 16 Jan 2021 13:03:58 +0000 (13:03 +0000)]
EMBA container build improvements for Emacs build testing.
* test/infra/gitlab-ci.yml: Moved from .gitlab-ci.yml. Use the
EMBA container registry with a different login token storage file
for each commit. Split test stages into prep, build, fast tests,
normal tests, platform tests, and slow (everything) and use
templates where possible.
* .gitlab-ci.yml: Include test/infra/gitlab-ci.yml and move all
content there.
Eli Zaretskii [Sat, 16 Jan 2021 13:02:48 +0000 (15:02 +0200)]
Fix last change
* src/frame.c (Fset_mouse_position, Fset_mouse_pixel_position):
Don't compile the FRAME_MSDOS_P case on platforms other than
MSDOS, as that will never happen there.
Jared Finder [Wed, 2 Dec 2020 08:05:59 +0000 (00:05 -0800)]
Make mouse-related calls be more consistent on all frame types
* src/frame.c (Fset_mouse_position, Fset_mouse_pixel_position): Call
Fselect_frame and appropriate mouse_moveto function on all non-GUI
frame types, independent of #ifdef's.
* src/term.c (init_tty): Initialize mouse_face_window for all
non-GUI frame types.
(term_mouse_moveto) [HAVE_GPM]: Make available even if
HAVE_WINDOW_SYSTEM is defined.
* src/xdisp.c (try_window_id): Call gui_clear_window_mouse_face
in all cases.
(blink-cursor-mode): Use `blink-cursor-check` rather than
`blink-cursor--start-idle-timer` so we check for the presence of
a frame where the cursor can be blinked before activating the idle timer.
Stefan Monnier [Sat, 16 Jan 2021 03:38:52 +0000 (22:38 -0500)]
* src/dispnew.c (sit_for): Return nil when interrupted by process output
Before adbb4eacc2a984c0fc0b65ec761368fd9067d6c5,
`read_and_dispose_of_process_output` called
`record_asynch_buffer_change` which added "artificial" input events
(in the form of BUFFER_SWITCH_EVENTs), causing sit_for to return
Qnil when interrupted by process output. Without those BUFFER_SWITCH_EVENTs,
sit_for now tends to return Qt when interrupted by process output
making `read_char` believe that we've waited the whole timeout,
As consequence incoming process output tended to cause premature
auto-saving of files (sometimes right after almost every key press).
This patch recovers the previous behavior, which is not ideal
(incoming process output can delay auto-save indefinitely), but has
been good enough for many years.
* lisp/window.el (display-buffer-use-some-window): Remove spurious
message included in 2021-01-11 "Support using auth-source for
NickServ passwords in ERC" (bug#45340#44).
Phillip Lord [Thu, 14 Jan 2021 22:51:13 +0000 (22:51 +0000)]
Remove support for 32 bit build
* admin/nt/dist-build/README-scripts: Update
* admin/nt/dist-build/README-windows-binaries: Update
* admin/nt/dist-build/build-zips.sh: Remove 32 bit and fix paths
* admin/nt/dist-build/build-dep-zips.py: Remove 32 bit and update
paths
* admin/nt/dist-build/emacs.nsi: Remove 32 bit and fix paths
Aaron Jensen [Sun, 10 Jan 2021 02:43:32 +0000 (20:43 -0600)]
Fix 'window-text-pixel-size' when there are leading/trailing spaces
First, scan to find the first non-whitespace character and then
backtrack to find the beginning of the line. The previous
algorithm always started on the non-whitespace character during
the backtrack, causing it to stop immediately and not actually
find the beginning of the line. The same applies to the end of
line calculation.
* src/xdisp.c: (Fwindow_text_pixel_size): Fix off by one error.
(Bug#45748)
* test/src/xdisp-tests.el (xdisp-tests--window-text-pixel-size)
(xdisp-tests--window-text-pixel-size-leading-space)
(xdisp-tests--window-text-pixel-size-trailing-space): New tests.
Jared Finder [Sat, 2 Jan 2021 22:10:17 +0000 (14:10 -0800)]
Make libraries works with xterm-mouse-mode.
Change calls from 'read-event' to 'read-key' in libraries expecting
mouse events. Do this only when 'xterm-mouse-mode' is enabled. That
way those libraries read decoded mouse events instead of the
underlying escape sequence. Add a parameter to 'read-key' that avoids
running any of the unbound fallbacks in 'read-key-sequence' so the
libraries can read mouse button-down events.
For backward compatibility purposes, the above logic is contained in a
new internal-only function: 'read--potential-mouse-event'.
* doc/lispref/commands.texi (Reading One Event): Document new
parameter to 'read-key'. Mention that non-character events on
terminals need 'read-key'.
* lisp/subr.el (read-key-full-map): Add new keymap used by 'read-key'.
(read-key): Add new parameter 'fallbacks-disabled' to prevent running
any of the unbound fallbacks normally run by 'read-key-sequence'.
(read--potential-mouse-event): Add new function that calls 'read-key'
or 'read-event' depending on if 'xterm-mouse-mode' is set.
* lisp/foldout.el (foldout-mouse-swallow-events):
* lisp/isearch.el (isearch-pre-command-hook):
* lisp/mouse-drag.el (mouse-drag-throw, mouse-drag-drag):
* lisp/mouse.el (mouse-drag-secondary):
* lisp/ruler-mode.el (ruler-mode-mouse-grab-any-column)
(ruler-mode-mouse-drag-any-column-iteration):
* lisp/strokes.el (strokes-read-stroke, strokes-read-complex-stroke):
* lisp/textmodes/artist.el (artist-mouse-draw-continously)
(artist-mouse-draw-poly, artist-mouse-draw-2points):
* lisp/vc/ediff-wind.el (ediff-get-window-by-clicking):
* lisp/wid-edit.el (widget-button--check-and-call-button)
(widget-button-click): Call 'read--potential-mouse-event' instead of
'read-event'.
* lisp/wid-edit.el (widget-key-sequence-read-event): Call 'read-key'
with 'fallbacks-disabled' set instead of 'read-event'. Unlike above
changes, this is unconditionally applied so it works for function
keys too. Apply 'local-function-key-map' instead of
'function-key-map' as that contains the full terminal translations.
* lisp/vc/ediff.el (ediff-windows): Use 'display-mouse-p' to check if
a mouse is available.
* src/lread.c (Fread_event): Recommend 'read-key' in docstring for
'read-event' for non-character events.
* lisp/net/tramp.el (tramp-methods): Adapt docstring.
(tramp-debug-message): Suppress lockfiles.
(tramp-test-message): New defun.
(tramp-direct-async-process-p): Check also for `tramp-direct-async'.
(tramp-handle-make-process): Do not check for `tramp-direct-async-args'.
* test/lisp/net/tramp-tests.el (all): Replace `string-match' by
`string-match-p'.
(dired-copy-dereference): Declare.
(tramp-test-temporary-file-directory):
Remove `tramp-direct-async-args` for mock method.
(tramp-test15-copy-directory, tramp-test40-special-characters)
(tramp-test40-special-characters-with-stat)
(tramp-test40-special-characters-with-perl)
(tramp-test40-special-characters-with-ls, tramp-test41-utf8)
(tramp-test41-utf8-with-stat, tramp-test41-utf8-with-perl)
(tramp-test41-utf8-with-ls): Skip for tramp-rclone.el.
(tramp--test--deftest-direct-async-process): Do not skip for mock
method.
(tramp-test32-shell-command): Adapt test for direct async processes.
(tramp-test36-vc-registered, tramp--test-hpux-p, tramp--test-ksh-p):
Use `tramp-test-vec'.
Eli Zaretskii [Fri, 15 Jan 2021 08:12:09 +0000 (10:12 +0200)]
Fix 'kill-visual-line'
* lisp/simple.el (kill-whole-line): Mention in the doc string that
this option affects 'kill-visual-line' as well.
(kill-visual-line): Improve the doc string. Delete the character
at which the line was wrapped under 'visual-line-mode'. Don't
indiscriminately delete whitespace following the wrap point.
(Bug#45837)
Stefan Monnier [Thu, 14 Jan 2021 22:37:57 +0000 (17:37 -0500)]
* lisp/startup.el (command-line): Remove redundant set of no-blinking-cursor
This is redundant because this was set based on "X" resources under
(memq window-system '(x w32 ns)) but the exact same resources and
values are tested in `x-apply-session-resources` which is also used for
those 3 window systems.
Stefan Monnier [Thu, 14 Jan 2021 22:21:56 +0000 (17:21 -0500)]
* lisp/startup.el (command-line): Remove redundant set of no-blinking-cursor
This was set when (or noninteractive emacs-basic-display), but
the code that sets `emacs-basic-display` also sets `no-blinking-cursor`
and `blink-cursor-mode`s value already tests `noninteractive`
alongside `no-blinking-cursor`.
Stefan Monnier [Thu, 14 Jan 2021 21:45:40 +0000 (16:45 -0500)]
Fix marking "delayed-initialization" vars as dynamically scoped
We used to mark those vars as dynbound in `custom-reevaluate-setting`
which forced us to bind `current-load-list` around it to avoid having
the vars be associated with the wrong file. Move this marking to
`custom-initialize-delay` so we don't need this workaround.
* lisp/custom.el (custom-initialize-delay): Mark the var as dynamic.
(custom-reevaluate-setting): Don't use `defvar` here.
* lisp/startup.el (command-line): Don't let-bind `current-load-list`
around calls to `custom-reevaluate-setting`.
Glenn Morris [Thu, 14 Jan 2021 15:50:28 +0000 (07:50 -0800)]
Merge from origin/emacs-27
488204cdc6 (origin/emacs-27) Remove one of recently added warnings ab... 55bc1560ac Fix assertion failure in window_box_height (Bug#45737) 27743e9e70 Fix cl-concatenate inlining 32a3758c84 Fix infloop in 'pixel-scroll-mode' 74d18957b8 Fix inhibiting the default.el loading in user init file
Juri Linkov [Wed, 13 Jan 2021 18:19:22 +0000 (20:19 +0200)]
* lisp/isearch.el: C-s C-u M-y reads a string from the kill-ring minibuffer
* lisp/isearch.el (isearch-yank-from-kill-ring): New command
with code moved from isearch-yank-pop.
(isearch-yank-pop): Use isearch-yank-from-kill-ring.
(isearch-yank-pop-only): Add optional arg, and call
isearch-yank-from-kill-ring when the prefix arg is C-u.
https://lists.gnu.org/archive/html/emacs-devel/2021-01/msg00089.html