commit 43b81b7ecaf465eef268dd2cd94f00a0c4da87ea (HEAD, refs/remotes/origin/master) Author: Stefan Kangas Date: Fri Dec 27 05:21:36 2024 +0100 Prefer defvar-keymap in two-column.el * lisp/textmodes/two-column.el (2C-mode-map, 2C-minor-mode-map): Convert to defvar-keymap. diff --git a/lisp/textmodes/two-column.el b/lisp/textmodes/two-column.el index 41cd82ce728..e4cbbbec95f 100644 --- a/lisp/textmodes/two-column.el +++ b/lisp/textmodes/two-column.el @@ -162,14 +162,12 @@ minus this value." :type 'boolean) -(defvar 2C-mode-map - (let ((map (make-sparse-keymap))) - (define-key map "2" #'2C-two-columns) - (define-key map [f2] #'2C-two-columns) - (define-key map "b" #'2C-associate-buffer) - (define-key map "s" #'2C-split) - map) - "Keymap for commands for setting up two-column mode.") +(defvar-keymap 2C-mode-map + :doc "Keymap for commands for setting up two-column mode." + "2" #'2C-two-columns + "" #'2C-two-columns + "b" #'2C-associate-buffer + "s" #'2C-split) ;;;###autoload (autoload '2C-command "two-column" () t 'keymap) (fset '2C-command 2C-mode-map) @@ -177,21 +175,19 @@ minus this value." ;; This one is for historical reasons and simple keyboards, it is not ;; at all mnemonic. All usual sequences containing 2 were used, and ;; f2 could not be set up in a standard way under Emacs 18. -;;;###autoload (global-set-key "\C-x6" #'2C-command) - -;;;###autoload (global-set-key [f2] #'2C-command) - -(defvar 2C-minor-mode-map - (let ((map (make-sparse-keymap))) - (define-key map "1" #'2C-merge) - (define-key map "d" #'2C-dissociate) - (define-key map "o" #'2C-associated-buffer) - (define-key map "\^m" #'2C-newline) - (define-key map "|" #'2C-toggle-autoscroll) - (define-key map "{" #'2C-shrink-window-horizontally) - (define-key map "}" #'2C-enlarge-window-horizontally) - map) - "Keymap for commands for use in two-column mode.") +;;;###autoload (keymap-global-set "C-x 6" #'2C-command) + +;;;###autoload (keymap-global-set "" #'2C-command) + +(defvar-keymap 2C-minor-mode-map + :doc "Keymap for commands for use in two-column mode." + "1" #'2C-merge + "d" #'2C-dissociate + "o" #'2C-associated-buffer + "RET" #'2C-newline + "|" #'2C-toggle-autoscroll + "{" #'2C-shrink-window-horizontally + "}" #'2C-enlarge-window-horizontally) (setq minor-mode-map-alist (cons (cons '2C-mode commit 4f942b4994df82b9ba7ee10a75008b2338e38fc3 Author: Stefan Kangas Date: Fri Dec 27 05:02:55 2024 +0100 Use with-environment-variables in more places * lisp/gnus/gnus-search.el (gnus-search-run-search): * lisp/man.el (Man-completion-table): * lisp/progmodes/cperl-mode.el (cperl-pod-to-manpage): * test/src/fileio-tests.el (fileio-tests--relative-HOME): Prefer 'with-environment-variables'. diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el index ca82546ef82..11a6a56f16e 100644 --- a/lisp/gnus/gnus-search.el +++ b/lisp/gnus/gnus-search.el @@ -1591,8 +1591,7 @@ fudges a relevancy score of 100." ;; I can't tell if this is actually necessary. (cl-defmethod gnus-search-run-search :around ((_e gnus-search-namazu) _server _query _groups) - (let ((process-environment (copy-sequence process-environment))) - (setenv "LC_MESSAGES" "C") + (with-environment-variables (("LC_MESSAGES" "C")) (cl-call-next-method))) (cl-defmethod gnus-search-indexed-search-command ((engine gnus-search-namazu) diff --git a/lisp/man.el b/lisp/man.el index d5ac8b93d99..512ea17a1ee 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1020,8 +1020,8 @@ foo(sec)[, bar(sec) [, ...]] [other stuff] - description" ;; whereas under macOS it seems to be BRE-style and doesn't ;; accept backslashes at all. Let's not bother to ;; quote anything. - (let ((process-environment (copy-sequence process-environment))) - (setenv "COLUMNS" "999") ;; don't truncate long names + (with-environment-variables + (("COLUMNS" "999")) ; don't truncate long names ;; manual-program might not even exist. And since it's ;; run differently in Man-getpage-in-background, an error ;; here may not necessarily mean that we'll also get an diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 3c49466e7f4..9fb498bfff4 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -9103,9 +9103,8 @@ the appropriate statement modifier." (bufname (concat "Man " buffer-file-name)) (buffer (generate-new-buffer bufname))) (with-current-buffer buffer - (let ((process-environment (copy-sequence process-environment))) - ;; Prevent any attempt to use display terminal fanciness. - (setenv "TERM" "dumb") + ;; Prevent any attempt to use display terminal fanciness. + (with-environment-variables (("TERM" "dumb")) (set-process-sentinel (start-process pod2man-program buffer "sh" "-c" (format (cperl-pod2man-build-command) pod2man-args)) diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el index 750de8444c9..29177fee7ad 100644 --- a/test/src/fileio-tests.el +++ b/test/src/fileio-tests.el @@ -100,8 +100,7 @@ Also check that an encoding error can appear in a symlink." (ert-deftest fileio-tests--relative-HOME () "Test that `expand-file-name' works even when HOME is relative." - (let ((process-environment (copy-sequence process-environment))) - (setenv "HOME" "a/b/c") + (with-environment-variables (("HOME" "a/b/c")) (should (equal (expand-file-name "~/foo") (expand-file-name "a/b/c/foo"))) (when (memq system-type '(ms-dos windows-nt)) commit 577714e3fe722625236ce060f53b5d76f7933454 Author: Paul Eggert Date: Thu Dec 26 15:44:34 2024 -0800 Don’t include stdlib.h from conf_post.h This is brittle, as evinced by the recent problem with lib/stdlib.c. * src/conf_post.h: Move potential inclusion of stdlib.h and redefinitions of malloc, free, realloc, aligned_alloc, and calloc from here ... * src/lisp.h: ... to here. Do not redefine the symbols if UNEXMACOS_C is defined. * src/unexmacosx.c: Do not undef malloc, realloc, free. (UNEXMACOS_C): New symbol, to prevent lisp.h from defining them. diff --git a/src/conf_post.h b/src/conf_post.h index 6aa2c901cc7..e204a85b973 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -93,55 +93,6 @@ typedef bool bool_bf; # define ADDRESS_SANITIZER false #endif -#ifdef emacs -/* We include stdlib.h here, because Gnulib's stdlib.h might redirect - 'free' to its replacement, and we want to avoid that in unexec - builds. Including it here will render its inclusion after config.h - a no-op. */ -# if (defined DARWIN_OS && defined HAVE_UNEXEC) || defined HYBRID_MALLOC -# include -# endif -#endif - -#if defined DARWIN_OS && defined emacs && defined HAVE_UNEXEC -# undef malloc -# define malloc unexec_malloc -# undef realloc -# define realloc unexec_realloc -# undef free -# define free unexec_free - -extern void *unexec_malloc (size_t); -extern void *unexec_realloc (void *, size_t); -extern void unexec_free (void *); - -#endif - -/* If HYBRID_MALLOC is defined (e.g., on Cygwin), emacs will use - gmalloc before dumping and the system malloc after dumping. - hybrid_malloc and friends, defined in gmalloc.c, are wrappers that - accomplish this. */ -#ifdef HYBRID_MALLOC -#ifdef emacs -#undef malloc -#define malloc hybrid_malloc -#undef realloc -#define realloc hybrid_realloc -#undef aligned_alloc -#define aligned_alloc hybrid_aligned_alloc -#undef calloc -#define calloc hybrid_calloc -#undef free -#define free hybrid_free - -extern void *hybrid_malloc (size_t); -extern void *hybrid_calloc (size_t, size_t); -extern void hybrid_free (void *); -extern void *hybrid_aligned_alloc (size_t, size_t); -extern void *hybrid_realloc (void *, size_t); -#endif /* emacs */ -#endif /* HYBRID_MALLOC */ - /* We have to go this route, rather than the old hpux9 approach of renaming the functions via macros. The system's stdlib.h has fully prototyped declarations, which yields a conflicting definition of diff --git a/src/gmalloc.c b/src/gmalloc.c index 1faf6506167..d6c5d351925 100644 --- a/src/gmalloc.c +++ b/src/gmalloc.c @@ -62,7 +62,7 @@ extern void (*__MALLOC_HOOK_VOLATILE __malloc_initialize_hook) (void); grealloc... via the macros that follow). The dumped emacs, however, will use the system malloc, realloc.... In other source files, malloc, realloc... are renamed hybrid_malloc, - hybrid_realloc... via macros in conf_post.h. hybrid_malloc and + hybrid_realloc... via macros in lisp.h. hybrid_malloc and friends are wrapper functions defined later in this file. */ #undef malloc #undef realloc diff --git a/src/lisp.h b/src/lisp.h index bf6b023fc2a..f3566ad2973 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4930,10 +4930,45 @@ Lisp_Object funcall_general (Lisp_Object fun, /* Defined in unexmacosx.c. */ #if defined DARWIN_OS && defined HAVE_UNEXEC +/* Redirect calls to malloc, realloc and free to a macOS zone memory allocator. + FIXME: Either also redirect unexec_aligned_alloc and unexec_calloc, + or fix this comment to explain why those two redirections are not needed. */ extern void unexec_init_emacs_zone (void); extern void *unexec_malloc (size_t); extern void *unexec_realloc (void *, size_t); extern void unexec_free (void *); +# ifndef UNEXMACOSX_C +# include +# undef malloc +# undef realloc +# undef free +# define malloc unexec_malloc +# define realloc unexec_realloc +# define free unexec_free +# endif +#endif + +/* Defined in gmalloc.c. */ +#ifdef HYBRID_MALLOC +/* Redirect calls to malloc and friends to a hybrid allocator that + uses gmalloc before dumping and the system malloc after dumping. + This can be useful on Cygwin, for example. */ +extern void *hybrid_aligned_alloc (size_t, size_t); +extern void *hybrid_calloc (size_t, size_t); +extern void *hybrid_malloc (size_t); +extern void *hybrid_realloc (void *, size_t); +extern void hybrid_free (void *); +# include +# undef aligned_alloc +# undef calloc +# undef malloc +# undef realloc +# undef free +# define aligned_alloc hybrid_aligned_alloc +# define calloc hybrid_calloc +# define malloc hybrid_malloc +# define realloc hybrid_realloc +# define free hybrid_free #endif /* The definition of Lisp_Module_Function depends on emacs-module.h, diff --git a/src/unexmacosx.c b/src/unexmacosx.c index 7b2326441b4..d6c7686607f 100644 --- a/src/unexmacosx.c +++ b/src/unexmacosx.c @@ -87,15 +87,10 @@ along with GNU Emacs. If not, see . */ #include -/* Although redefines malloc to unexec_malloc, etc., this - file wants stdlib.h to declare the originals. */ -#undef malloc -#undef realloc -#undef free - #include #include "unexec.h" +#define UNEXMACOSX_C /* Tell lisp.h we want the system malloc, etc. */ #include "lisp.h" #include "sysstdio.h" commit a51642ba5fad891239552fe7e746fa160e3f88ea Author: Paul Eggert Date: Mon Dec 23 14:03:06 2024 -0800 Let Gnulib deal with MB_CUR_MAX Recent Gnulib should work around the Android NDK 16 MB_CUR_MAX bug, so Emacs no longer needs to worry about it. * configure.ac (gl_STDLIB_H): Remove, to stop overriding Gnulib. * configure.ac (__ctype_get_mb_cur_max) (emacs_cv_broken_mb_cur_max, REPLACEMENT_MB_CUR_MAX): * src/conf_post.h (MB_CUR_MAX): Remove, as Gnulib does this now. diff --git a/configure.ac b/configure.ac index 18cbb42b0ef..bfef9cd294d 100644 --- a/configure.ac +++ b/configure.ac @@ -1615,10 +1615,6 @@ ac_func_list=$funcs AC_DEFUN([gt_TYPE_WINT_T], [GNULIBHEADERS_OVERRIDE_WINT_T=0 AC_SUBST([GNULIBHEADERS_OVERRIDE_WINT_T])]) -# Emacs does not need precise checks for the Solaris 10 MB_CUR_MAX bug. -AC_DEFUN_ONCE([gl_STDLIB_H], - [AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) - gl_NEXT_HEADERS([stdlib.h])]) # Emacs does not need to check for off64_t. AC_DEFUN([gl_TYPE_OFF64_T], [HAVE_OFF64_T=1 @@ -7646,35 +7642,6 @@ fi AC_SUBST([WINDOW_SYSTEM_OBJ]) -# Some systems have MB_CUR_MAX defined to a call to -# __ctype_get_mb_cur_max, but do not have __ctype_get_mb_cur_max in -# libc. Check for that situation and define MB_CUR_MAX to something -# sane. - -AC_CHECK_FUNC([__ctype_get_mb_cur_max]) - -AC_CACHE_CHECK([whether MB_CUR_MAX is defined to function that won't link], - [emacs_cv_broken_mb_cur_max], - [AC_EGREP_CPP(__ctype_get_mb_cur_max, [ -#include -#ifndef MB_CUR_MAX -#define MB_CUR_MAX -1 -#endif -static int foo = MB_CUR_MAX; -], [AS_IF([test "$ac_cv_func___ctype_get_mb_cur_max" = "yes"], - [emacs_cv_broken_mb_cur_max=no], - [emacs_cv_broken_mb_cur_max=yes])], - [emacs_cv_broken_mb_cur_max=no])]) - -AS_IF([test "$emacs_cv_broken_mb_cur_max" = "yes"], - # Define this to 4, which is right for Android. - [AS_CASE([$opsys], [android], - [AC_DEFINE([REPLACEMENT_MB_CUR_MAX], [4], - [Define to MB_CUR_MAX if stdlib.h is broken.])], - [AC_MSG_ERROR([MB_CUR_MAX does not work on your system. -Please modify configure.ac to set an appropriate value, then -send your change to bug-gnu-emacs@gnu.org])])]) - AH_TOP([/* GNU Emacs site configuration template file. Copyright (C) 1988-2024 Free Software Foundation, Inc. diff --git a/src/conf_post.h b/src/conf_post.h index 9d3f5711bef..6aa2c901cc7 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -462,16 +462,6 @@ extern int emacs_setenv_TZ (char const *); # define UNINIT /* empty */ #endif -/* MB_CUR_MAX is often broken on systems which copy-paste LLVM - headers, so replace its definition with a working one if - necessary. */ - -#ifdef REPLACEMENT_MB_CUR_MAX -#include -#undef MB_CUR_MAX -#define MB_CUR_MAX REPLACEMENT_MB_CUR_MAX -#endif /* REPLACEMENT_MB_CUR_MAX */ - /* Emacs does not need glibc strftime behavior for AM and PM indicators. */ #define REQUIRE_GNUISH_STRFTIME_AM_PM false commit cf5e58a14dedabd65dee297ee2a2abb05cd4449d Author: Paul Eggert Date: Mon Dec 23 13:55:59 2024 -0800 Update from Gnulib by running admin/merge-gnulib diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index 93d592193a0..456696f4c9e 100644 --- a/doc/misc/texinfo.tex +++ b/doc/misc/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2024-02-10.22} +\def\texinfoversion{2024-11-04.20} % % Copyright 1985, 1986, 1988, 1990-2024 Free Software Foundation, Inc. % @@ -951,7 +951,11 @@ \let\setfilename=\comment % @bye. -\outer\def\bye{\chappager\pagelabels\tracingstats=1\ptexend} +\outer\def\bye{% + \chappager\pagelabels + % possibly set in \printindex + \ifx\byeerror\relax\else\errmessage{\byeerror}\fi + \tracingstats=1\ptexend} \message{pdf,} @@ -3126,11 +3130,12 @@ % at the end of the line, or no break at all here. % Changing the value of the penalty and/or the amount of stretch affects how % preferable one choice is over the other. +% Check test cases in doc/texinfo-tex-test.texi before making any changes. \def\urefallowbreak{% \penalty0\relax - \hskip 0pt plus 2 em\relax + \hskip 0pt plus 3 em\relax \penalty1000\relax - \hskip 0pt plus -2 em\relax + \hskip 0pt plus -3 em\relax } \urefbreakstyle after @@ -5438,6 +5443,9 @@ \closein 1 \endgroup} +% Checked in @bye +\let\byeerror\relax + % If the index file starts with a backslash, forgo reading the index % file altogether. If somebody upgrades texinfo.tex they may still have % old index files using \ as the escape character. Reading this would @@ -5446,7 +5454,9 @@ \ifflagclear{txiindexescapeisbackslash}{% \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1 \ifflagclear{txiskipindexfileswithbackslash}{% -\errmessage{% + % Delay the error message until the very end to give a chance + % for the whole index to be output as input for texindex. + \global\def\byeerror{% ERROR: A sorted index file in an obsolete format was skipped. To fix this problem, please upgrade your version of 'texi2dvi' or 'texi2pdf' to that at . @@ -5567,7 +5577,7 @@ % \entry typesets a paragraph consisting of the text (#1), dot leaders, and % then page number (#2) flushed to the right margin. It is used for index % and table of contents entries. The paragraph is indented by \leftskip. -% +% If \tocnodetarget is set, link text to the referenced node. \def\entry{% \begingroup % @@ -5608,7 +5618,13 @@ \global\setbox\boxA=\hbox\bgroup \ifpdforxetex \iflinkentrytext - \pdflinkpage{#1}{\unhbox\boxA}% + \ifx\tocnodetarget\empty + \unhbox\boxA + \else + \startxreflink{\tocnodetarget}{}% + \unhbox\boxA + \endlink + \fi \else \unhbox\boxA \fi @@ -5625,11 +5641,18 @@ % \null\nobreak\indexdotfill % Have leaders before the page number. % + \hskip\skip\thinshrinkable \ifpdforxetex - \pdfgettoks#1.% - \hskip\skip\thinshrinkable\the\toksA + \ifx\tocnodetarget\empty + \pdfgettoks#1.% + \the\toksA + \else + % Should just be a single page number in toc + \startxreflink{\tocnodetarget}{}% + #1\endlink + \fi \else - \hskip\skip\thinshrinkable #1% + #1% \fi \fi \egroup % end \boxA @@ -6892,7 +6915,7 @@ \vskip 0pt plus 5\baselineskip \penalty-300 \vskip 0pt plus -5\baselineskip - \dochapentry{#1}{\numeralbox}{}% + \dochapentry{#1}{\numeralbox}{#3}{}% } % % Parts, in the short toc. @@ -6905,12 +6928,12 @@ % Chapters, in the main contents. \def\numchapentry#1#2#3#4{% \retrievesecnowidth\secnowidthchap{#2}% - \dochapentry{#1}{#2}{#4}% + \dochapentry{#1}{#2}{#3}{#4}% } % Chapters, in the short toc. \def\shortchapentry#1#2#3#4{% - \tocentry{#1}{\shortchaplabel{#2}}{#4}% + \tocentry{#1}{\shortchaplabel{#2}}{#3}{#4}% } % Appendices, in the main contents. @@ -6923,79 +6946,77 @@ % \def\appentry#1#2#3#4{% \retrievesecnowidth\secnowidthchap{#2}% - \dochapentry{\appendixbox{#2}\hskip.7em#1}{}{#4}% + \dochapentry{\appendixbox{#2}\hskip.7em#1}{}{#3}{#4}% } % Unnumbered chapters. -\def\unnchapentry#1#2#3#4{\dochapentry{#1}{}{#4}} -\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{}{#4}} +\def\unnchapentry#1#2#3#4{\dochapentry{#1}{}{#3}{#4}} +\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{}{#3}{#4}} % Sections. -\def\numsecentry#1#2#3#4{\dosecentry{#1}{#2}{#4}} - \def\numsecentry#1#2#3#4{% \retrievesecnowidth\secnowidthsec{#2}% - \dosecentry{#1}{#2}{#4}% + \dosecentry{#1}{#2}{#3}{#4}% } \let\appsecentry=\numsecentry \def\unnsecentry#1#2#3#4{% \retrievesecnowidth\secnowidthsec{#2}% - \dosecentry{#1}{}{#4}% + \dosecentry{#1}{}{#3}{#4}% } % Subsections. \def\numsubsecentry#1#2#3#4{% \retrievesecnowidth\secnowidthssec{#2}% - \dosubsecentry{#1}{#2}{#4}% + \dosubsecentry{#1}{#2}{#3}{#4}% } \let\appsubsecentry=\numsubsecentry \def\unnsubsecentry#1#2#3#4{% \retrievesecnowidth\secnowidthssec{#2}% - \dosubsecentry{#1}{}{#4}% + \dosubsecentry{#1}{}{#3}{#4}% } % And subsubsections. -\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#2}{#4}} +\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#2}{#3}{#4}} \let\appsubsubsecentry=\numsubsubsecentry -\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{}{#4}} +\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{}{#3}{#4}} % This parameter controls the indentation of the various levels. % Same as \defaultparindent. \newdimen\tocindent \tocindent = 15pt % Now for the actual typesetting. In all these, #1 is the text, #2 is -% a section number if present, and #3 is the page number. +% a section number if present, #3 is the node, and #4 is the page number. % % If the toc has to be broken over pages, we want it to be at chapters % if at all possible; hence the \penalty. -\def\dochapentry#1#2#3{% +\def\dochapentry#1#2#3#4{% \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip \begingroup % Move the page numbers slightly to the right \advance\entryrightmargin by -0.05em \chapentryfonts \extrasecnoskip=0.4em % separate chapter number more - \tocentry{#1}{#2}{#3}% + \tocentry{#1}{#2}{#3}{#4}% \endgroup \nobreak\vskip .25\baselineskip plus.1\baselineskip } -\def\dosecentry#1#2#3{\begingroup +\def\dosecentry#1#2#3#4{\begingroup \secnowidth=\secnowidthchap \secentryfonts \leftskip=\tocindent - \tocentry{#1}{#2}{#3}% + \tocentry{#1}{#2}{#3}{#4}% \endgroup} -\def\dosubsecentry#1#2#3{\begingroup +\def\dosubsecentry#1#2#3#4{\begingroup \secnowidth=\secnowidthsec \subsecentryfonts \leftskip=2\tocindent - \tocentry{#1}{#2}{#3}% + \tocentry{#1}{#2}{#3}{#4}% \endgroup} -\def\dosubsubsecentry#1#2#3{\begingroup +\def\dosubsubsecentry#1#2#3#4{\begingroup \secnowidth=\secnowidthssec \subsubsecentryfonts \leftskip=3\tocindent - \tocentry{#1}{#2}{#3}% + \tocentry{#1}{#2}{#3}{#4}% \endgroup} % Used for the maximum width of a section number so we can align @@ -7005,12 +7026,15 @@ \newdimen\extrasecnoskip \extrasecnoskip=0pt -% \tocentry{TITLE}{SEC NO}{PAGE} +\let\tocnodetarget\empty + +% \tocentry{TITLE}{SEC NO}{NODE}{PAGE} % -\def\tocentry#1#2#3{% +\def\tocentry#1#2#3#4{% + \def\tocnodetarget{#3}% \def\secno{#2}% \ifx\empty\secno - \entry{#1}{#3}% + \entry{#1}{#4}% \else \ifdim 0pt=\secnowidth \setbox0=\hbox{#2\hskip\labelspace\hskip\extrasecnoskip}% @@ -7021,7 +7045,7 @@ #2\hskip\labelspace\hskip\extrasecnoskip\hfill}% \fi \entrycontskip=\wd0 - \entry{\box0 #1}{#3}% + \entry{\box0 #1}{#4}% \fi } \newdimen\labelspace @@ -10515,6 +10539,16 @@ \catcode"#1=\other } +% Suppress ligature creation from adjacent characters. +\ifx\luatexversion\thisisundefined + \def\nolig{{}} +\else + % Braces do not suppress ligature creation in LuaTeX, e.g. in of{}fice + % to suppress the "ff" ligature. Using a kern appears to be the only + % workaround. + \def\nolig{\kern0pt{}} +\fi + % https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M % U+0000..U+007F = https://en.wikipedia.org/wiki/Basic_Latin_(Unicode_block) % U+0080..U+00FF = https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block) @@ -11132,8 +11166,8 @@ % Punctuation \DeclareUnicodeCharacter{2013}{--}% \DeclareUnicodeCharacter{2014}{---}% - \DeclareUnicodeCharacter{2018}{\quoteleft{}}% - \DeclareUnicodeCharacter{2019}{\quoteright{}}% + \DeclareUnicodeCharacter{2018}{\quoteleft\nolig}% + \DeclareUnicodeCharacter{2019}{\quoteright\nolig}% \DeclareUnicodeCharacter{201A}{\quotesinglbase{}}% \DeclareUnicodeCharacter{201C}{\quotedblleft{}}% \DeclareUnicodeCharacter{201D}{\quotedblright{}}% @@ -11168,7 +11202,7 @@ \DeclareUnicodeCharacter{2287}{\ensuremath\supseteq}% % \DeclareUnicodeCharacter{2016}{\ensuremath\Vert}% - \DeclareUnicodeCharacter{2032}{\ensuremath\prime}% + \DeclareUnicodeCharacter{2032}{\ensuremath{^\prime}}% \DeclareUnicodeCharacter{210F}{\ensuremath\hbar}% \DeclareUnicodeCharacter{2111}{\ensuremath\Im}% \DeclareUnicodeCharacter{2113}{\ensuremath\ell}% diff --git a/lib/endian.c b/lib/endian.c index 3e7e56f523d..089f5f7825e 100644 --- a/lib/endian.c +++ b/lib/endian.c @@ -17,7 +17,7 @@ /* Written by Collin Funk. */ +#define _GL_ENDIAN_INLINE _GL_EXTERN_INLINE #include -#define _GL_ENDIAN_INLINE _GL_EXTERN_INLINE #include diff --git a/lib/intprops-internal.h b/lib/intprops-internal.h index c8cc0e20194..0b7e1f539aa 100644 --- a/lib/intprops-internal.h +++ b/lib/intprops-internal.h @@ -77,10 +77,11 @@ /* Does the __typeof__ keyword work? This could be done by 'configure', but for now it's easier to do it by hand. */ -#if (2 <= __GNUC__ \ - || (4 <= __clang_major__) \ - || (1210 <= __IBMC__ && defined __IBM__TYPEOF__) \ - || (0x5110 <= __SUNPRO_C && !__STDC__)) +#if ((defined __GNUC__ && 2 <= __GNUC__) \ + || (defined __clang_major__ && 4 <= __clang_major__) \ + || (defined __IBMC__ && 1210 <= __IBMC__ && defined __IBM__TYPEOF__) \ + || (defined __SUNPRO_C && 0x5110 <= __SUNPRO_C && !__STDC__) \ + || (defined _MSC_VER && 1939 <= _MSC_VER)) # define _GL_HAVE___TYPEOF__ 1 #else # define _GL_HAVE___TYPEOF__ 0 diff --git a/lib/limits.in.h b/lib/limits.in.h index c65eb4c1cfe..3347e369fb5 100644 --- a/lib/limits.in.h +++ b/lib/limits.in.h @@ -20,7 +20,7 @@ #endif @PRAGMA_COLUMNS@ -#if defined _GL_ALREADY_INCLUDING_LIMITS_H +#if defined _@GUARD_PREFIX@_ALREADY_INCLUDING_LIMITS_H /* Special invocation convention: On Haiku/x86_64, we have a sequence of nested includes -> -> . @@ -34,12 +34,12 @@ #ifndef _@GUARD_PREFIX@_LIMITS_H -# define _GL_ALREADY_INCLUDING_LIMITS_H +# define _@GUARD_PREFIX@_ALREADY_INCLUDING_LIMITS_H /* The include_next requires a split double-inclusion guard. */ # @INCLUDE_NEXT@ @NEXT_LIMITS_H@ -# undef _GL_ALREADY_INCLUDING_LIMITS_H +# undef _@GUARD_PREFIX@_ALREADY_INCLUDING_LIMITS_H #ifndef _@GUARD_PREFIX@_LIMITS_H #define _@GUARD_PREFIX@_LIMITS_H diff --git a/lib/signal.in.h b/lib/signal.in.h index 6239b90adf3..18c88f0c1d7 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -20,7 +20,7 @@ #endif @PRAGMA_COLUMNS@ -#if defined __need_sig_atomic_t || defined __need_sigset_t || defined _GL_ALREADY_INCLUDING_SIGNAL_H || (defined _SIGNAL_H && !defined __SIZEOF_PTHREAD_MUTEX_T) +#if defined __need_sig_atomic_t || defined __need_sigset_t || defined _@GUARD_PREFIX@_ALREADY_INCLUDING_SIGNAL_H || (defined _SIGNAL_H && !defined __SIZEOF_PTHREAD_MUTEX_T) /* Special invocation convention: - Inside glibc header files. - On glibc systems we have a sequence of nested includes @@ -39,7 +39,7 @@ #ifndef _@GUARD_PREFIX@_SIGNAL_H -#define _GL_ALREADY_INCLUDING_SIGNAL_H +#define _@GUARD_PREFIX@_ALREADY_INCLUDING_SIGNAL_H /* Define pid_t, uid_t. Also, mingw defines sigset_t not in , but in . @@ -50,7 +50,7 @@ /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_SIGNAL_H@ -#undef _GL_ALREADY_INCLUDING_SIGNAL_H +#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_SIGNAL_H #ifndef _@GUARD_PREFIX@_SIGNAL_H #define _@GUARD_PREFIX@_SIGNAL_H diff --git a/lib/stdbit.c b/lib/stdbit.c index 4801e74d281..b9c52698e91 100644 --- a/lib/stdbit.c +++ b/lib/stdbit.c @@ -17,7 +17,7 @@ /* Written by Paul Eggert. */ +#define _GL_STDBIT_INLINE _GL_EXTERN_INLINE #include -#define _GL_STDBIT_INLINE _GL_EXTERN_INLINE #include diff --git a/lib/stdbit.in.h b/lib/stdbit.in.h index 20b9f4f4662..91d237d7ad0 100644 --- a/lib/stdbit.in.h +++ b/lib/stdbit.in.h @@ -77,7 +77,8 @@ _GL_INLINE_HEADER_BEGIN #if ((defined __GNUC__ && 2 <= __GNUC__) \ || (defined __clang_major__ && 4 <= __clang_major__) \ || (defined __IBMC__ && 1210 <= __IBMC__ && defined __IBM__TYPEOF__) \ - || (defined __SUNPRO_C && 0x5110 <= __SUNPRO_C && !__STDC__)) + || (defined __SUNPRO_C && 0x5110 <= __SUNPRO_C && !__STDC__) \ + || (defined _MSC_VER && 1939 <= _MSC_VER)) # define _GL_STDBIT_TYPEOF_CAST(a, b) ((__typeof__ (a)) (b)) #elif 202311 <= __STDC_VERSION__ # define _GL_STDBIT_TYPEOF_CAST(a, b) ((typeof (a)) (b)) diff --git a/lib/stdio.in.h b/lib/stdio.in.h index e77798d9b25..ed260d308b0 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -20,7 +20,7 @@ #endif @PRAGMA_COLUMNS@ -#if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H +#if defined __need_FILE || defined __need___FILE || defined _@GUARD_PREFIX@_ALREADY_INCLUDING_STDIO_H || defined _GL_SKIP_GNULIB_STDIO_H /* Special invocation convention: - Inside glibc header files. - On OSF/1 5.1 we have a sequence of nested includes @@ -48,12 +48,12 @@ # endif #endif -#define _GL_ALREADY_INCLUDING_STDIO_H +#define _@GUARD_PREFIX@_ALREADY_INCLUDING_STDIO_H /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STDIO_H@ -#undef _GL_ALREADY_INCLUDING_STDIO_H +#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_STDIO_H #ifdef _GL_DEFINED__POSIX_C_SOURCE # undef _GL_DEFINED__POSIX_C_SOURCE diff --git a/lib/stdlib.c b/lib/stdlib.c index 521d64627dc..6f70fa4bbda 100644 --- a/lib/stdlib.c +++ b/lib/stdlib.c @@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ +#define _GL_STDLIB_INLINE _GL_EXTERN_INLINE #include -#define _GL_STDLIB_INLINE _GL_EXTERN_INLINE #include diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index adbef69131b..14f45cc21e5 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -746,15 +746,20 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant everywhere - " # endif #endif -/* Return maximum number of bytes of a multibyte character. */ +/* Return maximum number of bytes in a multibyte character in the + current locale. */ #if @REPLACE_MB_CUR_MAX@ # if !GNULIB_defined_MB_CUR_MAX -_GL_STDLIB_INLINE int +_GL_STDLIB_INLINE size_t gl_MB_CUR_MAX (void) { +# if 0 < @REPLACE_MB_CUR_MAX@ + return @REPLACE_MB_CUR_MAX@; +# else /* Turn the value 3 to the value 4, as needed for the UTF-8 encoding. */ int gl_mb_cur_max = MB_CUR_MAX; return gl_mb_cur_max == 3 ? 4 : gl_mb_cur_max; +# endif } # undef MB_CUR_MAX # define MB_CUR_MAX gl_MB_CUR_MAX () diff --git a/lib/string.in.h b/lib/string.in.h index f5a6d8b3267..72cd7566e65 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -20,7 +20,7 @@ #endif @PRAGMA_COLUMNS@ -#if defined _GL_ALREADY_INCLUDING_STRING_H +#if defined _@GUARD_PREFIX@_ALREADY_INCLUDING_STRING_H /* Special invocation convention: - On OS X/NetBSD we have a sequence of nested includes -> -> "string.h" @@ -34,12 +34,12 @@ #ifndef _@GUARD_PREFIX@_STRING_H -#define _GL_ALREADY_INCLUDING_STRING_H +#define _@GUARD_PREFIX@_ALREADY_INCLUDING_STRING_H /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STRING_H@ -#undef _GL_ALREADY_INCLUDING_STRING_H +#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_STRING_H #ifndef _@GUARD_PREFIX@_STRING_H #define _@GUARD_PREFIX@_STRING_H diff --git a/lib/unistd.c b/lib/unistd.c index f3b3f7bd2fe..b25112eb91e 100644 --- a/lib/unistd.c +++ b/lib/unistd.c @@ -15,8 +15,8 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ +#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE #include -#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE #include typedef int dummy; diff --git a/m4/stdint.m4 b/m4/stdint.m4 index 0a078e64d58..1f3062a8900 100644 --- a/m4/stdint.m4 +++ b/m4/stdint.m4 @@ -1,5 +1,5 @@ # stdint.m4 -# serial 63 +# serial 64 dnl Copyright (C) 2001-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -158,7 +158,7 @@ uintmax_t j = UINTMAX_MAX; || defined __clang__) int k = _Generic (SIZE_MAX, size_t: 0); #elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ - || (0x5110 <= __SUNPRO_C && !__STDC__)) + || (0x5110 <= __SUNPRO_C && !__STDC__) || 1939 <= _MSC_VER) extern size_t k; extern __typeof__ (SIZE_MAX) k; #endif diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4 index 87b63ff54e3..ba56a9480b3 100644 --- a/m4/stdlib_h.m4 +++ b/m4/stdlib_h.m4 @@ -1,5 +1,5 @@ # stdlib_h.m4 -# serial 82 +# serial 84 dnl Copyright (C) 2007-2024 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -41,20 +41,21 @@ AC_DEFUN_ONCE([gl_STDLIB_H], AC_REQUIRE([gt_LOCALE_EN_UTF8]) AC_CACHE_CHECK([whether MB_CUR_MAX is correct], [gl_cv_macro_MB_CUR_MAX_good], - [ - dnl Initial guess, used when cross-compiling or when no suitable locale - dnl is present. -changequote(,)dnl - case "$host_os" in - # Guess no on Solaris and Haiku. - solaris* | haiku*) gl_cv_macro_MB_CUR_MAX_good="guessing no" ;; - # Guess yes otherwise. - *) gl_cv_macro_MB_CUR_MAX_good="guessing yes" ;; - esac -changequote([,])dnl - if test "$LOCALE_EN_UTF8" != none; then - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[#include + ]], + [[return !!MB_CUR_MAX;]]) + ], + [dnl Initial guess, used when cross-compiling or when no suitable locale + dnl is present. + # Guess no on Solaris and Haiku, yes otherwise. + AS_CASE([$host_os], + [solaris* | haiku*], + [gl_cv_macro_MB_CUR_MAX_good="guessing no"], + [gl_cv_macro_MB_CUR_MAX_good="guessing yes"]) + if test "$LOCALE_EN_UTF8" != none; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ #include #include int main () @@ -67,15 +68,21 @@ int main () } return result; }]])], - [gl_cv_macro_MB_CUR_MAX_good=yes], - [gl_cv_macro_MB_CUR_MAX_good=no], - [:]) - fi + [gl_cv_macro_MB_CUR_MAX_good=yes], + [gl_cv_macro_MB_CUR_MAX_good=no], + [:]) + fi + ], + [gl_cv_macro_MB_CUR_MAX_good="link failed - so no"]) ]) - case "$gl_cv_macro_MB_CUR_MAX_good" in - *yes) ;; - *) REPLACE_MB_CUR_MAX=1 ;; - esac + AS_CASE([$gl_cv_macro_MB_CUR_MAX_good], + [*yes], + [], + ["link failed - so no"], + [# 4 suffices as a workaround in Android NDK 16, + # the only known platform with the bug. + REPLACE_MB_CUR_MAX=4], + [REPLACE_MB_CUR_MAX="(-1)"]) AC_CHECK_DECLS_ONCE([ecvt]) if test $ac_cv_have_decl_ecvt = no; then commit 85ca91ff912da7c3a672e4bfe6ce103a23ddec73 Author: Stefan Kangas Date: Thu Dec 26 23:24:50 2024 +0100 Drop support form gnome-moz-remote from browse-url * lisp/net/browse-url.el (browse-url-gnome-moz-program) (browse-url-gnome-moz-arguments, browse-url-gnome-moz): Delete functions and variables obsolete since Emacs 25.1. diff --git a/etc/NEWS b/etc/NEWS index 8adead78a32..b714f675a4b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -330,6 +330,9 @@ For better integration with the Qutebrowser, set *** Support for the Conkeror web browser has been removed. It has been obsolete since Emacs 28.1. +*** Support for gnome-moz-remote has been removed. +It has been obsolete since Emacs 25.1. + ** CL-Lib +++ diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index 9dd990108df..4f4196044d1 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -376,18 +376,6 @@ Defaults to the value of `browse-url-epiphany-arguments' at the time :type 'string :version "29.1") -;; GNOME means of invoking Mozilla. -(defvar browse-url-gnome-moz-program "gnome-moz-remote") - -(make-obsolete-variable 'browse-url-gnome-moz-program nil "25.1") - -(defcustom browse-url-gnome-moz-arguments '() - "A list of strings passed to the GNOME mozilla viewer as arguments." - :version "21.1" - :type '(repeat (string :tag "Argument"))) - -(make-obsolete-variable 'browse-url-gnome-moz-arguments nil "25.1") - (defcustom browse-url-mozilla-new-window-is-tab nil "Whether to open up new Mozilla windows in a tab or a new window. If non-nil, then open the URL in a new tab rather than a new window if @@ -1119,7 +1107,6 @@ instead of `browse-url-new-window-flag'." ((eq system-type 'android) 'browse-url-default-android-browser) ((browse-url-can-use-xdg-open) 'browse-url-xdg-open) -;;; ((executable-find browse-url-gnome-moz-program) 'browse-url-gnome-moz) ((executable-find browse-url-firefox-program) 'browse-url-firefox) ((executable-find browse-url-chromium-program) 'browse-url-chromium) ((executable-find browse-url-kde-program) 'browse-url-kde) @@ -1465,32 +1452,6 @@ currently selected window instead." (function-put 'browse-url-emacs 'browse-url-browser-kind 'internal) -;;;###autoload -(defun browse-url-gnome-moz (url &optional new-window) - "Ask Mozilla to load URL via the GNOME program `gnome-moz-remote'. -Default to the URL around or before point. The strings in variable -`browse-url-gnome-moz-arguments' are also passed. - -When called interactively, if variable `browse-url-new-window-flag' is -non-nil, load the document in a new browser window, otherwise use an -existing one. A non-nil interactive prefix argument reverses the -effect of `browse-url-new-window-flag'. - -When called non-interactively, optional second argument NEW-WINDOW is -used instead of `browse-url-new-window-flag'." - (declare (obsolete nil "25.1")) - (interactive (browse-url-interactive-arg "URL: ")) - (apply #'start-process (concat "gnome-moz-remote " url) - nil - browse-url-gnome-moz-program - (append - browse-url-gnome-moz-arguments - (if (browse-url-maybe-new-window new-window) - '("--newwin")) - (list "--raise" url)))) - -(function-put 'browse-url-gnome-moz 'browse-url-browser-kind 'external) - ;; --- W3 --- ;; External. commit 099e439ea99d794502f403b6de53b8589d7b6d6e Author: Antero Mejr Date: Thu Dec 26 15:58:24 2024 -0500 Add scheme-mode indentation rules for SRFI 227 and 253 * lisp/progmodes/scheme.el: Add properties for SRFI 227 and SRFI 253 identifiers. (Bug#75126) diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el index a0f922f279c..db3e0161f79 100644 --- a/lisp/progmodes/scheme.el +++ b/lisp/progmodes/scheme.el @@ -693,6 +693,19 @@ indentation." (put 'match-let* 'scheme-indent-function 1) (put 'match-letrec 'scheme-indent-function 1) +;; SRFI-227 +(put 'opt-lambda 'scheme-indent-function 1) +(put 'opt*-lambda 'scheme-indent-function 1) +(put 'let-optionals 'scheme-indent-function 2) +(put 'let-optionals* 'scheme-indent-function 2) +;; define-optionals and define-optionals* already work + +;; SRFI-253 +(put 'check-case 'scheme-indent-function 1) +(put 'lambda-checked 'scheme-indent-function 1) +(put 'case-lambda-checked 'scheme-doc-string-elt 1) +;; define-checked and define-record-type-checked already work + ;;;; MIT Scheme specific indentation. (if scheme-mit-dialect commit 85f5be491e001d30b80e853ee028b80812577071 Author: Stefan Kangas Date: Thu Dec 26 21:17:28 2024 +0100 Improve flag variable names in uniquify * lisp/uniquify.el (uniquify-after-kill-buffer-flag) (uniquify-trailing-separator-flag): Rename from 'uniquify-after-kill-buffer-p' and 'uniquify-trailing-separator-p', to better adhere to our conventions. Update all users and leave old names as obsolete variable aliases. diff --git a/lisp/files.el b/lisp/files.el index 9144aaf0553..30e2787f9e6 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2233,7 +2233,7 @@ this function prepends a \"|\" to the final result if necessary." (lastname (if (string= lastname "") ; FILENAME is a root directory filename lastname)) (lastname (cond - ((not (and uniquify-trailing-separator-p + ((not (and uniquify-trailing-separator-flag (file-directory-p filename))) lastname) ((eq uniquify-buffer-name-style 'forward) diff --git a/lisp/uniquify.el b/lisp/uniquify.el index efe42762a6b..a3b53a88928 100644 --- a/lisp/uniquify.el +++ b/lisp/uniquify.el @@ -124,15 +124,18 @@ you can set, browse the `uniquify' custom group." :version "24.4" :require 'uniquify) -(defcustom uniquify-after-kill-buffer-p t +(define-obsolete-variable-alias 'uniquify-after-kill-buffer-p + 'uniquify-after-kill-buffer-flag "31.1") +(defcustom uniquify-after-kill-buffer-flag t "If non-nil, rerationalize buffer names after a buffer has been killed." - :type 'boolean) + :type 'boolean + :version "31.1") (defcustom uniquify-ignore-buffers-re nil "Regular expression matching buffer names that should not be uniquified. -For instance, set this to \"^draft-[0-9]+$\" to avoid having uniquify rename -draft buffers even if `uniquify-after-kill-buffer-p' is non-nil and the -visited file name isn't the same as that of the buffer." +For instance, set this to \"^draft-[0-9]+$\" to avoid having uniquify +rename draft buffers even if `uniquify-after-kill-buffer-flag' is +non-nil and the visited file name isn't the same as that of the buffer." :type '(choice (const :tag "Uniquify all buffers" nil) regexp)) (defcustom uniquify-min-dir-content 0 @@ -147,12 +150,15 @@ When `uniquify-buffer-name-style' is `reverse', separates all file name components (default \"\\\")." :type '(choice (const nil) string)) -(defcustom uniquify-trailing-separator-p nil - "If non-nil, add a file name separator to Dired buffer names. +(define-obsolete-variable-alias 'uniquify-trailing-separator-p + 'uniquify-trailing-separator-flag "31.1") +(defcustom uniquify-trailing-separator-flag nil + "Non-nil means add a file name separator to Dired buffer names. If `uniquify-buffer-name-style' is `forward', add the separator at the end; if it is `reverse', add the separator at the beginning; otherwise, this variable is ignored." - :type 'boolean) + :type 'boolean + :version "31.1") (defcustom uniquify-strip-common-suffix ;; Using it when uniquify-min-dir-content>0 doesn't make much sense. @@ -466,7 +472,7 @@ in `uniquify-list-buffers-directory-modes', otherwise returns nil." (defun uniquify-kill-buffer-function () "Re-rationalize buffer names, ignoring current buffer. For use on `kill-buffer-hook'." - (and uniquify-after-kill-buffer-p + (and uniquify-after-kill-buffer-flag (uniquify-maybe-rerationalize-w/o-cb))) ;; Ideally we'd like to add it buffer-locally, but that doesn't work diff --git a/test/lisp/uniquify-tests.el b/test/lisp/uniquify-tests.el index 9b33c9d7d47..f38f7ebe5c0 100644 --- a/test/lisp/uniquify-tests.el +++ b/test/lisp/uniquify-tests.el @@ -66,7 +66,7 @@ (make-directory b-path 'parents) (let ((uniquify-buffer-name-style 'forward) (uniquify-strip-common-suffix t) - (uniquify-trailing-separator-p nil)) + (uniquify-trailing-separator-flag nil)) (let ((bufs (list (find-file-noselect a-path) (find-file-noselect b-path)))) (should (equal (mapcar #'buffer-name bufs) @@ -74,7 +74,7 @@ (mapc #'kill-buffer bufs))) (let ((uniquify-buffer-name-style 'forward) (uniquify-strip-common-suffix nil) - (uniquify-trailing-separator-p t)) + (uniquify-trailing-separator-flag t)) (let ((bufs (list (find-file-noselect a-path) (find-file-noselect b-path)))) (should (equal (mapcar #'buffer-name bufs) @@ -82,7 +82,7 @@ (mapc #'kill-buffer bufs))) (let ((uniquify-buffer-name-style 'forward) (uniquify-strip-common-suffix t) - (uniquify-trailing-separator-p t)) + (uniquify-trailing-separator-flag t)) (let ((bufs (list (find-file-noselect a-path) (find-file-noselect b-path)))) (should (equal (mapcar #'buffer-name bufs) @@ -92,7 +92,7 @@ (ert-deftest uniquify-rename-to-dir () "Giving a buffer a name which matches a directory doesn't rename the buffer" (let ((uniquify-buffer-name-style 'forward) - (uniquify-trailing-separator-p t)) + (uniquify-trailing-separator-flag t)) (save-excursion (find-file "../README") (rename-buffer "lisp" t) @@ -101,7 +101,7 @@ (ert-deftest uniquify-separator-style-reverse () (let ((uniquify-buffer-name-style 'reverse) - (uniquify-trailing-separator-p t)) + (uniquify-trailing-separator-flag t)) (save-excursion (should (file-directory-p "../lib-src")) (find-file "../lib-src") @@ -109,10 +109,10 @@ (kill-buffer)))) (ert-deftest uniquify-separator-ignored () - "If uniquify-buffer-name-style isn't forward or reverse, -uniquify-trailing-separator-p is ignored" + "If `uniquify-buffer-name-style' isn't forward or reverse, +`uniquify-trailing-separator-flag' is ignored." (let ((uniquify-buffer-name-style 'post-forward-angle-brackets) - (uniquify-trailing-separator-p t)) + (uniquify-trailing-separator-flag t)) (save-excursion (should (file-directory-p "../lib-src")) (find-file "../lib-src") commit ab3888515694f89a24f64e94292c578af86eeaee Author: Charalampos Mitrodimas Date: Thu Dec 19 13:28:05 2024 +0000 Fix format specifier warnings in nsterm.m Resolve warnings caused by mismatched format specifiers in `NSLog` and `fprintf` calls. This was observed when compiled with Clang version 19.1.6 (arm64-apple-darwin). Warnings fixed: - "format specifies type 'unsigned int' but the argument has type 'IOReturn' (aka 'int')" * src/nsterm.m: Cast `IOReturn` (aka `int`) to `unsigned int` for `%x` format specifiers in `NSLog`. (Bug#74971) diff --git a/src/nsterm.m b/src/nsterm.m index c705a3c78f4..5793bb961e8 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -6955,8 +6955,12 @@ In that case we use UCKeyTranslate (ns_get_shifted_character) #ifndef NS_IMPL_GNUSTEP if (NS_KEYLOG) - fprintf (stderr, "keyDown: code =%x\tfnKey =%x\tflags = %x\tmods = %x\n", - code, fnKeysym, flags, emacs_event->modifiers); + fprintf (stderr, + "keyDown: code = %x\tfnKey = %x\tflags = %x\tmods = " + "%x\n", + (unsigned int) code, (unsigned int) fnKeysym, + (unsigned int) flags, + (unsigned int) emacs_event->modifiers); #endif /* If it was a function key or had control-like modifiers, pass @@ -10761,7 +10765,7 @@ - (CGContextRef) getContext IOReturn lockStatus = IOSurfaceLock (surface, 0, nil); if (lockStatus != kIOReturnSuccess) - NSLog (@"Failed to lock surface: %x", lockStatus); + NSLog (@"Failed to lock surface: %x", (unsigned int)lockStatus); [self copyContentsTo:surface]; @@ -10808,7 +10812,7 @@ - (void) releaseContext IOReturn lockStatus = IOSurfaceUnlock (currentSurface, 0, nil); if (lockStatus != kIOReturnSuccess) - NSLog (@"Failed to unlock surface: %x", lockStatus); + NSLog (@"Failed to unlock surface: %x", (unsigned int)lockStatus); } @@ -10849,7 +10853,8 @@ - (void) copyContentsTo: (IOSurfaceRef) destination lockStatus = IOSurfaceLock (source, kIOSurfaceLockReadOnly, nil); if (lockStatus != kIOReturnSuccess) - NSLog (@"Failed to lock source surface: %x", lockStatus); + NSLog (@"Failed to lock source surface: %x", + (unsigned int) lockStatus); sourceData = IOSurfaceGetBaseAddress (source); destinationData = IOSurfaceGetBaseAddress (destination); @@ -10861,7 +10866,7 @@ - (void) copyContentsTo: (IOSurfaceRef) destination lockStatus = IOSurfaceUnlock (source, kIOSurfaceLockReadOnly, nil); if (lockStatus != kIOReturnSuccess) - NSLog (@"Failed to unlock source surface: %x", lockStatus); + NSLog (@"Failed to unlock source surface: %x", (unsigned int)lockStatus); } #undef CACHE_MAX_SIZE commit bdc21b246cdb6fe3d977222ab7566cfdf889a38c Author: Visuwesh Date: Thu Dec 26 17:19:41 2024 +0530 Ensure Dired window is selected when reverting buffer * lisp/dired.el (dired--make-directory-clickable): Ensure the Dired window is selected. This prevents erroneously reverting a non-Dired buffer. (Bug#74700) diff --git a/lisp/dired.el b/lisp/dired.el index 9929545eba9..2a020803528 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2088,8 +2088,10 @@ mouse-2: visit this file in other window" `(mouse-face highlight help-echo "mouse-1: re-read this buffer's directory" keymap ,(define-keymap - "" #'revert-buffer - "" 'follow-link + "" (lambda () + (interactive "@") + (revert-buffer)) + "" 'mouse-face "RET" #'revert-buffer)))))))) (defun dired--get-ellipsis-length () commit dc4b8d198bab5363e139853f656ff553dcdeeeb5 Author: Morgan Willcock Date: Wed Dec 25 09:47:42 2024 +0000 Set marker insertion type for Imenu markers * lisp/imenu.el (imenu-default-create-index-function) (imenu--generic-function): Configure Imenu markers to advance their position when characters are inserted at the marker position. (Bug#75072) diff --git a/lisp/imenu.el b/lisp/imenu.el index ba1ba5fcd00..12bc89cb159 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -583,7 +583,9 @@ The alternate method, which is the one most often used, is to call (and (stringp name) ;; [ydi] Updated for imenu-use-markers. (push (cons name - (if imenu-use-markers (point-marker) (point))) + (if imenu-use-markers + (copy-marker (point) t) + (point))) index-alist))) index-alist)) ;; Use generic expression if possible. @@ -688,7 +690,7 @@ depending on PATTERNS." (unless (assoc menu-title index-alist) (push (list menu-title) index-alist)) (if imenu-use-markers - (setq beg (copy-marker beg))) + (setq beg (copy-marker beg t))) (let ((item (if function (nconc (list (match-string-no-properties index) commit 6412a5503c404bbe177879d113c2299288c76ccd Author: Spencer Baugh Date: Tue Dec 10 12:41:49 2024 -0500 Consistently add wildcards for completion-pcm-leading-wildcard completion-pcm--find-all-completions has two different phases: First we turn the minibuffer text into a regex and matches completion alternatives against it. If that finds no matches, then we strip some text off the completions and minibuffer text and call ourselves recursively to find completions, then filter the results with the removed text (converted into a regex). Because of this, completion-pcm-leading-wildcard had inconsistent behavior: in the second phase, the filter created from the removed text would have a leading wildcard. That effectively adds wildcards in the middle of the minibuffer text at the start of each "word". But the first phrase created a regex which had no such wildcards. Thus, the two phases could get substantially different results. We fix this by changing completion-pcm-leading-wildcard to consistently add a leading wildcard for each word. This was always my intention. * lisp/minibuffer.el (completion-pcm--string->pattern): Include a wildcard after each delimter with completion-pcm-leading-wildcard. (bug#74772) * lisp/minibuffer.el (completion-pcm-leading-wildcard): Update docs. * doc/emacs/mini.texi (Completion Styles): Update docs. diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi index 0fcd24ed79d..8e0d58d0f7c 100644 --- a/doc/emacs/mini.texi +++ b/doc/emacs/mini.texi @@ -577,9 +577,9 @@ corresponding position in the completion alternative. @vindex completion-pcm-leading-wildcard If @code{completion-pcm-leading-wildcard} is set to @code{t}, this style -always acts as if a @dfn{wildcard} is present at the start of the -minibuffer text, similar to the @code{substring} style. For example, -@samp{l-m} will complete to @samp{emacs-lisp-mode}. +always acts as if a @dfn{wildcard} is present at the start of each word +in the minibuffer text, similar to the @code{substring} style. For +example, @samp{l-ode} will complete to @samp{emacs-lisp-mode}. @item emacs22 @cindex @code{emacs22}, completion style diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 253c26a84ea..39e7a399404 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3951,17 +3951,18 @@ the commands start with a \"-\" or a SPC." trivial))) (defcustom completion-pcm-leading-wildcard nil - "If non-nil, partial-completion completes as if there's a leading wildcard. + "If non-nil, partial-completion behaves as if each word is preceded by wildcard. -If nil (the default), partial-completion requires a matching completion -alternative to have the same beginning as the first \"word\" in the -minibuffer text, where \"word\" is determined by +If nil (the default), partial-completion requires each word in a +matching completion alternative to have the same beginning as each +\"word\" in the minibuffer text, where \"word\" is determined by `completion-pcm-word-delimiters'. If non-nil, partial-completion allows any string of characters to occur -at the beginning of a completion alternative, as if a wildcard such as -\"*\" was present at the beginning of the minibuffer text. This makes -partial-completion behave more like the substring completion style." +at the beginning of each word in a completion alternative, as if a +wildcard such as \"*\" was present at the beginning of each word. This +makes partial-completion behave more like the substring completion +style." :version "31.1" :type 'boolean) @@ -4008,7 +4009,7 @@ or a symbol, see `completion-pcm--merge-completions'." (setq p0 p) (push (substring string p (match-end 0)) pattern) ;; `any-delim' is used so that "a-b" also finds "array->beginning". - (setq pending 'any-delim) + (setq pending (if completion-pcm-leading-wildcard 'prefix 'any-delim)) (setq p0 (match-end 0)))) (setq p p0)) commit aaacd5806c75019b052a69764ef4d193d243573c Author: Visuwesh Date: Thu Dec 12 18:58:37 2024 +0530 Show the keybinding next to command in calc's x * lisp/calc/calc-ext.el (calc-execute-extended-command): Use M-x's ':affixation-function' to show the keybinding of the calc command next to its name. (Bug#74829) diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index 25d2492b277..0cbd02be657 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -1728,8 +1728,11 @@ calc-kill calc-kill-region calc-yank)))) (interactive "P") (let* ((prompt (concat (calc-num-prefix-name n) "M-x ")) (cmd (intern - (completing-read prompt obarray 'commandp t "calc-" - 'calc-extended-command-history)))) + (let ((completion-extra-properties + (list :affixation-function + #'read-extended-command--affixation))) + (completing-read prompt obarray 'commandp t "calc-" + 'calc-extended-command-history))))) (setq prefix-arg n) (command-execute cmd))) commit b561f896b5e52d3e4571901fd5d545354ba29bac Author: Dmitry Gutov Date: Thu Dec 26 06:17:40 2024 +0200 ruby-ts--s-p-query: Put '_' syntax on ?! method definitions * lisp/progmodes/ruby-ts-mode.el (ruby-ts--s-p-query): Put 'symbol' syntax on method definitions ending with [?!]. Reported in https://github.com/dgutov/robe/issues/149. diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index a6fe39da45f..0ee72df6c9d 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -1052,6 +1052,9 @@ leading double colon is not added." ;; Method calls with name ending with ? or !. ((call method: (identifier) @ident) (:match "[?!]\\'" @ident)) + ;; Method definitions for the above. + ((method name: (identifier) @ident) + (:match "[?!]\\'" @ident)) ;; Backtick method redefinition. ((operator "`" @backtick)) ;; TODO: Stop at interpolations. commit 704aa2b6ebaa0e19f72dcc2e8c0f1a02aa6eadbb Author: Dmitry Gutov Date: Thu Dec 26 02:53:05 2024 +0200 ruby-ts-mode: Refine the forward-sexp improvement * lisp/progmodes/ruby-ts-mode.el (ruby-ts--sexp-list-p): New function (bug#73404). (ruby-ts-mode): Use it in sexp-list thing definition. diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index 4ef0cb18eae..a6fe39da45f 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -1120,6 +1120,12 @@ leading double colon is not added." (equal (treesit-node-type (treesit-node-child node 0)) "("))) +(defun ruby-ts--sexp-list-p (node) + ;; Distinguish between the named `unless' node and the + ;; node with the same value of type. + (when (treesit-node-check node 'named) + (ruby-ts--sexp-p node))) + (defvar-keymap ruby-ts-mode-map :doc "Keymap used in Ruby mode" :parent prog-mode-map @@ -1235,7 +1241,7 @@ leading double colon is not added." "array" "hash") eol) - #'ruby-ts--sexp-p)) + #'ruby-ts--sexp-list-p)) (text ,(lambda (node) (or (member (treesit-node-type node) '("comment" "string_content" "heredoc_content")) commit e96727f0ea0986bffe7ff235e5abc5354e63a64d Author: Eli Zaretskii Date: Wed Dec 25 20:52:45 2024 +0200 ; Fix documentation of recent additions to treesit.el * lisp/treesit.el (treesit-language-display-name-alist) (treesit-language-display-name): Doc fixes. * etc/NEWS: Fix wording of entry announcing the above. diff --git a/etc/NEWS b/etc/NEWS index ca107bb4938..8adead78a32 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -994,10 +994,10 @@ it uses `forward-sexp-default-function'. +++ *** New function 'treesit-language-display-name'. -New function that returns the display name given the language symbol. -For example, 'cpp' is translated to "C++". Also adds a new variable -'treesit-language-display-name-alist' that the function uses to -translate display names. +This new function returns the display name of a language given the +language symbol. For example, 'cpp' is translated to "C++". A new +variable 'treesit-language-display-name-alist' holds the translations of +language symbols where that translation is not trivial. +++ *** New command 'treesit-explore' diff --git a/lisp/treesit.el b/lisp/treesit.el index 2616d16e800..eb3e26fff7e 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -851,17 +851,18 @@ omitted, default END to BEG." ) "An alist mapping language symbols to their display names. -Used by `treesit-language-display-name'. If there's no mapping in this -alist, `treesit-language-display-name' converts the symbol to display -name by capitalizing the first letter. So languages like Java, -Javascript, Rust don't need an entry in this variable.") +Used by `treesit-language-display-name'. If there's no mapping for a +lamguage in this alist, `treesit-language-display-name' converts the +symbol to the display name by capitalizing the first letter of the +symbol's name. Thus, languages like Java, Javascript, Rust don't need +an entry in this variable.") (defun treesit-language-display-name (language) - "Returns the display name (a string) of LANGUAGE. + "Return the display name (a string) of LANGUAGE (a symbol). If LANGUAGE has an entry in `treesit-language-display-name-alist', use -the display name in their. Otherwise, capitalize the first letter of -LANGUAGE and return the string." +the display name from there. Otherwise, capitalize the first letter of +LANGUAGE's name and return the resulting string." (or (alist-get language treesit-language-display-name-alist) (capitalize (symbol-name language)))) commit d70ef80868996b9119f032cd13911c600436e29f Author: Eli Zaretskii Date: Wed Dec 25 20:46:14 2024 +0200 ; * doc/lispref/modes.texi (Imenu): Fix wording and markup. diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index f227bdc635f..6ecee0b2ee7 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -3112,10 +3112,11 @@ automatically sets up Imenu if this variable is non-@code{nil}. @defvar treesit-aggregated-simple-imenu-settings This variable allows major modes to configure Imenu for multiple languages. Its value is an alist mapping language symbols to Imenu -settings described in @var{treesit-simple-imenu-settings}. +settings of the form described above for the value of +@code{treesit-simple-imenu-settings}. -If both this variable and @var{treesit-simple-imenu-settings} is -non-@code{nil}, Emacs uses this variable for setting up Imenu. +If this variable is non-@code{nil}, it overrides +@code{treesit-simple-imenu-settings} for setting up Imenu. @end defvar @node Outline Minor Mode commit c09e056c43e344c5adda08ef819252824cff0ef0 Author: Juri Linkov Date: Wed Dec 25 19:52:10 2024 +0200 * lisp/treesit.el: Improvements for treesit-explore-mode (bug#75079) (treesit-explorer-switch-parser): Don't use completing-read on the single parser. (treesit-explore-mode): Don't save treesit-explore-mode to the desktop. diff --git a/lisp/treesit.el b/lisp/treesit.el index 464b7e688be..2616d16e800 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -3911,8 +3911,10 @@ covers point. PARSER-NAME are unique." (interactive (list (let* ((parser-alist (treesit--explorer-generate-parser-alist)) - (parser-name (completing-read - "Parser: " (mapcar #'car parser-alist)))) + (parser-name (if (= (length parser-alist) 1) + (car parser-alist) + (completing-read + "Parser: " (mapcar #'car parser-alist))))) (alist-get parser-name parser-alist nil nil #'equal)))) (unless treesit-explore-mode @@ -3952,7 +3954,15 @@ window." (unless (memq 'treesit--explorer-tree-mode desktop-modes-not-to-save) (push 'treesit--explorer-tree-mode - desktop-modes-not-to-save)))) + desktop-modes-not-to-save))) + ;; Tell `desktop-save' to not save this minor mode + ;; that might disrupt loading the desktop + ;; with the prompt to select a parser. + (when (boundp 'desktop-minor-mode-table) + (unless (member '(treesit-explore-mode nil) + desktop-minor-mode-table) + (push '(treesit-explore-mode nil) + desktop-minor-mode-table)))) ;; Turn off explore mode. (remove-hook 'post-command-hook #'treesit--explorer-post-command t) commit 1e40be0ab830852ff5e2330c50f8b047d9ebe338 Author: Stefan Kangas Date: Wed Dec 25 04:35:50 2024 +0100 Improve dictionary-switch-tooltip-mode docstring * lisp/net/dictionary.el (dictionary-switch-tooltip-mode): Fix docstring and argument name. diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index 543a98f8de3..7add1db3099 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -1453,16 +1453,15 @@ via `dictionary-dictionaries'." (setq dictionary-tooltip-mouse-event (copy-sequence event)) (tooltip-start-delayed-tip))) -(defun dictionary-switch-tooltip-mode (on) - "Turn dictionary tooltip mode off or ON. - -It is normally internally called with 1 to enable support for the -tooltip mode. The hook function will check the value of the -variable `dictionary-tooltip-mode' to decide if some action must be -taken. When disabling the tooltip mode the value of this variable -will be set to nil." - (tooltip-mode on) - (if on +(defun dictionary-switch-tooltip-mode (state) + "Turn dictionary tooltip mode on or off depending on STATE. + +It is normally called internally with a non-nil value to enable the +tooltip mode. The hook function uses the value of the variable +`dictionary-tooltip-mode' to decide if some action must be taken. +When disabling the tooltip mode, that variable will be set to nil." + (tooltip-mode state) + (if state (add-hook 'tooltip-functions #'dictionary-display-tooltip) (remove-hook 'tooltip-functions #'dictionary-display-tooltip))) commit 7cda5e7f0272d766bd2090a274faeb7776303f46 Author: Nicholas Vollmer Date: Tue Jan 23 09:39:02 2024 -0500 Fix checkdoc warnings in dictionary.el * lisp/net/dictionary.el (dictionary-tool-bar-map): Add missing period. (dictionary-process-popup-replies) (dictionary-read-definition) (dictionary-display-tooltip): Rename ignored parameters. (dictionary-tooltip-track-mouse): Describe what function does, not just when. (dictionary-switch-tooltip-mode): Reword docstring in terms of ON parameter. (Bug#68684) diff --git a/lisp/net/dictionary.el b/lisp/net/dictionary.el index 8c7d87f56a5..543a98f8de3 100644 --- a/lisp/net/dictionary.el +++ b/lisp/net/dictionary.el @@ -1340,7 +1340,7 @@ prompt for DICTIONARY." dictionary-default-popup-strategy 'dictionary-process-popup-replies)) -(defun dictionary-process-popup-replies (&ignore) +(defun dictionary-process-popup-replies (_) (let ((list (dictionary-simple-split-string (dictionary-read-answer) "\n+"))) (let ((result (mapcar (lambda (item) @@ -1395,7 +1395,7 @@ via `dictionary-dictionaries'." (dictionary-do-search word dictionary 'dictionary-read-definition t)) nil)) -(defun dictionary-read-definition (&ignore) +(defun dictionary-read-definition (_) (let ((list (dictionary-simple-split-string (dictionary-read-answer) "\n+"))) (mapconcat #'identity (cdr list) "\n"))) @@ -1422,7 +1422,7 @@ via `dictionary-dictionaries'." (defvar dictionary-tooltip-mouse-event nil "Event that triggered the tooltip mode.") -(defun dictionary-display-tooltip (&ignore) +(defun dictionary-display-tooltip (_) "Search the current word in the `dictionary-tooltip-dictionary'." (interactive "e") (if (and dictionary-tooltip-mode dictionary-tooltip-dictionary) @@ -1446,7 +1446,7 @@ via `dictionary-dictionaries'." nil))) (defun dictionary-tooltip-track-mouse (event) - "Called whenever a dictionary tooltip display is about to be triggered." + "Hide current tooltip and setup next tooltip in response to mouse movement EVENT." (interactive "e") (tooltip-hide) (when dictionary-tooltip-mode @@ -1454,7 +1454,7 @@ via `dictionary-dictionaries'." (tooltip-start-delayed-tip))) (defun dictionary-switch-tooltip-mode (on) - "Turn off or on support for the dictionary tooltip mode. + "Turn dictionary tooltip mode off or ON. It is normally internally called with 1 to enable support for the tooltip mode. The hook function will check the value of the commit 8c7db480ead8ef623a382fcd990dd91486616dca Author: Yuan Fu Date: Tue Dec 24 13:52:03 2024 -0800 ; * etc/NEWS: Update tree-sitter NEWS. diff --git a/etc/NEWS b/etc/NEWS index 9754322b1bf..ca107bb4938 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -999,6 +999,22 @@ For example, 'cpp' is translated to "C++". Also adds a new variable 'treesit-language-display-name-alist' that the function uses to translate display names. ++++ +*** New command 'treesit-explore' +This command replaces 'treesit-explore-mode'. It turns on +'treesit-explore-mode' if it’s not on, and pops up the explorer buffer +if it’s already on. + ++++ +*** 'treesit-explore-mode' now supports local parsers +Now 'treesit-explore-mode' (or 'treesit-explore') prompts for a parser +rather than a language, and it’s now possible to select a local parser +at point to explore. + ++++ +*** New variable 'treesit-aggregated-simple-imenu-settings' +This variable allows major modes to setup Imenu for multiple languages. + +++ ** New optional BUFFER argument for 'string-pixel-width'. If supplied, 'string-pixel-width' will use any face remappings from commit e2a9af431191d5c71e2ca7a4347ce9e435e8cca0 Author: Yuan Fu Date: Tue Dec 24 13:17:51 2024 -0800 Add treesit-aggregated-simple-imenu-settings Now we support setting up Imenu for multiple languages * doc/lispref/modes.texi: Update manual. * lisp/treesit.el: (treesit-aggregated-simple-imenu-settings): New variable. (treesit--imenu-merge-entries): New function. (treesit--generate-simple-imenu): This was previously treesit-simple-imenu. (treesit-simple-imenu): Support treesit-aggregated-simple-imenu-settings. (treesit-major-mode-setup): Recognize treesit-aggregated-simple-imenu-settings. * test/src/treesit-tests.el (treesit-imenu): New test. diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 73edb688c85..f227bdc635f 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -3109,6 +3109,15 @@ instead. automatically sets up Imenu if this variable is non-@code{nil}. @end defvar +@defvar treesit-aggregated-simple-imenu-settings +This variable allows major modes to configure Imenu for multiple +languages. Its value is an alist mapping language symbols to Imenu +settings described in @var{treesit-simple-imenu-settings}. + +If both this variable and @var{treesit-simple-imenu-settings} is +non-@code{nil}, Emacs uses this variable for setting up Imenu. +@end defvar + @node Outline Minor Mode @section Outline Minor Mode diff --git a/lisp/treesit.el b/lisp/treesit.el index 2cf7bccdeed..464b7e688be 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -3123,6 +3123,31 @@ node and returns the name of that defun node. If NAME-FN is nil, `treesit-major-mode-setup' automatically sets up Imenu if this variable is non-nil.") +;; `treesit-simple-imenu-settings' doesn't support multiple languages, +;; and we need to add multi-lang support for Imenu. One option is to +;; extend treesit-simple-imenu-settings to specify language, either by +;; making it optionally an alist (just like +;; `treesit-aggregated-simple-imenu-settings'), or add a fifth element +;; to each setting. But either way makes borrowing Imenu settings from +;; other modes difficult: with the alist approach, you'd need to check +;; whether other mode uses a plain list or an alist; with the fifth +;; element approach, again, you need to check if each setting has the +;; fifth element, and add it if not. +;; +;; OTOH, with `treesit-aggregated-simple-imenu-settings', borrowing +;; Imenu settings is easy: if `treesit-aggregated-simple-imenu-settings' +;; is non-nil, copy everything over; if `treesit-simple-imenu-settings' +;; is non-nil, copy the settings and put them under a language symbol. +(defvar treesit-aggregated-simple-imenu-settings nil + "Settings that configure `treesit-simple-imenu' for multi-language modes. + +The value should be an alist of (LANG . SETTINGS), where LANG is a +language symbol, and SETTINGS has the same form as +`treesit-simple-imenu-settings'. + +When both this variable and `treesit-simple-imenu-settings' are non-nil, +this variable takes priority.") + (defun treesit--simple-imenu-1 (node pred name-fn) "Given a sparse tree, create an Imenu index. @@ -3170,20 +3195,69 @@ ENTRY. MARKER marks the start of each tree-sitter node." ;; Leaf node, return a (list of) plain index entry. (t (list (cons name marker)))))) +(defun treesit--imenu-merge-entries (entries) + "Merge ENTRIES by category. + +ENTRIES is a list of (CATEGORY . SUB-ENTRIES...). Merge them so there's +no duplicate CATEGORY. CATEGORY's are strings. The merge is stable, +meaning the order of elements are kept." + (let ((return-entries nil)) + (dolist (entry entries) + (let* ((category (car entry)) + (sub-entries (cdr entry)) + (existing-entries + (alist-get category return-entries nil nil #'equal))) + (if (not existing-entries) + (push entry return-entries) + (setf (alist-get category return-entries nil nil #'equal) + (append existing-entries sub-entries))))) + (nreverse return-entries))) + +(defun treesit--generate-simple-imenu (node settings) + "Return an Imenu index for NODE with SETTINGS. + +NODE usually should be a root node of a parser. SETTINGS is described +by `treesit-simple-imenu-settings'." + (mapcan (lambda (setting) + (pcase-let ((`(,category ,regexp ,pred ,name-fn) + setting)) + (when-let* ((tree (treesit-induce-sparse-tree + node regexp)) + (index (treesit--simple-imenu-1 + tree pred name-fn))) + (if category + (list (cons category index)) + index)))) + settings)) + (defun treesit-simple-imenu () "Return an Imenu index for the current buffer." - (let ((root (treesit-buffer-root-node))) - (mapcan (lambda (setting) - (pcase-let ((`(,category ,regexp ,pred ,name-fn) - setting)) - (when-let* ((tree (treesit-induce-sparse-tree - root regexp)) - (index (treesit--simple-imenu-1 - tree pred name-fn))) - (if category - (list (cons category index)) - index)))) - treesit-simple-imenu-settings))) + (if (not treesit-aggregated-simple-imenu-settings) + (treesit--generate-simple-imenu + (treesit-parser-root-node treesit-primary-parser) + treesit-simple-imenu-settings) + ;; Use `treesit-aggregated-simple-imenu-settings'. Remove languages + ;; that doesn't have any Imenu entries. + (seq-filter + #'cdr + (mapcar + (lambda (entry) + (let* ((lang (car entry)) + (settings (cdr entry)) + (global-parser (car (treesit-parser-list nil lang))) + (local-parsers + (treesit-parser-list nil lang 'embedded))) + (cons (treesit-language-display-name lang) + ;; No one says you can't have both global and local + ;; parsers for the same language. E.g., Rust uses + ;; local parsers for the same language to handle + ;; macros. + (treesit--imenu-merge-entries + (mapcan (lambda (parser) + (treesit--generate-simple-imenu + (treesit-parser-root-node parser) settings)) + (cons global-parser local-parsers)))))) + treesit-aggregated-simple-imenu-settings)))) ;;; Outline minor mode @@ -3321,7 +3395,8 @@ and `end-of-defun-function'. If `treesit-defun-name-function' is non-nil, set up `add-log-current-defun'. -If `treesit-simple-imenu-settings' is non-nil, set up Imenu. +If `treesit-simple-imenu-settings' or +`treesit-aggregated-simple-imenu-settings' is non-nil, set up Imenu. If either `treesit-outline-predicate' or `treesit-simple-imenu-settings' are non-nil, and Outline minor mode settings don't already exist, setup @@ -3395,7 +3470,8 @@ before calling this function." (setq-local forward-sentence-function #'treesit-forward-sentence)) ;; Imenu. - (when treesit-simple-imenu-settings + (when (or treesit-aggregated-simple-imenu-settings + treesit-simple-imenu-settings) (setq-local imenu-create-index-function #'treesit-simple-imenu)) diff --git a/test/src/treesit-tests.el b/test/src/treesit-tests.el index 50f205421d7..43102fc97e0 100644 --- a/test/src/treesit-tests.el +++ b/test/src/treesit-tests.el @@ -1270,6 +1270,20 @@ This tests bug#60355." (should node) (should (equal (treesit-node-text node) "2")))) +;;; Imenu + +(ert-deftest treesit-imenu () + "Test imenu functions." + (should (equal (treesit--imenu-merge-entries + '(("Function" . (f1 f2)) + ("Function" . (f3 f4 f5)) + ("Class" . (c1 c2 c3)) + ("Variables" . (v1 v2)) + ("Class" . (c4)))) + '(("Function" . (f1 f2 f3 f4 f5)) + ("Class" . (c1 c2 c3 c4)) + ("Variables" . (v1 v2)))))) + ;; TODO ;; - Functions in treesit.el commit 833494d4b00a837be8ceaa09b37f54ce17d0a062 Author: Yuan Fu Date: Mon Dec 23 21:20:18 2024 -0800 ; Add some shortdoc examples for treesit entry * lisp/treesit.el: Add some shortdoc examples. diff --git a/lisp/treesit.el b/lisp/treesit.el index be264b4292a..2cf7bccdeed 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -4376,6 +4376,22 @@ generated by \"git describe\". It only works when :eval (treesit-pattern-expand '(identifier)) :eval (treesit-pattern-expand :equal)) + "Tree-sitter things and navigation" + (treesit-thing-defined-p + :no-eval (treesit-thing-defined-p 'sexp) + :eg-result nil) + (treesit-thing-definition + :no-eval (treesit-thing-defined 'sexp) + :eg-result (not ,(rx (or "{" "}" "[" "]" "(" ")" ",")))) + (treesit-thing-at + :no-eval (treesit-thing-at 3943) + :eg-result-string "#") + (treesit-thing-next + :no-eval (treesit-thing-next 3943 'sexp)) + (treesit-navigate-thing + :no-eval (treesit-navigate-thing 3943 1 'beg 'sexp)) + (treesit-beginning-of-thing + :no-eval (treesit-beginning-of-thing 'defun 1 'nested)) "Parsing a string" (treesit-parse-string @@ -4388,7 +4404,15 @@ generated by \"git describe\". It only works when "Misc" (treesit-subtree-stat :no-eval (treesit-subtree-stat node) - :eg-result (6 33 487))) + :eg-result (6 33 487)) + (treesit-language-abi-version + :no-eval (treesit-language-abi-version 'c) + :eg-result 14) + (treesit-grammar-location + :no-eval (treesit-language-abi-version 'c)) + (treesit-language-display-name + :no-eval (treesit-language-display-name 'cpp) + :eg-result "C++")) (provide 'treesit) commit 251b4c8c39535fee9f6da89420483304274ac03e Author: Yuan Fu Date: Mon Dec 23 21:19:32 2024 -0800 Add treesit-language-display-name * lisp/treesit.el: (treesit-language-display-name-alist): New variable. (treesit-language-display-name): New function. * doc/lispref/parsing.texi (Language Grammar): Add to manual. * etc/NEWS: Add to NEWS. diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index 7f21c3864fc..fc56c20304b 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -160,6 +160,22 @@ grammar library loaded by Emacs for @var{language}. If @var{language} is unavailable, this function returns @code{nil}. @end defun +@vindex treesit-language-display-name-alist +@defun treesit-language-display-name language +This function translates @var{language} to an appropriate display name. +For example, it translates @code{ruby} to ``Ruby'', @code{cpp} to +``C++''. + +Most languages has ``regular'' names, and their display name is simply +the symbol name with first letter capitalized. For languages that has +``irregular'' names, @var{treesit-language-display-name-alist} maps +language symbols to their display names. + +If a major mode package uses a langauge with ``irregular'' name, they +should add a mapping into @var{treesit-language-display-name-alist} on +load. +@end defun + @heading Concrete syntax tree @cindex syntax tree, concrete diff --git a/etc/NEWS b/etc/NEWS index 847cc39ce96..9754322b1bf 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -992,6 +992,13 @@ The new function 'treesit-forward-sexp-list' uses 'sexp-list' to move across lists. But to move across atoms inside the list it uses `forward-sexp-default-function'. ++++ +*** New function 'treesit-language-display-name'. +New function that returns the display name given the language symbol. +For example, 'cpp' is translated to "C++". Also adds a new variable +'treesit-language-display-name-alist' that the function uses to +translate display names. + +++ ** New optional BUFFER argument for 'string-pixel-width'. If supplied, 'string-pixel-width' will use any face remappings from diff --git a/lisp/treesit.el b/lisp/treesit.el index e37ea85ebbe..be264b4292a 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -835,6 +835,36 @@ omitted, default END to BEG." return rng finally return nil)))) +;;; Language display name + +;; The entries are sorted by `sort-lines'. +(defvar treesit-language-display-name-alist + '( + (charp . "C#") + (cmake . "CMake") + (cpp . "C++") + (gomod . "Go Mod") + (heex . "HEEx") + (json . "JSON") + (php . "PHP") + (tsx . "TSX") + ) + "An alist mapping language symbols to their display names. + +Used by `treesit-language-display-name'. If there's no mapping in this +alist, `treesit-language-display-name' converts the symbol to display +name by capitalizing the first letter. So languages like Java, +Javascript, Rust don't need an entry in this variable.") + +(defun treesit-language-display-name (language) + "Returns the display name (a string) of LANGUAGE. + +If LANGUAGE has an entry in `treesit-language-display-name-alist', use +the display name in their. Otherwise, capitalize the first letter of +LANGUAGE and return the string." + (or (alist-get language treesit-language-display-name-alist) + (capitalize (symbol-name language)))) + ;;; Fontification (define-error 'treesit-font-lock-error commit 563e5868f6dbab59937ad247b45b488f5523ad3c Author: Juri Linkov Date: Tue Dec 24 19:39:30 2024 +0200 Add treesit thing 'sexp-list' to c++-ts-mode (bug#73404) * lisp/progmodes/c-ts-mode.el (c-ts-mode--thing-settings): Add C++ 'sexp-list' nodes for 'treesit-thing-settings'. diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 90e73260b9b..5537439004e 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -1170,7 +1170,18 @@ if `c-ts-mode-emacs-sources-support' is non-nil." "initializer_list" "subscript_designator" "subscript_range_designator" - "string_literal") + "string_literal" + "system_lib_string" + ;; C++ + "template_parameter_list" + "structured_binding_declarator" + "template_argument_list" + "condition_clause" + "subscript_argument_list" + "requirement_seq" + "requires_parameter_list" + "lambda_capture_specifier" + "fold_expression") 'symbols)) ;; compound_statement makes us jump over too big units ;; of code, so skip that one, and include the other commit b061c01607aa43b8ffa1b5c4a90c3602497cf823 Author: Juri Linkov Date: Tue Dec 24 19:24:11 2024 +0200 Add treesit thing 'sexp-list' to tsx-ts-mode (bug#73404, bug#73978) * lisp/progmodes/typescript-ts-mode.el (tsx-ts-mode): Add 'sexp-list' to 'treesit-thing-settings' with "jsx" things. (typescript-ts-mode--sexp-list-nodes): Remove "jsx" things. diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 5c3c9a24ff4..df41c179e30 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -470,8 +470,6 @@ See `treesit-thing-settings' for more information.") "object_pattern" "array" "array_pattern" - "jsx_expression" - "_jsx_string" "string" "regex" "arguments" @@ -599,8 +597,15 @@ at least 3 (which is the default value)." `((tsx (sexp ,(regexp-opt (append typescript-ts-mode--sexp-nodes - '("jsx")) - 'symbols)) + '("jsx")))) + (sexp-list ,(concat "^" + (regexp-opt + (append typescript-ts-mode--sexp-list-nodes + '( + "jsx_element" + "jsx_self_closing_element" + "jsx_expression"))) + "$")) (sentence ,(regexp-opt (append typescript-ts-mode--sentence-nodes '("jsx_element" commit f0afebb99158be3db1d9623758321622a1026c8d Author: Juri Linkov Date: Tue Dec 24 09:40:21 2024 +0200 * lisp/progmodes/typescript-ts-mode.el: Fix regexp-opt of treesit-thing. (typescript-ts-base-mode): Add arg 'symbols' to regexp-opt of 'sexp', 'sexp-list', 'sentence', 'text' (bug#73404, bug#74366, bug#74963). (tsx-ts-mode): Add arg 'symbols' to regexp-opt of 'sexp', 'sentence'. This avoids such mismatches as "string_fragment" by "string". diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 08c8a71c18e..5c3c9a24ff4 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -514,12 +514,14 @@ This mode is intended to be inherited by concrete major modes." (setq-local treesit-thing-settings `((typescript - (sexp ,(regexp-opt typescript-ts-mode--sexp-nodes)) - (sexp-list ,(regexp-opt typescript-ts-mode--sexp-list-nodes)) + (sexp ,(regexp-opt typescript-ts-mode--sexp-nodes 'symbols)) + (sexp-list ,(regexp-opt typescript-ts-mode--sexp-list-nodes + 'symbols)) (sentence ,(regexp-opt - typescript-ts-mode--sentence-nodes)) + typescript-ts-mode--sentence-nodes 'symbols)) (text ,(regexp-opt '("comment" - "template_string")))))) + "template_string") + 'symbols))))) ;; Imenu (same as in `js-ts-mode'). (setq-local treesit-simple-imenu-settings @@ -597,11 +599,13 @@ at least 3 (which is the default value)." `((tsx (sexp ,(regexp-opt (append typescript-ts-mode--sexp-nodes - '("jsx")))) + '("jsx")) + 'symbols)) (sentence ,(regexp-opt (append typescript-ts-mode--sentence-nodes '("jsx_element" - "jsx_self_closing_element"))))))) + "jsx_self_closing_element")) + 'symbols))))) ;; Font-lock. (setq-local treesit-font-lock-settings commit 7ac7ebef6cde9942905c45126cc6ef2bab01dc10 Author: Yuan Fu Date: Mon Dec 23 18:51:51 2024 -0800 ; Update c-ts-mode and c++-ts-mode's verified revision * lisp/progmodes/c-ts-mode.el: Update revision. diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 67ccbb8594b..90e73260b9b 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -25,10 +25,10 @@ ;;; Tree-sitter language versions ;; ;; c-ts-mode is known to work with the following languages and version: -;; - tree-sitter-c: v0.20.8-61-g3efee11 +;; - tree-sitter-c: v0.23.4 ;; ;; c++-ts-mode is known to work with the following languages and version: -;; - tree-sitter-cpp: v0.20.5-49-gf41b4f6 +;; - tree-sitter-cpp: v0.23.4-1-gf41b4f6 ;; ;; We try our best to make builtin modes work with latest grammar ;; versions, so a more recent grammar version has a good chance to work. commit 32ad7342893833058ca2f7f8eca667bd32d42ea0 Author: Yuan Fu Date: Mon Dec 23 18:50:08 2024 -0800 Include lightweight tags in treesit-admin--verify-major-mode-queries * lisp/treesit.el (treesit--language-git-revision): Include lightweight tags as well. diff --git a/lisp/treesit.el b/lisp/treesit.el index 69b800cb271..e37ea85ebbe 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -4013,7 +4013,7 @@ Return the output of \"git describe\". If anything goes wrong, return nil." (with-temp-buffer (cond - ((eq 0 (call-process "git" nil t nil "describe")) + ((eq 0 (call-process "git" nil t nil "describe" "--tags")) (string-trim (buffer-string))) ((eq 0 (progn (erase-buffer) (call-process "git" nil t nil "rev-parse" "HEAD"))) commit 4def541bbfe67b1a492e8a3b6041a1d8f76d680b Author: Yuan Fu Date: Mon Dec 23 18:43:11 2024 -0800 Fix cmake-ts-mode font-lock queries This commit in tree-sitter-cmake removed angle brackets: https://github.com/uyha/tree-sitter-cmake/commit/a414a4c83d54388f596269639c175a5b84bfa929 * lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode--font-lock-settings): Remove angle brackets. diff --git a/lisp/progmodes/cmake-ts-mode.el b/lisp/progmodes/cmake-ts-mode.el index 3ec239e89bb..1871ea39a47 100644 --- a/lisp/progmodes/cmake-ts-mode.el +++ b/lisp/progmodes/cmake-ts-mode.el @@ -22,6 +22,15 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see . +;;; Tree-sitter language versions +;; +;; cmake-ts-mode is known to work with the following languages and version: +;; - tree-sitter-cmake: e409ae33f00e04cde30f2bcffb979caf1a33562a +;; +;; We try our best to make builtin modes work with latest grammar +;; versions, so a more recent grammar version has a good chance to work. +;; Send us a bug report if it doesn't. + ;;; Commentary: ;; @@ -175,7 +184,7 @@ Check if a node type is available, then return the right font lock rules." :feature 'misc-punctuation ;; Don't override strings. :override 'nil - '((["$" "{" "}" "<" ">"]) @font-lock-misc-punctuation-face) + '((["$" "{" "}"]) @font-lock-misc-punctuation-face) :language 'cmake :feature 'variable commit 93755ea1a6113e115ac3349b67e58e2f3fd03894 Author: Yuan Fu Date: Mon Dec 23 17:12:39 2024 -0800 Create a blobless clone in treesit-admin--verify-major-mode-queries * admin/treesit-admin.el (treesit-admin--verify-major-mode-queries): Create a blobless clone. * lisp/treesit.el (treesit--install-language-grammar-blobless): New variable. (treesit--git-clone-repo): Support blobless clone. diff --git a/admin/treesit-admin.el b/admin/treesit-admin.el index 3c0798a29f2..440056aff21 100644 --- a/admin/treesit-admin.el +++ b/admin/treesit-admin.el @@ -96,6 +96,7 @@ queries that has problems with latest grammar." (let ((treesit-extra-load-path (list grammar-dir)) (treesit-language-source-alist treesit-admin--builtin-language-sources) (treesit--install-language-grammar-full-clone t) + (treesit--install-language-grammar-blobless t) (version-alist nil) (invalid-feature-list nil) (valid-modes nil) diff --git a/lisp/treesit.el b/lisp/treesit.el index 7b7f4842505..69b800cb271 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -3925,6 +3925,9 @@ See `treesit-language-source-alist' for details." (defvar treesit--install-language-grammar-full-clone nil "If non-nil, do a full clone when cloning git repos.") +(defvar treesit--install-language-grammar-blobless nil + "If non-nil, create a blobless clone when cloning git repos.") + ;;;###autoload (defun treesit-install-language-grammar (lang &optional out-dir) "Build and install the tree-sitter language grammar library for LANG. @@ -4048,6 +4051,8 @@ Use shallow clone by default. Do a full clone when (let ((args (list "git" nil t nil "clone" url "--quiet"))) (when (not treesit--install-language-grammar-full-clone) (setq args (append args (list "--depth" "1")))) + (when treesit--install-language-grammar-blobless + (setq args (append args (list "--filter=blob:none")))) (when revision (setq args (append args (list "-b" revision)))) (setq args (append args (list workdir))) commit 8d7cba7bbf8fe83bbf9a9d8cae963983f3bca8cf Author: Yuan Fu Date: Fri Dec 20 22:46:31 2024 -0800 ; Minor comment improvement in c-ts-common--adaptive-fill-prefix * lisp/progmodes/c-ts-common.el (c-ts-common--adaptive-fill-prefix): Improve comment. diff --git a/lisp/progmodes/c-ts-common.el b/lisp/progmodes/c-ts-common.el index 137ff37a661..25b386cbaa7 100644 --- a/lisp/progmodes/c-ts-common.el +++ b/lisp/progmodes/c-ts-common.el @@ -249,9 +249,12 @@ This function should be called at BOL. Used by ;; (3) ;; Current line: *, |, - ;; Prefix: same. - ;; This branch must return the same prefix as branch (1), as the - ;; second line in the paragraph; then the whole paragraph will use * - ;; as the prefix. + ;; Adaptive fill looks at the first and second line of a paragraph, + ;; only when both lines return the same prefix does it use that + ;; prefix for the following lines. If the first lines matches branch + ;; (1) and returns * as prefix, and the second line matches this + ;; branch (3), and returns * as prefix, then the whole paragraph will + ;; use * as prefix. ((looking-at (rx (* (syntax whitespace)) (or "*" "|" "-") (* (syntax whitespace)))) commit 6ac38396898e6324d4c6dddb2ad05d1ad0dc5e7c Author: Stefan Kangas Date: Tue Dec 24 00:04:51 2024 +0100 ; * .mailmap: Fix UTF-8 issue. diff --git a/.mailmap b/.mailmap index bbfe4bceba1..56876a30fbe 100644 --- a/.mailmap +++ b/.mailmap @@ -27,6 +27,7 @@ Andrew G Cohen Arash Esbati Arash Esbati Arni Magnusson +Arsen Arsenović Artur Malabarba Artur Malabarba Artur Malabarba Basil L. Contovounesios commit 28c420afab6a0944a192c30ff2d5d9e40c88f14f Author: Paul Eggert Date: Mon Dec 23 13:38:51 2024 -0800 Avoid U+FFFD in commit messages * build-aux/git-hooks/commit-msg: Also check against U+FFFD REPLACEMENT CHARACTER in commit messages. diff --git a/build-aux/git-hooks/commit-msg b/build-aux/git-hooks/commit-msg index 1eb2560bba2..dace4c7fb66 100755 --- a/build-aux/git-hooks/commit-msg +++ b/build-aux/git-hooks/commit-msg @@ -31,6 +31,8 @@ fi # Use U+00A2 CENT SIGN to test whether the locale works. cent_sign_utf8_format='\302\242\n' cent_sign=`printf "$cent_sign_utf8_format"` +replacement_character_utf8_format='\357\277\275\n' +replacement_character=`printf "$replacement_character_utf8_format"` print_at_sign='BEGIN {print substr("'$cent_sign'@", 2)}' at_sign=`$awk "$print_at_sign" /dev/null` if test "$at_sign" != @; then @@ -44,7 +46,12 @@ if test "$at_sign" != @; then fi # Check the log entry. -exec $awk -v at_sign="$at_sign" -v cent_sign="$cent_sign" -v file="$1" ' +exec $awk \ + -v at_sign="$at_sign" \ + -v cent_sign="$cent_sign" \ + -v file="$1" \ + -v replacement_character="$replacement_character" \ +' BEGIN { # These regular expressions assume traditional Unix unibyte behavior. # They are needed for old or broken versions of awk, e.g., @@ -137,6 +144,10 @@ exec $awk -v at_sign="$at_sign" -v cent_sign="$cent_sign" -v file="$1" ' print "Unprintable character in commit message" status = 1 } + $0 ~ replacement_character { + print "Replacement character in commit message" + status = 1 + } END { if (nlines == 0) { commit b1de495eeae9afc8abccd908e5c53c463afdb7dc Author: Michael Albinus Date: Mon Dec 23 12:46:23 2024 +0100 * configure.ac (dbus): Default to ifavailable. (Bug#75004) diff --git a/configure.ac b/configure.ac index 1c7545ef984..18cbb42b0ef 100644 --- a/configure.ac +++ b/configure.ac @@ -578,7 +578,7 @@ OPTION_DEFAULT_OFF([w32], [use native MS Windows GUI in a Cygwin build]) OPTION_DEFAULT_OFF([pgtk], [use GTK to support window systems other than X]) OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console]) -OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support]) +OPTION_DEFAULT_IFAVAILABLE([dbus],[compile with D-Bus support]) AC_ARG_WITH([gconf],[AS_HELP_STRING([--with-gconf], [compile with Gconf support (Gsettings replaces this)])],[], [if test $with_features = yes; then @@ -3969,8 +3969,8 @@ dnl D-Bus has been tested under GNU/Linux only. Must be adapted for dnl other platforms. HAVE_DBUS=no DBUS_OBJ= -if test "${with_dbus}" = "yes"; then - EMACS_CHECK_MODULES([DBUS], [dbus-1 >= 1.0]) +if test "${with_dbus}" != "no" ; then + EMACS_CHECK_MODULES([DBUS], [dbus-1 >= 1.0], [HAVE_DBUS=yes], [HAVE_DBUS=no]) if test "$HAVE_DBUS" = yes; then AC_DEFINE([HAVE_DBUS], [1], [Define to 1 if using D-Bus.]) dnl dbus_watch_get_unix_fd has been introduced in D-Bus 1.1.1. @@ -5564,6 +5564,11 @@ if test "${HAVE_X11}" = "yes"; then WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-tiff=ifavailable";; esac fi +case $with_dbus,$HAVE_DBUS in + no,* | ifavailable,* | *,yes) ;; + *) MISSING="$MISSING dbus-1" + WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-dbus=ifavailable";; +esac case $with_gnutls,$HAVE_GNUTLS in no,* | ifavailable,* | *,yes) ;; *) MISSING="$MISSING gnutls" commit 6017c6a986fd958732facb1bb6ea2c040981b023 Author: Martin Rudalics Date: Mon Dec 23 10:59:11 2024 +0100 Make 'fit-frame-to-buffer' work around size hints (Bug#74866) * lisp/window.el (fit-frame-to-buffer-1): When 'frame-resize-pixelwise' is nil, round up requested sizes to avoid that lines get wrapped (Bug#74866). * doc/lispref/windows.texi (Resizing Windows): Mention that with size hints one may have to set 'frame-resize-pixelwise' to make 'fit-frame-to-buffer' fit the buffer exactly. diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index adc294e4c99..3ff78b599de 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -1166,7 +1166,9 @@ frame to its buffer using the command @code{fit-frame-to-buffer}. This command adjusts the size of @var{frame} to display the contents of its buffer exactly. @var{frame} can be any live frame and defaults to the selected one. Fitting is done only if @var{frame}'s root window is -live. +a live window. On window systems that use size hints, exact fitting can +be often achieved if and only if @code{frame-resize-pixelwise} +(@pxref{Frame Size}) is non-@code{nil}. The arguments @var{max-height}, @var{min-height}, @var{max-width} and @var{min-width}, if non-@code{nil}, specify bounds on the new body size diff --git a/lisp/window.el b/lisp/window.el index e9d57652ec6..cd19fd73849 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -9921,6 +9921,26 @@ for `fit-frame-to-buffer'." ;; Move frame down. (setq top top-margin))))) ;; Apply our changes. + (unless frame-resize-pixelwise + ;; When 'frame-resize-pixelwise' is nil, a frame cannot be + ;; necessarily fit completely even if the window's calculated + ;; width and height are integral multiples of the frame's + ;; character width and height. The size hints Emacs produces + ;; are inept to handle that when the combined sizes of the + ;; frame's fringes, scroll bar and internal border are not an + ;; integral multiple of the frame's character width (Bug#74866). + ;; Consequently, the window manager will round sizes down and + ;; this may cause lines getting wrapped. To avoid that, round + ;; sizes up here which will, however, leave a blank space at the + ;; end of the longest line(s). + (setq text-minus-body-width + (+ text-minus-body-width + (- char-width + (% text-minus-body-width char-width)))) + (setq text-minus-body-height + (+ text-minus-body-height + (- char-height + (% text-minus-body-height char-height))))) (setq text-width (if width (+ width text-minus-body-width) commit 39380e1bd3bfc26e355445590e243fcfa940fc9f Author: Arsen Arsenović Date: Sun Dec 22 19:33:29 2024 +0000 Java Mode: introduce the keyword `assert'. * lisp/progmodes/cc-langs.el (c-simple-stmt-kwds): Put `assert' into the java value. diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index a256371f850..8d3d0ed3a3b 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -3251,7 +3251,7 @@ Such a keyword is a member of `c-paren-clause-kwds." c++ '("break" "continue" "goto" "return" "co_return") objc '("break" "continue" "goto" "return" "@throw") ;; Note: `goto' is not valid in Java, but the keyword is still reserved. - java '("break" "continue" "goto" "return" "throw") + java '("assert" "break" "continue" "goto" "return" "throw") idl nil pike '("break" "continue" "return") awk '(;; Not sure about "delete", "exit", "getline", etc. ; ACM 2002/5/30 commit 423e1ee7d6d6f34c0bc249a8dfb14a4a25eae08a Author: Juri Linkov Date: Sun Dec 22 21:15:18 2024 +0200 Add treesit thing 'sexp-list' to typescript-ts-mode (bug#73404) * lisp/progmodes/typescript-ts-mode.el (typescript-ts-base-mode): Add 'sexp-list' to 'treesit-thing-settings'. (typescript-ts-mode--sexp-list-nodes): New variable. diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index edca89e5c3a..08c8a71c18e 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -459,6 +459,35 @@ See `treesit-thing-settings' for more information.") "Nodes that designate sexps in TypeScript. See `treesit-thing-settings' for more information.") +(defvar typescript-ts-mode--sexp-list-nodes + '("export_clause" + "named_imports" + "statement_block" + "_for_header" + "switch_body" + "parenthesized_expression" + "object" + "object_pattern" + "array" + "array_pattern" + "jsx_expression" + "_jsx_string" + "string" + "regex" + "arguments" + "class_body" + "formal_parameters" + "computed_property_name" + "decorator_parenthesized_expression" + "enum_body" + "parenthesized_type" + "type_arguments" + "object_type" + "type_parameters" + "tuple_type") + "Nodes that designate lists in TypeScript. +See `treesit-thing-settings' for more information.") + ;;;###autoload (define-derived-mode typescript-ts-base-mode prog-mode "TypeScript" "Generic major mode for editing TypeScript. @@ -486,6 +515,7 @@ This mode is intended to be inherited by concrete major modes." (setq-local treesit-thing-settings `((typescript (sexp ,(regexp-opt typescript-ts-mode--sexp-nodes)) + (sexp-list ,(regexp-opt typescript-ts-mode--sexp-list-nodes)) (sentence ,(regexp-opt typescript-ts-mode--sentence-nodes)) (text ,(regexp-opt '("comment" commit ec39f669f902143a68a99fb42dd05716a27736be Author: Augusto Stoffel Date: Tue Nov 5 15:07:27 2024 +0100 Handle ':noquery' in 'open-gnutls-stream' * lisp/net/gnutls.el (open-gnutls-stream): Extract and use ':noquery' keyword. (Bug#74193). diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el index b5fb4d47d57..2261ccc7e30 100644 --- a/lisp/net/gnutls.el +++ b/lisp/net/gnutls.el @@ -166,7 +166,7 @@ Third arg HOST is the name of the host to connect to, or its IP address. Fourth arg SERVICE is the name of the service desired, or an integer specifying a port number to connect to. Fifth arg PARAMETERS is an optional list of keyword/value pairs. -Only :client-certificate, :nowait, and :coding keywords are +Only :client-certificate, :nowait, :noquery, and :coding keywords are recognized, and have the same meaning as for `open-network-stream'. For historical reasons PARAMETERS can also be a symbol, which is @@ -197,9 +197,11 @@ trust and key files, and priority string." (cert (network-stream-certificate host service parameters)) (keylist (and cert (list cert))) (nowait (plist-get parameters :nowait)) + (noquery (plist-get parameters :noquery)) (process (open-network-stream name buffer host service :nowait nowait + :noquery noquery :tls-parameters (and nowait (cons 'gnutls-x509pki commit fb7bf20a9c129a97ceeabad00523ecafaa58697c Author: Michael Albinus Date: Sun Dec 22 10:20:15 2024 +0100 * test/lisp/files-tests.el (sh-shell): Move down declaration. diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index 78fc139025c..9dbf42ee603 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -1659,8 +1659,6 @@ The door of all subtleties! (should (equal (file-name-base "foo") "foo")) (should (equal (file-name-base "foo/bar") "bar"))) -(defvar sh-shell) - (defun files-tests--check-mode (filename) "Return the major mode found in `auto-mode-alist' for FILENAME." (set-auto-mode--find-matching-alist-entry @@ -1682,6 +1680,8 @@ The door of all subtleties! (should-not (eq (files-tests--check-mode "gdbinit.5") #'gdb-script-mode)) (should-not (eq (files-tests--check-mode ".gdbinit.py.in") #'gdb-script-mode))) +(defvar sh-shell) + (defun files-tests--check-shebang (shebang expected-mode &optional expected-dialect) "Assert that mode for SHEBANG derives from EXPECTED-MODE.