Alan Mackenzie [Mon, 15 Aug 2022 12:18:01 +0000 (12:18 +0000)]
Enhance safe_run_hooks_1 and safe_run_hook_funcall to handle more arguments
This fixes bug #57179.
* src/keyboard.c (safe_run_hooks_1, safe_run_hook_funcall): Enhance these
functions so that nargs == 3 or 4 is handled as well as nargs == 2. This
allows them to be used to call hooks with 1 or 2 arguments.
Matt Armstrong [Mon, 15 Aug 2022 06:56:57 +0000 (08:56 +0200)]
Pacify warnings from gcc 12 in encode_coding_object
* src/coding.c (encode_coding_object): Mark saved_pt_byte with UNINIT
to silence a false alarm from -Wmaybe-uninitialized. This was already
done in decode_coding_object. The fix is correct because saved_pt is
used as a sentinel before saved_pt_byte is used (bug#57219).
Tweak autoloads of defsubsts containing spaces/control chars
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--print-form):
Escape control chars in bodies so that we don't end up with
trailing spaces if we're autoloading a defsubst containing
"\\`[ \t\n\r]*\\'".
* lisp/emacs-lisp/lisp-mode.el (lisp-current-defun-name): Further
tweaks to make (autoload 'foo) work again. Perhaps this should
all be reverted to the original version and then given a new rething.
Stefan Kangas [Sun, 14 Aug 2022 14:37:11 +0000 (16:37 +0200)]
Make gnus-iswitchb-completing-read obsolete
* lisp/gnus/gnus-util.el (gnus-iswitchb-completing-read): Make
obsolete. It depends on the obsolete library iswitchb.el.
(gnus-completing-read-function): Don't advertise above obsolete
function.
Paul Eggert [Sun, 14 Aug 2022 20:48:11 +0000 (13:48 -0700)]
Improve timefns speed on integers
* src/timefns.c (decode_lisp_time) [FASTER_TIMEFNS]:
Speed up when SPECIFIED_TIME is an integer.
(time_cmp) [FASTER_TIMEFNS]: Speed up when comparing integers.
Paul Eggert [Sun, 14 Aug 2022 18:11:30 +0000 (11:11 -0700)]
Fix selection preservation bug when USE_XCB
* src/xterm.c (x_preserve_selections) [USE_XCB]: Fix bug: use of
wrong ‘tem’ value. Found by GCC -Wanalyzer-use-of-uninitialized-value.
Move decl of local to make the (former) bug more obvious.
Michael Albinus [Sun, 14 Aug 2022 15:01:25 +0000 (17:01 +0200)]
Tramp code cleanup
* lisp/net/tramp-adb.el
(tramp-adb-handle-directory-files-and-attributes): Use it.
* lisp/net/tramp-compat.el (tramp-compat-replace-regexp-in-region):
New defalias.
* lisp/net/tramp-crypt.el (tramp-crypt-do-encrypt-or-decrypt-file-name):
Fix root filename for cache.
* lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file):
Adapt check for proper remote command.
* lisp/net/tramp-sh.el (tramp-open-shell): Add sanity check for
shell prompt.
(tramp-get-ls-command): Check, that argument "--color=never" has
the intended effect.
Stefan Kangas [Sun, 14 Aug 2022 14:17:31 +0000 (16:17 +0200)]
; Delete commented out manual section on emulation
This section has been commented out for close to a decade already. It
mostly deals with obsolete libraries, and there are separate manuals
for viper and edt.
* doc/emacs/misc.texi (Recursive Edit): Delete commented out section
on emulation.
Stefan Kangas [Sun, 14 Aug 2022 13:20:18 +0000 (15:20 +0200)]
Make Gnus FAQ more contemporary
* doc/misc/gnus-faq.texi (FAQ - Introduction): Fix timeline.
(FAQ - Changes): Delete outdated section.
(FAQ 5-5): Update to reflect that ispell.el and flyspell.el is
distributed with Emacs.
(FAQ 4-1, FAQ 4-7, FAQ 4-8, FAQ 4-14, FAQ 5-8, FAQ 5-10, FAQ 6-3)
(FAQ 7-2): Delete references to ancient versions of Gnus.
(FAQ 6-3): Delete reference to obsolete library nnir.el.
(FAQ - Glossary): Remove "Emacs" entry. This is self-explanatory, and
risks causing confusion; our docs never mean anything but "GNU Emacs"
when we say "Emacs".
Eli Zaretskii [Sun, 14 Aug 2022 12:47:59 +0000 (15:47 +0300)]
Further speedups of redisplay of long and truncated lines
* src/xdisp.c (mode_line_update_needed, redisplay_window)
(decode_mode_spec): Don't avoid calling current_column, as it is
now fast enough.
(redisplay_window) <optional_new_start>: Don't call 'move_it_to'
if its result will not be used.
(Flong_line_optimizations_p): New primitive.
* src/indent.c (Fcurrent_column): Doc fix.
(current_column, scan_for_column): When in a buffer with long
and/or truncated lines, quickly return an approximate value.
* src/window.c (Frecenter): Use the old text-mode code when the
buffer has very long lines.
* lisp/simple.el (line-move): Avoid costly calls to
'line-move-partial' and 'line-move-visual' when lines are
truncated and/or very long.
(move-beginning-of-line): Call 'line-beginning-position' instead
of the slower 'skip-chars-backward'.
Eli Zaretskii [Sun, 14 Aug 2022 05:51:44 +0000 (08:51 +0300)]
; Improve documentation of minibuffer history wrt completion
* doc/emacs/mini.texi (Minibuffer History): Mention explicitly
that minibuffer history is related also to completion candidates.
Improve indexing. (Bug#57163)
Po Lu [Sun, 14 Aug 2022 01:39:08 +0000 (09:39 +0800)]
More fixes to MPX drag-and-drop interaction
* src/xterm.c (x_dnd_begin_drag_and_drop): Also initialize the
keyboard device used for drag-and-drop.
(handle_one_xevent): Verify deviceid in more places; also test
keyboard device before swallowing F1.
Stefan Monnier [Sat, 13 Aug 2022 16:03:22 +0000 (12:03 -0400)]
nadvice.el: Avoid exponential blow up in interactive-form recursion
* lisp/emacs-lisp/nadvice.el (advice--interactive-form): Sink the call
to `commandp` into the autoloaded function case since it's redundant in
the other branch.
(advice--make-interactive-form): Take just the interactive forms rather
than the actual functions as arguments.
(oclosure-interactive-form): Use `advice--interactive-form` rather than
`commandp` since we'd call `advice--interactive-form` afterwards anyway.
Stefan Kangas [Sat, 13 Aug 2022 15:40:17 +0000 (17:40 +0200)]
Update Gnus Installation FAQ
* doc/misc/gnus-faq.texi (FAQ 1-1, FAQ 1-2, FAQ 1-3, FAQ 1-4)
(FAQ 1-5): Update to reflect that Gnus is no longer released
separately from Emacs. Delete FAQ on Gnus 5.10, released in May 2003.
Eli Zaretskii [Sat, 13 Aug 2022 13:59:22 +0000 (16:59 +0300)]
Speed up display of long lines under 'truncate-lines'
* src/xdisp.c (partial_line_height): Return zero for long and
truncated lines.
(fast_move_it_horizontally): New function.
(hscroll_window_tree, display_line): Use
'fast_move_it_horizontally' in preference to
'move_it_in_display_line_to', when dealing with long and truncated
lines.
(redisplay_internal): Optimize "optimization 3" for long and
truncated lines.
* src/buffer.c (syms_of_buffer) <large-hscroll-threshold>: New
variable.
Eli Zaretskii [Sat, 13 Aug 2022 06:58:44 +0000 (09:58 +0300)]
Fix a recently-added Eshell test on MS-Windows
* test/lisp/eshell/esh-var-tests.el
(esh-var-test/last-result-var-ext-cmd): Fix the test on
MS-Windows by making sure the internal 'format' command
is invoked. (Bug#57129)
Jim Porter [Wed, 10 Aug 2022 03:09:57 +0000 (20:09 -0700)]
Make '$?' and '$$' variables more consistent in Eshell
Previously, '$?' (last exit code) was only useful for external
commands, and '$$' (last result) was only useful for Lisp commands.
* lisp/eshell/esh-cmd.el (eshell-lisp-form-nil-is-failure): New
option.
(eshell-lisp-command): Set last exit code to 1 when the command
signals an error, and 2 if it returns nil (for Lisp forms only).
* lisp/eshell/esh-proc.el (eshell-sentinel): Set last result to t if
the command succeeded.
* test/lisp/eshell/esh-cmd-tests.el
(esh-cmd-test/while-loop-lisp-form, esh-cmd-test/until-loop-lisp-form)
(esh-cmd-test/if-else-statement-lisp-form)
(esh-cmd-test/if-else-statement-lisp-form-2)
(esh-cmd-test/unless-else-statement-lisp-form): New tests.
* test/lisp/eshell/esh-var-tests.el
(esh-var-test/last-status-var-lisp-command)
(esh-var-test/last-status-var-lisp-form)
(esh-var-test/last-status-var-lisp-form-2)
(esh-var-test/last-status-var-ext-cmd)
(esh-var-test/last-status-var-ext-cmd): New tests.
(esh-var-test/last-result-var2): Rename from this...
( esh-var-test/last-result-var-twice): ... to this.
* doc/misc/eshell.texi (Variables): Update documentation about '$?'
and '$$'.
(Control Flow): Mention that '(lisp forms)' can be used as
conditionals.
Jim Porter [Sat, 6 Aug 2022 20:37:28 +0000 (13:37 -0700)]
Only set Eshell execution result metavariables when non-nil
This simplifies usage of 'eshell-close-handles' in several places and
makes it work more like the docstring indicated it would.
* lisp/eshell/esh-io.el (eshell-close-handles): Only store EXIT-CODE
and RESULT if they're non-nil. Also, use 'dotimes' and 'dolist' to
simplify the implementation.
* doc/misc/eshell.texi (Invocation): Explain '&&' and '||'.
(for loop): Move from here...
(Control Flow): ... to here, and add documentation for other control
flow forms.
Po Lu [Sat, 13 Aug 2022 02:35:08 +0000 (10:35 +0800)]
Improve MPX interaction with drag-and-drop
* src/xfns.c (Fx_set_mouse_absolute_pixel_position): Use
internal client pointer record.
* src/xterm.c (x_dnd_cancel_dnd_early): New function. Only used
on XI2 builds so far.
(x_dnd_begin_drag_and_drop): Set the pointer device used for DND
events.
(xi_disable_devices): Cancel the drag-and-drop operation if that
device is disabled.
(x_send_scroll_bar_event): Update outdated comment.
(handle_one_xevent): Only accept DND events from that device.
(frame_set_mouse_pixel_position): Use internal client pointer
record.
Stefan Kangas [Thu, 11 Aug 2022 11:49:15 +0000 (13:49 +0200)]
Rename etc-authors-mode to emacs-authors-mode
* emacs-authors-mode.el: Rename all symbols from 'etc-authors-*' to
'emacs-authors-*'. Make most old names into obsolete compat aliases.
* admin/authors.el: (Bug#57105)
* etc/AUTHORS: Use 'emacs-authors' instead of 'etc-authors'.
Clarify face-at-point doc string and add (thing-at-point 'face)
* lisp/faces.el (face-at-point): Say what this function does.
* lisp/thingatpt.el (thing-at-point-face-at-point): Add `face'
type (bug#57087).
(thing-at-point-provider-alist, thing-at-point): Mention it in the
doc strings.
Default outline-minor-mode-use-buttons to only happen in *Help*
* lisp/outline.el (outline-minor-mode-use-buttons): Change the
default to only use buttons in the *Help* buffer (for now),
because it's too disruptive in other modes. This will probably be
changed again to have some other mechanism to opt in in certain
modes, but it's not clear what that mechanism should look like.