[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/android a892c0487a6 2/2: Merge remote-tracking branch 'origin/ma
From: |
Po Lu |
Subject: |
feature/android a892c0487a6 2/2: Merge remote-tracking branch 'origin/master' into feature/android |
Date: |
Tue, 21 Feb 2023 08:08:53 -0500 (EST) |
branch: feature/android
commit a892c0487a6391e9d35296b2b4168318a7ca622f
Merge: 77feba74564 428442fb530
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Merge remote-tracking branch 'origin/master' into feature/android
---
ChangeLog.3 | 430 ++++++++++++++++++++-
doc/emacs/dired.texi | 40 +-
doc/lispref/eval.texi | 17 +-
doc/lispref/functions.texi | 13 +-
doc/lispref/modes.texi | 7 +-
doc/misc/transient.texi | 5 +-
etc/AUTHORS | 24 +-
etc/HISTORY | 2 +
etc/NEWS | 15 +
lisp/emacs-lisp/bytecomp.el | 2 +-
lisp/emacs-lisp/comp.el | 4 +-
lisp/help-fns.el | 4 +-
lisp/image/image-dired.el | 15 +-
lisp/org/ob-octave.el | 4 +-
lisp/org/org-agenda.el | 2 +-
lisp/org/org-cycle.el | 3 +
lisp/org/org-element.el | 6 +-
lisp/org/org-version.el | 2 +-
lisp/org/ox-texinfo.el | 16 +-
lisp/progmodes/c-ts-mode.el | 57 ++-
lisp/progmodes/cc-fonts.el | 2 +-
lisp/progmodes/cc-langs.el | 2 +-
lisp/progmodes/csharp-mode.el | 33 +-
lisp/progmodes/eglot.el | 19 +-
lisp/progmodes/js.el | 6 +-
lisp/progmodes/rust-ts-mode.el | 110 +++---
lisp/progmodes/typescript-ts-mode.el | 11 +-
lisp/progmodes/xref.el | 2 +-
lisp/simple.el | 7 +-
lisp/subr.el | 30 +-
lisp/transient.el | 20 +-
lisp/treesit.el | 32 +-
src/comp.c | 8 +-
src/data.c | 63 +--
src/eval.c | 2 +-
src/regex-emacs.c | 18 +
test/lisp/emacs-lisp/nadvice-tests.el | 8 +-
test/lisp/help-fns-tests.el | 4 -
.../c-ts-mode-resources/indent-preproc.erts | 45 +++
.../lisp/progmodes/c-ts-mode-resources/indent.erts | 31 ++
test/lisp/progmodes/c-ts-mode-tests.el | 4 +
test/lisp/subr-tests.el | 10 +-
test/src/data-tests.el | 36 ++
test/src/regex-emacs-tests.el | 11 +
44 files changed, 918 insertions(+), 264 deletions(-)
diff --git a/ChangeLog.3 b/ChangeLog.3
index c254f595e89..85cccf0d6ed 100644
--- a/ChangeLog.3
+++ b/ChangeLog.3
@@ -1,3 +1,431 @@
+2022-02-18 Stefan Kangas <stefankangas@gmail.com>
+
+ * Version 28.3 released.
+
+2023-02-17 Stefan Kangas <stefankangas@gmail.com>
+
+ Update HISTORY for Emacs 28.3
+
+2023-02-17 Stefan Kangas <stefankangas@gmail.com>
+
+ Bump Emacs version to 28.3
+
+ * README:
+ * configure.ac:
+ * msdos/sed2v2.inp:
+ * nt/README.W32: Bump Emacs version to 28.3.
+
+2023-02-17 Stefan Kangas <stefankangas@gmail.com>
+
+ Update NEWS for Emacs 28.3
+
+ * etc/NEWS: Update for Emacs 28.3.
+
+2023-02-17 Stefan Kangas <stefankangas@gmail.com>
+
+ Update ChangeLog and AUTHORS for Emacs 28.3
+
+ * ChangeLog.3:
+ * etc/AUTHORS: Update for Emacs 28.3.
+
+2023-02-17 Xi Lu <lx@shellcodes.org>
+
+ Fix etags local command injection vulnerability
+
+ * lib-src/etags.c: (escape_shell_arg_string): New function.
+ (process_file_name): Use it to quote file names passed to the
+ shell. (Bug#59817)
+
+ (cherry picked from commit 01a4035c869b91c153af9a9132c87adb7669ea1c)
+
+2023-02-17 Xi Lu <lx@shellcodes.org>
+
+ Fixed ctags local command execute vulnerability
+
+ * lib-src/etags.c:
+
+ (clean_matched_file_tag): New function
+ (do_move_file): New function
+ (readline_internal):
+ Add `leave_cr` parameter, if true, include the \r character
+
+ * test/manual/etags/CTAGS.good_crlf: New file
+ * test/manual/etags/CTAGS.good_update: New file
+ * test/manual/etags/crlf: New file
+ * test/manual/etags/Makefile: Add `ctags -u` test cases
+
+ (cherry picked from commit d48bb4874bc6cd3e69c7a15fc3c91cc141025c51)
+
+2023-02-17 Xi Lu <lx@shellcodes.org>
+
+ Fix ruby-mode.el local command injection vulnerability (bug#60268)
+
+ * lisp/progmodes/ruby-mode.el
+ (ruby-find-library-file): Fix local command injection vulnerability.
+
+ (cherry picked from commit 9a3b08061feea14d6f37685ca1ab8801758bfd1c)
+
+2023-02-17 Xi Lu <lx@shellcodes.org>
+
+ Fix htmlfontify.el command injection vulnerability.
+
+ * lisp/htmlfontify.el (hfy-text-p): Fix command injection
+ vulnerability. (Bug#60295)
+
+ (cherry picked from commit 1b4dc4691c1f87fc970fbe568b43869a15ad0d4c)
+
+2022-12-19 Eli Zaretskii <eliz@gnu.org>
+
+ Fix storing email into nnmail by Gnus
+
+ Backporting suggested by Florian Weimer, since this is
+ a denial-of-service issue.
+ * lisp/gnus/nnml.el (nnml--encode-headers): Wrap
+ 'rfc2047-encode-string' calls with 'ignore-errors', to avoid
+ disrupting email workflows due to possibly-invalid headers.
+ Reported by Florian Weimer <fweimer@redhat.com>.
+
+ (cherry picked from commit 23f7c9c2a92e4619b7c4d2286d4249f812cd695d)
+
+2022-11-14 Robert Pluim <rpluim@gmail.com>
+
+ Explain how to bind keys to non-ASCII sequences
+
+ * doc/emacs/custom.texi (Init Rebinding): Explain how to use `kbd'
+ when binding keys to non-ASCII sequences.
+
+2022-11-12 Eli Zaretskii <eliz@gnu.org>
+
+ Document that 'transient-mark-mode' is off in batch mode
+
+ * doc/emacs/mark.texi (Mark, Disabled Transient Mark): Document,
+ belatedly, that 'transient-mark-mode' is turned on by default only
+ in interactive sessions. (Bug#59201)
+
+2022-10-14 Eli Zaretskii <eliz@gnu.org>
+
+ Document how to control where the *.eln files are written
+
+ * doc/lispref/compile.texi (Native Compilation): Document the
+ trick of pointing $HOME to a non-existent directory.
+ (Native-Compilation Variables): Document the role of
+ 'native-comp-eln-load-path' in determining where *.eln files are
+ written.
+
+2022-10-14 Robert Pluim <rpluim@gmail.com>
+
+ Add cross-reference to alternative syntaxes for Unicode
+
+ These alternative syntaxes allow you to specify Unicode codepoints
+ using only ASCII, which helps avoid decoding issues.
+
+ * doc/emacs/custom.texi (Init Non-ASCII): Add cross reference to
+ "General Escape Syntax" in the Emacs Lisp Reference Manual.
+
+2022-10-07 Lars Ingebrigtsen <larsi@gnus.org>
+
+ Update name of hs-mouse-toggle-hiding in Emacs manual
+
+ * doc/emacs/programs.texi (Hideshow): Update the name of
+ hs-mouse-toggle-hiding (bug#58331).
+
+2022-10-06 Stefan Kangas <stefankangas@gmail.com>
+
+ Fix typo in `(emacs) Lisp Doc'
+
+ * doc/emacs/programs.texi (Lisp Doc): Fix reference to
+ 'eldoc-echo-area-display-truncation-message'. (Bug#58324)
+
+2022-10-06 Stefan Kangas <stefankangas@gmail.com>
+
+ Fix references to 'default-indent-new-line'
+
+ * doc/emacs/programs.texi (Comment Commands)
+ (Multi-Line Comments): Fix references to
+ 'default-indent-new-line'. (Bug#58325)
+
+2022-10-04 Andreas Schwab <schwab@linux-m68k.org>
+
+ * src/emacs.c (load_pdump): Propery handle case when executable
+ wasn't found.
+
+2022-10-04 Eli Zaretskii <eliz@gnu.org>
+
+ Avoid assertion violations in STRING_CHAR
+
+ * src/xdisp.c (handle_composition_prop):
+ * src/editfns.c (styled_format): Don't call 'STRING_CHAR' on
+ unibyte strings. This avoids assertion violation in
+ 'string_char_and_length'.
+
+ (cherry picked from commit d52d6e1e106117eb4bba81a65e256e2e793037b6)
+
+2022-10-03 Stefan Kangas <stefankangas@gmail.com>
+
+ Fix documentation of 'TAB' in cc-mode
+
+ * doc/emacs/programs.texi (C Indent): Fix documentation of 'TAB'
+ in cc-mode. (Bug#58258)
+
+2022-10-03 Stefan Kangas <stefankangas@gmail.com>
+
+ Fix 'org-export-dispatch' command name in manual
+
+ * doc/emacs/text.texi (Org Authoring): Fix 'org-export-dispatch'
+ command name. (Bug#58260)
+
+2022-10-02 Andreas Schwab <schwab@linux-m68k.org>
+
+ * src/emacs.c (load_pdump): Fix use of xpalloc.
+
+2022-10-02 Eli Zaretskii <eliz@gnu.org>
+
+ Avoid assertion violation in 'xpalloc'
+
+ * src/emacs.c (load_pdump): Ensure the 3rd argument of xpalloc is
+ always positive. (Bug#58232)
+
+2022-09-30 Michael Albinus <michael.albinus@gmx.de>
+
+ Fix connection property incompatibility in Tramp
+
+ * lisp/net/tramp.el (tramp-get-remote-tmpdir): Remove obsolete
+ connection property "tmpdir". (Bug#57800)
+
+2022-09-29 Lars Ingebrigtsen <larsi@gnus.org>
+
+ Update some Gnus documentation in the Emacs manual
+
+ * doc/emacs/misc.texi (Gnus Group Buffer, Gnus Summary Buffer):
+ Update documentation (bug#58145).
+
+2022-09-28 Eli Zaretskii <eliz@gnu.org>
+
+ Clarify image file search
+
+ * doc/lispref/display.texi (Defining Images, Image Descriptors):
+ * lisp/image.el (create-image): Clarify that non-absolute image
+ files are searched along 'image-load-path'. (Bug#52931)
+
+2022-09-28 Stefan Kangas <stefankangas@gmail.com>
+
+ .mailcap: Some additional fixes.
+
+2022-09-28 Eli Zaretskii <eliz@gnu.org>
+
+ Avoid assertion violations in 'pop_it'
+
+ * src/xdisp.c (pop_it): Avoid assertion violations when handling
+ lists or vectors of display properties. (Bug#58122)
+
+2022-09-28 Stefan Kangas <stefankangas@gmail.com>
+
+ Add .mailmap for proper git log output
+
+ This file is used to fix a few misspelled names in various git
+ listings (e.g., "git log"). This can be used to fix incorrect
+ attribution, poor display, or names showing up more than once.
+ It also allows updating an old email addresses to a new one.
+ See "man git-shortlog" for more information on the format.
+
+ * .mailmap: New file.
+
+2022-09-27 Stefan Kangas <stefankangas@gmail.com>
+
+ * doc/emacs/ack.texi (Acknowledgments): Update maintainers.
+
+2022-09-24 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * lisp/progmodes/hideshow.el (hs-toggle-hiding): Fix `interactive` form
+
+ This fixes the first part of bug#52092, which is a regression
+ introduced by commit d0e9113de97.
+
+2022-09-23 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ Fix shaping with bitmap-only fonts on HarfBuzz 5.2.0 (Bug#57976)
+
+ * src/ftcrfont.c (ftcrhbfont_begin_hb_font): Undo last change for
+ HarfBuzz 5.2.0.
+
+2022-09-20 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * lisp/text-modes/tex-mode.el (tex-mode): Fix AUCTeX regression
+
+ As discussed in
+ https://lists.gnu.org/r/auctex/2022-08/msg00004.html
+ AUCTeX installs its own advice to redefine `tex-mode`, and that
+ advice used to take precedence before commit 6075a7c5ae3fa456cd.
+
+2022-09-20 Robert Pluim <rpluim@gmail.com>
+
+ Add vc-annotate-switches to manual
+
+ * doc/emacs/maintaining.texi (Old Revisions): Add description of
+ `vc-annotate-switches' and `vc-BACKEND-annotate-switches'.
+
+2022-09-20 Robert Pluim <rpluim@gmail.com>
+
+ Remove mention of non-existent `annotate-switches'
+
+ * lisp/vc/vc.el (vc-annotate-switches): Remove mention of
+ `annotate-switches'. As far as I can tell this has never existed in
+ Emacs.
+
+2022-09-20 Robert Pluim <rpluim@gmail.com>
+
+ Mention that src/macuvs.h sometimes needs committing
+
+ * admin/notes/unicode: src/macuvs.h is generated, but needs to be
+ committed sometimes.
+
+2022-09-19 Gerd Möllmann <gerd@gnu.org>
+
+ MacOS ld warning from native compilation (bug#57849)
+
+ * lisp/emacs-lisp/comp.el (native-comp-driver-options): Add "-Wl,-w"
+ on Darwin systems.
+ * etc/NEWS: Describe change.
+
+2022-09-18 Michael Albinus <michael.albinus@gmx.de>
+
+ Fix Tramp error with eshell integration
+
+ * lisp/net/tramp-integration.el (tramp-eshell-directory-change):
+ Respect local `default-directory'. (Bug#57556)
+
+2022-09-17 Michael Albinus <michael.albinus@gmx.de>
+
+ Sync with Tramp 2.5.3.2. Don't merge with master
+
+ * doc/misc/tramp.texi (Android shell setup): Rework.
+ (Frequently Asked Questions): Improve recommendations for speeding up.
+
+ * doc/misc/trampver.texi:
+ * lisp/net/trampver.el: Change version to "2.5.4-pre".
+
+ * lisp/net/tramp-adb.el (tramp-methods): Use "%d".
+ (tramp-adb-handle-directory-files-and-attributes): Fix "." and
+ ".." in listing.
+ (tramp-adb-handle-file-attributes)
+ (tramp-adb-handle-directory-files-and-attributes)
+ (tramp-adb-handle-file-name-all-completions): Pipe "ls" output
+ through "cat", in order to avoid quoting special characters.
+ (tramp-adb-maybe-open-connection): Compute args from `tramp-login-args'.
+
+ * lisp/net/tramp-compat.el (tramp-compat-replace-regexp-in-region):
+ New defalias.
+
+ * lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file):
+ Adapt check for proper remote command.
+
+ * lisp/net/tramp.el (tramp-methods): Adapt docstring.
+ (tramp-handle-make-process): Check for adb device if indicated.
+ (tramp-get-remote-tmpdir): Cache result in temporary connection
+ property.
+
+ * test/lisp/net/tramp-tests.el (tramp-test17-insert-directory)
+ (tramp-test22-file-times, tramp--test-utf8): Adapt tests.
+ (tramp--test-shell-file-name): Do not depend on `tramp--test-adb-p'.
+ (tramp-test46-unload): Ignore autoload functions in
+ `tramp-file-name' structure tests, since `tramp-file-name-handler'
+ is also autoloaded in Emacs 29.
+
+2022-09-17 Stefan Kangas <stefankangas@gmail.com>
+
+ Simplify regexp in make-news-html-file
+
+ * admin/admin.el (make-news-html-file): Simplify regexp.
+ Suggested by Mattias Engdegård <mattiase@acm.org>.
+
+2022-09-16 Stefan Kangas <stefankangas@gmail.com>
+
+ * admin/admin.el (make-news-html-file): Set id on correct tag.
+
+2022-09-16 Stefan Kangas <stefankangas@gmail.com>
+
+ Add version headlines to HTML NEWS export
+
+ This allows linking to, e.g. "NEWS.28.html#28.1" to go directly to
+ those release notes.
+ * admin/admin.el (admin--org-export-headers-format)
+ (make-news-html-file): Add XX.Y version headlines with an HTML anchor.
+
+2022-09-16 Stefan Kangas <stefankangas@gmail.com>
+
+ Improve HTML export of NEWS file
+
+ * admin/admin.el (admin--org-export-headers-format)
+ (admin--org-html-postamble): New variables.
+ (admin--require-external-package): New function.
+ (make-news-html-file): Improve HTML export.
+
+2022-09-16 Stefan Kangas <stefankangas@gmail.com>
+
+ Delete "etc/NEWS*.html" from .gitignore
+
+ We actually do want to see it when preparing a release, so that we
+ don't include it in a tarball by mistake.
+ * .gitignore: Don't ignore "etc/NEWS*.html".
+
+2022-09-16 Stefan Kangas <stefankangas@gmail.com>
+
+ Recommend NonGNU ELPA over MELPA
+
+ * doc/misc/org.org (Using CDLaTeX to enter math, Footnotes): Recommend
+ NonGNU ELPA over MELPA.
+
+2022-09-16 Stefan Kangas <stefankangas@gmail.com>
+
+ Minor doc fixes in picture.el
+
+ * lisp/textmodes/picture.el: Improve Commentary.
+ (picture-forward-column, picture-backward-column)
+ (picture-move-down, picture-move-up, picture-movement-nw)
+ (picture-movement-ne, picture-movement-sw, picture-movement-se)
+ (picture-set-motion, picture-clear-line, picture-newline)
+ (picture-tab, picture-yank-rectangle)
+ (picture-yank-rectangle-from-register, picture-insert-rectangle)
+ (picture-draw-rectangle): Minor doc fixes.
+
+2022-09-16 Stefan Kangas <stefankangas@gmail.com>
+
+ * lisp/textmodes/page-ext.el: Improve Commentary.
+
+2022-09-14 Stefan Kangas <stefankangas@gmail.com>
+
+ Automate exporting etc/NEWS to HTML
+
+ * admin/admin.el (make-news-html-file): New function.
+ * .gitignore: Ignore generated "etc/NEWS*.html" file.
+
+2022-09-14 Eli Zaretskii <eliz@gnu.org>
+
+ * Makefile.in (uninstall): Remove the *.eln files. (Bug#57771)
+
+2022-09-12 Stefan Kangas <stefankangas@gmail.com>
+
+ Update HISTORY for Emacs 28.2
+
+ * etc/HISTORY: Update for the Emacs 28.2 release.
+
+2022-09-07 Stefan Kangas <stefankangas@gmail.com>
+
+ Bump Emacs version to 28.2
+
+ * README:
+ * configure.ac:
+ * msdos/sed2v2.inp:
+ * nt/README.W32: Bump Emacs version to 28.2.
+
+2022-09-07 Stefan Kangas <stefankangas@gmail.com>
+
+ Update ChangeLog and AUTHORS for Emacs 28.2
+
+ * ChangeLog.3:
+ * etc/AUTHORS:
+ * etc/NEWS: Update for Emacs 28.2.
+
2022-09-06 Stefan Kangas <stefankangas@gmail.com>
* doc/misc/idlwave.texi (Troubleshooting): Don't say "Emacsen".
@@ -236920,7 +237348,7 @@
This file records repository revisions from
commit 9d56a21e6a696ad19ac65c4b405aeca44785884a (exclusive) to
-commit ddabb03a0176beb4b7fc8d4f2267d459fd2ebded (inclusive).
+commit f7bd5ac55211ad0ae2e473f0dff46df1e60f99bf (inclusive).
See ChangeLog.2 for earlier changes.
;; Local Variables:
diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index cae8207990e..3f2c8d4afdf 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -1655,11 +1655,11 @@ become available.
@findex image-dired-display-previous
With point in the thumbnail buffer, you can type @key{RET}
(@code{image-dired-display-this}) to display the image in another
-window. Use the arrow keys to move around in the thumbnail buffer.
-For easy browsing, use @key{SPC} (@code{image-dired-display-next}) to
-advance and display the next image. Typing @key{DEL}
-(@code{image-dired-display-previous}) backs up to the previous
-thumbnail and displays that instead.
+window. Use the standard Emacs movement key bindings or the arrow
+keys to move around in the thumbnail buffer. For easy browsing, use
+@key{SPC} (@code{image-dired-display-next}) to advance and display the
+next image. Typing @key{DEL} (@code{image-dired-display-previous})
+backs up to the previous thumbnail and displays that instead.
@vindex image-dired-external-viewer
Type @kbd{C-@key{RET}}
@@ -1669,9 +1669,19 @@ in an external viewer. You must first configure
You can delete images through Image-Dired also. Type @kbd{d}
(@code{image-dired-flag-thumb-original-file}) to flag the image file
-for deletion in the Dired buffer. You can also delete the thumbnail
-image from the thumbnail buffer with @kbd{C-d}
-(@code{image-dired-delete-char}).
+for deletion in the Dired buffer. Alternatively, you can remove an
+image's thumbnail from the thumbnail buffer without flagging the image
+for deletion, by typing @kbd{C-d} (@code{image-dired-delete-char}).
+
+@findex image-dired-dired-toggle-marked-thumbs
+@findex image-dired-dired-display-external
+@findex image-dired-dired-display-image
+ You could also use Image-Dired for ``inline'' operations (i.e.,
+right into the Dired buffer). Type @kbd{C-t C-t}, and the thumbnails
+of the selected images in Dired will appear in front of their names
+(@code{image-dired-dired-toggle-marked-thumbs}). @kbd{C-t i} and
+@kbd{C-t x} will display the image under the point in Emacs or with
+the external viewer, respectively.
More advanced features include @dfn{image tags}, which are metadata
used to categorize image files. The tags are stored in a plain text
@@ -1684,14 +1694,18 @@ in the minibuffer. To mark files having a certain tag,
type @kbd{C-t f}
(@code{image-dired-mark-tagged-files}). After marking image files
with a certain tag, you can use @kbd{C-t d} to view them.
+@findex image-dired-dired-comment-files
+@findex image-dired-dired-edit-comment-and-tags
You can also tag a file directly from the thumbnail buffer by typing
-@kbd{t t} and you can remove a tag by typing @kbd{t r}. There is also
-a special tag called ``comment'' for each file (it is not a tag in
-the exact same sense as the other tags, it is handled slightly
-differently). That is used to enter a comment or description about the
-image. You comment a file from the thumbnail buffer by typing
+@kbd{t t}, and you can remove a tag by typing @kbd{t r}. There is
+also a special tag called ``comment'' for each file (it is not a tag
+in the exact same sense as the other tags, it is handled slightly
+differently). That is used to enter a comment or description about
+the image. You comment a file from the thumbnail buffer by typing
@kbd{c}. You will be prompted for a comment. Type @kbd{C-t c} to add
a comment from Dired (@code{image-dired-dired-comment-files}).
+@kbd{C-t e} will bring a buffer to edit comment and tags
+(@code{image-dired-dired-edit-comment-and-tags}).
@vindex image-dired-thumb-visible-marks
Files that are marked in Dired will also be marked in Image-Dired if
diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi
index 88e899de1e8..a45517287b7 100644
--- a/doc/lispref/eval.texi
+++ b/doc/lispref/eval.texi
@@ -252,11 +252,8 @@ the original symbol. If the contents are another symbol,
this
process, called @dfn{symbol function indirection}, is repeated until
it obtains a non-symbol. @xref{Function Names}, for more information
about symbol function indirection.
-
- One possible consequence of this process is an infinite loop, in the
-event that a symbol's function cell refers to the same symbol.
-Otherwise, we eventually obtain a non-symbol, which ought to be a
-function or other suitable object.
+We eventually obtain a non-symbol, which ought to be a function or
+other suitable object.
@kindex invalid-function
More precisely, we should now have a Lisp function (a lambda
@@ -332,19 +329,17 @@ or just
The built-in function @code{indirect-function} provides an easy way to
perform symbol function indirection explicitly.
-@defun indirect-function function &optional noerror
+@defun indirect-function function
@anchor{Definition of indirect-function}
This function returns the meaning of @var{function} as a function. If
@var{function} is a symbol, then it finds @var{function}'s function
definition and starts over with that value. If @var{function} is not a
symbol, then it returns @var{function} itself.
-This function returns @code{nil} if the final symbol is unbound. It
-signals a @code{cyclic-function-indirection} error if there is a loop
-in the chain of symbols.
+This function returns @code{nil} if the final symbol is unbound.
-The optional argument @var{noerror} is obsolete, kept for backward
-compatibility, and has no effect.
+There is also a second, optional argument that is obsolete and has no
+effect.
Here is how you could define @code{indirect-function} in Lisp:
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index f5572e447d3..b6a4ee13308 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -737,9 +737,12 @@ explicitly in the source file being loaded. This is
because
By contrast, in programs that manipulate function definitions for other
purposes, it is better to use @code{fset}, which does not keep such
records. @xref{Function Cells}.
+
+If the resulting function definition chain would be circular, then
+Emacs will signal a @code{cyclic-function-indirection} error.
@end defun
-@defun function-alias-p object &optional noerror
+@defun function-alias-p object
Checks whether @var{object} is a function alias. If it is, it returns
a list of symbols representing the function alias chain, else
@code{nil}. For instance, if @code{a} is an alias for @code{b}, and
@@ -750,9 +753,8 @@ a list of symbols representing the function alias chain,
else
@result{} (b c)
@end example
-If there's a loop in the definitions, an error will be signaled. If
-@var{noerror} is non-@code{nil}, the non-looping parts of the chain is
-returned instead.
+There is also a second, optional argument that is obsolete and has no
+effect.
@end defun
You cannot create a new primitive function with @code{defun} or
@@ -1539,6 +1541,9 @@ is not a function, e.g., a keyboard macro
(@pxref{Keyboard Macros}):
If you wish to use @code{fset} to make an alternate name for a
function, consider using @code{defalias} instead. @xref{Definition of
defalias}.
+
+If the resulting function definition chain would be circular, then
+Emacs will signal a @code{cyclic-function-indirection} error.
@end defun
@node Closures
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 750c4b47894..052a10e3797 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -5111,8 +5111,11 @@ This anchor is a function that is called with 3
arguments: @var{node},
@var{parent}, and @var{bol}. It tries to go to the beginning of the
previous non-empty line, and matches @code{adaptive-fill-regexp}. If
there is a match, this function returns the end of the match,
-otherwise it returns nil. This anchor is useful for a
-@code{indent-relative}-like indent behavior for block comments.
+otherwise it returns nil. However, if the current line begins with a
+prefix (e.g., ``-''), return the beginning of the prefix of the
+previous line instead, so that the two prefixes aligns. This anchor
+is useful for a @code{indent-relative}-like indent behavior for block
+comments.
@end ftable
@end defvar
diff --git a/doc/misc/transient.texi b/doc/misc/transient.texi
index 7be8b630412..850930a290f 100644
--- a/doc/misc/transient.texi
+++ b/doc/misc/transient.texi
@@ -1214,7 +1214,7 @@ Suffix specifications have this form:
@lisp
([@var{LEVEL}]
- [@var{KEY}] [@var{DESCRIPTION}]
+ [@var{KEY} [@var{DESCRIPTION}]]
@var{COMMAND}|@var{ARGUMENT} [@var{KEYWORD} @var{VALUE}]...)
@end lisp
@@ -1253,8 +1253,7 @@ Any command will do; it does not need to have an object
associated
with it (as would be the case if @code{transient-define-suffix} or
@code{transient-define-infix} were used to define it).
-Anonymous, dynamically defined suffix commands are also supported.
-See information about the @code{:setup-children} function in @ref{Group
Specifications}.
+COMMAND can also be a @code{lambda} expression.
As mentioned above, the object that is associated with a command can
be used to set the default for certain values that otherwise have to
diff --git a/etc/AUTHORS b/etc/AUTHORS
index 26593958988..647b73aea4e 100644
--- a/etc/AUTHORS
+++ b/etc/AUTHORS
@@ -325,9 +325,9 @@ Andreas Politz: changed filenotify.el inotify.c
buffer-tests.el
Andreas Rottmann: changed emacsclient.1 emacsclient.c misc.texi server.el
Andreas Schwab: changed configure.ac lisp.h xdisp.c process.c alloc.c
- coding.c Makefile.in files.el fileio.c keyboard.c lread.c xterm.c fns.c
- src/Makefile.in editfns.c emacs.c print.c eval.c font.c xfns.c sysdep.c
- and 656 other files
+ coding.c Makefile.in files.el fileio.c keyboard.c emacs.c lread.c
+ xterm.c fns.c src/Makefile.in editfns.c print.c eval.c font.c xfns.c
+ sysdep.c and 656 other files
Andreas Seltenreich: changed nnweb.el gnus.texi message.el gnus-sum.el
gnus.el nnslashdot.el gnus-srvr.el gnus-util.el mm-url.el mm-uu.el
@@ -1575,7 +1575,7 @@ and co-wrote help-tests.el
and changed xdisp.c display.texi w32.c msdos.c w32fns.c simple.el
files.el fileio.c emacs.c keyboard.c w32term.c text.texi dispnew.c
w32proc.c files.texi frames.texi configure.ac lisp.h dispextern.h
- process.c ms-w32.h and 1236 other files
+ process.c editfns.c and 1237 other files
Eliza Velasquez: changed server.el
@@ -1984,7 +1984,7 @@ Gerd Möllmann: wrote authors.el ebrowse.el jit-lock.el
tooltip.el
and changed xdisp.c xterm.c dispnew.c dispextern.h xfns.c xfaces.c
window.c keyboard.c lisp.h faces.el alloc.c buffer.c startup.el xterm.h
fns.c simple.el term.c configure.ac frame.c xmenu.c emacs.c
- and 609 other files
+ and 610 other files
Gergely Nagy: changed erc.el
@@ -4787,8 +4787,8 @@ Robert P. Goldman: changed org.texi ob-exp.el org.el
ox-latex.el
Robert Pluim: wrote nsm-tests.el
and changed configure.ac process.c blocks.awk network-stream-tests.el
font.c processes.texi ftfont.c gtkutil.c vc-git.el process-tests.el
- emoji-zwj.awk gnutls.el network-stream.el nsm.el tramp.texi mml-sec.el
- nsterm.m unicode xfns.c auth.texi composite.c and 139 other files
+ custom.texi emoji-zwj.awk gnutls.el network-stream.el nsm.el tramp.texi
+ unicode mml-sec.el nsterm.m xfns.c auth.texi and 140 other files
Robert Thorpe: changed cus-start.el indent.el rmail.texi
@@ -5182,7 +5182,7 @@ and co-wrote help-tests.el keymap-tests.el
and changed efaq.texi checkdoc.el package.el cperl-mode.el bookmark.el
help.el keymap.c subr.el simple.el erc.el ediff-util.el idlwave.el
time.el bytecomp-tests.el comp.el emacs-lisp-intro.texi speedbar.el
- bytecomp.el edebug.el flyspell.el ibuffer.el and 1348 other files
+ bytecomp.el edebug.el flyspell.el ibuffer.el and 1352 other files
Stefan Merten: co-wrote rst.el
@@ -5937,7 +5937,7 @@ W. Trevor King: changed xterm.el
Xavier Maillard: changed gnus-faq.texi gnus-score.el mh-utils.el spam.el
-Xi Lu: changed etags.c tramp-sh.el
+Xi Lu: changed etags.c htmlfontify.el ruby-mode.el tramp-sh.el
Xu Chunyang: changed eww.el dom.el gud.el netrc.el
@@ -5953,8 +5953,8 @@ Yair F: changed hebrew.el
Yamamoto Mitsuharu: wrote uvs.el
and changed macterm.c macfns.c mac-win.el xterm.c mac.c macterm.h image.c
- macmenu.c macgui.h xdisp.c ftfont.c xfns.c keyboard.c macselect.c
- ftcrfont.c macfont.m configure.ac w32term.c dispextern.h
+ macmenu.c macgui.h xdisp.c ftfont.c xfns.c ftcrfont.c keyboard.c
+ macselect.c macfont.m configure.ac w32term.c dispextern.h
src/Makefile.in unexmacosx.c and 111 other files
Yan Gajdos: changed vc-git.el
@@ -6005,7 +6005,7 @@ Yuchen Pei: changed calendar.texi diary-lib.el
icalendar-tests.el
Yue Daian: wrote cl-font-lock.el
-Yuga Ego: changed emacs-lisp-intro.texi
+Yuga Ego: changed custom.texi emacs-lisp-intro.texi
Yu-ji Hosokawa: changed README.W32
diff --git a/etc/HISTORY b/etc/HISTORY
index 9e4becc946e..8b80473e321 100644
--- a/etc/HISTORY
+++ b/etc/HISTORY
@@ -228,6 +228,8 @@ GNU Emacs 28.1 (2022-04-04) emacs-28.1
GNU Emacs 28.2 (2022-09-12) emacs-28.2
+GNU Emacs 28.3 (2023-02-17) emacs-28.3
+
----------------------------------------------------------------------
This file is part of GNU Emacs.
diff --git a/etc/NEWS b/etc/NEWS
index af37633db83..ed276a4241d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -358,6 +358,21 @@ This function is like 'user-uid', but is aware of file
name handlers,
so it will return the remote UID for remote files (or -1 if the
connection has no associated user).
++++
+** 'fset' and 'defalias' now signal an error for circular alias chains.
+Previously, 'fset' and 'defalias' could be made to build circular
+function indirection chains as in
+
+ (defalias 'able 'baker)
+ (defalias 'baker 'able)
+
+but trying to call them would often make Emacs hang. Now, an attempt
+to create such a loop results in an error.
+
+Since circular alias chains now cannot occur, 'function-alias-p' and
+'indirect-function' will never signal an error. Their second
+'noerror' arguments have no effect and are therefore obsolete.
+
* Changes in Emacs 30.1 on Non-Free Operating Systems
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index a0e124bcf1b..b1410fc2646 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -3416,7 +3416,7 @@ lambda-expression."
(let* ((fn (car form))
(handler (get fn 'byte-compile))
(interactive-only
- (or (get fn 'interactive-only)
+ (or (function-get fn 'interactive-only)
(memq fn byte-compile-interactive-only-functions))))
(when (memq fn '(set symbol-value run-hooks ;; add-to-list
add-hook remove-hook run-hook-with-args
diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 872c757be1f..9674b5c30e9 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -3813,8 +3813,8 @@ Return the trampoline if found or nil otherwise."
;; found.
finally (cl-return
(expand-file-name
- (make-temp-file-internal (file-name-sans-extension rel-filename)
- 0 ".eln" nil)
+ (make-temp-file (file-name-sans-extension rel-filename) 0 ".eln"
+ nil)
temporary-file-directory))))
(defun comp-trampoline-compile (subr-name)
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 8bf8af73d30..84266e02901 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -769,7 +769,7 @@ the C sources, too."
(and (symbolp function)
(not (eq (car-safe (symbol-function function)) 'macro))
(let* ((interactive-only
- (or (get function 'interactive-only)
+ (or (function-get function 'interactive-only)
(if (boundp 'byte-compile-interactive-only-functions)
(memq function
byte-compile-interactive-only-functions)))))
@@ -996,7 +996,7 @@ Returns a list of the form (REAL-FUNCTION DEF ALIASED
REAL-DEF)."
(symbol-name function)))))))
(real-def (cond
((and aliased (not (subrp def)))
- (car (function-alias-p real-function t)))
+ (car (function-alias-p real-function)))
((subrp def) (intern (subr-name def)))
(t def))))
diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el
index cfcd1851188..11632e7f28e 100644
--- a/lisp/image/image-dired.el
+++ b/lisp/image/image-dired.el
@@ -167,28 +167,27 @@ to use the Thumbnail Managing Standard; they will be
saved in
There are three ways that Image-Dired can store and generate
thumbnails:
- 1. According to the \"Thumbnail Managing Standard\", which allows
+ 1. According to the Thumbnail Managing Standard, which allows
sharing of thumbnails across different programs. Thumbnails
will be stored in \"$XDG_CACHE_HOME/thumbnails/\"
- To use this way, set this user option to one of the following values:
+ Set this user option to one of the following symbols:
- `standard' means use thumbnails sized 128x128.
- `standard-large' means use thumbnails sized 256x256.
- `standard-x-large' means use thumbnails sized 512x512.
- `standard-xx-large' means use thumbnails sized 1024x1024.
- 2. In the Image-Dired specific directory indicated by
+ 2. In the Image-Dired specific directory, as indicated by
`image-dired-dir'.
- To use this way, set this user option to `image-dired' (or
- to `use-image-dired-dir', which means the same thing for
- backward-compatibility reasons).
+ Set this user option to `image-dired' (`use-image-dired-dir'
+ also works, for backward-compatibility reasons).
3. In a subdirectory \".image-dired\" in the same directory
- where the image files are.
+ as the image files.
- To use this way, set this user option to `per-directory'.
+ Set this user option to `per-directory'.
To control the default size of thumbnails for alternatives (2)
and (3) above, customize the value of `image-dired-thumb-size'.
diff --git a/lisp/org/ob-octave.el b/lisp/org/ob-octave.el
index 9bf16b9849c..1de263a52d0 100644
--- a/lisp/org/ob-octave.el
+++ b/lisp/org/ob-octave.el
@@ -243,8 +243,8 @@ value of the last statement in BODY, as elisp."
(`output
(setq results
(if matlabp
- (cdr (reverse (delq "" (mapcar #'org-strip-quotes
- (mapcar #'org-trim raw)))))
+ (cdr (reverse (delete "" (mapcar #'org-strip-quotes
+ (mapcar #'org-trim raw)))))
(cdr (member org-babel-octave-eoe-output
(reverse (mapcar #'org-strip-quotes
(mapcar #'org-trim raw)))))))
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index 3db33c4d63e..a33d84f1cd4 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -7330,7 +7330,7 @@ Any match of REMOVE-RE will be removed from TXT."
(let ((s (org-format-outline-path
(org-get-outline-path)
(1-
(frame-width))
nil
org-agenda-breadcrumbs-separator)))
- (if (eq "" s) "" (concat s
org-agenda-breadcrumbs-separator))))))
+ (if (equal "" s) "" (concat s
org-agenda-breadcrumbs-separator))))))
(setq time (cond (s2 (concat
(org-agenda-time-of-day-to-ampm-maybe s1)
"-" (org-agenda-time-of-day-to-ampm-maybe s2)
diff --git a/lisp/org/org-cycle.el b/lisp/org/org-cycle.el
index 828c84cd0ac..90fc95f41f7 100644
--- a/lisp/org/org-cycle.el
+++ b/lisp/org/org-cycle.el
@@ -648,6 +648,9 @@ With a numeric prefix, show all headlines up to that level."
(org-fold-show-hidden-entry)
(org-fold-show-children))
("content"
+ ;; Newline before heading will be outside the
+ ;; narrowing. Make sure that it is revealed.
+ (org-fold-heading nil)
(save-excursion
(save-restriction
(org-narrow-to-subtree)
diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el
index 4f4eebfcc2d..8524dd29d83 100644
--- a/lisp/org/org-element.el
+++ b/lisp/org/org-element.el
@@ -7562,15 +7562,15 @@ the cache."
;; beginning.
(next-element-re (pcase granularity
((or `headline
- (guard (eq '(headline)
- restrict-elements)))
+ (guard (equal '(headline)
+ restrict-elements)))
(cons
(org-with-limited-levels
org-element-headline-re)
'match-beg))
(`headline+inlinetask
(cons
- (if (eq '(inlinetask) restrict-elements)
+ (if (equal '(inlinetask)
restrict-elements)
(org-inlinetask-outline-regexp)
org-element-headline-re)
'match-beg))
diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el
index 5f587fb3fd8..5f93356709e 100644
--- a/lisp/org/org-version.el
+++ b/lisp/org/org-version.el
@@ -11,7 +11,7 @@ Inserted by installing Org mode or when a release is made."
(defun org-git-version ()
"The Git version of Org mode.
Inserted by installing Org or when a release is made."
- (let ((org-git-version "release_9.6.1-31-gaf1bb1"))
+ (let ((org-git-version "release_9.6.1-34-geea8da"))
org-git-version))
(provide 'org-version)
diff --git a/lisp/org/ox-texinfo.el b/lisp/org/ox-texinfo.el
index 8e3a0456299..4ff482cc3f5 100644
--- a/lisp/org/ox-texinfo.el
+++ b/lisp/org/ox-texinfo.el
@@ -32,6 +32,8 @@
(require 'cl-lib)
(require 'ox)
+(eval-when-compile (require 'subr-x))
+
(defvar orgtbl-exp-regexp)
(defvar org-texinfo-supports-math--cache)
@@ -2025,12 +2027,14 @@ Once computed, the results remain cached."
(unless (boundp 'org-texinfo-supports-math--cache)
(setq org-texinfo-supports-math--cache
(let ((math-example "1 + 1 = 2"))
- (let* ((input-file
- (make-temp-file "test" nil ".info"))
- (input-content
- (concat (format "@setfilename %s" input-file) "\n"
- "@node Top" "\n"
- (format "@displaymath{%s}" math-example) "\n")))
+ (let* ((input-file (make-temp-file "test" nil ".info"))
+ (input-content (string-join
+ (list (format "@setfilename %s" input-file)
+ "@node Top"
+ "@displaymath"
+ math-example
+ "@end displaymath")
+ "\n")))
(with-temp-file input-file
(insert input-content))
(let* ((output-file (org-texinfo-compile input-file))
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 8a4cc2fac18..b7a487687a8 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -87,6 +87,25 @@
:safe 'integerp
:group 'c)
+(defun c-ts-mode-toggle-comment-style ()
+ "Toggle the comment style between block and line comments.
+Optional numeric ARG, if supplied, switches to block comment
+style when positive, to line comment style when negative, and
+just toggles it when zero or left out."
+ (interactive)
+ (pcase-let ((`(,starter . ,ender)
+ (if (string= comment-start "// ")
+ (cons "/* " " */")
+ (cons "// " ""))))
+ (setq-local comment-start starter
+ comment-end ender))
+ (c-ts-mode-set-modeline))
+
+(defun c-ts-mode-set-modeline ()
+ (setq mode-name
+ (concat (if (eq major-mode 'c-ts-mode) "C" "C++") comment-start))
+ (force-mode-line-update))
+
(defun c-ts-mode--indent-style-setter (sym val)
"Custom setter for `c-ts-mode-set-style'.
@@ -214,6 +233,25 @@ delimiters < and >'s."
;;; Indent
+(defun c-ts-mode--preproc-offset (_n _p &rest _)
+ "This anchor is used for preprocessor directives.
+
+Because node is nil at the moment of indentation, we use
+`treesit-node-on' to capture the anonymous node covering the
+newline. If the grand-parent of that node is the
+translation_unit itself, we don't indent. Otherwise, just indent
+one step according to the great-grand-parent indent level. The
+reason there is a difference between grand-parent and
+great-grand-parent here is that the node containing the newline
+is actually the parent of point at the moment of indentation."
+ (when-let ((node (treesit-node-on (point) (point))))
+ (if (string-equal "translation_unit"
+ (treesit-node-type
+ (treesit-node-parent
+ (treesit-node-parent node))))
+ 0
+ c-ts-mode-indent-offset)))
+
(defun c-ts-mode--indent-styles (mode)
"Indent rules supported by `c-ts-mode'.
MODE is either `c' or `cpp'."
@@ -246,13 +284,14 @@ MODE is either `c' or `cpp'."
((match nil "do_statement" "body") parent-bol
c-ts-mode-indent-offset)
((match nil "for_statement" "body") parent-bol
c-ts-mode-indent-offset)
- ((match "preproc_ifdef" "compound_statement") point-min 0)
- ((match "#endif" "preproc_ifdef") point-min 0)
- ((match "preproc_if" "compound_statement") point-min 0)
- ((match "#endif" "preproc_if") point-min 0)
- ((match "preproc_function_def" "compound_statement") point-min 0)
+ ((node-is "preproc") point-min 0)
+ ((node-is "#endif") point-min 0)
((match "preproc_call" "compound_statement") point-min 0)
+ ((n-p-gp nil "preproc" "translation_unit") point-min 0)
+ ((n-p-gp nil "\n" "preproc") great-grand-parent
c-ts-mode--preproc-offset)
+ ((parent-is "preproc") grand-parent c-ts-mode-indent-offset)
+
((parent-is "function_definition") parent-bol 0)
((parent-is "conditional_expression") first-sibling 0)
((parent-is "assignment_expression") parent-bol
c-ts-mode-indent-offset)
@@ -740,7 +779,8 @@ the semicolon. This function skips the semicolon."
:parent prog-mode-map
"C-c C-q" #'c-ts-mode-indent-defun
"C-c ." #'c-ts-mode-set-style
- "C-c C-c" #'comment-region)
+ "C-c C-c" #'comment-region
+ "C-c C-k" #'c-ts-mode-toggle-comment-style)
;;;###autoload
(define-derived-mode c-ts-base-mode prog-mode "C"
@@ -805,7 +845,8 @@ the semicolon. This function skips the semicolon."
`((block . ,(rx (or "compound_statement"
"field_declaration_list"
"enumerator_list"
- "initializer_list")))
+ "initializer_list"
+ "declaration_list")))
(if . "if_statement")
(else . ("if_statement" . "alternative"))
(do . "do_statement")
@@ -855,6 +896,7 @@ To use tree-sitter C/C++ modes by default, evaluate
in your configuration."
:group 'c
+ :after-hook (c-ts-mode-set-modeline)
(when (treesit-ready-p 'c)
(treesit-parser-create 'c)
@@ -887,6 +929,7 @@ To use tree-sitter C/C++ modes by default, evaluate
in your configuration."
:group 'c++
+ :after-hook (c-ts-mode-set-modeline)
(when (treesit-ready-p 'cpp)
(setq-local treesit-text-type-regexp
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 4ec21af1b25..f726fef467e 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -2105,7 +2105,7 @@ casts and declarations are fontified. Used on level 2
and higher."
;; prevent a repeat invocation. See elisp/lispref page "Search-based
;; Fontification".
(while (and (< (point) limit)
- (re-search-forward
+ (re-search-forward
"\\<\\(module\\|export\\|import\\)\\>\\(?:[^_$]\\|$\\)"
limit t))
(goto-char (match-end 1))
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 61f81f09b3e..28403385115 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -3975,7 +3975,7 @@ is in effect when this is matched (see
`c-identifier-syntax-table')."
;; "throw" in `c-type-modifier-kwds' is followed
;; by a parenthesis list, but no extra measures
;; are necessary to handle that.
- (regexp-opt
+ (regexp-opt
(append (c-lang-const c-fun-name-substitute-kwds)
(c-lang-const c-type-modifier-kwds))
t)
diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el
index 07ec25a477a..239c85ce25f 100644
--- a/lisp/progmodes/csharp-mode.el
+++ b/lisp/progmodes/csharp-mode.el
@@ -474,28 +474,37 @@ compilation and evaluation time conflicts."
(and (eq (char-before) ?\])
(not (eq (char-after) ?\;))))))
`((annotation-top-cont ,(c-point 'iopl))))
-
((and
;; Heuristics to find object initializers
(save-excursion
;; Next non-whitespace character should be '{'
(goto-char (c-point 'boi))
- (eq (char-after) ?{))
- (save-excursion
- ;; 'new' should be part of the line
- (goto-char (c-point 'iopl))
- (looking-at ".*new.*"))
+ (unless (eq (char-after) ?{)
+ (backward-up-list 1 t t))
+ (save-excursion
+ ;; 'new' should be part of the line
+ (goto-char (c-point 'iopl))
+ (looking-at ".*new.*")))
;; Line should not already be terminated
(save-excursion
(goto-char (c-point 'eopl))
(or (not (eq (char-before) ?\;))
(not (eq (char-before) ?\{)))))
- (if (save-excursion
- ;; if we have a hanging brace on line before
- (goto-char (c-point 'eopl))
- (eq (char-before) ?\{))
- `((brace-list-intro ,(c-point 'iopl)))
- `((block-open) (statement ,(c-point 'iopl)))))
+ (cond
+ ((save-excursion
+ ;; if we have a hanging brace on line before
+ (goto-char (c-point 'eopl))
+ (eq (char-before) ?\{))
+ `((brace-list-intro ,(c-point 'iopl))))
+ ((save-excursion
+ ;; if we have a hanging brace on line before
+ (goto-char (c-point 'boi))
+ (and (eq (char-after) ?\})
+ `((brace-list-close ,(save-excursion
+ (backward-up-list 1 t t)
+ (point)))))))
+ (t
+ `((block-open) (statement ,(c-point 'iopl))))))
(t
(apply orig-fun args))))
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 267a7a5ea23..906cd2434f6 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -1760,11 +1760,6 @@ Use `eglot-managed-p' to determine if current buffer is
managed.")
(add-hook 'change-major-mode-hook #'eglot--managed-mode-off nil t)
(add-hook 'post-self-insert-hook 'eglot--post-self-insert-hook nil t)
(add-hook 'pre-command-hook 'eglot--pre-command-hook nil t)
- (eglot--setq-saving eldoc-documentation-functions
- '(eglot-signature-eldoc-function
- eglot-hover-eldoc-function))
- (eglot--setq-saving eldoc-documentation-strategy
- #'eldoc-documentation-enthusiast)
(eglot--setq-saving xref-prompt-for-identifier nil)
(eglot--setq-saving flymake-diagnostic-functions '(eglot-flymake-backend))
(eglot--setq-saving company-backends '(company-capf))
@@ -1773,7 +1768,12 @@ Use `eglot-managed-p' to determine if current buffer is
managed.")
(add-function :before-until (local 'imenu-create-index-function)
#'eglot-imenu))
(unless (eglot--stay-out-of-p 'flymake) (flymake-mode 1))
- (unless (eglot--stay-out-of-p 'eldoc) (eldoc-mode 1))
+ (unless (eglot--stay-out-of-p 'eldoc)
+ (add-hook 'eldoc-documentation-functions #'eglot-hover-eldoc-function
+ nil t)
+ (add-hook 'eldoc-documentation-functions #'eglot-signature-eldoc-function
+ nil t)
+ (eldoc-mode 1))
(cl-pushnew (current-buffer) (eglot--managed-buffers
(eglot-current-server))))
(t
(remove-hook 'after-change-functions 'eglot--after-change t)
@@ -2782,10 +2782,9 @@ for which LSP on-type-formatting should be requested."
(cl-sort completions
#'string-lessp
:key (lambda (c)
- (or (plist-get
- (get-text-property 0 'eglot--lsp-item c)
- :sortText)
- "")))))
+ (plist-get
+ (get-text-property 0 'eglot--lsp-item c)
+ :sortText)))))
(metadata `(metadata (category . eglot)
(display-sort-function . ,sort-completions)))
resp items (cached-proxies :none)
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 90813c8de34..dc49d7e818c 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3458,12 +3458,14 @@ This function is intended for use in
`after-change-functions'."
((match "<" "jsx_fragment") parent 0)
((parent-is "jsx_fragment") parent js-indent-level)
((node-is "jsx_closing_element") parent 0)
- ((node-is "jsx_element") parent js-indent-level)
+ ((match "jsx_element" "statement") parent js-indent-level)
((parent-is "jsx_element") parent js-indent-level)
+ ((parent-is "jsx_text") parent-bol js-indent-level)
((parent-is "jsx_opening_element") parent js-indent-level)
((parent-is "jsx_expression") parent-bol js-indent-level)
((match "/" "jsx_self_closing_element") parent 0)
((parent-is "jsx_self_closing_element") parent js-indent-level)
+ ;; FIXME(Theo): This no-node catch-all should be removed. When is it
needed?
(no-node parent-bol 0)))))
(defvar js--treesit-keywords
@@ -3873,7 +3875,7 @@ See `treesit-sexp-type-regexp' for more information.")
;; Electric-indent.
(setq-local electric-indent-chars
- (append "{}():;," electric-indent-chars)) ;FIXME: js2-mode adds
"[]*".
+ (append "{}():;,<>/" electric-indent-chars)) ;FIXME: js2-mode
adds "[]*".
(setq-local electric-layout-rules
'((?\; . after) (?\{ . after) (?\} . before)))
diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index e53cdb5ce7d..ee73ebf7a9f 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -36,6 +36,7 @@
(declare-function treesit-node-child "treesit.c")
(declare-function treesit-node-child-by-field-name "treesit.c")
(declare-function treesit-node-start "treesit.c")
+(declare-function treesit-node-end "treesit.c")
(declare-function treesit-node-type "treesit.c")
(declare-function treesit-node-parent "treesit.c")
(declare-function treesit-query-compile "treesit.c")
@@ -209,50 +210,15 @@
`((scoped_use_list path: (identifier) @font-lock-constant-face)
(scoped_use_list path: (scoped_identifier
name: (identifier) @font-lock-constant-face))
-
((use_as_clause alias: (identifier) @font-lock-type-face)
(:match "^[A-Z]" @font-lock-type-face))
((use_as_clause path: (identifier) @font-lock-type-face)
(:match "^[A-Z]" @font-lock-type-face))
- ((use_as_clause path:
- (scoped_identifier path: (_)
- name: (identifier)
@font-lock-type-face))
- (:match "^[A-Z]" @font-lock-type-face))
- (use_as_clause path: (scoped_identifier name: (identifier) @default))
-
- ((use_declaration
- argument: (scoped_identifier
- path: (_) @font-lock-constant-face
- name: (identifier) @font-lock-type-face))
- (:match "^[A-Z]" @font-lock-type-face))
- (use_declaration
- argument: (scoped_identifier
- name: (identifier) @default))
-
- (use_declaration
- argument: (scoped_identifier
- path: (scoped_identifier
- path: (_) @font-lock-constant-face
- name: (identifier) @font-lock-constant-face)
- name: (identifier) @default))
-
- (use_declaration
- argument: (scoped_use_list
- path: (scoped_identifier
- path: (_) @font-lock-constant-face
- name: (identifier) @font-lock-constant-face)))
-
((use_list (identifier) @font-lock-type-face)
(:match "^[A-Z]" @font-lock-type-face))
- (use_list (identifier) @default)
- ((use_list (scoped_identifier path: (_)
- name: (identifier) @font-lock-type-face))
- (:match "^[A-Z]" @font-lock-type-face))
- (use_list (scoped_identifier path: (_)
- name: (identifier) @default))
- (use_wildcard (scoped_identifier
- name: (identifier) @font-lock-constant-face))
-
+ (use_wildcard [(identifier) @rust-ts-mode--fontify-scope
+ (scoped_identifier
+ name: (identifier) @rust-ts-mode--fontify-scope)])
(enum_variant name: (identifier) @font-lock-type-face)
(match_arm
pattern: (match_pattern (_ type: (identifier) @font-lock-type-face)))
@@ -263,31 +229,13 @@
(mod_item name: (identifier) @font-lock-constant-face)
(primitive_type) @font-lock-type-face
(type_identifier) @font-lock-type-face
- ((scoped_identifier name: (identifier) @font-lock-type-face)
- (:match "^[A-Z]" @font-lock-type-face))
- ((scoped_identifier path: (identifier) @font-lock-type-face)
- (:match "^[A-Z]" @font-lock-type-face))
- ((scoped_identifier
- path: [(identifier) @font-lock-type-face
- (scoped_identifier
- name: (identifier) @font-lock-type-face)])
- (:match "^[A-Z]" @font-lock-type-face))
+ ((scoped_identifier name: (identifier) @rust-ts-mode--fontify-tail))
((scoped_identifier path: (identifier) @font-lock-type-face)
(:match
"^\\(u8\\|u16\\|u32\\|u64\\|u128\\|usize\\|i8\\|i16\\|i32\\|i64\\|i128\\|isize\\|char\\|str\\)$"
@font-lock-type-face))
- (scoped_identifier path: (_) @font-lock-constant-face
- name: (identifier) @font-lock-type-face)
- (scoped_identifier path: (scoped_identifier
- name: (identifier) @font-lock-constant-face))
- (scoped_type_identifier path: (_) @font-lock-constant-face)
- (scoped_type_identifier
- path: (scoped_identifier
- path: (_) @font-lock-constant-face
- name: (identifier) @font-lock-constant-face))
- (type_identifier) @font-lock-type-face
- ;; Ensure function calls aren't highlighted as types.
- (call_expression function: (scoped_identifier name: (identifier)
@default)))
+ ((scoped_identifier path: (identifier) @rust-ts-mode--fontify-scope))
+ (type_identifier) @font-lock-type-face)
:language 'rust
:feature 'property
@@ -303,9 +251,25 @@
:language 'rust
:feature 'variable
- '((identifier) @font-lock-variable-name-face
- ;; Everything in a token_tree is an identifier.
- (token_tree (identifier) @default))
+ '((arguments (identifier) @font-lock-variable-name-face)
+ (array_expression (identifier) @font-lock-variable-name-face)
+ (assignment_expression right: (identifier) @font-lock-variable-name-face)
+ (binary_expression left: (identifier) @font-lock-variable-name-face)
+ (binary_expression right: (identifier) @font-lock-variable-name-face)
+ (block (identifier) @font-lock-variable-name-face)
+ (compound_assignment_expr right: (identifier)
@font-lock-variable-name-face)
+ (field_expression value: (identifier) @font-lock-variable-name-face)
+ (field_initializer value: (identifier) @font-lock-variable-name-face)
+ (if_expression condition: (identifier) @font-lock-variable-name-face)
+ (let_condition value: (identifier) @font-lock-variable-name-face)
+ (let_declaration value: (identifier) @font-lock-variable-name-face)
+ (match_arm value: (identifier) @font-lock-variable-name-face)
+ (match_expression value: (identifier) @font-lock-variable-name-face)
+ (reference_expression value: (identifier) @font-lock-variable-name-face)
+ (return_expression (identifier) @font-lock-variable-name-face)
+ (tuple_expression (identifier) @font-lock-variable-name-face)
+ (unary_expression (identifier) @font-lock-variable-name-face)
+ (while_expression condition: (identifier) @font-lock-variable-name-face))
:language 'rust
:feature 'escape-sequence
@@ -318,6 +282,28 @@
'((ERROR) @font-lock-warning-face))
"Tree-sitter font-lock settings for `rust-ts-mode'.")
+(defun rust-ts-mode--fontify-scope (node override start end &optional tail-p)
+ (let* ((case-fold-search nil)
+ (face
+ (cond
+ ((string-match-p "^[A-Z]" (treesit-node-text node))
+ 'font-lock-type-face)
+ ((and
+ tail-p
+ (string-match-p
+
"\\`\\(?:use_list\\|call_expression\\|use_as_clause\\|use_declaration\\)\\'"
+ (treesit-node-type (treesit-node-parent (treesit-node-parent
node)))))
+ nil)
+ (t 'font-lock-constant-face))))
+ (when face
+ (treesit-fontify-with-override
+ (treesit-node-start node) (treesit-node-end node)
+ face
+ override start end))))
+
+(defun rust-ts-mode--fontify-tail (node override start end)
+ (rust-ts-mode--fontify-scope node override start end t))
+
(defalias 'rust-ts-mode--fontify-pattern
(and
(treesit-available-p)
diff --git a/lisp/progmodes/typescript-ts-mode.el
b/lisp/progmodes/typescript-ts-mode.el
index afc8ff47db3..1646776ce95 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -81,6 +81,8 @@ Argument LANGUAGE is either `typescript' or `tsx'."
((parent-is "member_expression") parent-bol
typescript-ts-mode-indent-offset)
((parent-is "named_imports") parent-bol typescript-ts-mode-indent-offset)
((parent-is "statement_block") parent-bol
typescript-ts-mode-indent-offset)
+ ((parent-is "switch_case") parent-bol typescript-ts-mode-indent-offset)
+ ((parent-is "switch_default") parent-bol typescript-ts-mode-indent-offset)
((parent-is "type_arguments") parent-bol typescript-ts-mode-indent-offset)
((parent-is "variable_declarator") parent-bol
typescript-ts-mode-indent-offset)
((parent-is "arguments") parent-bol typescript-ts-mode-indent-offset)
@@ -101,12 +103,14 @@ Argument LANGUAGE is either `typescript' or `tsx'."
`(((match "<" "jsx_fragment") parent 0)
((parent-is "jsx_fragment") parent typescript-ts-mode-indent-offset)
((node-is "jsx_closing_element") parent 0)
- ((node-is "jsx_element") parent typescript-ts-mode-indent-offset)
+ ((match "jsx_element" "statement") parent
typescript-ts-mode-indent-offset)
((parent-is "jsx_element") parent typescript-ts-mode-indent-offset)
+ ((parent-is "jsx_text") parent-bol typescript-ts-mode-indent-offset)
((parent-is "jsx_opening_element") parent
typescript-ts-mode-indent-offset)
((parent-is "jsx_expression") parent-bol
typescript-ts-mode-indent-offset)
((match "/" "jsx_self_closing_element") parent 0)
((parent-is "jsx_self_closing_element") parent
typescript-ts-mode-indent-offset)))
+ ;; FIXME(Theo): This no-node catch-all should be removed. When is it
needed?
(no-node parent-bol 0))))
(defvar typescript-ts-mode--keywords
@@ -377,8 +381,9 @@ See `treesit-sexp-type-regexp' for more information.")
;; Electric
(setq-local electric-indent-chars
- (append "{}():;," electric-indent-chars))
-
+ (append "{}():;,<>/" electric-indent-chars))
+ (setq-local electric-layout-rules
+ '((?\; . after) (?\{ . after) (?\} . before)))
;; Navigation.
(setq-local treesit-defun-type-regexp
(regexp-opt '("class_declaration"
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 581eda0513e..38c424402a0 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1,7 +1,7 @@
;;; xref.el --- Cross-referencing commands -*-lexical-binding:t-*-
;; Copyright (C) 2014-2023 Free Software Foundation, Inc.
-;; Version: 1.6.1
+;; Version: 1.6.2
;; Package-Requires: ((emacs "26.1"))
;; This is a GNU ELPA :core package. Avoid functionality that is not
diff --git a/lisp/simple.el b/lisp/simple.el
index 594f2d6aa73..a870ab31a91 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -9918,7 +9918,12 @@ minibuffer, but don't quit the completions window."
(with-current-buffer buffer
(choose-completion-string
choice buffer
- (or (and completion-use-base-affixes base-affixes)
+ ;; Don't allow affixes to replace the whole buffer when not
+ ;; in the minibuffer. Thus check for `completion-in-region-mode'
+ ;; to ignore non-nil value of `completion-use-base-affixes' set by
+ ;; `minibuffer-choose-completion'.
+ (or (and (not completion-in-region-mode)
+ completion-use-base-affixes base-affixes)
base-position
;; If all else fails, just guess.
(list (choose-completion-guess-base-position choice)))
diff --git a/lisp/subr.el b/lisp/subr.el
index a64346fadf8..168f85992bc 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -7029,27 +7029,17 @@ string will be displayed only if BODY takes longer than
TIMEOUT seconds.
(lambda ()
,@body)))
-(defun function-alias-p (func &optional noerror)
+(defun function-alias-p (func &optional _noerror)
"Return nil if FUNC is not a function alias.
-If FUNC is a function alias, return the function alias chain.
-
-If the function alias chain contains loops, an error will be
-signaled. If NOERROR, the non-loop parts of the chain is returned."
- (declare (side-effect-free t))
- (let ((chain nil)
- (orig-func func))
- (nreverse
- (catch 'loop
- (while (and (symbolp func)
- (setq func (symbol-function func))
- (symbolp func))
- (when (or (memq func chain)
- (eq func orig-func))
- (if noerror
- (throw 'loop chain)
- (signal 'cyclic-function-indirection (list orig-func))))
- (push func chain))
- chain))))
+If FUNC is a function alias, return the function alias chain."
+ (declare (advertised-calling-convention (func) "30.1")
+ (side-effect-free error-free))
+ (let ((chain nil))
+ (while (and (symbolp func)
+ (setq func (symbol-function func))
+ (symbolp func))
+ (push func chain))
+ (nreverse chain)))
(defun readablep (object)
"Say whether OBJECT has a readable syntax.
diff --git a/lisp/transient.el b/lisp/transient.el
index c0ecd2950d7..96e711e950c 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -1048,26 +1048,30 @@ example, sets a variable, use `transient-define-infix'
instead.
(setq args (plist-put args :key pop)))
(cond
((or (stringp car)
- (eq (car-safe car) 'lambda))
+ (and (eq (car-safe car) 'lambda)
+ (not (commandp car))))
(setq args (plist-put args :description pop)))
((and (symbolp car)
+ (not (keywordp car))
(not (commandp car))
(commandp (cadr spec)))
(setq args (plist-put args :description (macroexp-quote pop)))))
(cond
((keywordp car)
- (error "Need command, got %S" car))
+ (error "Need command, got `%s'" car))
((symbolp car)
(setq args (plist-put args :command (macroexp-quote pop))))
((and (commandp car)
(not (stringp car)))
(let ((cmd pop)
- (sym (intern (format "transient:%s:%s"
- prefix
- (or (plist-get args :description)
- (plist-get args :key))))))
- (defalias sym cmd)
- (setq args (plist-put args :command (macroexp-quote sym)))))
+ (sym (intern
+ (format "transient:%s:%s"
+ prefix
+ (let ((desc (plist-get args :description)))
+ (if (and desc (or (stringp desc) (symbolp desc)))
+ desc
+ (plist-get args :key)))))))
+ (setq args (plist-put args :command `(defalias ',sym ,cmd)))))
((or (stringp car)
(and car (listp car)))
(let ((arg pop))
diff --git a/lisp/treesit.el b/lisp/treesit.el
index 077f1da6e47..644a8018ad2 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -1186,12 +1186,18 @@ See `treesit-simple-indent-presets'.")
(skip-syntax-backward "-")
(point))))
(cons 'prev-adaptive-prefix
- (lambda (_n parent &rest _)
- (let ((comment-start-bol
- (save-excursion
- (goto-char (treesit-node-start parent))
- (line-beginning-position))))
+ (lambda (_n parent bol &rest _)
+ (let (comment-start-bol
+ this-line-has-prefix)
(save-excursion
+ (goto-char (treesit-node-start parent))
+ (setq comment-start-bol (line-beginning-position))
+
+ (goto-char bol)
+ (setq this-line-has-prefix
+ (and (looking-at adaptive-fill-regexp)
+ (match-string 1)))
+
(forward-line -1)
(and (>= (point) comment-start-bol)
adaptive-fill-regexp
@@ -1199,7 +1205,14 @@ See `treesit-simple-indent-presets'.")
;; If previous line is an empty line, don't
;; indent.
(not (looking-at (rx (* whitespace) eol)))
- (match-end 0))))))
+ ;; Return the anchor. If the indenting line
+ ;; has a prefix and the previous line also
+ ;; has a prefix, indent to the beginning of
+ ;; prev line's prefix rather than the end of
+ ;; prev line's prefix. (Bug#61314).
+ (or (and this-line-has-prefix
+ (match-beginning 1))
+ (match-end 0)))))))
;; TODO: Document.
(cons 'grand-parent
(lambda (_n parent &rest _)
@@ -1336,8 +1349,11 @@ prev-adaptive-prefix
Goes to the beginning of previous non-empty line, and tries
to match `adaptive-fill-regexp'. If it matches, return the
- end of the match, otherwise return nil. This is useful for a
- `indent-relative'-like indent behavior for block comments.")
+ end of the match, otherwise return nil. However, if the
+ current line begins with a prefix, return the beginning of
+ the prefix of the previous line instead, so that the two
+ prefixes aligns. This is useful for a `indent-relative'-like
+ indent behavior for block comments.")
(defun treesit--simple-indent-eval (exp)
"Evaluate EXP.
diff --git a/src/comp.c b/src/comp.c
index 1b55226b0c3..5cbe441dd7f 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -514,6 +514,10 @@ load_gccjit_if_necessary (bool mandatory)
#define CALL2I(fun, arg1, arg2) \
CALLN (Ffuncall, intern_c_string (STR (fun)), arg1, arg2)
+/* Like call4 but stringify and intern. */
+#define CALL4I(fun, arg1, arg2, arg3, arg4) \
+ CALLN (Ffuncall, intern_c_string (STR (fun)), arg1, arg2, arg3, arg4)
+
#define DECL_BLOCK(name, func) \
gcc_jit_block *(name) = \
gcc_jit_function_new_block ((func), STR (name))
@@ -4991,8 +4995,8 @@ DEFUN ("comp--compile-ctxt-to-file",
Fcomp__compile_ctxt_to_file,
format_string ("%s_libgccjit_repro.c", SSDATA (ebase_name)));
Lisp_Object tmp_file =
- Fmake_temp_file_internal (base_name, make_fixnum (0),
- build_string (".eln.tmp"), Qnil);
+ CALL4I (make-temp-file, base_name, Qnil, build_string (".eln.tmp"), Qnil);
+
Lisp_Object encoded_tmp_file = ENCODE_FILE (tmp_file);
#ifdef WINDOWSNT
encoded_tmp_file = ansi_encode_filename (encoded_tmp_file);
diff --git a/src/data.c b/src/data.c
index 1fa8b0358b5..d2f4d40d7bc 100644
--- a/src/data.c
+++ b/src/data.c
@@ -840,7 +840,9 @@ the position will be taken. */)
}
DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
- doc: /* Set SYMBOL's function definition to DEFINITION, and return
DEFINITION. */)
+ doc: /* Set SYMBOL's function definition to DEFINITION, and return
DEFINITION.
+If the resulting chain of function definitions would contain a loop,
+signal a `cyclic-function-indirection' error. */)
(register Lisp_Object symbol, Lisp_Object definition)
{
CHECK_SYMBOL (symbol);
@@ -852,6 +854,12 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
eassert (valid_lisp_object_p (definition));
+ /* Ensure non-circularity. */
+ for (Lisp_Object s = definition; SYMBOLP (s) && !NILP (s);
+ s = XSYMBOL (s)->u.s.function)
+ if (EQ (s, symbol))
+ xsignal1 (Qcyclic_function_indirection, symbol);
+
#ifdef HAVE_NATIVE_COMP
register Lisp_Object function = XSYMBOL (symbol)->u.s.function;
@@ -1078,7 +1086,7 @@ If CMD is not a command, the return value is nil.
Value, if non-nil, is a list (interactive SPEC). */)
(Lisp_Object cmd)
{
- Lisp_Object fun = indirect_function (cmd); /* Check cycles. */
+ Lisp_Object fun = indirect_function (cmd);
bool genfun = false;
if (NILP (fun))
@@ -1168,7 +1176,7 @@ If COMMAND is not a command, the return value is nil.
The value, if non-nil, is a list of mode name symbols. */)
(Lisp_Object command)
{
- Lisp_Object fun = indirect_function (command); /* Check cycles. */
+ Lisp_Object fun = indirect_function (command);
if (NILP (fun))
return Qnil;
@@ -2482,55 +2490,22 @@ If the current binding is global (the default), the
value is nil. */)
/* If OBJECT is a symbol, find the end of its function chain and
return the value found there. If OBJECT is not a symbol, just
- return it. If there is a cycle in the function chain, signal a
- cyclic-function-indirection error.
-
- This is like Findirect_function, except that it doesn't signal an
- error if the chain ends up unbound. */
+ return it. */
Lisp_Object
-indirect_function (register Lisp_Object object)
+indirect_function (Lisp_Object object)
{
- Lisp_Object tortoise, hare;
-
- hare = tortoise = object;
-
- for (;;)
- {
- if (!SYMBOLP (hare) || NILP (hare))
- break;
- hare = XSYMBOL (hare)->u.s.function;
- if (!SYMBOLP (hare) || NILP (hare))
- break;
- hare = XSYMBOL (hare)->u.s.function;
-
- tortoise = XSYMBOL (tortoise)->u.s.function;
-
- if (EQ (hare, tortoise))
- xsignal1 (Qcyclic_function_indirection, object);
- }
-
- return hare;
+ while (SYMBOLP (object) && !NILP (object))
+ object = XSYMBOL (object)->u.s.function;
+ return object;
}
DEFUN ("indirect-function", Findirect_function, Sindirect_function, 1, 2, 0,
doc: /* Return the function at the end of OBJECT's function chain.
If OBJECT is not a symbol, just return it. Otherwise, follow all
-function indirections to find the final function binding and return it.
-Signal a cyclic-function-indirection error if there is a loop in the
-function chain of symbols. */)
- (register Lisp_Object object, Lisp_Object noerror)
+function indirections to find the final function binding and return it. */)
+ (Lisp_Object object, Lisp_Object noerror)
{
- Lisp_Object result;
-
- /* Optimize for no indirection. */
- result = object;
- if (SYMBOLP (result) && !NILP (result)
- && (result = XSYMBOL (result)->u.s.function, SYMBOLP (result)))
- result = indirect_function (result);
- if (!NILP (result))
- return result;
-
- return Qnil;
+ return indirect_function (object);
}
/* Extract and set vector and string elements. */
diff --git a/src/eval.c b/src/eval.c
index e377e30c6fb..eb40c953f96 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2116,7 +2116,7 @@ then strings and vectors are not accepted. */)
fun = function;
- fun = indirect_function (fun); /* Check cycles. */
+ fun = indirect_function (fun);
if (NILP (fun))
return Qnil;
diff --git a/src/regex-emacs.c b/src/regex-emacs.c
index 2dca0d16ad9..2571812cb39 100644
--- a/src/regex-emacs.c
+++ b/src/regex-emacs.c
@@ -3653,6 +3653,7 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp,
re_char *p1,
re_opcode_t op2;
bool multibyte = RE_MULTIBYTE_P (bufp);
unsigned char *pend = bufp->buffer + bufp->used;
+ re_char *p2_orig = p2;
eassert (p1 >= bufp->buffer && p1 < pend
&& p2 >= bufp->buffer && p2 <= pend);
@@ -3822,6 +3823,23 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp,
re_char *p1,
case notcategoryspec:
return ((re_opcode_t) *p1 == categoryspec && p1[1] == p2[1]);
+ case on_failure_jump_nastyloop:
+ case on_failure_jump_smart:
+ case on_failure_jump_loop:
+ case on_failure_keep_string_jump:
+ case on_failure_jump:
+ {
+ int mcnt;
+ p2++;
+ EXTRACT_NUMBER_AND_INCR (mcnt, p2);
+ /* Don't just test `mcnt > 0` because non-greedy loops have
+ their test at the end with an unconditional jump at the start. */
+ if (p2 + mcnt > p2_orig) /* Ensure forward progress. */
+ return (mutually_exclusive_p (bufp, p1, p2)
+ && mutually_exclusive_p (bufp, p1, p2 + mcnt));
+ break;
+ }
+
default:
;
}
diff --git a/test/lisp/emacs-lisp/nadvice-tests.el
b/test/lisp/emacs-lisp/nadvice-tests.el
index 987483f00b1..716ab694e2c 100644
--- a/test/lisp/emacs-lisp/nadvice-tests.el
+++ b/test/lisp/emacs-lisp/nadvice-tests.el
@@ -29,6 +29,7 @@
(advice-add 'sm-test1 :around (lambda (f y) (* (funcall f y) 2)))
(advice-remove 'sm-test1 (lambda (f y) (* (funcall f y) 5)))
(defun sm-test1 (x) (+ x 4))
+ (declare-function sm-test1 nil)
(should (equal (sm-test1 6) 20))
(advice-remove 'sm-test1 (lambda (f y) (* (funcall f y) 2)))
(should (equal (sm-test1 6) 10))
@@ -62,6 +63,7 @@
(ert-deftest advice-tests-advice ()
"Test advice code."
(defun sm-test2 (x) (+ x 4))
+ (declare-function sm-test2 nil)
(should (equal (sm-test2 6) 10))
(defadvice sm-test2 (around sm-test activate)
ad-do-it (setq ad-return-value (* ad-return-value 5)))
@@ -94,6 +96,7 @@
(ert-deftest advice-tests-combination ()
"Combining old style and new style advices."
(defun sm-test5 (x) (+ x 4))
+ (declare-function sm-test5 nil)
(should (equal (sm-test5 6) 10))
(advice-add 'sm-test5 :around (lambda (f y) (* (funcall f y) 5)))
(should (equal (sm-test5 6) 50))
@@ -112,6 +115,7 @@
(ert-deftest advice-test-called-interactively-p ()
"Check interaction between advice and called-interactively-p."
(defun sm-test7 (&optional x) (interactive) (+ (or x 7) 4))
+ (declare-function sm-test7 nil)
(advice-add 'sm-test7 :around
(lambda (f &rest args)
(list (cons 1 (called-interactively-p)) (apply f args))))
@@ -119,7 +123,7 @@
(should (equal (call-interactively 'sm-test7) '((1 . t) 11)))
(let ((smi 7))
(advice-add 'sm-test7 :before
- (lambda (&rest args)
+ (lambda (&rest _args)
(setq smi (called-interactively-p))))
(should (equal (list (sm-test7) smi)
'(((1 . nil) 11) nil)))
@@ -137,6 +141,7 @@ This tests the currently broken case of the innermost
advice to a
function being an around advice."
:expected-result :failed
(defun sm-test7.2 () (interactive) (cons 1 (called-interactively-p)))
+ (declare-function sm-test7.2 nil)
(advice-add 'sm-test7.2 :around
(lambda (f &rest args)
(list (cons 1 (called-interactively-p)) (apply f args))))
@@ -147,6 +152,7 @@ function being an around advice."
"Check interaction between filter-args advice and called-interactively-p."
:expected-result :failed
(defun sm-test7.3 () (interactive) (cons 1 (called-interactively-p)))
+ (declare-function sm-test7.3 nil)
(advice-add 'sm-test7.3 :filter-args #'list)
(should (equal (sm-test7.3) '(1 . nil)))
(should (equal (call-interactively 'sm-test7.3) '(1 . t))))
diff --git a/test/lisp/help-fns-tests.el b/test/lisp/help-fns-tests.el
index 4d715cde1d5..243a45ae6d2 100644
--- a/test/lisp/help-fns-tests.el
+++ b/test/lisp/help-fns-tests.el
@@ -180,10 +180,6 @@ Return first line of the output of (describe-function-1
FUNC)."
(ert-deftest help-fns--analyze-function-recursive ()
(defalias 'help-fns--a 'help-fns--b)
- (should (equal (help-fns--analyze-function 'help-fns--a)
- '(help-fns--a help-fns--b t help-fns--b)))
- ;; Make a loop and see that it doesn't infloop.
- (defalias 'help-fns--b 'help-fns--a)
(should (equal (help-fns--analyze-function 'help-fns--a)
'(help-fns--a help-fns--b t help-fns--b))))
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts
b/test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts
new file mode 100644
index 00000000000..5a4996f642e
--- /dev/null
+++ b/test/lisp/progmodes/c-ts-mode-resources/indent-preproc.erts
@@ -0,0 +1,45 @@
+Code:
+ (lambda ()
+ (c-ts-mode)
+ (newline)
+ (indent-for-tab-command))
+
+Point-Char: |
+
+Name: Indents inside #if preproc
+
+=-=
+static void
+free_glyph_pool (struct glyph_pool *pool)
+{
+ if (pool)
+ {
+#if defined GLYPH_DEBUG|
+#endif
+ }
+}
+=-=
+static void
+free_glyph_pool (struct glyph_pool *pool)
+{
+ if (pool)
+ {
+#if defined GLYPH_DEBUG
+ |
+#endif
+ }
+}
+=-=-=
+
+Name: Indents to 0 if #if preproc at root
+
+=-=
+#if 0|
+/* */
+static void
+=-=
+#if 0
+|
+/* */
+static void
+=-=-=
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts
b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
index 05d59c10a42..36d7af4faf1 100644
--- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts
+++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
@@ -242,6 +242,21 @@ line 2
*/
=-=-=
+Name: Block Comment prefixes (Bug#61314)
+
+=-=-=
+/*
+- item1
+- item2
+- item3
+*/
+=-=-=
+/*
+ - item1
+ - item2
+ - item3
+ */
+=-=-=
Code:
(lambda ()
@@ -354,3 +369,19 @@ int main()
};
}
=-=-=
+
+Code:
+ (lambda ()
+ (c++-ts-mode)
+ (setq-local indent-tabs-mode nil)
+ (setq-local c-ts-mode-indent-offset 2)
+ (indent-region (point-min) (point-max)))
+
+Name: Declaration List (Namespace) (Bug#61635)
+
+=-=
+namespace test {
+ class Name {
+ };
+}
+=-=-=
diff --git a/test/lisp/progmodes/c-ts-mode-tests.el
b/test/lisp/progmodes/c-ts-mode-tests.el
index ddf64b40736..ea5fab4cbef 100644
--- a/test/lisp/progmodes/c-ts-mode-tests.el
+++ b/test/lisp/progmodes/c-ts-mode-tests.el
@@ -27,6 +27,10 @@
(skip-unless (treesit-ready-p 'c))
(ert-test-erts-file (ert-resource-file "indent.erts")))
+(ert-deftest c-ts-mode-test-indentation-preproc ()
+ (skip-unless (treesit-ready-p 'c))
+ (ert-test-erts-file (ert-resource-file "indent-preproc.erts")))
+
(ert-deftest c-ts-mode-test-indentation-bsd ()
(skip-unless (treesit-ready-p 'c))
(ert-test-erts-file (ert-resource-file "indent-bsd.erts")))
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index 1abd3be4ea1..d5efabc1370 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -1058,10 +1058,12 @@ final or penultimate step during initialization."))
'(subr-tests--b subr-tests--c)))
(defalias 'subr-tests--d 'subr-tests--e)
- (defalias 'subr-tests--e 'subr-tests--d)
- (should-error (function-alias-p 'subr-tests--d))
- (should (equal (function-alias-p 'subr-tests--d t)
- '(subr-tests--e))))
+ (should (equal (function-alias-p 'subr-tests--d)
+ '(subr-tests--e)))
+
+ (fset 'subr-tests--f 'subr-tests--a)
+ (should (equal (function-alias-p 'subr-tests--f)
+ '(subr-tests--a subr-tests--b subr-tests--c))))
(ert-deftest test-readablep ()
(should (readablep "foo"))
diff --git a/test/src/data-tests.el b/test/src/data-tests.el
index 28cee9d2c5b..680fdd57d71 100644
--- a/test/src/data-tests.el
+++ b/test/src/data-tests.el
@@ -772,4 +772,40 @@ comparing the subr with a much slower Lisp implementation."
"Can't set variable marked with 'make_symbol_constant'."
(should-error (setq most-positive-fixnum 1) :type 'setting-constant))
+(ert-deftest data-tests-fset ()
+ (fset 'data-tests--fs-fun (lambda () 'moo))
+ (declare-function data-tests--fs-fun nil)
+ (should (equal (data-tests--fs-fun) 'moo))
+
+ (fset 'data-tests--fs-fun1 'data-tests--fs-fun)
+ (declare-function data-tests--fs-fun1 nil)
+ (should (equal (data-tests--fs-fun1) 'moo))
+
+ (fset 'data-tests--fs-a 'data-tests--fs-b)
+ (fset 'data-tests--fs-b 'data-tests--fs-c)
+
+ (should-error (fset 'data-tests--fs-c 'data-tests--fs-c)
+ :type 'cyclic-function-indirection)
+ (fset 'data-tests--fs-d 'data-tests--fs-a)
+ (should-error (fset 'data-tests--fs-c 'data-tests--fs-d)
+ :type 'cyclic-function-indirection))
+
+(ert-deftest data-tests-defalias ()
+ (defalias 'data-tests--da-fun (lambda () 'baa))
+ (declare-function data-tests--da-fun nil)
+ (should (equal (data-tests--da-fun) 'baa))
+
+ (defalias 'data-tests--da-fun1 'data-tests--da-fun)
+ (declare-function data-tests--da-fun1 nil)
+ (should (equal (data-tests--da-fun1) 'baa))
+
+ (defalias 'data-tests--da-a 'data-tests--da-b)
+ (defalias 'data-tests--da-b 'data-tests--da-c)
+
+ (should-error (defalias 'data-tests--da-c 'data-tests--da-c)
+ :type 'cyclic-function-indirection)
+ (defalias 'data-tests--da-d 'data-tests--da-a)
+ (should-error (defalias 'data-tests--da-c 'data-tests--da-d)
+ :type 'cyclic-function-indirection))
+
;;; data-tests.el ends here
diff --git a/test/src/regex-emacs-tests.el b/test/src/regex-emacs-tests.el
index 34fa35e32ff..52d43775b8e 100644
--- a/test/src/regex-emacs-tests.el
+++ b/test/src/regex-emacs-tests.el
@@ -872,4 +872,15 @@ This evaluates the TESTS test cases from glibc."
(should (equal (string-match "\\`\\(?:ab\\)*\\'" "a") nil))
(should (equal (string-match "\\`a\\{2\\}*\\'" "a") nil)))
+(ert-deftest regexp-tests-backtrack-optimization () ;bug#61514
+ ;; Make sure we don't use up the regexp stack needlessly.
+ (with-current-buffer (get-buffer-create "*bug*")
+ (erase-buffer)
+ (insert (make-string 1000000 ?x) "=")
+ (goto-char (point-min))
+ (should (looking-at "x*=*"))
+ (should (looking-at "x*\\(=\\|:\\)"))
+ (should (looking-at "x*\\(=\\|:\\)*"))
+ (should (looking-at "x*=*?"))))
+
;;; regex-emacs-tests.el ends here