kobarity [Wed, 17 Aug 2022 11:10:16 +0000 (13:10 +0200)]
Enhance Python font-lock to support multilines
* test/lisp/progmodes/python-tests.el
(python-tests-assert-faces-after-change): New helper function.
(python-font-lock-keywords-level-1-3)
(python-font-lock-assignment-statement-multiline-*): New tests.
* lisp/progmodes/python.el (python-rx): Add `sp-nl' to represent
space or newline (with/without backslash).
(python-font-lock-keywords-level-1)
(python-font-lock-keywords-maximum-decoration): Allow newlines
where appropriate.
(python-font-lock-extend-region): New function.
(python-mode): Set `python-font-lock-extend-region' to
`font-lock-extend-after-change-region-function'.
kobarity [Wed, 17 Aug 2022 10:44:56 +0000 (12:44 +0200)]
Add Python blocks support for hideshow
* lisp/progmodes/python.el (python-nav-beginning-of-block-regexp):
New variable.
(python-hideshow-forward-sexp-function): Change to call
`python-nav-end-of-block'.
(python-hideshow-find-next-block): New function to be used as
FIND-NEXT-BLOCK-FUNC in `hs-special-modes-alist'.
(python-info-looking-at-beginning-of-block): New function to be
used as LOOKING-AT-BLOCK-START-P-FUNC in `hs-special-modes-alist'.
(python-mode): Change settings of `hs-special-modes-alist'.
* test/lisp/progmodes/python-tests.el
(python-hideshow-hide-levels-1): Fix to keep empty lines.
(python-info-looking-at-beginning-of-block-1)
(python-hideshow-hide-levels-3, python-hideshow-hide-levels-4)
(python-hideshow-hide-all-1, python-hideshow-hide-all-2)
(python-hideshow-hide-all-3, python-hideshow-hide-block-1): New
tests (bug#56635).
* lisp/emacs-lisp/byte-opt.el (byte-optimize-and, byte-optimize-or):
Rewrite. Avoid branching on arguments statically known to be true or
false, and hoist code out to an unconditional prefix when possible.
Improved static detection of nil and non-nil expressions
* lisp/emacs-lisp/byte-opt.el (byte-opt--bool-value-form): New.
(byte-compile-trueconstp, byte-compile-nilconstp): Determine a static
nil or non-nil result in more cases. These functions have grown and
are no longer defsubst.
Michael Albinus [Tue, 16 Aug 2022 17:41:00 +0000 (19:41 +0200)]
Handle root permissions on remote files
* lisp/net/tramp.el (tramp-check-cached-permissions): Check also
for remote uid/gid being 0. (Bug#57238)
* lisp/net/tramp-sh.el (tramp-do-file-attributes-with-ls):
Convert numeric uid/gid strings into real strings.
(tramp-sh-get-signal-strings): Use `zerop'.
* lisp/net/tramp.el (tramp-root-id-string, tramp-root-id-integer):
New defconsts.
(tramp-handle-find-backup-file-name, tramp-handle-lock-file)
(tramp-local-host-p, tramp-handle-make-auto-save-file-name)
* lisp/net/tramp-sh.el (tramp-default-method-alist)
(ramp-default-user-alist, tramp-find-shell):
* lisp/net/tramp-sudoedit.el (tramp-default-user-alist): Use them.
* lisp/mh-e/mh-identity.el (mh-identity-pgg-default-user-id): Rename
from 'mh-identity-gpg-default-user-id', and make the old name into
obsolete variable alias. Update all uses.
Stefan Kangas [Tue, 16 Aug 2022 08:14:52 +0000 (10:14 +0200)]
Modernize spam section in Gnus manual slightly
* doc/misc/gnus.texi (The problem of spam): Don't explain what
spam is; there is no need for that in 2022. Don't explain
limitations of obsolete software TMDA; it's website has stopped
working but seems to have been updated last in 2007.
(Thwarting Email Spam, Anti-Spam Basics)
(Spam Package Configuration Examples): Prefer "spam" to "UCE".
(The problem of spam): Use example.org in example.
(SpamAssassin, Hashcash): Improve wording.
Jim Porter [Tue, 2 Aug 2022 18:40:43 +0000 (11:40 -0700)]
Make the bookmark fringe icon look like a bookmark
* src/fringe.c (large_circle_bits): New variable.
(standard_bitmaps): Add large_circle_bits.
* lisp/fringe.el (fringe-bitmaps): Add 'large-circle'.
(fringe-custom-set-bitmap): New function.
* lisp/cus-edit.el (widget-fringe-bitmap-prompt-value-history): New
variable.
(fringe-bitmap): New widget.
* lisp/bookmark.el (bookmark-set-fringe-mark): Obsolete in favor of...
(bookmark-fringe-mark): ... this.
(bookmark-fringe-mark): Rename this fringe bitmap to...
(bookmark-mark): ... and change it to look like a bookmark.
(bookmark-face): Don't set the ':background' of the face. Instead,
set ':distant-foreground'.
(bookmark--set-fringe-mark, bookmark--remove-fringe-mark)
(bookmark-store, bookmark--jump-via): Consult the
'bookmark-fringe-mark' option.
Jim Porter [Sun, 14 Aug 2022 20:48:22 +0000 (13:48 -0700)]
Fix non-interactive use of conditionals in Eshell
* lisp/eshell/esh-cmd.el (eshell-rewrite-if-command): Fix misplaced
't' symbol; it should be passed to 'eshell-invokify-arg'.
(eshell-do-eval): Pass 'synchronous-p' to recursive calls in some
missing cases.
Jim Porter [Sun, 14 Aug 2022 03:31:11 +0000 (20:31 -0700)]
Provide ERT explainer for 'eshell-match-command-output'
This was formerly named 'eshell-command-result-p', but "result" isn't
quite the right terminology, since this function specifically tested
the output of a command, not its Lisp result (as
'eshell-command-result' would return).
* test/lisp/eshell/eshell-tests-helpers.el (eshell-insert-command):
Provide a more-complete docstring.
(eshell-match-result): Rename to...
(eshell-match-output): ... this.
(eshell-match-output--explainer): New function.
(eshell-command-result-p): Rename to...
(eshell-match-command-output): ... this.
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.