commit 339945c05a6c4709352183326a2fa5c682073889 (HEAD, refs/remotes/origin/master) Merge: ca1ce00854 cf38e1c393 Author: Stefan Kangas Date: Thu Sep 29 06:30:58 2022 +0200 Merge from origin/emacs-28 cf38e1c393 Clarify image file search fc212364ce ; Fix typo. commit ca1ce00854970b65b05da33de23799d9e0dd3e7f Author: Po Lu Date: Thu Sep 29 09:36:13 2022 +0800 Pacify compiler warning in xterm.c * src/xterm.c (handle_one_xevent): Mark gen_help_time UNINIT. Reported by Lars Ingebrigtsen . diff --git a/src/xterm.c b/src/xterm.c index 198c816471..cb5d540dd3 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -17699,7 +17699,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, int do_help = 0; #ifdef HAVE_XINPUT2 struct xi_device_t *gen_help_device; - Time gen_help_time; + Time gen_help_time UNINIT; #endif ptrdiff_t nbytes = 0; struct frame *any, *f = NULL; commit 2bb8c2cf64890e296ff3f395625ab5b184bc6ecd Author: Po Lu Date: Thu Sep 29 09:35:31 2022 +0800 Fix the MS-DOS build * config.bat: Add assert.in-h. * msdos/sed2v2.inp: Define HAVE_STDBOOL_H. * msdos/sedlibmk.inp (GL_GNULIB_LCHMOD, HAVE_LCHMOD): Define to reflect realities. (NEXT_ASSERT_H, @GL_GENERATE_ASSERT_H_CONDITION@): Define. (assert.h): Edit command group into individual commands appending to assert.h-t. diff --git a/config.bat b/config.bat index 4adc477bc9..7f2060ce00 100644 --- a/config.bat +++ b/config.bat @@ -276,6 +276,7 @@ cd lib Rem Rename files like djtar on plain DOS filesystem would. If Exist c++defs.h update c++defs.h cxxdefs.h If Exist alloca.in.h update alloca.in.h alloca.in-h +If Exist assert.in.h update assert.in.h assert.in-h If Exist byteswap.in.h update byteswap.in.h byteswap.in-h If Exist dirent.in.h update dirent.in.h dirent.in-h If Exist errno.in.h update errno.in.h errno.in-h diff --git a/msdos/sed2v2.inp b/msdos/sed2v2.inp index 8728c8dac4..ff6be8d083 100644 --- a/msdos/sed2v2.inp +++ b/msdos/sed2v2.inp @@ -114,6 +114,7 @@ s/^#undef POINTER_TYPE *$/#define POINTER_TYPE void/ #else\ #undef HAVE_INTTYPES_H\ #endif +s/^#undef HAVE_STDBOOL_H/#define HAVE_STDBOOL_H 1/ /^#undef HAVE_STDINT_H/c\ #if __DJGPP__ > 2 || __DJGPP_MINOR__ > 3\ #define HAVE_STDINT_H 1\ diff --git a/msdos/sedlibmk.inp b/msdos/sedlibmk.inp index 79430bbaf1..3af0db6e0a 100644 --- a/msdos/sedlibmk.inp +++ b/msdos/sedlibmk.inp @@ -182,6 +182,7 @@ s/@PACKAGE@/emacs/ /^GL_GNULIB_GETLOADAVG *=/s/@GL_GNULIB_GETLOADAVG@/1/ /^GL_GNULIB_GETRANDOM *=/s/@GL_GNULIB_GETRANDOM@/1/ /^GL_GNULIB_UNISTD_H_GETOPT *=/s/@GL_GNULIB_UNISTD_H_GETOPT@/1/ +/^GL_GNULIB_LCHMOD *=/s/@GL_GNULIB_LCHMOD@/1/ /^GL_GNULIB_MEMMEM *=/s/@GL_GNULIB_MEMMEM@/1/ /^GL_GNULIB_MEMRCHR *=/s/@GL_GNULIB_MEMRCHR@/1/ /^GL_GNULIB_MEMPCPY *=/s/@GL_GNULIB_MEMPCPY@/1/ @@ -216,7 +217,8 @@ s/@PACKAGE@/emacs/ /^HAVE_GETHOSTNAME *=/s/@HAVE_GETHOSTNAME@/1/ /^HAVE_GETLOGIN *=/s/@HAVE_GETLOGIN@/1/ /^HAVE_GETPAGESIZE *=/s/@HAVE_GETPAGESIZE@/1/ -/^HAVE_INTTYPES_H *=/s/@HAVE_INTTYPES_H@/HAVE_INTTYPES_H/ +/^HAVE_INTTYPES_H *=/s/@HAVE_INTTYPES_H@/1/ +/^HAVE_LCHMOD *=/s/@HAVE_LCHMOD@/0/ /^HAVE_LINK *=/s/@HAVE_LINK@/1/ /^HAVE_LONG_LONG_INT *=/s/@HAVE_LONG_LONG_INT@/1/ /^HAVE_LSTAT *=/s/@HAVE_LSTAT@/HAVE_LSTAT/ @@ -293,7 +295,8 @@ s/@PACKAGE@/emacs/ /^NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H *=/s/@[^@\n]*@// /^NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H *=/s!@[^@\n]*@!! /^NEXT_AS_FIRST_DIRECTIVE_TIME_H *=/s/@[^@\n]*@// -/^NEXT_AS_FIRST_DIRECTIVE_UNISTD_H *=/s/@[^@\n]*@// +/^NEXT_ASSERT_H *=/s/@[^@\n]*@// +/^NEXT_DIRENT_H *=/s/@[^@\n]*@// /^NEXT_DIRENT_H *=/s/@[^@\n]*@// /^NEXT_ERRNO_H *=/s/@[^@\n]*@// /^NEXT_FCNTL_H *=/s/@[^@\n]*@// @@ -323,6 +326,7 @@ s/@PACKAGE@/emacs/ /^LIB_GETRANDOM[^ =]* *= *@/s/@[^@\n]*@// /^SIG_ATOMIC_T_SUFFIX *=/s/@SIG_ATOMIC_T_SUFFIX@// /^SIZE_T_SUFFIX *=/s/@SIZE_T_SUFFIX@/u/ +/^ASSERT_H *=/s/@[^@\n]*@/assert.h/ /^ALLOCA_H *=/s/@[^@\n]*@/alloca.h/ /^BYTESWAP_H *=/s/@[^@\n]*@/byteswap.h/ /^DIRENT_H *=/s/@[^@\n]*@// @@ -412,6 +416,9 @@ s/^ -*test -z.*|| rm/ -rm/ s/@echo /@djecho / # # Determine which headers to generate +# DJGPP assert.h lacks static_assert, so assert.h will have to be +# generated +s/= @GL_GENERATE_ASSERT_H_CONDITION@/= 1/ s/= @GL_GENERATE_ALLOCA_H_CONDITION@/= 1/ s/= @GL_GENERATE_BYTESWAP_H_CONDITION@/= 1/ s/= @GL_GENERATE_EXECINFO_H_CONDITION@/= 1/ @@ -497,6 +504,14 @@ s/\.in-h\; *\\$/.in-h >> $@-t/ s/'\; \\ *$/' >> $@-t/ /< \$(srcdir)\/string\.in-h >>/d } +/^assert\.h/,/^ \$(AM_V_AT)mv \$@-t \$@/{ + s/\$(gl_V_at){/\$(gl_V_at)/ + s/< \$(srcdir)\/assert\.in-h/& > $@-t/ + s/ sed/ \$(gl_V_at) \$(SED_HEADER_STDOUT)\\\ + / + s/\} > \$@-t/>> $@-t/ + s/< \$(srcdir)\/verify\.h; \\/\$(srcdir)\/verify\.h >> \$@-t/ +} s!\$(MKDIR_P)[ ][ ]*sys!command.com /c "if not exist sys\\stat.h md sys"! /^ @for dir in/,/^[^ ]/c\ -rm -rf $(MOSTLYCLEANDIRS) commit cf38e1c3939f4799113755c762fc7b8c3093fe56 (refs/remotes/origin/emacs-28) Author: Eli Zaretskii Date: Wed Sep 28 22:03:27 2022 +0300 Clarify image file search * doc/lispref/display.texi (Defining Images, Image Descriptors): * lisp/image.el (create-image): Clarify that non-absolute image files are searched along 'image-load-path'. (Bug#52931) diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index b068c7d08c..3861f89036 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -5416,10 +5416,9 @@ Every image descriptor must include this property. @item :file @var{file} This says to load the image from file @var{file}. If @var{file} is -not an absolute file name, it is expanded relative to the -@file{images} subdirectory of @code{data-directory}, and failing that, -relative to the directories listed by @code{x-bitmap-file-path} -(@pxref{Face Attributes}). +not an absolute file name, it is expanded relative to each of the +directories mentioned by @code{image-load-path} (@pxref{Defining +Images}). @item :data @var{data} This specifies the raw image data. Each image descriptor must have @@ -6367,7 +6366,9 @@ Supports the @code{:index} property. @xref{Multi-Frame Images}. This function creates and returns an image descriptor which uses the data in @var{file-or-data}. @var{file-or-data} can be a file name or a string containing the image data; @var{data-p} should be @code{nil} -for the former case, non-@code{nil} for the latter case. +for the former case, non-@code{nil} for the latter case. If +@var{file-or-data} is a relative file name, the function will search +for it in directories mentioned in @code{image-load-path}. The optional argument @var{type} is a symbol specifying the image type. If @var{type} is omitted or @code{nil}, @code{create-image} tries to diff --git a/lisp/image.el b/lisp/image.el index ea1a22698c..72b7862c95 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -460,8 +460,9 @@ must be available." ;;;###autoload (defun create-image (file-or-data &optional type data-p &rest props) - "Create an image. -FILE-OR-DATA is an image file name or image data. + "Create an image from FILE-OR-DATA. +FILE-OR-DATA is an image file name or image data. If it is a relative +file name, the function will look for it along `image-load-path'. Optional TYPE is a symbol describing the image type. If TYPE is omitted or nil, try to determine the image type from its first few bytes commit b6a163ba7cdf57eff5542b4cb6956780ebb2880f Author: Stefan Monnier Date: Wed Sep 28 14:14:32 2022 -0400 * doc/lispref/functions.texi (Declare Form) : Re-rephrase diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 0659d3556b..8b858e0aa0 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -2478,9 +2478,10 @@ expander will call @var{expander} with that form as well as with instead of the function call, or it can return just the form unchanged, to indicate that the function call should be left alone. -When @var{expander} is a lambda form it should be of the form -@code{(lambda (@var{arg}) @var{body})} because the function's formal -arguments are automatically added to the lambda's list of arguments. +When @var{expander} is a lambda form it should be written with +a single argument (i.e., be of the form @code{(lambda (@var{arg}) +@var{body})}) because the function's formal arguments are +automatically added to the lambda's list of arguments for you. @item (gv-expander @var{expander}) Declare @var{expander} to be the function to handle calls to the macro (or commit 1254d9a3ae89697b591343de2ddf55c5879bc937 Author: Stefan Monnier Date: Wed Sep 28 12:28:30 2022 -0400 * doc/lispref/functions.texi (Declare Form) : Rephrase See bug#57397. diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 983dfe2ec5..0659d3556b 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -2476,11 +2476,11 @@ function, of the form @code{(@var{function} @var{args}@dots{})}, the macro expander will call @var{expander} with that form as well as with @var{args}@dots{}, and @var{expander} can either return a new expression to use instead of the function call, or it can return just the form unchanged, -to indicate that the function call should be left alone. @var{expander} can -be a symbol, or it can be a form @code{(lambda (@var{arg}) @var{body})} in -which case @var{arg} will hold the original function call expression, and the -(unevaluated) arguments to the function can be accessed using the function's -formal arguments. +to indicate that the function call should be left alone. + +When @var{expander} is a lambda form it should be of the form +@code{(lambda (@var{arg}) @var{body})} because the function's formal +arguments are automatically added to the lambda's list of arguments. @item (gv-expander @var{expander}) Declare @var{expander} to be the function to handle calls to the macro (or commit ab5b1cf88ebe58544fb0aa7624816f944dd5e5cd Author: Eli Zaretskii Date: Wed Sep 28 19:00:57 2022 +0300 ; Improve doc strings in doc-view.el * lisp/doc-view.el (doc-view-imenu-title-format) (doc-view-imenu-flatten): Doc fixes. (Bug#58131) diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 9e3bb6e46c..80c4fd21de 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -220,7 +220,7 @@ are available (see Info node `(emacs)Document View')." :version "29.1") (defcustom doc-view-imenu-title-format "%t (%p)" - "Format string for document section titles in imenu. + "Format spec for imenu's display of section titles from docview documents. The special markers '%t' and '%p' are replaced by the section title and page number in this format string, which uses @@ -232,7 +232,7 @@ showing only titles and no page number." :version "29.1") (defcustom doc-view-imenu-flatten nil - "Whether to generate a flat list of sections instead of a nested tree." + "Whether to flatten the list of sections in an imenu or show it nested." :type 'boolean :version "29.1") commit 7280f3f0739ac02f19adc7d1bb8945f3c42c5f91 Author: Stefan Kangas Date: Wed Sep 28 17:34:59 2022 +0200 ; Fix typos diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi index bc3b21d019..0ee33f2c2a 100644 --- a/doc/misc/eshell.texi +++ b/doc/misc/eshell.texi @@ -1677,7 +1677,7 @@ inserting it like with @code{>>> @var{file}}. @item >&@var{other-fd} @itemx @var{fd}>&@var{other-fd} Duplicate the file descriptor @var{other-fd} to @var{fd} (or 1 if -unspecified). The order in which this is used is signficant, so +unspecified). The order in which this is used is significant, so @example @var{command} > @var{file} 2>&1 diff --git a/etc/themes/modus-themes.el b/etc/themes/modus-themes.el index c4edb1efcb..6296bf9025 100644 --- a/etc/themes/modus-themes.el +++ b/etc/themes/modus-themes.el @@ -2270,7 +2270,7 @@ follows (order is not significant): The `popup' key takes the same values as `selection'. -Apart from specfying each key separately, a fallback list is +Apart from specifying each key separately, a fallback list is accepted. This is only useful when the desired aesthetic is the same across all keys that are not explicitly referenced. For example, this: diff --git a/lisp/faces.el b/lisp/faces.el index ffdc391f66..09e8110449 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -2060,7 +2060,7 @@ IF MULTIPLE is non-nil, return a list of faces. Return nil if there is no face at point. -This function is not meant for handling faces programatically; to +This function is not meant for handling faces programmatically; to do that, use `get-text-property' and `get-char-property'." (let (faces) (when text diff --git a/lisp/imenu.el b/lisp/imenu.el index bfc2429100..7f68bd15b9 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -210,7 +210,7 @@ See `imenu--index-alist' for the format of the buffer index alist.") ;;;###autoload (defvar-local imenu-submenus-on-top t - "Flag specifiying whether items with sublists should be kept at top. + "Flag specifying whether items with sublists should be kept at top. For some indexes, such as those describing sections in a document, it makes sense to keep their original order even in the menubar.") diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el index fd244a97b1..a5f589459b 100644 --- a/lisp/net/mailcap.el +++ b/lisp/net/mailcap.el @@ -724,7 +724,7 @@ appropriately. The format of INFO is described in `mailcap-mime-data'. -STORAGE should be a symbol refering to a variable. The value of +STORAGE should be a symbol referring to a variable. The value of this variable should have the same format as `mailcap-mime-data'. STORAGE defaults to `mailcap--computed-mime-data'. diff --git a/src/xterm.c b/src/xterm.c index 409d39b27e..198c816471 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -28278,7 +28278,7 @@ xi_select_hierarchy_events (struct x_display_info *dpyinfo) extension. Value is 0 if GTK was not built with the input extension, or if it - was explictly disabled, 1 if GTK enabled the input extension and + was explicitly disabled, 1 if GTK enabled the input extension and the version was successfully determined, and 2 if that information could not be determined. */ diff --git a/test/lisp/net/mailcap-tests.el b/test/lisp/net/mailcap-tests.el index c4f011dd1a..8d047c7ff5 100644 --- a/test/lisp/net/mailcap-tests.el +++ b/test/lisp/net/mailcap-tests.el @@ -239,7 +239,7 @@ (print . "print1"))))))))) (ert-deftest mailcap-add-mailcap-entry-new-minor-to-various-major-positions () - "Add a new minor entry to major entries at various postions + "Add a new minor entry to major entries at various positions in ‘mailcap-mime-data’." (let ((mailcap-mime-data (list commit fc212364ce8f4615f27c2de40a2815ce2a8d95b2 Author: Stefan Kangas Date: Wed Sep 28 17:18:49 2022 +0200 ; Fix typo. diff --git a/doc/emacs/ack.texi b/doc/emacs/ack.texi index 625aa706d5..f0a45fd315 100644 --- a/doc/emacs/ack.texi +++ b/doc/emacs/ack.texi @@ -1441,7 +1441,7 @@ Victor Zandy wrote @file{zone.el}, a package for people who like to zone out in front of Emacs. @item -Eli Zaretskii was the the Emacs (co-)maintainer from Emacs 25 +Eli Zaretskii was the Emacs (co-)maintainer from Emacs 25 onwards. He made many standard Emacs features work on MS-DOS and Microsoft Windows. He also wrote @file{tty-colors.el}, which implements transparent mapping of X colors to tty colors; and commit e37484ee26501c2267bc8ceceb06723490391f00 Author: Stefan Kangas Date: Wed Sep 28 16:46:54 2022 +0200 * .mailmap: Fixes for Emacs 29. diff --git a/.mailmap b/.mailmap index 4066ab30c8..8454eb9154 100644 --- a/.mailmap +++ b/.mailmap @@ -30,6 +30,8 @@ Artur Malabarba Bastien Guerry Bastien Guerry Bastien Guerry +Benjamin Schwerdtner +Bob Rogers Bruno Félix Rezende Ribeiro Carlos Pita Chong Yidong @@ -77,6 +79,9 @@ Ian Dunn Jan Djärv Jan Djärv Jason Rumney +Jeff Walsh +Jeff Walsh +Jeff Walsh Jens Lechtenbörger Jim Blandy Jimmy Aguilar Mena @@ -100,12 +105,14 @@ Kenichi Handa Kenichi Handa Kenichi Handa Kenjiro Nakayama +Kjartan Óli Ágústsson Károly Lőrentey Lars Ingebrigtsen Lars Ingebrigtsen Lars Ingebrigtsen Lars Ingebrigtsen Lars Ingebrigtsen +Laurence Warne Lin Sun Ludovic Courtès Luke Lee @@ -119,6 +126,7 @@ Maxim Nikulin Michael Albinus Michalis V Miha Rihtaršič +Morgan J. Smith Nick Drozd Nicolas Petton Nitish Chandra @@ -133,6 +141,7 @@ Peter Oliver Peter Oliver Philip Kaludercic Philip Kaludercic +Philip Kaludercic Philip Kaludercic Philipp Stephani Philipp Stephani Philipp Stephani @@ -140,6 +149,7 @@ Phillip Lord Pierre Lorenzon Pieter van Oostrum Pip Cet +Po Lu Po Lu Po Lu via Przemysław Wojnowski Rasmus @@ -149,8 +159,10 @@ Robert Weiner Roland Winkler Ronnie Schnell Ryan C. Thompson -Simen Heggestøyl -Simen Heggestøyl +Sam Steingold +Simen Heggestøyl +Simen Heggestøyl +Simen Heggestøyl Simon Josefsson Stefan Kangas Stefan Monnier @@ -172,10 +184,13 @@ Ulf Jasper Ulf Jasper <> Ulf Jasper Ulf Jasper Ulrich Müller Vinicius Jose Latorre +Vladimir Nikishkin Werner Lemberg Wolfgang Scherer Xi Lu Xue Fuqiao +Yilkal Argaw +Yuuki Harano Óscar Fuentes İ. Göktuğ Kayaalp Łukasz Stelmach commit 86938bfbeae8eff8c85c998986ccb8f719c483c5 Merge: d096819089 8033947fe2 Author: Stefan Kangas Date: Wed Sep 28 16:38:31 2022 +0200 Merge from origin/emacs-28 8033947fe2 .mailcap: Some additional fixes. b1e92c59ed Avoid assertion violations in 'pop_it' commit d096819089273f2854305db03763a91fa303f651 Author: Gregory Heytings Date: Mon Sep 26 12:58:07 2022 +0000 Remove hard-coded path to pwd in Makefiles. * Makefile.in: * lib-src/Makefile.in: * nextstep/Makefile.in: * nt/Makefile.in: Replace hard-coded calls to /bin/pwd by calls to 'pwd -P'. Fixes bug#58080. diff --git a/Makefile.in b/Makefile.in index c6a2e50959..741a4c5538 100644 --- a/Makefile.in +++ b/Makefile.in @@ -698,8 +698,8 @@ install-arch-indep: lisp install-info install-man ${INSTALL_ARCH_INDEP_EXTRA} [ -d $${dir} ] || exit 1 ; \ dest="$$1" ; shift ; \ if [ -d "$${dest}" ]; then \ - exp_dest=`cd "$${dest}" && /bin/pwd`; \ - [ "$$exp_dest" = "`cd $${dir} && /bin/pwd`" ] && continue ; \ + exp_dest=`cd "$${dest}" && pwd -P`; \ + [ "$$exp_dest" = "`cd $${dir} && pwd -P`" ] && continue ; \ else true; \ fi; \ rm -rf "$${dest}" ; \ @@ -755,8 +755,8 @@ install-arch-indep: lisp install-info install-man ${INSTALL_ARCH_INDEP_EXTRA} install-etcdoc: src install-arch-indep -unset CDPATH; \ umask 022; ${MKDIR_P} "$(DESTDIR)${etcdocdir}" ; \ - exp_etcdocdir=`cd "$(DESTDIR)${etcdocdir}"; /bin/pwd`; \ - if [ "`cd ./etc; /bin/pwd`" != "$$exp_etcdocdir" ]; \ + exp_etcdocdir=`cd "$(DESTDIR)${etcdocdir}"; pwd -P`; \ + if [ "`cd ./etc; pwd -P`" != "$$exp_etcdocdir" ]; \ then \ docfile="DOC"; \ printf 'Copying %s to %s ...\n' "etc/$$docfile" \ @@ -771,9 +771,9 @@ install-etcdoc: src install-arch-indep install-info: info umask 022; ${MKDIR_P} "$(DESTDIR)${infodir}" -unset CDPATH; \ - thisdir=`/bin/pwd`; \ - exp_infodir=`cd "$(DESTDIR)${infodir}" && /bin/pwd`; \ - if [ "`cd ${srcdir}/info && /bin/pwd`" = "$$exp_infodir" ]; then \ + thisdir=`pwd -P`; \ + exp_infodir=`cd "$(DESTDIR)${infodir}" && pwd -P`; \ + if [ "`cd ${srcdir}/info && pwd -P`" = "$$exp_infodir" ]; then \ true; \ else \ [ -f "$(DESTDIR)${infodir}/dir" ] || \ @@ -802,7 +802,7 @@ install-info: info ## but not sure if portable. install-man: umask 022; ${MKDIR_P} "$(DESTDIR)${man1dir}" - thisdir=`/bin/pwd`; \ + thisdir=`pwd -P`; \ cd ${mansrcdir}; \ for page in *.1; do \ test "$$page" = ChangeLog.1 && continue; \ @@ -869,7 +869,7 @@ install-etc: ${srcdir}/etc/emacs.service > $${tmp}; \ $(INSTALL_DATA) $${tmp} "$(DESTDIR)$(systemdunitdir)/${EMACS_NAME}.service"; \ rm -f $${tmp} - thisdir=`/bin/pwd`; \ + thisdir=`pwd -P`; \ cd ${iconsrcdir} || exit 1; umask 022 ; \ for dir in */*/apps */*/mimetypes; do \ [ -d $${dir} ] || continue ; \ @@ -906,8 +906,8 @@ uninstall: uninstall-$(NTDIR) uninstall-doc uninstall-gsettings-schemas -unset CDPATH; \ for dir in "$(DESTDIR)${lispdir}" "$(DESTDIR)${etcdir}" "$(ELN_DESTDIR)" ; do \ if [ -d "$${dir}" ]; then \ - case `cd "$${dir}" ; /bin/pwd` in \ - "`cd ${srcdir} ; /bin/pwd`"* ) ;; \ + case `cd "$${dir}" ; pwd -P` in \ + "`cd ${srcdir} ; pwd -P`"* ) ;; \ * ) rm -rf "$${dir}" ;; \ esac ; \ case "$${dir}" in \ @@ -918,7 +918,7 @@ uninstall: uninstall-$(NTDIR) uninstall-doc uninstall-gsettings-schemas fi ; \ done -rm -rf "$(DESTDIR)${libexecdir}/emacs/${version}" - thisdir=`/bin/pwd`; \ + thisdir=`pwd -P`; \ (info_misc=`MAKEFLAGS= $(MAKE) --no-print-directory -s -C doc/misc echo-info`; \ if cd "$(DESTDIR)${infodir}"; then \ for elt in ${INFO_NONMISC} $${info_misc}; do \ diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index cf4659fc2c..cfad3fc394 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in @@ -306,8 +306,8 @@ $(DESTDIR)${archlibdir}: all $(info $ ) $(info Installing utilities run internally by Emacs.) umask 022 && ${MKDIR_P} "$(DESTDIR)${archlibdir}" - exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd` && \ - if [ "$$exp_archlibdir" != "`/bin/pwd`" ]; then \ + exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && pwd -P` && \ + if [ "$$exp_archlibdir" != "`pwd -P`" ]; then \ for file in ${UTILITIES}; do \ $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file \ "$(DESTDIR)${archlibdir}/$$file" || exit; \ @@ -333,8 +333,8 @@ $(DESTDIR)${archlibdir}: all chmod u=rwx,g=rwx,o=rx "$(DESTDIR)${gamedir}" endif endif - exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd` && \ - if [ "$$exp_archlibdir" != "`cd ${srcdir} && /bin/pwd`" ]; then \ + exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && pwd -P` && \ + if [ "$$exp_archlibdir" != "`cd ${srcdir} && pwd -P`" ]; then \ for file in ${SCRIPTS}; do \ $(INSTALL_SCRIPT) ${srcdir}/$$file \ "$(DESTDIR)${archlibdir}/$$file" || exit; \ diff --git a/nextstep/Makefile.in b/nextstep/Makefile.in index 82bf13bc92..c1200f73fb 100644 --- a/nextstep/Makefile.in +++ b/nextstep/Makefile.in @@ -59,7 +59,7 @@ ${ns_appdir}: ${srcdir}/${ns_appsrc} ${ns_appsrc} ${MKDIR_P} ${ns_appdir} ( cd ${srcdir}/${ns_appsrc} ; tar cfh - . ) | \ ( cd ${ns_appdir} ; umask 022; tar xf - ) - [ "`cd ${srcdir} && /bin/pwd`" = "`/bin/pwd`" ] || \ + [ "`cd ${srcdir} && pwd -P`" = "`pwd -P`" ] || \ ( cd ${ns_appsrc} ; tar cfh - . ) | \ ( cd ${ns_appdir} ; umask 022; tar xf - ) touch ${ns_appdir} diff --git a/nt/Makefile.in b/nt/Makefile.in index c904e6d451..c5a9bf4363 100644 --- a/nt/Makefile.in +++ b/nt/Makefile.in @@ -163,8 +163,8 @@ $(DESTDIR)${archlibdir}: all @echo @echo "Installing utilities run internally by Emacs." umask 022; ${MKDIR_P} "$(DESTDIR)${archlibdir}" - exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd`; \ - if [ "$$exp_archlibdir" != "`/bin/pwd`" ]; then \ + exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && pwd -P`; \ + if [ "$$exp_archlibdir" != "`pwd -P`" ]; then \ for file in ${UTILITIES}; do \ $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file "$(DESTDIR)${archlibdir}/$$file" ; \ done ; \ commit 8033947fe2ea5c1513a18c893b201c1f829f6b7a Author: Stefan Kangas Date: Wed Sep 28 16:23:09 2022 +0200 .mailcap: Some additional fixes. diff --git a/.mailmap b/.mailmap index f231fb5cc7..4066ab30c8 100644 --- a/.mailmap +++ b/.mailmap @@ -8,8 +8,14 @@ # # Keep file sorted using `M-x sort-lines'. # +Aaron S. Hawley +Aaron S. Hawley +Aaron S. Hawley Alan Third Alan Third +Alan Third Alan Third +Alan Third bug-gnu-emacs@gnu.org +Alex Harsanyi Alexander Gramiak Amin Bandali Andrea Corallo @@ -22,13 +28,19 @@ Arash Esbati Arash Esbati Artur Malabarba Bastien Guerry +Bastien Guerry +Bastien Guerry +Bruno Félix Rezende Ribeiro Carlos Pita Chong Yidong Christoph Scholtes Christoph Scholtes +Christoph Scholtes Christoph Scholtes <> Clément Pit-Claudel Clément Pit-Claudel Courtney Bane +Daiki Ueno +Daiki Ueno Daiki Ueno Dan Nicolaescu Dan Nicolaescu Daniel Colascione @@ -36,6 +48,7 @@ David Abrahams David M. Koppelman Deniz Dogan Dick R. Chiang +Dick R. Chiang dickmao Earl Hyatt Earl Hyatt Edward M. Reingold @@ -43,9 +56,13 @@ Eli Zaretskii Emilio C. Lopes Enami Tsugutomo Era Eriksson +Eric Ludlam +Eric Ludlam +Eric Ludlam Eric S. Raymond Etienne Prud’homme Fabián Ezequiel Gallina +Fabián Ezequiel Gallina Francis Litterio Gabor Vida Gerd Möllmann @@ -53,7 +70,7 @@ Gerd Möllmann Glenn Morris Glenn Morris Glenn Morris -Gnus developers +Gnus developers Gregory Heytings Grégoire Jadi Ian Dunn @@ -68,12 +85,17 @@ Joakim Verona John Wiegley Jose A. Ortega Ruiz João Távora +Julien Danjou +Julien Danjou Julien Danjou Juri Linkov Jérémy Compostella Jürgen Hötzel Karl Fogel +Katsumi Yamaoka Kaushal Modi Kelvin White +Kelvin White +Ken Raeburn Kenichi Handa Kenichi Handa Kenichi Handa @@ -86,8 +108,10 @@ Lars Ingebrigtsen Lars Ingebrigtsen Lin Sun Ludovic Courtès +Luke Lee Martin Rudalics Martin Rudalics <“rudalics@gmx.at”> +Masatake YAMATO Matt Armstrong Matt Armstrong Mattias Engdegård @@ -116,10 +140,13 @@ Phillip Lord Pierre Lorenzon Pieter van Oostrum Pip Cet +Po Lu Po Lu via Przemysław Wojnowski Rasmus Richard M. Stallman Robert J. Chassell +Robert Weiner +Roland Winkler Ronnie Schnell Ryan C. Thompson Simen Heggestøyl @@ -127,6 +154,13 @@ Simen Heggestøyl Simon Josefsson Stefan Kangas Stefan Monnier +Stephen Berman +Stephen Berman +Stephen Berman +Stephen Gildea +Stephen Gildea +Stephen Gildea +Stephen Gildea Tassilo Horn Ted Zlatanov Thien-Thi Nguyen @@ -134,8 +168,10 @@ Thierry Volpiatto Tino Calancha Tino Calancha Tom Tromey -Ulf Jasper +Ulf Jasper Ulf Jasper <> +Ulf Jasper Ulf Jasper Ulrich Müller +Vinicius Jose Latorre Werner Lemberg Wolfgang Scherer Xi Lu commit 56f871b0e2008f0f57c22b4c3018dbdda9d427ac Author: Eli Zaretskii Date: Wed Sep 28 16:59:51 2022 +0300 ; * doc/lispref/control.texi (Conditionals): Fix typo. diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index e0c5ddf2cb..9035e7f6bb 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi @@ -294,7 +294,7 @@ For example: @end group @end example -If can be convenient to bind variables in conjunction with using a +It can be convenient to bind variables in conjunction with using a conditional. It's often the case that you compute a value, and then want to do something with that value if it's non-@code{nil}. The straightforward way to do that is to just write, for instance: commit b1e92c59ede2e67e36531a35ecb4ccabeaa68ff6 Author: Eli Zaretskii Date: Wed Sep 28 16:46:39 2022 +0300 Avoid assertion violations in 'pop_it' * src/xdisp.c (pop_it): Avoid assertion violations when handling lists or vectors of display properties. (Bug#58122) diff --git a/src/xdisp.c b/src/xdisp.c index 6d42105474..f5f3a811e9 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -6755,7 +6755,14 @@ pop_it (struct it *it) || (STRINGP (it->object) && IT_STRING_CHARPOS (*it) == it->bidi_it.charpos && IT_STRING_BYTEPOS (*it) == it->bidi_it.bytepos) - || (CONSP (it->object) && it->method == GET_FROM_STRETCH)); + || (CONSP (it->object) && it->method == GET_FROM_STRETCH) + /* We could be in the middle of handling a list or a + vector of several 'display' properties, in which + case we should only verify the above conditions when + we pop the iterator stack the last time, because + higher stack levels cannot "iterate out of the + display property". */ + || it->sp > 0); } /* If we move the iterator over text covered by a display property to a new buffer position, any info about previously seen overlays commit d1d0f03a58fc14be06fd2b236ab39784529d46e9 Merge: ec2559e863 72aac80184 Author: Stefan Kangas Date: Wed Sep 28 15:35:06 2022 +0200 Merge from origin/emacs-28 72aac80184 ; Fix typo c54a64491f Add .mailmap for proper git log output f9a072c592 ; Fix typo 3d056f6947 * doc/emacs/ack.texi (Acknowledgments): Update maintainers. 00159c086c ; Add commentary to disabled OTF support code in font.c # Conflicts: # src/font.c commit 72aac80184ce8f8a66bd7558fa935c229a6f13f7 Author: Stefan Kangas Date: Wed Sep 28 15:22:46 2022 +0200 ; Fix typo diff --git a/doc/emacs/ack.texi b/doc/emacs/ack.texi index 8f75c2c315..625aa706d5 100644 --- a/doc/emacs/ack.texi +++ b/doc/emacs/ack.texi @@ -1441,7 +1441,7 @@ Victor Zandy wrote @file{zone.el}, a package for people who like to zone out in front of Emacs. @item -Eli Zaretskii was the was the Emacs (co-)maintainer from Emacs 25 +Eli Zaretskii was the the Emacs (co-)maintainer from Emacs 25 onwards. He made many standard Emacs features work on MS-DOS and Microsoft Windows. He also wrote @file{tty-colors.el}, which implements transparent mapping of X colors to tty colors; and commit c54a64491f3944078d8da1e0cc81da7565a22de8 Author: Stefan Kangas Date: Wed Sep 28 14:50:24 2022 +0200 Add .mailmap for proper git log output This file is used to fix a few misspelled names in various git listings (e.g., "git log"). This can be used to fix incorrect attribution, poor display, or names showing up more than once. It also allows updating an old email addresses to a new one. See "man git-shortlog" for more information on the format. * .mailmap: New file. diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000000..f231fb5cc7 --- /dev/null +++ b/.mailmap @@ -0,0 +1,146 @@ +# +# This list is used to fix a few misspelled names in various git +# listings (e.g., "git log"). This can be used to fix incorrect +# attribution, poor display, or names showing up more than once. +# It also allows updating an old email addresses to a new one. +# +# See "man git-shortlog" for more information on the format. +# +# Keep file sorted using `M-x sort-lines'. +# +Alan Third +Alan Third +Alexander Gramiak +Amin Bandali +Andrea Corallo +Andrea Corallo +Andrea Corallo +Andrea Corallo +Andrew G Cohen +Andrew G Cohen +Arash Esbati +Arash Esbati +Artur Malabarba +Bastien Guerry +Carlos Pita +Chong Yidong +Christoph Scholtes +Christoph Scholtes +Clément Pit-Claudel +Clément Pit-Claudel +Courtney Bane +Dan Nicolaescu +Dan Nicolaescu +Daniel Colascione +David Abrahams +David M. Koppelman +Deniz Dogan +Dick R. Chiang +Earl Hyatt +Earl Hyatt +Edward M. Reingold +Eli Zaretskii +Emilio C. Lopes +Enami Tsugutomo +Era Eriksson +Eric S. Raymond +Etienne Prud’homme +Fabián Ezequiel Gallina +Francis Litterio +Gabor Vida +Gerd Möllmann +Gerd Möllmann +Glenn Morris +Glenn Morris +Glenn Morris +Gnus developers +Gregory Heytings +Grégoire Jadi +Ian Dunn +Jan Djärv +Jan Djärv +Jason Rumney +Jens Lechtenbörger +Jim Blandy +Jimmy Aguilar Mena +Joakim Verona +Joakim Verona +John Wiegley +Jose A. Ortega Ruiz +João Távora +Juri Linkov +Jérémy Compostella +Jürgen Hötzel +Karl Fogel +Kaushal Modi +Kelvin White +Kenichi Handa +Kenichi Handa +Kenichi Handa +Kenjiro Nakayama +Károly Lőrentey +Lars Ingebrigtsen +Lars Ingebrigtsen +Lars Ingebrigtsen +Lars Ingebrigtsen +Lars Ingebrigtsen +Lin Sun +Ludovic Courtès +Martin Rudalics +Martin Rudalics <“rudalics@gmx.at”> +Matt Armstrong +Matt Armstrong +Mattias Engdegård +Maxim Nikulin +Michael Albinus +Michalis V +Miha Rihtaršič +Nick Drozd +Nicolas Petton +Nitish Chandra +Noam Postavsky +Noam Postavsky +Paul Eggert +Paul Eggert +Paul Eggert +Paul Eggert +Peter J. Weisberg +Peter Oliver +Peter Oliver +Philip Kaludercic +Philip Kaludercic +Philip Kaludercic +Philipp Stephani +Philipp Stephani Philipp Stephani +Phillip Lord +Pierre Lorenzon +Pieter van Oostrum +Pip Cet +Przemysław Wojnowski +Rasmus +Richard M. Stallman +Robert J. Chassell +Ronnie Schnell +Ryan C. Thompson +Simen Heggestøyl +Simen Heggestøyl +Simon Josefsson +Stefan Kangas +Stefan Monnier +Tassilo Horn +Ted Zlatanov +Thien-Thi Nguyen +Thierry Volpiatto +Tino Calancha +Tino Calancha +Tom Tromey +Ulf Jasper +Ulrich Müller +Werner Lemberg +Wolfgang Scherer +Xi Lu +Xue Fuqiao +Óscar Fuentes +İ. Göktuğ Kayaalp +Łukasz Stelmach +Łukasz Stelmach commit ec2559e863e21c06915448e89584ed82149bfd6d Author: Eli Zaretskii Date: Wed Sep 28 15:53:22 2022 +0300 ; Move the thumbnail file-name entry to its proper place. diff --git a/etc/NEWS b/etc/NEWS index 8cb4de4d06..4c0c07b570 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2219,15 +2219,6 @@ nil to disable this confirmation completely. +++ *** 'image-dired-db-file' renamed to 'image-dired-tags-db-file'. ---- -*** Naming of thumbnail files has changed. -Thumbnail files generated when 'image-dired-thumbnail-storage' is -'image-dired' now always end in ".jpg". This fixes various issues on -different platforms, but means that thumbnails generated in Emacs 28 -will not be used in Emacs 29, and vice-versa. If disk space is an -issue, consider deleting the directory 'image-dired-dir' after -upgrading (usually "~/.emacs.d/image-dired/"). - --- *** 'image-dired-thumb-{height,width}' are now obsolete. Customize 'image-dired-thumb-size' instead, which will set both the @@ -2673,6 +2664,15 @@ This means that images found through 'find-image' also have auto-scaling applied. (This only makes a difference on HiDPI displays.) +--- +** Naming of thumbnail files has changed. +Names of thumbnail files generated when 'image-dired-thumbnail-storage' +is 'image-dired' now always end in ".jpg". This fixes various issues +on different platforms, but means that thumbnails generated in Emacs 28 +will not be used in Emacs 29, and vice-versa. If disk space is an +issue, consider deleting the directory 'image-dired-dir' after +upgrading (usually "~/.emacs.d/image-dired/"). + +++ ** Changes to "raw" in-memory xbm images are specified. Some years back Emacs gained the ability to scale images, and you commit 5d2985a03537c5e3a5e2119f39d018edc1fa8f92 Author: Eli Zaretskii Date: Wed Sep 28 15:49:32 2022 +0300 ; * doc/lispref/control.texi (Conditionals): Fix wording. diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index 9635b335bc..e0c5ddf2cb 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi @@ -295,9 +295,9 @@ For example: @end example If can be convenient to bind variables in conjunction with using a -conditional. It's often the case that you do a computation, and then -want to do something with that computation if it's non-@code{nil}. -The straightforward way to do that is to just write, for instance: +conditional. It's often the case that you compute a value, and then +want to do something with that value if it's non-@code{nil}. The +straightforward way to do that is to just write, for instance: @example (let ((result1 (do-computation))) commit 2286fbceaba49473e94011d2c37549f38304497a Author: समीर सिंह Sameer Singh Date: Tue Sep 27 16:44:28 2022 +0530 Add support for the Adlam script (bug#58111) * lisp/language/misc-lang.el ("Adlam"): New language environment. Add composition rules for Adlam. Add sample text and input method. * lisp/international/fontset.el (script-representative-chars): Support Adlam. * lisp/leim/quail/misc-lang.el ("adlam"): New input method. * etc/HELLO: Add Adlam greeting. * etc/NEWS: Announce the new language environment. diff --git a/etc/HELLO b/etc/HELLO index d73465318c..18c5ee5e54 100644 --- a/etc/HELLO +++ b/etc/HELLO @@ -24,6 +24,7 @@ Non-ASCII examples: LANGUAGE (NATIVE NAME) HELLO ---------------------- ----- +Adlam (𞤀𞤣𞤤𞤢𞤥) 𞤅𞤢𞤤𞤢𞥄𞤥 Amharic (አማርኛ) ሠላም Arabic (العربيّة) السّلام عليكم Armenian (հայերեն) Բարև ձեզ diff --git a/etc/NEWS b/etc/NEWS index e70f9be546..8cb4de4d06 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1229,10 +1229,10 @@ to edit such sequences by allowing point to "enter" the sequence. *** Support for many old scripts and writing systems. Emacs now supports and has language-environments and input methods for several dozens of old scripts that were used in the past for various -languages in South and South-East Asia. For each such script Emacs -now has font-selection and character composition rules, a language -environment, and an input method. The newly-added scripts and the -corresponding language environments are: +languages. For each such script Emacs now has font-selection and +character composition rules, a language environment, and an input +method. The newly-added scripts and the corresponding language +environments are: Tai Tham script and the Northern Thai language environment Brahmi script and language environment @@ -1259,6 +1259,7 @@ Grantha script and language environment Kharoshthi script and language environment Lepcha script and language environment Meetei Mayek script and language environment +Adlam script and language environment --- *** The "Oriya" language environment was renamed to "Odia". diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index ff2411eb86..3cd7765ef8 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el @@ -295,7 +295,7 @@ (wancho #x1e2c0) (nag-mundari #x1E4D0 #x1E4EB #x1E4F0) (mende-kikakui #x1E810) - (adlam #x1E900) + (adlam #x1E900 #x1E943) (indic-siyaq-number #x1ec71) (ottoman-siyaq-number #x1ed01) (mahjong-tile #x1F000) diff --git a/lisp/language/misc-lang.el b/lisp/language/misc-lang.el index 3d5b68f84b..bd1edb9185 100644 --- a/lisp/language/misc-lang.el +++ b/lisp/language/misc-lang.el @@ -269,6 +269,28 @@ using the Kharoṣṭhī script."))) modifier "*") 1 'font-shape-gstring)))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Adlam +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(set-language-info-alist + "Adlam" '((charset unicode) + (coding-system utf-8) + (coding-priority utf-8) + (input-method . "adlam") + (sample-text . "Adlam (𞤀𞤣𞤤𞤢𞤥) 𞤅𞤢𞤤𞤢𞥄𞤥") + (documentation . "\ +Fulani language and its script Adlam are supported +in this language environment."))) + +;; Adlam composition rules +(set-char-table-range + composition-function-table + '(#x1E900 . #x1E95F) + (list (vector + "[\x1E900-\x1E95F]+" + 0 'font-shape-gstring))) + (provide 'misc-lang) ;;; misc-lang.el ends here diff --git a/lisp/leim/quail/misc-lang.el b/lisp/leim/quail/misc-lang.el index 0c4a0d4ce4..6bafa6b5fb 100644 --- a/lisp/leim/quail/misc-lang.el +++ b/lisp/leim/quail/misc-lang.el @@ -1180,5 +1180,102 @@ (".||" ?𐩗) (".=" ?𐩘)) +(quail-define-package + "adlam" "Adlam" "𞤀" t "Adlam input method. + + `\\=`' is used to switch levels instead of Alt-Gr. +" nil t t t t nil nil nil nil nil t) + +(quail-define-rules + ("1" ?𞥑) + ("`!" ?𞥞) + ("2" ?𞥒) + ("3" ?𞥓) + ("4" ?𞥔) + ("5" ?𞥕) + ("6" ?𞥖) + ("7" ?𞥗) + ("8" ?𞥘) + ("9" ?𞥙) + ("0" ?𞥐) + ("q" ?𞤹) + ("Q" ?𞤗) + ("`q" ?𞥆) + ("w" ?𞤱) + ("W" ?𞤏) + ("`w" ?𞥈) + ("`W" ?𞥉) + ("e" ?𞤫) + ("E" ?𞤉) + ("`e" ?𞥅) + ("r" ?𞤪) + ("R" ?𞤈) + ("t" ?𞤼) + ("T" ?𞤚) + ("y" ?𞤴) + ("Y" ?𞤒) + ("`y" ?𞤰) + ("`Y" ?𞤎) + ("u" ?𞤵) + ("U" ?𞤓) + ("i" ?𞤭) + ("I" ?𞤋) + ("o" ?𞤮) + ("O" ?𞤌) + ("p" ?𞤨) + ("P" ?𞤆) + ("a" ?𞤢) + ("A" ?𞤀) + ("`a" ?𞥄) + ("s" ?𞤧) + ("S" ?𞤅) + ("`s" ?𞥃) + ("`S" ?𞤡) + ("d" ?𞤣) + ("D" ?𞤁) + ("`d" ?𞤯) + ("`D" ?𞤍) + ("f" ?𞤬) + ("F" ?𞤊) + ("g" ?𞤺) + ("G" ?𞤘) + ("`g" ?𞥀) + ("`G" ?𞤞) + ("h" ?𞤸) + ("H" ?𞤖) + ("`h" ?𞥇) + ("j" ?𞤶) + ("J" ?𞤔) + ("k" ?𞤳) + ("K" ?𞤑) + ("`k" ?𞤿) + ("`K" ?𞤝) + ("l" ?𞤤) + ("L" ?𞤂) + ("z" ?𞥁) + ("Z" ?𞤟) + ("`z" ?𞥂) + ("`Z" ?𞤠) + ("x" ?𞤽) + ("X" ?𞤛) + ("c" ?𞤷) + ("C" ?𞤕) + ("`c" #x200C) ; ZWNJ + ("v" ?𞤾) + ("V" ?𞤜) + ("`v" ?𞥊) + ("b" ?𞤦) + ("B" ?𞤄) + ("`b" ?𞤩) + ("`B" ?𞤇) + ("n" ?𞤲) + ("N" ?𞤐) + ("`n" ?𞤻) + ("`N" ?𞤙) + ("m" ?𞤥) + ("M" ?𞤃) + ("`m" ?𞥋) + ("`/" ?𞥟)) + (provide 'misc-lang) ;;; misc-lang.el ends here commit db74fd0a4dba7a7e7abff50501eb6f0961f2e4d6 Merge: 64c07c01c1 5f7d9a1a9f Author: Eli Zaretskii Date: Wed Sep 28 15:38:23 2022 +0300 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs commit 64c07c01c193d8b3d5171dcbbcdad7ad7f139167 Author: समीर सिंह Sameer Singh Date: Tue Sep 27 00:03:23 2022 +0530 Improve Gurmukhi composition rules (Bug#58098) * lisp/language/indian.el: Improve composition rules for Gurmukhi. * lisp/international/fontset.el (script-representative-chars) (setup-default-fontset): Support Chess Symbols. diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el index 99c7848704..ff2411eb86 100644 --- a/lisp/international/fontset.el +++ b/lisp/international/fontset.el @@ -300,7 +300,8 @@ (ottoman-siyaq-number #x1ed01) (mahjong-tile #x1F000) (domino-tile #x1F030) - (emoji #x1F300 #x1F600))) + (emoji #x1F300 #x1F600) + (chess-symbol . [#x1FA00 #x1FA67]))) (defvar otf-script-alist) @@ -836,7 +837,8 @@ tai-tham mahjong-tile domino-tile - emoji)) + emoji + chess-symbol)) (set-fontset-font "fontset-default" script (font-spec :registry "iso10646-1" :script script) nil 'append)) diff --git a/lisp/language/indian.el b/lisp/language/indian.el index 407173827f..81b7cbd99b 100644 --- a/lisp/language/indian.el +++ b/lisp/language/indian.el @@ -340,23 +340,24 @@ language environment.")) (defconst gurmukhi-composable-pattern (let ((table - '(("a" . "[\u0A01\u0A02\u0A70]") ; SIGN ADAK BINDI .. BINDI, TIPPI + '(("a" . "[\u0A01\u0A02\u0A70\u0A71\u0A75]") ; SIGN ADAK BINDI .. BINDI, TIPPI, ADDAK, YAKASH ("A" . "\u0A03") ; SIGN VISARGA - ("V" . "[\u0A05-\u0A14]") ; independent vowel + ("V" . "[\u0A05-\u0A14\u0A72\u0A73]") ; independent vowel ("C" . "[\u0A15-\u0A39\u0A59-\u0A5E]") ; consonant ("Y" . "[\u0A2F\u0A30\u0A35\u0A39]") ; YA, RA, VA, HA ("n" . "\u0A3C") ; NUKTA ("v" . "[\u0A3E-\u0A4C]") ; vowel sign ("H" . "\u0A4D") ; VIRAMA + ("s" . "\u0A51") ; stress sign ("N" . "\u200C") ; ZWNJ ("J" . "\u200D") ; ZWJ ("X" . "[\u0A00-\u0A7F]")))) ; all coverage (indian-compose-regexp (concat ;; consonant-based syllables, or - "Cn?\\(?:J?HJ?Cn?\\)*\\(?:H[NJ]?\\|v*n?a?A?\\)\\|" + "Cn?\\(?:J?HJ?Cn?\\)*\\(?:H[NJ]?\\|v*n?a?s?v?A?\\)\\|" ;; syllables with an independent vowel, or - "Vn?\\(?:J?HY\\)?v*n?a?A?\\|" + "Vn?\\(?:J?HY\\)?v*n?a?s?A?\\|" ;; special consonant form, or "JHY\\|" ;; any other singleton characters commit 5f7d9a1a9f9ac2b57cd84da6a1bd460b3111562b Author: Po Lu Date: Wed Sep 28 20:33:24 2022 +0800 Apply root window coordinate optimizations to crossing events as well * src/xterm.c (xi_compute_root_window_offset_enter): New function. (handle_one_xevent): Apply root window crossing optimizations to XI_Enter and XI_Leave events too. Not strictly necessary but since we apply them to motion events it would be consistent to apply them to crossing events as well as recommended by the ICCCM. diff --git a/src/xterm.c b/src/xterm.c index d7ea63bb4f..409d39b27e 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -13584,6 +13584,13 @@ xi_compute_root_window_offset (struct frame *f, XIDeviceEvent *xev) xev->event_x, xev->event_y); } +static void +xi_compute_root_window_offset_enter (struct frame *f, XIEnterEvent *enter) +{ + x_compute_root_window_offset (f, enter->root_x, enter->root_y, + enter->event_x, enter->event_y); +} + #ifdef HAVE_XINPUT2_4 static void @@ -19495,6 +19502,16 @@ handle_one_xevent (struct x_display_info *dpyinfo, f = any; + if (f && event->xcrossing.window == FRAME_X_WINDOW (f)) + x_compute_root_window_offset (f, event->xcrossing.x_root, + event->xcrossing.y_root, + event->xcrossing.x, + event->xcrossing.y); + + /* The code below relies on the first several fields of + XCrossingEvent being laid out the same way as + XMotionEvent. */ + if (f && x_mouse_click_focus_ignore_position) { ignore_next_mouse_click_timeout = (event->xmotion.time @@ -19639,6 +19656,13 @@ handle_one_xevent (struct x_display_info *dpyinfo, || EQ (track_mouse, Qdropping)) && gui_mouse_grabbed (dpyinfo))) do_help = -1; + + if (event->xcrossing.window == FRAME_X_WINDOW (f)) + x_compute_root_window_offset (f, event->xcrossing.x_root, + event->xcrossing.y_root, + event->xcrossing.x, + event->xcrossing.y); + } #ifdef USE_GTK /* See comment in EnterNotify above */ @@ -21049,6 +21073,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, f = any; + if (f && enter->event == FRAME_X_WINDOW (f)) + xi_compute_root_window_offset_enter (f, enter); + if (f && x_mouse_click_focus_ignore_position) { ignore_next_mouse_click_timeout = (enter->time @@ -21245,6 +21272,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, || EQ (track_mouse, Qdropping)) && gui_mouse_grabbed (dpyinfo))) do_help = -1; + + if (f && leave->event == FRAME_X_WINDOW (f)) + xi_compute_root_window_offset_enter (f, leave); } #ifdef USE_GTK /* See comment in EnterNotify above */ commit 9f32e6dea15c7167c794658a56c7c0861dd6dedd Author: Stefan Kangas Date: Wed Sep 28 14:31:05 2022 +0200 * lisp/files.el (auto-mode-alist): Add entry for ".mailmap". diff --git a/lisp/files.el b/lisp/files.el index b953961aa1..5463f3b5ec 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3016,6 +3016,7 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|CBR\\|7Z\\|SQUASHFS\\)\\'" . ("[cC]hange[lL]og[-.][-0-9a-z]+\\'" . change-log-mode) ;; either user's dot-files or under /etc or some such ("/\\.?\\(?:gitconfig\\|gnokiirc\\|hgrc\\|kde.*rc\\|mime\\.types\\|wgetrc\\)\\'" . conf-mode) + ("/\\.mailmap\\'" . conf-unix-mode) ;; alas not all ~/.*rc files are like this ("/\\.\\(?:asound\\|enigma\\|fetchmail\\|gltron\\|gtk\\|hxplayer\\|mairix\\|mbsync\\|msmtp\\|net\\|neverball\\|nvidia-settings-\\|offlineimap\\|qt/.+\\|realplayer\\|reportbug\\|rtorrent\\.\\|screen\\|scummvm\\|sversion\\|sylpheed/.+\\|xmp\\)rc\\'" . conf-mode) ("/\\.\\(?:gdbtkinit\\|grip\\|mpdconf\\|notmuch-config\\|orbital/.+txt\\|rhosts\\|tuxracer/options\\)\\'" . conf-mode) commit 26ef0f122175549174ad940b63a7074e80740836 Author: Stefan Kangas Date: Wed Sep 28 14:29:11 2022 +0200 ; image-dired: Fix last change * test/lisp/image/image-dired-util-tests.el (image-dired-thumb-name/per-directory): * lisp/image/image-dired-util.el (image-dired-thumb-name): Fix last change. diff --git a/lisp/image/image-dired-util.el b/lisp/image/image-dired-util.el index dd746886a4..bc7a355262 100644 --- a/lisp/image/image-dired-util.el +++ b/lisp/image/image-dired-util.el @@ -88,7 +88,8 @@ See also `image-dired-thumbnail-storage'." (expand-file-name (format "%s.jpg" (sha1 file)) (image-dired-dir))) ((eq 'per-directory image-dired-thumbnail-storage) - (expand-file-name (format "%s.thumb.jpg" file) + (expand-file-name (format "%s.thumb.jpg" + (file-name-nondirectory file)) (expand-file-name ".image-dired" (file-name-directory file))))))) diff --git a/test/lisp/image/image-dired-util-tests.el b/test/lisp/image/image-dired-util-tests.el index cd371ef61a..63d42f56de 100644 --- a/test/lisp/image/image-dired-util-tests.el +++ b/test/lisp/image/image-dired-util-tests.el @@ -63,9 +63,9 @@ (file-name-nondirectory (image-dired-thumb-name "foo.jpg")) (file-name-nondirectory (image-dired-thumb-name "/tmp/foo.jpg")))) (should (equal (file-name-split (image-dired-thumb-name "/tmp/foo.jpg")) - '("" "tmp" ".image-dired" "foo.thumb.jpg"))) + '("" "tmp" ".image-dired" "foo.jpg.thumb.jpg"))) (should (equal (file-name-nondirectory (image-dired-thumb-name "foo.jpg")) - "foo.thumb.jpg")))) + "foo.jpg.thumb.jpg")))) ;;; image-dired-util-tests.el ends here commit eac4e34a2c0fd3b7a7e2c1205f452dc65db3fd9d Author: Lars Ingebrigtsen Date: Wed Sep 28 13:27:05 2022 +0200 Simplify eww--rescale-images code * lisp/net/eww.el (eww--rescale-images): Simplify code. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 624958915a..414de931c4 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1189,18 +1189,17 @@ the like." (defun eww--rescale-images () (let ((scaling (if text-scale-mode (+ 1 (* text-scale-mode-amount 0.1)) - 1)) - match) + 1))) (save-excursion (goto-char (point-min)) - (while (setq match (text-property-search-forward 'display)) + (while-let ((match (text-property-search-forward + 'display nil (lambda (_ value) (imagep value))))) (let ((image (prop-match-value match))) - (when (imagep image) - (unless (image-property image :original-scale) - (setf (image-property image :original-scale) - (or (image-property image :scale) 1))) - (setf (image-property image :scale) - (* (image-property image :original-scale) scaling)))))))) + (unless (image-property image :original-scale) + (setf (image-property image :original-scale) + (or (image-property image :scale) 1))) + (setf (image-property image :scale) + (* (image-property image :original-scale) scaling))))))) (defun eww--url-at-point () "`thing-at-point' provider function." commit 12f63c18f6d5a886f62f10b4c8de8de3509e52df Author: Lars Ingebrigtsen Date: Wed Sep 28 13:19:08 2022 +0200 Add new macro 'while-let' * doc/lispref/control.texi (Conditionals): Document when-let/if-let/while-let. * lisp/subr.el (while-let): New macro. diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index ee2acdb002..9635b335bc 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi @@ -294,6 +294,48 @@ For example: @end group @end example +If can be convenient to bind variables in conjunction with using a +conditional. It's often the case that you do a computation, and then +want to do something with that computation if it's non-@code{nil}. +The straightforward way to do that is to just write, for instance: + +@example +(let ((result1 (do-computation))) + (when result1 + (let ((result2 (do-more result1))) + (when result2 + (do-something result2))))) +@end example + +Since this is a very common pattern, Emacs provides a number of macros +to make this easier and more readable. The above can be written the +following way instead: + +@example +(when-let ((result1 (do-computation)) + (result2 (do-more result1))) + (do-something result2)) +@end example + +There's a number of variations on this theme, and they're briefly +described below. + +@defmac if-let spec then-form else-forms... +Evaluate each binding in @var{spec} in turn, like in @code{let*} +(@pxref{Local Variables}, stopping if a binding value is @code{nil}. +If all are non-@code{nil}, return the value of @var{then-form}, +otherwise the last form in @var{else-forms}. +@end defmac + +@defmac when-let spec then-forms... +Like @code{if-let}, but without @var{else-forms}. +@end defmac + +@defmac while-let spec then-forms... +Like @code{when-let}, but repeat until a binding in @var{spec} is +@code{nil}. The return value is always @code{nil}. +@end defmac + @node Combining Conditions @section Constructs for Combining Conditions @cindex combining conditions diff --git a/etc/NEWS b/etc/NEWS index b85975944a..e70f9be546 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3012,6 +3012,10 @@ The following generalized variables have been made obsolete: * Lisp Changes in Emacs 29.1 ++++ +** New macro 'while-let'. +This is like 'when-let', but repeats until a binding form is nil. + +++ ** New function 'make-obsolete-generalized-variable'. This can be used to mark setters used by 'setf' as obsolete, and the diff --git a/lisp/subr.el b/lisp/subr.el index 26fba4771b..2a8fc46a9f 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -2514,7 +2514,20 @@ The variable list SPEC is the same as in `if-let'." (declare (indent 1) (debug if-let)) (list 'if-let spec (macroexp-progn body))) +(defmacro while-let (spec &rest body) + "Bind variables according to SPEC and conditionally evaluate BODY. +Evaluate each binding in turn, stopping if a binding value is nil. +If all bindings are non-nil, eval BODY and repeat. +The variable list SPEC is the same as in `if-let'." + (declare (indent 1) (debug if-let)) + (let ((done (gensym "done"))) + `(catch ',done + (while t + (if-let ,spec + (progn + ,@body) + (throw ',done nil)))))) ;; PUBLIC: find if the current mode derives from another. commit fe002cc8ce38efb256a2a60660ee626c2b2cdf81 Author: Jose A. Ortega Ruiz Date: Wed Sep 28 13:06:38 2022 +0200 docview: new customization options for imenu * doc/emacs/misc.texi (DocView Navigation): * lisp/doc-view.el (doc-view-imenu-title-format, doc-view-imenu-flatten): (doc-view--imenu-subtree): customizable format for imenu entry titles, and flag to disable nested submenus. * lisp/doc-view.el (doc-view--pdf-outline): clean up whitespace markers '\r' and '\t' in imenu item titles (bug#58131). diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 04f7f2e921..cef2580f3b 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -585,11 +585,16 @@ default size for DocView, customize the variable @code{doc-view-resolution}. @vindex doc-view-imenu-enabled +@vindex doc-view-imenu-flatten +@vindex doc-view-imenu-format When the @command{mutool} program is available, DocView will use it to generate entries for an outline menu, making it accessible via the @code{imenu} facility (@pxref{Imenu}). To disable this functionality -even when @command{mutool} can be found on your system, customize -the variable @code{doc-view-imenu-enabled} to the @code{nil} value. +even when @command{mutool} can be found on your system, customize the +variable @code{doc-view-imenu-enabled} to the @code{nil} value. You +can further customize how @code{imenu} items are formatted and +displayed using the variables @code{doc-view-imenu-format} and +@code{doc-view-flatten}. @node DocView Searching @subsection DocView Searching diff --git a/lisp/doc-view.el b/lisp/doc-view.el index fa583df12b..9e3bb6e46c 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -219,6 +219,23 @@ are available (see Info node `(emacs)Document View')." :type 'boolean :version "29.1") +(defcustom doc-view-imenu-title-format "%t (%p)" + "Format string for document section titles in imenu. + +The special markers '%t' and '%p' are replaced by the section +title and page number in this format string, which uses +`format-spec'. + +For instance, setting this variable to \"%t\" will produce items +showing only titles and no page number." + :type 'string + :version "29.1") + +(defcustom doc-view-imenu-flatten nil + "Whether to generate a flat list of sections instead of a nested tree." + :type 'boolean + :version "29.1") + (defcustom doc-view-svg-background "white" "Background color for svg images. See `doc-view-mupdf-use-svg'." @@ -1898,7 +1915,8 @@ structure is extracted by `doc-view--imenu-subtree'." (goto-char (point-min)) (while (re-search-forward doc-view--outline-rx nil t) (push `((level . ,(length (match-string 1))) - (title . ,(match-string 2)) + (title . ,(replace-regexp-in-string "\\\\[rt]" " " + (match-string 2))) (page . ,(string-to-number (match-string 3)))) outline))) (nreverse outline))) @@ -1911,11 +1929,14 @@ the first node in the outline and all its siblings at the same level. Returns that imenu alist together with any other pending outline entries at an upper level." (let ((level (alist-get 'level (car outline))) + (nested (not doc-view-imenu-flatten)) (index nil)) - (while (and (car outline) (<= level (alist-get 'level (car outline)))) + (while (and (car outline) + (or nested (<= level (alist-get 'level (car outline))))) (let-alist (car outline) - (let ((title (format "%s (%s)" .title .page))) - (if (> .level level) + (let ((title (format-spec doc-view-imenu-title-format + `((?t . ,.title) (?p . ,.page))))) + (if (and nested (> .level level)) (let ((sub (doc-view--imenu-subtree outline act)) (fst (car index))) (setq index (cdr index)) commit ec121e035bfed692634faf3a67e97de68c991ea3 Author: Lin Sun Date: Wed Sep 28 13:05:26 2022 +0200 package-update would always re-install package * lisp/emacs-lisp/package.el (package--updateable-packages): fix version comparison between available packages and archived packages (bug#58129). diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 70c15d2793..4abee9d053 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2189,8 +2189,8 @@ to install it but still mark it as selected." (assq (car elt) package-archive-contents))) (and available (version-list-< - (package-desc-priority-version (cadr elt)) - (package-desc-priority-version (cadr available)))))) + (package-desc-version (cadr elt)) + (package-desc-version (cadr available)))))) package-alist))) ;;;###autoload commit c2b9e74686282706e8c2784048616479280b7214 Author: Visuwesh Date: Wed Sep 28 12:59:04 2022 +0200 Follow #target links in eww without re-rendering * lisp/net/eww.el (eww-follow-link): Do a text property search instead of re-rendering to follow #target links in the same page. (bug#58118) (eww-link-keymap): Bind to eww-follow-link as well. diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 61b1b75068..624958915a 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -315,7 +315,8 @@ parameter, and should return the (possibly) transformed URL." (defvar-keymap eww-link-keymap :parent shr-map - "RET" #'eww-follow-link) + "RET" #'eww-follow-link + "" #'eww-follow-link) (defvar-keymap eww-image-link-keymap :parent shr-map @@ -1901,7 +1902,8 @@ If EXTERNAL is double prefix, browse in new buffer." eww-mode) (mouse-set-point mouse-event) (let* ((orig-url (get-text-property (point) 'shr-url)) - (url (eww--transform-url orig-url))) + (url (eww--transform-url orig-url)) + target) (cond ((not url) (message "No link under point")) @@ -1913,12 +1915,17 @@ If EXTERNAL is double prefix, browse in new buffer." (funcall browse-url-secondary-browser-function url) (shr--blink-link)) ;; This is a #target url in the same page as the current one. - ((and (url-target (url-generic-parse-url url)) + ((and (setq target (url-target (url-generic-parse-url url))) (eww-same-page-p url (plist-get eww-data :url))) - (let ((dom (plist-get eww-data :dom))) + (let ((point (point))) (eww-save-history) (plist-put eww-data :url url) - (eww-display-html 'utf-8 url dom nil (current-buffer)))) + (goto-char (point-min)) + (if-let ((match (text-property-search-forward 'shr-target-id target #'member))) + (goto-char (prop-match-beginning match)) + (goto-char (if (equal target "top") + (point-min) + point))))) (t (eww-browse-url orig-url external))))) commit ca043773db1e72a765ef8984bf70b0322eff46e2 Author: Stefan Kangas Date: Wed Sep 28 12:23:29 2022 +0200 ; Fix debugging image-dired-dired-toggle-marked-thumbs * lisp/image/image-dired-dired.el (image-dired-dired-toggle-marked-thumbs): Fix debugging. diff --git a/lisp/image/image-dired-dired.el b/lisp/image/image-dired-dired.el index d03c1629da..46adf3f26f 100644 --- a/lisp/image/image-dired-dired.el +++ b/lisp/image/image-dired-dired.el @@ -63,6 +63,7 @@ current line. ARG, if non-nil, specifies the files to use instead of the marked files. If ARG is an integer, use the next ARG (or previous -ARG, if ARG<0) files." (interactive "P" dired-mode) + (setq image-dired--generate-thumbs-start (current-time)) (dired-map-over-marks (let ((image-pos (dired-move-to-filename)) (image-file (dired-get-filename nil t)) commit 6cffaa3b6daf767808a9d9ae549fc2aea5c5c07e Author: Stefan Kangas Date: Wed Sep 28 00:41:01 2022 +0200 image-dired: End thumbnail file names with ".jpg" * lisp/image/image-dired-util.el (image-dired-thumb-name): Always end thumbnail name in ".jpg" and simplify naming to just use the SHA-1 hash. (Bug#57961) * test/lisp/image/image-dired-util-tests.el (image-dired-thumb-name/image-dired): Adjust test for the above change. * etc/NEWS: Announce the above change. diff --git a/etc/NEWS b/etc/NEWS index 99243481a0..b85975944a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2218,6 +2218,15 @@ nil to disable this confirmation completely. +++ *** 'image-dired-db-file' renamed to 'image-dired-tags-db-file'. +--- +*** Naming of thumbnail files has changed. +Thumbnail files generated when 'image-dired-thumbnail-storage' is +'image-dired' now always end in ".jpg". This fixes various issues on +different platforms, but means that thumbnails generated in Emacs 28 +will not be used in Emacs 29, and vice-versa. If disk space is an +issue, consider deleting the directory 'image-dired-dir' after +upgrading (usually "~/.emacs.d/image-dired/"). + --- *** 'image-dired-thumb-{height,width}' are now obsolete. Customize 'image-dired-thumb-size' instead, which will set both the diff --git a/lisp/image/image-dired-util.el b/lisp/image/image-dired-util.el index e7d116d90b..dd746886a4 100644 --- a/lisp/image/image-dired-util.el +++ b/lisp/image/image-dired-util.el @@ -70,37 +70,28 @@ file name of the thumbnail will vary: of the image file's directory name will be added to the filename. See also `image-dired-thumbnail-storage'." - (cond ((memq image-dired-thumbnail-storage - image-dired--thumbnail-standard-sizes) - (let ((thumbdir (cl-case image-dired-thumbnail-storage - (standard "thumbnails/normal") - (standard-large "thumbnails/large") - (standard-x-large "thumbnails/x-large") - (standard-xx-large "thumbnails/xx-large")))) - (expand-file-name - ;; MD5 is mandated by the Thumbnail Managing Standard. - (concat (md5 (concat "file://" (expand-file-name file))) ".png") - (expand-file-name thumbdir (xdg-cache-home))))) - ((or (eq 'image-dired image-dired-thumbnail-storage) - ;; Maintained for backwards compatibility: - (eq 'use-image-dired-dir image-dired-thumbnail-storage)) - (let* ((f (expand-file-name file)) - (hash (md5 (file-name-as-directory (file-name-directory f))))) - (expand-file-name - (format "%s%s.thumb.%s" - (file-name-base f) - (if hash (concat "_" hash) "") - (file-name-extension f)) - (image-dired-dir)))) - ((eq 'per-directory image-dired-thumbnail-storage) - (let ((f (expand-file-name file))) - (expand-file-name - (format "%s.thumb.%s" - (file-name-base f) - (file-name-extension f)) - (expand-file-name - ".image-dired" - (file-name-directory f))))))) + (let ((file (expand-file-name file))) + (cond ((memq image-dired-thumbnail-storage + image-dired--thumbnail-standard-sizes) + (let ((thumbdir (cl-case image-dired-thumbnail-storage + (standard "thumbnails/normal") + (standard-large "thumbnails/large") + (standard-x-large "thumbnails/x-large") + (standard-xx-large "thumbnails/xx-large")))) + (expand-file-name + ;; MD5 is mandated by the Thumbnail Managing Standard. + (concat (md5 (concat "file://" file)) ".png") + (expand-file-name thumbdir (xdg-cache-home))))) + ((or (eq 'image-dired image-dired-thumbnail-storage) + ;; Maintained for backwards compatibility: + (eq 'use-image-dired-dir image-dired-thumbnail-storage)) + (expand-file-name (format "%s.jpg" (sha1 file)) + (image-dired-dir))) + ((eq 'per-directory image-dired-thumbnail-storage) + (expand-file-name (format "%s.thumb.jpg" file) + (expand-file-name + ".image-dired" + (file-name-directory file))))))) (defvar image-dired-thumbnail-buffer "*image-dired*" "Image-Dired's thumbnail buffer.") diff --git a/test/lisp/image/image-dired-util-tests.el b/test/lisp/image/image-dired-util-tests.el index 9fb457dd36..cd371ef61a 100644 --- a/test/lisp/image/image-dired-util-tests.el +++ b/test/lisp/image/image-dired-util-tests.el @@ -48,9 +48,12 @@ (file-name-directory (image-dired-thumb-name "foo.jpg")) (file-name-directory (image-dired-thumb-name "/tmp/foo.jpg")))) (should (equal (file-name-nondirectory - ;; The checksum is based on the directory name. + ;; The checksum is based on the file name. (image-dired-thumb-name "/some/path/foo.jpg")) - "foo_45fff7fcc4a0945679b7b11dec36a82d.thumb.jpg"))))) + "dc4e6f7068157023e7f2e8362d15bdd2e3ca89e4.jpg")) + (should (equal (file-name-extension + (image-dired-thumb-name "foo.gif")) + "jpg"))))) (ert-deftest image-dired-thumb-name/per-directory () (let ((image-dired-thumbnail-storage 'per-directory)) commit b5b59d1b8afe1e13f63190b9688ddfd9605f2945 Author: Stefan Kangas Date: Tue Sep 27 23:51:21 2022 +0200 Standardize XPM files These headers make GraphicsMagick croak with "Improper image header". Note that the copyright information is already in README. * etc/images/checked.xpm: * etc/images/gnus/gnus.xpm: * etc/images/gnus/gnus-pointer.xpm: * etc/images/mh-logo.xpm: * etc/images/unchecked.xpm: Normalize file headers. diff --git a/etc/images/checked.xpm b/etc/images/checked.xpm index aefa9dd5da..4dbcb9e6fd 100644 --- a/etc/images/checked.xpm +++ b/etc/images/checked.xpm @@ -1,23 +1,4 @@ /* XPM */ -/* Copyright (C) 2010-2022 Free Software Foundation, Inc. - * - * Author: Chong Yidong - * - * This file is part of GNU Emacs. - * - * GNU Emacs is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GNU Emacs is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Emacs. If not, see . - */ static char * checked_xpm[] = { "12 12 5 1", " c None", diff --git a/etc/images/gnus/gnus-pointer.xpm b/etc/images/gnus/gnus-pointer.xpm index c47443dbb7..5328b15bed 100644 --- a/etc/images/gnus/gnus-pointer.xpm +++ b/etc/images/gnus/gnus-pointer.xpm @@ -1,7 +1,7 @@ /* XPM */ -static char *gnus-pointer[] = { +static char *gnus_pointer_xpm[] = { /* width height num_colors chars_per_pixel */ -" 18 13 2 1", +"18 13 2 1", /* colors */ ". c #0000ff", "# c None s None", @@ -19,4 +19,4 @@ static char *gnus-pointer[] = { "###....####.######", "###..######.######", "###########.######" -}; \ No newline at end of file +}; diff --git a/etc/images/gnus/gnus.xpm b/etc/images/gnus/gnus.xpm index b6ee4d0d73..4f46eca4fa 100644 --- a/etc/images/gnus/gnus.xpm +++ b/etc/images/gnus/gnus.xpm @@ -1,7 +1,7 @@ /* XPM */ -static char *gnus[] = { +static char *gnus_xpm[] = { /* width height num_colors chars_per_pixel */ -" 271 273 3 1", +"271 273 3 1", /* colors */ ". s thing c #bf9900", "# s shadow c #ffcc00", diff --git a/etc/images/mh-logo.xpm b/etc/images/mh-logo.xpm index 846859e058..637c456964 100644 --- a/etc/images/mh-logo.xpm +++ b/etc/images/mh-logo.xpm @@ -1,32 +1,8 @@ /* XPM */ -/* MH-E Logo - * - * Copyright (C) 2003-2022 Free Software Foundation, Inc. - * - * Author: Satyaki Das - * - * This file is part of GNU Emacs. - * - * GNU Emacs is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GNU Emacs is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Emacs. If not, see . - */ -static char *mh-e[] = { -/* width height num_colors chars_per_pixel */ -" 18 13 2 1", -/* colors */ +static char *mh_logo_xpm[] = { +"18 13 2 1", "# c #666699", ". c None s None", -/* pixels */ "........##........", ".......####.......", "......######......", diff --git a/etc/images/unchecked.xpm b/etc/images/unchecked.xpm index b758346b96..85eec75230 100644 --- a/etc/images/unchecked.xpm +++ b/etc/images/unchecked.xpm @@ -1,23 +1,4 @@ /* XPM */ -/* Copyright (C) 2010-2022 Free Software Foundation, Inc. - * - * Author: Chong Yidong - * - * This file is part of GNU Emacs. - * - * GNU Emacs is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GNU Emacs is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Emacs. If not, see . - */ static char * unchecked_xpm[] = { "12 12 5 1", " c None", commit f6fb2b9e1f94917601201f5d43c15e92e99b2a2f Author: Paul Eggert Date: Wed Sep 28 01:06:10 2022 -0700 Port better to C23 bool+true+false keywords C23 is adding the C++ keywords bool, true, and false; prefer them to if they are available. * admin/merge-gnulib (GNULIB_MODULES): Add stdbool, which emulates C23 on pre-C23 platforms. (AVOIDED_MODULES): Remove stdbool; Gnulib has renamed this module to stdbool-c99 and nobody uses it so it does not need to be avoided. * m4/c-bool.m4: New file, from Gnulib stdbool module. * lib-src/seccomp-filter.c, src/conf_post.h, src/dynlib.h: * src/emacs-module.c, src/nsterm.m, src/systhread.h: * test/src/emacs-module-resources/mod-test.c: Use the C23 style and use bool without including . The Gnulib stdbool module causes config.h to include stdbool.h on pre-C23 platforms. * src/emacs-module.h.in: Don’t include if C23 or later, or if it has already been included. diff --git a/admin/merge-gnulib b/admin/merge-gnulib index 4dd6a4d222..d3c5520ad0 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib @@ -43,7 +43,7 @@ GNULIB_MODULES=' nanosleep nproc nstrftime pathmax pipe2 pselect pthread_sigmask qcopy-acl readlink readlinkat regex - sig2str sigdescr_np socklen stat-time std-gnu11 stdalign stddef stdio + sig2str sigdescr_np socklen stat-time std-gnu11 stdalign stdbool stddef stdio stpcpy strnlen strtoimax symlink sys_stat sys_time tempname time time_r time_rz timegm timer-time timespec-add timespec-sub update-copyright unlocked-io utimensat @@ -54,7 +54,7 @@ AVOIDED_MODULES=' btowc chmod close crypto/af_alg dup fchdir fstat langinfo lock mbrtowc mbsinit memchr mkdir msvc-inval msvc-nothrow nl_langinfo openat-die opendir pthread-h raise - save-cwd select setenv sigprocmask stat stdarg stdbool + save-cwd select setenv sigprocmask stat stdarg threadlib tzset unsetenv utime utime-h wchar wcrtomb wctype-h ' diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index 8d2089bad8..ea1679f693 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -3004,8 +3004,8 @@ Using @code{bool} can make programs easier to read and a bit faster than using @code{int}. Although it is also OK to use @code{int}, @code{0} and @code{1}, this older style is gradually being phased out. When using @code{bool}, respect the limitations of the replacement -implementation of @code{bool}, as documented in the source file -@file{lib/stdbool.in.h}. In particular, boolean bitfields should be of type +implementation of @code{bool}. In particular, +boolean bitfields should be of type @code{bool_bf}, not @code{bool}, so that they work correctly even when compiling Objective C with standard GCC. diff --git a/lib-src/seccomp-filter.c b/lib-src/seccomp-filter.c index 9f0de7d64f..4bd2816dfc 100644 --- a/lib-src/seccomp-filter.c +++ b/lib-src/seccomp-filter.c @@ -39,7 +39,6 @@ variants of those files that can be used to sandbox Emacs before #include #include #include -#include #include #include #include diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 7eca66a609..04644bdabe 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -60,7 +60,6 @@ # --avoid=sigprocmask \ # --avoid=stat \ # --avoid=stdarg \ -# --avoid=stdbool \ # --avoid=threadlib \ # --avoid=tzset \ # --avoid=unsetenv \ @@ -147,6 +146,7 @@ # stat-time \ # std-gnu11 \ # stdalign \ +# stdbool \ # stddef \ # stdio \ # stpcpy \ @@ -953,6 +953,8 @@ MKDIR_P = @MKDIR_P@ MODULES_OBJ = @MODULES_OBJ@ MODULES_SECONDARY_SUFFIX = @MODULES_SECONDARY_SUFFIX@ MODULES_SUFFIX = @MODULES_SUFFIX@ +NEXT_ASSERT_H = @NEXT_ASSERT_H@ +NEXT_AS_FIRST_DIRECTIVE_ASSERT_H = @NEXT_AS_FIRST_DIRECTIVE_ASSERT_H@ NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@ NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ diff --git a/m4/c-bool.m4 b/m4/c-bool.m4 new file mode 100644 index 0000000000..bb109b7796 --- /dev/null +++ b/m4/c-bool.m4 @@ -0,0 +1,51 @@ +# Check for bool that conforms to C2023. + +dnl Copyright 2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_C_BOOL], +[ + AC_CACHE_CHECK([for bool, true, false], [gl_cv_c_bool], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE([[ + #if true == false + #error "true == false" + #endif + extern bool b; + bool b = true == false;]])], + [gl_cv_c_bool=yes], + [gl_cv_c_bool=no])]) + if test "$gl_cv_c_bool" = yes; then + AC_DEFINE([HAVE_C_BOOL], [1], + [Define to 1 if bool, true and false work as per C2023.]) + fi + + AC_CHECK_HEADERS_ONCE([stdbool.h]) + + dnl The "zz" puts this toward config.h's end, to avoid potential + dnl collisions with other definitions. + dnl If 'bool', 'true' and 'false' do not work, arrange for them to work. + dnl In C, this means including if it is not already included. + dnl However, if the preprocessor mistakenly treats 'true' as 0, + dnl define it to a bool expression equal to 1; this is needed in + dnl Sun C++ 5.11 (Oracle Solaris Studio 12.2, 2010) and older. + AH_VERBATIM([zzbool], +[#ifndef HAVE_C_BOOL +# if !defined __cplusplus && !defined __bool_true_false_are_defined +# if HAVE_STDBOOL_H +# include +# else +# if defined __SUNPRO_C +# error " is not usable with this configuration. To make it usable, add -D_STDC_C99= to $CC." +# else +# error " does not exist on this platform. Use gnulib module 'stdbool-c99' instead of gnulib module 'stdbool'." +# endif +# endif +# endif +# if !true +# define true (!false) +# endif +#endif]) +]) diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 6a5f300678..f1ac499132 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -172,6 +172,7 @@ AC_DEFUN([gl_EARLY], # Code from module stat-time: # Code from module std-gnu11: # Code from module stdalign: + # Code from module stdbool: # Code from module stdckdint: # Code from module stddef: # Code from module stdint: @@ -490,6 +491,7 @@ AC_DEFUN([gl_INIT], gl_STDALIGN_H gl_CONDITIONAL_HEADER([stdalign.h]) AC_PROG_MKDIR_P + gl_C_BOOL gl_STDDEF_H gl_STDDEF_H_REQUIRE_DEFAULTS gl_CONDITIONAL_HEADER([stddef.h]) @@ -1428,6 +1430,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/assert_h.m4 m4/builtin-expect.m4 m4/byteswap.m4 + m4/c-bool.m4 m4/canonicalize.m4 m4/clock_time.m4 m4/copy-file-range.m4 diff --git a/src/conf_post.h b/src/conf_post.h index 6ecebf36ab..fb8d2e5d96 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -30,14 +30,10 @@ along with GNU Emacs. If not, see . */ #endif /* To help make dependencies clearer elsewhere, this file typically - does not #include other files. The exceptions are stdbool.h - because it is unlikely to interfere with configuration and bool is - such a core part of the C language, and ms-w32.h (DOS_NT + does not #include other files. The exception is ms-w32.h (DOS_NT only) because it historically was included here and changing that would take some work. */ -#include - #if defined WINDOWSNT && !defined DEFER_MS_W32_H # include #endif diff --git a/src/dynlib.h b/src/dynlib.h index 03b8f98356..9a11c12898 100644 --- a/src/dynlib.h +++ b/src/dynlib.h @@ -21,7 +21,6 @@ along with GNU Emacs. If not, see . */ #define DYNLIB_H #include -#include typedef void *dynlib_handle_ptr; dynlib_handle_ptr dynlib_open (const char *path); diff --git a/src/emacs-module.c b/src/emacs-module.c index 1c392d65df..fcdf103c19 100644 --- a/src/emacs-module.c +++ b/src/emacs-module.c @@ -78,7 +78,6 @@ To add a new module function, proceed as follows: #include "emacs-module.h" #include -#include #include #include #include diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in index 6642b55d93..bef89b059f 100644 --- a/src/emacs-module.h.in +++ b/src/emacs-module.h.in @@ -30,7 +30,8 @@ information how to write modules and use this header file. #include #include -#ifndef __cplusplus +#if ((defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 202311 \ + && !defined __bool_true_false_are_defined && !defined __cplusplus) #include #endif diff --git a/src/nsterm.m b/src/nsterm.m index 44979c7c04..b68a6f8ec1 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -37,7 +37,6 @@ Updated by Christian Limpach (chris@nice.ch) #include #include #include -#include #include #include diff --git a/src/systhread.h b/src/systhread.h index bf4e0306cd..10d6237f27 100644 --- a/src/systhread.h +++ b/src/systhread.h @@ -19,8 +19,6 @@ along with GNU Emacs. If not, see . */ #ifndef SYSTHREAD_H #define SYSTHREAD_H -#include - #include #ifdef THREADS_ENABLED diff --git a/test/src/emacs-module-resources/mod-test.c b/test/src/emacs-module-resources/mod-test.c index 187af821c2..b47a0b7a39 100644 --- a/test/src/emacs-module-resources/mod-test.c +++ b/test/src/emacs-module-resources/mod-test.c @@ -24,7 +24,6 @@ along with GNU Emacs. If not, see . */ #include #include -#include #include #include #include commit a9b29ee4a0ffa4878d67eaf518dbeed098844b9e Author: Paul Eggert Date: Wed Sep 28 00:29:09 2022 -0700 Update from Gnulib by running admin/merge-gnulib diff --git a/build-aux/config.guess b/build-aux/config.guess index 1817bdce90..a419d8643b 100755 --- a/build-aux/config.guess +++ b/build-aux/config.guess @@ -4,7 +4,7 @@ # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2022-05-25' +timestamp='2022-08-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -1036,7 +1036,7 @@ EOF k1om:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; - loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) + loongarch32:Linux:*:* | loongarch64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; m32r*:Linux:*:*) diff --git a/build-aux/config.sub b/build-aux/config.sub index dba16e84c7..fbaa37f235 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -4,7 +4,7 @@ # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2022-01-03' +timestamp='2022-08-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -1207,7 +1207,7 @@ case $cpu-$vendor in | k1om \ | le32 | le64 \ | lm32 \ - | loongarch32 | loongarch64 | loongarchx32 \ + | loongarch32 | loongarch64 \ | m32c | m32r | m32rle \ | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index f86af0db3e..09f2d28c2f 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{2022-08-20.19} +\def\texinfoversion{2022-09-21.15} % % Copyright 1985, 1986, 1988, 1990-2022 Free Software Foundation, Inc. % @@ -241,9 +241,6 @@ % \def\finalout{\overfullrule=0pt } -\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines -\newdimen\topandbottommargin \topandbottommargin=.75in - % Output a mark which sets \thischapter, \thissection and \thiscolor. % We dump everything together because we only have one kind of mark. % This works because we only use \botmark / \topmark, not \firstmark. @@ -317,16 +314,8 @@ \newbox\footlinebox % When outputting the double column layout for indices, an output routine -% is run several times, which hides the original value of \topmark. This -% can lead to a page heading being output and duplicating the chapter heading -% of the index. Hence, save the contents of \topmark at the beginning of -% the output routine. The saved contents are valid until we actually -% \shipout a page. -% -% (We used to run a short output routine to actually set \topmark and -% \firstmark to the right values, but if this was called with an empty page -% containing whatsits for writing index entries, the whatsits would be thrown -% away and the index auxiliary file would remain empty.) +% is run several times, hiding the original value of \topmark. Hence, save +% \topmark at the beginning. % \newtoks\savedtopmark \newif\iftopmarksaved @@ -351,15 +340,9 @@ % \checkchapterpage % - % Retrieve the information for the headings from the marks in the page, - % and call Plain TeX's \makeheadline and \makefootline, which use the - % values in \headline and \footline. - % - % Common context changes for both heading and footing. - % Do this outside of the \shipout so @code etc. will be expanded in - % the headline as they should be, not taken literally (outputting ''code). + % Make the heading and footing. \makeheadline and \makefootline + % use the contents of \headline and \footline. \def\commonheadfootline{\let\hsize=\txipagewidth \texinfochars} - % \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi \global\setbox\headlinebox = \vbox{\commonheadfootline \makeheadline}% \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi @@ -617,21 +600,6 @@ % @? is an end-of-sentence query. \def\?{?\spacefactor=\endofsentencespacefactor\space} -% @frenchspacing on|off says whether to put extra space after punctuation. -% -\def\onword{on} -\def\offword{off} -% -\parseargdef\frenchspacing{% - \def\temp{#1}% - \ifx\temp\onword \plainfrenchspacing - \else\ifx\temp\offword \plainnonfrenchspacing - \else - \errhelp = \EMsimple - \errmessage{Unknown @frenchspacing option `\temp', must be on|off}% - \fi\fi -} - % @w prevents a word break. Without the \leavevmode, @w at the % beginning of a paragraph, when TeX is still in vertical mode, would % produce a whole line of output instead of starting the paragraph. @@ -2803,14 +2771,22 @@ % @var unconditionally uses \sl. This gives consistency for % parameter names whether they are in @def, @table @code or a % regular paragraph. +% To get ttsl font for @var when used in code context, @set txicodevaristt. % The \null is to reset \spacefactor. \def\aftersmartic{} \def\var#1{% \let\saveaftersmartic = \aftersmartic \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}% - {\sl #1}\smartitaliccorrection + % + \ifflagclear{txicodevaristt}% + {\def\varnext{{{\sl #1}}\smartitaliccorrection}}% + {\def\varnext{\smartslanted{#1}}}% + \varnext } +% To be removed after next release +\def\SETtxicodevaristt{}% @set txicodevaristt + \let\i=\smartitalic \let\slanted=\smartslanted \let\dfn=\smartslanted @@ -2859,6 +2835,24 @@ \catcode`@=\other \def\endofsentencespacefactor{3000}% default +% @frenchspacing on|off says whether to put extra space after punctuation. +% +\def\onword{on} +\def\offword{off} +% +\let\frenchspacingsetting\plainnonfrenchspacing % used in output routine +\parseargdef\frenchspacing{% + \def\temp{#1}% + \ifx\temp\onword \let\frenchspacingsetting\plainfrenchspacing + \else\ifx\temp\offword \let\frenchspacingsetting\plainnonfrenchspacing + \else + \errhelp = \EMsimple + \errmessage{Unknown @frenchspacing option `\temp', must be on|off}% + \fi\fi + \frenchspacingsetting +} + + % @t, explicit typewriter. \def\t#1{% {\tt \defcharsdefault \plainfrenchspacing #1}% @@ -3450,8 +3444,13 @@ % Revert to plain's \scriptsize, which is 7pt. \count255=\the\fam $\fam\count255 \scriptstyle A$% \else - % For 11pt, we can use our lllsize. - \switchtolllsize A% + \ifx\curfontsize\smallword + % For footnotes and indices + \count255=\the\fam $\fam\count255 \scriptstyle A$% + \else + % For 11pt, we can use our lllsize. + \switchtolllsize A% + \fi \fi }% \vss @@ -3459,6 +3458,7 @@ \kern-.15em \TeX } +\def\smallword{small} % Some math mode symbols. Define \ensuremath to switch into math mode % unless we are already there. Expansion tricks may not be needed here, @@ -3829,15 +3829,16 @@ \newtoks\oddfootline % footline on odd pages % Now make \makeheadline and \makefootline in Plain TeX use those variables -\headline={{\textfonts\rm +\headline={{\textfonts\rm\frenchspacingsetting \ifchapterpage \ifodd\pageno\the\oddchapheadline\else\the\evenchapheadline\fi \else \ifodd\pageno\the\oddheadline\else\the\evenheadline\fi \fi}} -\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline - \else \the\evenfootline \fi}\HEADINGShook} +\footline={{\textfonts\rm\frenchspacingsetting + \ifodd\pageno \the\oddfootline \else \the\evenfootline \fi}% + \HEADINGShook} \let\HEADINGShook=\relax % Commands to set those variables. @@ -3963,7 +3964,7 @@ \global\oddfootline={\hfil} \global\evenheadline={\line{\folio\hfil\thistitle}} \global\oddheadline={\line{\thischapter\hfil\folio}} -\global\evenchapheadline={\line{\folio\hfil}} +\global\evenchapheadline={\line{\folio\hfil\thistitle}} \global\oddchapheadline={\line{\hfil\folio}} \global\let\contentsalignmacro = \chapoddpage } @@ -4351,8 +4352,7 @@ % undo it ourselves. \def\headitemfont{\b}% for people to use in the template row; not changeable \def\headitem{% - \checkenv\multitable - \crcr + \crcr % must appear first \gdef\headitemcrhook{\nobreak}% attempt to avoid page break after headings \global\everytab={\bf}% can't use \headitemfont since the parsing differs \the\everytab % for the first item @@ -6755,6 +6755,11 @@ \ifnum\romancount=0 \global\romancount=\pagecount \fi } +% \raggedbottom in plain.tex hardcodes \topskip so override it +\catcode`\@=11 +\def\raggedbottom{\advance\topskip by 0pt plus60pt \r@ggedbottomtrue} +\catcode`\@=\other + % redefined for the two-volume lispref. We always output on % \jobname.toc even if this is redefined. % @@ -7115,7 +7120,7 @@ % collide with the section heading. \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi % - \setbox\groupbox=\vbox\bgroup + \setbox\groupbox=\vtop\bgroup \baselineskip=0pt\parskip=0pt\lineskip=0pt \carttop \hbox\bgroup @@ -7801,6 +7806,8 @@ % Print arguments. Use slanted for @def*, typewriter for @deftype*. \def\defunargs#1{% \df \ifdoingtypefn \tt \else \sl \fi + \ifflagclear{txicodevaristt}{}% + {\def\var##1{{\setregularquotes \ttsl ##1}}}% #1% } @@ -9311,6 +9318,12 @@ \imagexxx #1,,,,,\finish \fi } + +% Approximate height of a line in the standard text font. +\newdimen\capheight +\setbox0=\vbox{\tenrm H} +\capheight=\ht0 + % % Arguments to @image: % #1 is (mandatory) image filename; we tack on .eps extension. @@ -9340,7 +9353,7 @@ % % Place image in a \vtop for a top page margin that is (close to) correct, % as \topskip glue is relative to the first baseline. - \vtop\bgroup\hrule height 0pt\vskip-\parskip + \vtop\bgroup \kern -\capheight \vskip-\parskip \fi % % Enter horizontal mode so that indentation from an enclosing @@ -11217,13 +11230,9 @@ % \vsize = #1\relax \advance\vsize by \topskip - \outervsize = \vsize - \advance\outervsize by 2\topandbottommargin \txipageheight = \vsize % \hsize = #2\relax - \outerhsize = \hsize - \advance\outerhsize by 0.5in \txipagewidth = \hsize % \normaloffset = #4\relax diff --git a/lib/acl-internal.h b/lib/acl-internal.h index 93533762dd..94553fab25 100644 --- a/lib/acl-internal.h +++ b/lib/acl-internal.h @@ -19,7 +19,6 @@ #include "acl.h" -#include #include /* All systems define the ACL related API in . */ diff --git a/lib/acl.h b/lib/acl.h index f4d0df8061..0be6ef1cea 100644 --- a/lib/acl.h +++ b/lib/acl.h @@ -20,7 +20,6 @@ #ifndef _GL_ACL_H #define _GL_ACL_H 1 -#include #include #include diff --git a/lib/assert.in.h b/lib/assert.in.h new file mode 100644 index 0000000000..2c358ba62e --- /dev/null +++ b/lib/assert.in.h @@ -0,0 +1,27 @@ +/* Substitute for and wrapper around + Copyright (C) 2011-2022 Free Software Foundation, Inc. + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Do not guard the include, since is supposed to define + the assert macro each time it is included. */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#@INCLUDE_NEXT@ @NEXT_ASSERT_H@ + +/* The definition of static_assert is copied here. */ diff --git a/lib/c-ctype.h b/lib/c-ctype.h index 1a4f603898..1202ff8a36 100644 --- a/lib/c-ctype.h +++ b/lib/c-ctype.h @@ -23,8 +23,6 @@ #ifndef C_CTYPE_H #define C_CTYPE_H -#include - #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." #endif diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c index a7fa7feb62..8c3d7f7cf8 100644 --- a/lib/canonicalize-lgpl.c +++ b/lib/canonicalize-lgpl.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/cloexec.h b/lib/cloexec.h index 7a22d77532..15d2d5efe2 100644 --- a/lib/cloexec.h +++ b/lib/cloexec.h @@ -15,8 +15,6 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ -#include - /* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true, or clear the flag if VALUE is false. Return 0 on success, or -1 on error with 'errno' set. diff --git a/lib/close-stream.c b/lib/close-stream.c index 9b0e97b271..0fdca79bf8 100644 --- a/lib/close-stream.c +++ b/lib/close-stream.c @@ -20,7 +20,6 @@ #include "close-stream.h" #include -#include #include "fpending.h" diff --git a/lib/count-leading-zeros.h b/lib/count-leading-zeros.h index 354641af0a..4b4f5d4f9a 100644 --- a/lib/count-leading-zeros.h +++ b/lib/count-leading-zeros.h @@ -43,13 +43,17 @@ extern "C" { # define COUNT_LEADING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE) \ return x ? BUILTIN (x) : CHAR_BIT * sizeof x; #elif _MSC_VER -# pragma intrinsic _BitScanReverse -# pragma intrinsic _BitScanReverse64 +# pragma intrinsic (_BitScanReverse) +# if defined _M_X64 +# pragma intrinsic (_BitScanReverse64) +# endif # define COUNT_LEADING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE) \ do \ { \ unsigned long result; \ - return MSC_BUILTIN (&result, x) ? result : CHAR_BIT * sizeof x; \ + if (MSC_BUILTIN (&result, x)) \ + return CHAR_BIT * sizeof x - 1 - result; \ + return CHAR_BIT * sizeof x; \ } \ while (0) #else @@ -109,8 +113,18 @@ count_leading_zeros_l (unsigned long int x) COUNT_LEADING_ZEROS_INLINE int count_leading_zeros_ll (unsigned long long int x) { +#if (defined _MSC_VER && !defined __clang__) && !defined _M_X64 + /* 32-bit MSVC does not have _BitScanReverse64, only _BitScanReverse. */ + unsigned long result; + if (_BitScanReverse (&result, (unsigned long) (x >> 32))) + return CHAR_BIT * sizeof x - 1 - 32 - result; + if (_BitScanReverse (&result, (unsigned long) x)) + return CHAR_BIT * sizeof x - 1 - result; + return CHAR_BIT * sizeof x; +#else COUNT_LEADING_ZEROS (__builtin_clzll, _BitScanReverse64, unsigned long long int); +#endif } #ifdef __cplusplus diff --git a/lib/count-trailing-zeros.h b/lib/count-trailing-zeros.h index 9a989a4324..61fbdf2980 100644 --- a/lib/count-trailing-zeros.h +++ b/lib/count-trailing-zeros.h @@ -43,8 +43,10 @@ extern "C" { # define COUNT_TRAILING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE) \ return x ? BUILTIN (x) : CHAR_BIT * sizeof x; #elif _MSC_VER -# pragma intrinsic _BitScanForward -# pragma intrinsic _BitScanForward64 +# pragma intrinsic (_BitScanForward) +# if defined _M_X64 +# pragma intrinsic (_BitScanForward64) +# endif # define COUNT_TRAILING_ZEROS(BUILTIN, MSC_BUILTIN, TYPE) \ do \ { \ @@ -101,8 +103,18 @@ count_trailing_zeros_l (unsigned long int x) COUNT_TRAILING_ZEROS_INLINE int count_trailing_zeros_ll (unsigned long long int x) { +#if (defined _MSC_VER && !defined __clang__) && !defined _M_X64 + /* 32-bit MSVC does not have _BitScanForward64, only _BitScanForward. */ + unsigned long result; + if (_BitScanForward (&result, (unsigned long) x)) + return result; + if (_BitScanForward (&result, (unsigned long) (x >> 32))) + return result + 32; + return CHAR_BIT * sizeof x; +#else COUNT_TRAILING_ZEROS (__builtin_ctzll, _BitScanForward64, unsigned long long int); +#endif } #ifdef __cplusplus diff --git a/lib/diffseq.h b/lib/diffseq.h index 0f76ea1d5a..a8b0e7bd40 100644 --- a/lib/diffseq.h +++ b/lib/diffseq.h @@ -70,7 +70,6 @@ Before including this file, you also need to include: #include - #include #include "minmax.h" */ diff --git a/lib/filevercmp.c b/lib/filevercmp.c index 7e54793e61..844505a6bf 100644 --- a/lib/filevercmp.c +++ b/lib/filevercmp.c @@ -20,11 +20,9 @@ #include #include "filevercmp.h" -#include #include #include #include -#include /* Return the length of a prefix of S that corresponds to the suffix defined by this extended regular expression in the C locale: @@ -75,7 +73,7 @@ order (char const *s, idx_t pos, idx_t len) return -2; else { - verify (UCHAR_MAX <= (INT_MAX - 1 - 2) / 2); + static_assert (UCHAR_MAX <= (INT_MAX - 1 - 2) / 2); return c + UCHAR_MAX + 1; } } diff --git a/lib/fsusage.h b/lib/fsusage.h index 0443d19f92..27085b7b41 100644 --- a/lib/fsusage.h +++ b/lib/fsusage.h @@ -22,7 +22,6 @@ # define FSUSAGE_H_ # include -# include struct fs_usage { diff --git a/lib/getloadavg.c b/lib/getloadavg.c index 37e8280867..1fddee97af 100644 --- a/lib/getloadavg.c +++ b/lib/getloadavg.c @@ -82,7 +82,6 @@ #include #include -#include #include # include diff --git a/lib/getrandom.c b/lib/getrandom.c index e146873093..c05a48167e 100644 --- a/lib/getrandom.c +++ b/lib/getrandom.c @@ -23,7 +23,6 @@ #include #include -#include #include #if defined _WIN32 && ! defined __CYGWIN__ diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in index 5bb78740d6..7eca66a609 100644 --- a/lib/gnulib.mk.in +++ b/lib/gnulib.mk.in @@ -180,6 +180,7 @@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@ AR = @AR@ ARFLAGS = @ARFLAGS@ +ASSERT_H = @ASSERT_H@ AUTO_DEPEND = @AUTO_DEPEND@ AWK = @AWK@ BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ @@ -307,6 +308,7 @@ GL_COND_OBJ_TIME_RZ_CONDITION = @GL_COND_OBJ_TIME_RZ_CONDITION@ GL_COND_OBJ_TIME_R_CONDITION = @GL_COND_OBJ_TIME_R_CONDITION@ GL_COND_OBJ_UTIMENSAT_CONDITION = @GL_COND_OBJ_UTIMENSAT_CONDITION@ GL_GENERATE_ALLOCA_H_CONDITION = @GL_GENERATE_ALLOCA_H_CONDITION@ +GL_GENERATE_ASSERT_H_CONDITION = @GL_GENERATE_ASSERT_H_CONDITION@ GL_GENERATE_BYTESWAP_H_CONDITION = @GL_GENERATE_BYTESWAP_H_CONDITION@ GL_GENERATE_ERRNO_H_CONDITION = @GL_GENERATE_ERRNO_H_CONDITION@ GL_GENERATE_EXECINFO_H_CONDITION = @GL_GENERATE_EXECINFO_H_CONDITION@ @@ -1440,6 +1442,39 @@ EXTRA_DIST += allocator.h endif ## end gnulib module allocator +## begin gnulib module assert-h +ifeq (,$(OMIT_GNULIB_MODULE_assert-h)) + +BUILT_SOURCES += $(ASSERT_H) + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +ifneq (,$(GL_GENERATE_ASSERT_H_CONDITION)) +assert.h: assert.in.h verify.h $(top_builddir)/config.status + $(gl_V_at){ $(SED_HEADER_STDOUT) \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_ASSERT_H''@|$(NEXT_ASSERT_H)|g' \ + < $(srcdir)/assert.in.h && \ + sed -e '/@assert.h omit start@/,/@assert.h omit end@/d' \ + -e 's|_gl_verify|_gl_static_assert|g' \ + -e 's|_GL_VERIFY|_GL_STATIC_ASSERT|g' \ + -e 's|_GL\(_STATIC_ASSERT_H\)|_GL\1|g' \ + < $(srcdir)/verify.h; \ + } > $@-t + $(AM_V_at)mv $@-t $@ +else +assert.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += assert.h assert.h-t + +EXTRA_DIST += assert.in.h verify.h + +endif +## end gnulib module assert-h + ## begin gnulib module at-internal ifeq (,$(OMIT_GNULIB_MODULE_at-internal)) diff --git a/lib/malloc/dynarray.h b/lib/malloc/dynarray.h index f16fd950df..df1aa4167d 100644 --- a/lib/malloc/dynarray.h +++ b/lib/malloc/dynarray.h @@ -94,7 +94,6 @@ #ifndef _DYNARRAY_H #define _DYNARRAY_H -#include #include #include diff --git a/lib/md5.c b/lib/md5.c index 57489ed74c..c16ac4a93a 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -27,7 +27,6 @@ #endif #include "md5.h" -#include #include #include #include diff --git a/lib/mini-gmp.c b/lib/mini-gmp.c index 95f067f82d..ea037b801d 100644 --- a/lib/mini-gmp.c +++ b/lib/mini-gmp.c @@ -1,8 +1,9 @@ /* mini-gmp, a minimalistic implementation of a GNU GMP subset. Contributed to the GNU project by Niels Möller + Additional functionalities and improvements by Marco Bodrato. -Copyright 1991-1997, 1999-2021 Free Software Foundation, Inc. +Copyright 1991-1997, 1999-2022 Free Software Foundation, Inc. This file is part of the GNU MP Library. @@ -3098,7 +3099,7 @@ mpz_powm (mpz_t r, const mpz_t b, const mpz_t e, const mpz_t m) if (en == 0) { - mpz_set_ui (r, 1); + mpz_set_ui (r, mpz_cmpabs_ui (m, 1)); return; } diff --git a/lib/nanosleep.c b/lib/nanosleep.c index 446794edc0..55d6fa650e 100644 --- a/lib/nanosleep.c +++ b/lib/nanosleep.c @@ -23,9 +23,7 @@ #include #include "intprops.h" -#include "verify.h" -#include #include #include #include @@ -59,7 +57,7 @@ nanosleep (const struct timespec *requested_delay, { /* Verify that time_t is large enough. */ - verify (TYPE_MAXIMUM (time_t) / 24 / 24 / 60 / 60); + static_assert (TYPE_MAXIMUM (time_t) / 24 / 24 / 60 / 60); const time_t limit = 24 * 24 * 60 * 60; time_t seconds = requested_delay->tv_sec; struct timespec intermediate; diff --git a/lib/nstrftime.c b/lib/nstrftime.c index c1dd554247..37034eb9fb 100644 --- a/lib/nstrftime.c +++ b/lib/nstrftime.c @@ -65,7 +65,6 @@ extern char *tzname[]; #include #include #include -#include #include "attribute.h" #include diff --git a/lib/openat.h b/lib/openat.h index 56919ef8dc..c2f64ff50e 100644 --- a/lib/openat.h +++ b/lib/openat.h @@ -24,7 +24,6 @@ #include #include #include -#include #ifndef _GL_INLINE_HEADER_BEGIN #error "Please include config.h first." diff --git a/lib/pipe2.c b/lib/pipe2.c index 400aff001a..a3cbb7f261 100644 --- a/lib/pipe2.c +++ b/lib/pipe2.c @@ -23,7 +23,6 @@ #include #include "binary-io.h" -#include "verify.h" #if GNULIB_defined_O_NONBLOCK # include "nonblocking.h" @@ -95,7 +94,7 @@ pipe2 (int fd[2], int flags) } # else { - verify (O_NONBLOCK == 0); + static_assert (O_NONBLOCK == 0); } # endif diff --git a/lib/rawmemchr.c b/lib/rawmemchr.c index ea68c1bfc6..bdd7307de4 100644 --- a/lib/rawmemchr.c +++ b/lib/rawmemchr.c @@ -23,10 +23,8 @@ #if !HAVE_RAWMEMCHR # include -# include # include -# include "verify.h" /* Find the first occurrence of C in S. */ void * @@ -36,7 +34,7 @@ rawmemchr (const void *s, int c_in) typedef uintptr_t longword; /* If you change the "uintptr_t", you should change UINTPTR_WIDTH to match. This verifies that the type does not have padding bits. */ - verify (UINTPTR_WIDTH == UCHAR_WIDTH * sizeof (longword)); + static_assert (UINTPTR_WIDTH == UCHAR_WIDTH * sizeof (longword)); const unsigned char *char_ptr; unsigned char c = c_in; diff --git a/lib/regex_internal.h b/lib/regex_internal.h index 57a455b1f4..784d2d4586 100644 --- a/lib/regex_internal.h +++ b/lib/regex_internal.h @@ -29,7 +29,6 @@ #include #include #include -#include #include #ifndef _LIBC diff --git a/lib/sha1.c b/lib/sha1.c index 79e50ba0b0..5a18213edc 100644 --- a/lib/sha1.c +++ b/lib/sha1.c @@ -29,7 +29,6 @@ #endif #include "sha1.h" -#include #include #include diff --git a/lib/sha256.c b/lib/sha256.c index c9ca618c67..60cd763612 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -28,7 +28,6 @@ #endif #include "sha256.h" -#include #include #include diff --git a/lib/sha512.c b/lib/sha512.c index 6776bb464d..fd17a7dc76 100644 --- a/lib/sha512.c +++ b/lib/sha512.c @@ -28,7 +28,6 @@ #endif #include "sha512.h" -#include #include #include diff --git a/lib/signal.in.h b/lib/signal.in.h index 640b5022f5..c0d4848db0 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -55,13 +55,21 @@ #ifndef _@GUARD_PREFIX@_SIGNAL_H #define _@GUARD_PREFIX@_SIGNAL_H -/* Mac OS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6, Android, +/* For testing the OpenBSD version. */ +#if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \ + && defined __OpenBSD__ +# include +#endif + +/* Mac OS X 10.3, FreeBSD < 8.0, OpenBSD < 5.1, OSF/1 4.0, Solaris 2.6, Android, OS/2 kLIBC declare pthread_sigmask in , not in . But avoid namespace pollution on glibc systems.*/ #if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \ && ((defined __APPLE__ && defined __MACH__) \ - || defined __FreeBSD__ || defined __OpenBSD__ || defined __osf__ \ - || defined __sun || defined __ANDROID__ || defined __KLIBC__) \ + || (defined __FreeBSD__ && __FreeBSD__ < 8) \ + || (defined __OpenBSD__ && OpenBSD < 201205) \ + || defined __osf__ || defined __sun || defined __ANDROID__ \ + || defined __KLIBC__) \ && ! defined __GLIBC__ # include #endif diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h index 3b117df11f..58fd245c62 100644 --- a/lib/stdalign.in.h +++ b/lib/stdalign.in.h @@ -42,10 +42,7 @@ '-malign-double' is used. The result cannot be used as a value for an 'enum' constant, if you - want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. - - Include for offsetof. */ -#include + want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc. */ /* FreeBSD 9.1 , included by and lots of other standard headers, defines conflicting implementations of _Alignas @@ -61,17 +58,19 @@ && !defined __clang__) \ || (defined __clang__ && __clang_major__ < 8)) # ifdef __cplusplus -# if 201103 <= __cplusplus +# if (201103 <= __cplusplus || defined _MSC_VER) # define _Alignof(type) alignof (type) # else template struct __alignof_helper { char __a; __t __b; }; # define _Alignof(type) offsetof (__alignof_helper, __b) +# define _GL_STDALIGN_NEEDS_STDDEF 1 # endif # else # define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) +# define _GL_STDALIGN_NEEDS_STDDEF 1 # endif #endif -#if ! (defined __cplusplus && 201103 <= __cplusplus) +#if ! (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)) # define alignof _Alignof #endif #define __alignof_is_defined 1 @@ -102,7 +101,7 @@ */ #if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 -# if defined __cplusplus && 201103 <= __cplusplus +# if defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER) # define _Alignas(a) alignas (a) # elif (!defined __attribute__ \ && ((defined __APPLE__ && defined __MACH__ \ @@ -116,12 +115,19 @@ # define _Alignas(a) __declspec (align (a)) # endif #endif -#if ((defined _Alignas && ! (defined __cplusplus && 201103 <= __cplusplus)) \ +#if ((defined _Alignas \ + && !(defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) \ || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) # define alignas _Alignas #endif -#if defined alignas || (defined __cplusplus && 201103 <= __cplusplus) +#if (defined alignas \ + || (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) # define __alignas_is_defined 1 #endif +/* Include if needed for offsetof. */ +#if _GL_STDALIGN_NEEDS_STDDEF +# include +#endif + #endif /* _GL_STDALIGN_H */ diff --git a/lib/stdckdint.in.h b/lib/stdckdint.in.h index 90fa62e596..762d3fdb79 100644 --- a/lib/stdckdint.in.h +++ b/lib/stdckdint.in.h @@ -20,8 +20,6 @@ #include "intprops-internal.h" -#include - /* Store into *R the low-order bits of A + B, A - B, A * B, respectively. Return 1 if the result overflows, 0 otherwise. A, B, and *R can have any integer type other than char, bool, a diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index a86643c3ca..8e0a609f1f 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -226,7 +226,7 @@ _GL_FUNCDECL_SYS (aligned_alloc, void *, _GL_CXXALIAS_SYS (aligned_alloc, void *, (size_t alignment, size_t size)); # endif # endif -# if @HAVE_ALIGNED_ALLOC@ +# if (__GLIBC__ >= 2) && @HAVE_ALIGNED_ALLOC@ _GL_CXXALIASWARN (aligned_alloc); # endif #else @@ -1363,7 +1363,9 @@ _GL_CXXALIAS_SYS (strtol, long, (const char *restrict string, char **restrict endptr, int base)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (strtol); +# endif #elif defined GNULIB_POSIXCHECK # undef strtol # if HAVE_RAW_DECL_STRTOL @@ -1444,7 +1446,9 @@ _GL_CXXALIAS_SYS (strtoul, unsigned long, (const char *restrict string, char **restrict endptr, int base)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (strtoul); +# endif #elif defined GNULIB_POSIXCHECK # undef strtoul # if HAVE_RAW_DECL_STRTOUL diff --git a/lib/string.in.h b/lib/string.in.h index 3996da9fcb..e56f6db0c9 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -943,7 +943,9 @@ _GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) _GL_ARG_NONNULL ((1))); _GL_CXXALIAS_SYS (mbslen, size_t, (const char *string)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (mbslen); +# endif #endif #if @GNULIB_MBSNLEN@ diff --git a/lib/strtoimax.c b/lib/strtoimax.c index cad12d0d9b..29d16d29ce 100644 --- a/lib/strtoimax.c +++ b/lib/strtoimax.c @@ -25,8 +25,6 @@ #include -#include "verify.h" - #ifdef UNSIGNED # ifndef HAVE_DECL_STRTOULL "this configure-time declaration test was not run" @@ -62,8 +60,8 @@ long long int strtoll (char const *, char **, int); Int Strtoimax (char const *ptr, char **endptr, int base) { - verify (sizeof (Int) == sizeof (Unsigned long int) - || sizeof (Int) == sizeof (Unsigned long long int)); + static_assert (sizeof (Int) == sizeof (Unsigned long int) + || sizeof (Int) == sizeof (Unsigned long long int)); if (sizeof (Int) != sizeof (Unsigned long int)) return Strtoll (ptr, endptr, base); diff --git a/lib/sys_random.in.h b/lib/sys_random.in.h index e730e6139f..c91bcd2cd0 100644 --- a/lib/sys_random.in.h +++ b/lib/sys_random.in.h @@ -84,7 +84,9 @@ _GL_FUNCDECL_SYS (getrandom, ssize_t, _GL_CXXALIAS_SYS (getrandom, ssize_t, (void *buffer, size_t length, unsigned int flags)); # endif +# if __GLIBC__ + (__GLIBC_MINOR__ >= 25) > 2 _GL_CXXALIASWARN (getrandom); +# endif #elif defined GNULIB_POSIXCHECK # undef getrandom # if HAVE_RAW_DECL_GETRANDOM diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h index 2bd0e0f79a..860e957fe0 100644 --- a/lib/sys_select.in.h +++ b/lib/sys_select.in.h @@ -82,9 +82,10 @@ of 'struct timeval', and no definition of this type. Also, Mac OS X, AIX, HP-UX, IRIX, Solaris, Interix declare select() in . - But avoid namespace pollution on glibc systems and "unknown type - name" problems on Cygwin. */ -# if !(defined __GLIBC__ || defined __CYGWIN__) + But avoid namespace pollution on glibc systems, a circular include + -> -> on FreeBSD 13.1, and + "unknown type name" problems on Cygwin. */ +# if !(defined __GLIBC__ || defined __FreeBSD__ || defined __CYGWIN__) # include # endif @@ -287,7 +288,9 @@ _GL_CXXALIAS_SYS_CAST (pselect, int, struct timespec const *restrict, const sigset_t *restrict)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (pselect); +# endif #elif defined GNULIB_POSIXCHECK # undef pselect # if HAVE_RAW_DECL_PSELECT diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h index 714c3cb189..0ec320f58c 100644 --- a/lib/sys_stat.in.h +++ b/lib/sys_stat.in.h @@ -596,44 +596,6 @@ _GL_WARN_ON_USE (lchmod, "lchmod is unportable - " #endif -#if @GNULIB_LSTAT@ -# if ! @HAVE_LSTAT@ -/* mingw does not support symlinks, therefore it does not have lstat. But - without links, stat does just fine. */ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# define lstat stat -# endif -_GL_CXXALIAS_RPL_1 (lstat, stat, int, - (const char *restrict name, struct stat *restrict buf)); -# elif @REPLACE_LSTAT@ -# if !(defined __cplusplus && defined GNULIB_NAMESPACE) -# undef lstat -# define lstat rpl_lstat -# endif -_GL_FUNCDECL_RPL (lstat, int, - (const char *restrict name, struct stat *restrict buf) - _GL_ARG_NONNULL ((1, 2))); -_GL_CXXALIAS_RPL (lstat, int, - (const char *restrict name, struct stat *restrict buf)); -# else -_GL_CXXALIAS_SYS (lstat, int, - (const char *restrict name, struct stat *restrict buf)); -# endif -# if @HAVE_LSTAT@ -_GL_CXXALIASWARN (lstat); -# endif -#elif @GNULIB_OVERRIDES_STRUCT_STAT@ -# undef lstat -# define lstat lstat_used_without_requesting_gnulib_module_lstat -#elif defined GNULIB_POSIXCHECK -# undef lstat -# if HAVE_RAW_DECL_LSTAT -_GL_WARN_ON_USE (lstat, "lstat is unportable - " - "use gnulib module lstat for portability"); -# endif -#endif - - #if @GNULIB_MKDIR@ # if @REPLACE_MKDIR@ # if !(defined __cplusplus && defined GNULIB_NAMESPACE) @@ -895,6 +857,44 @@ _GL_WARN_ON_USE (stat, "stat is unportable - " #endif +#if @GNULIB_LSTAT@ +# if ! @HAVE_LSTAT@ +/* mingw does not support symlinks, therefore it does not have lstat. But + without links, stat does just fine. */ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define lstat stat +# endif +_GL_CXXALIAS_RPL_1 (lstat, stat, int, + (const char *restrict name, struct stat *restrict buf)); +# elif @REPLACE_LSTAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef lstat +# define lstat rpl_lstat +# endif +_GL_FUNCDECL_RPL (lstat, int, + (const char *restrict name, struct stat *restrict buf) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (lstat, int, + (const char *restrict name, struct stat *restrict buf)); +# else +_GL_CXXALIAS_SYS (lstat, int, + (const char *restrict name, struct stat *restrict buf)); +# endif +# if @HAVE_LSTAT@ +_GL_CXXALIASWARN (lstat); +# endif +#elif @GNULIB_OVERRIDES_STRUCT_STAT@ +# undef lstat +# define lstat lstat_used_without_requesting_gnulib_module_lstat +#elif defined GNULIB_POSIXCHECK +# undef lstat +# if HAVE_RAW_DECL_LSTAT +_GL_WARN_ON_USE (lstat, "lstat is unportable - " + "use gnulib module lstat for portability"); +# endif +#endif + + #if @GNULIB_MDA_UMASK@ /* On native Windows, map 'umask' to '_umask', so that -loldnames is not required. In C++ with GNULIB_NAMESPACE, avoid differences between diff --git a/lib/tempname.c b/lib/tempname.c index 11b4796b34..dbff638f70 100644 --- a/lib/tempname.c +++ b/lib/tempname.c @@ -20,7 +20,6 @@ # include "tempname.h" #endif -#include #include #include diff --git a/lib/time.in.h b/lib/time.in.h index 6d4c771963..6aa67498f5 100644 --- a/lib/time.in.h +++ b/lib/time.in.h @@ -435,8 +435,10 @@ _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " # endif # if defined GNULIB_POSIXCHECK # undef asctime_r +# if HAVE_RAW_DECL_ASCTIME_R _GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); +# endif # endif # if defined GNULIB_POSIXCHECK # undef ctime @@ -445,8 +447,10 @@ _GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - " # endif # if defined GNULIB_POSIXCHECK # undef ctime_r +# if HAVE_RAW_DECL_CTIME_R _GL_WARN_ON_USE (ctime_r, "ctime_r can overrun buffers in some cases - " "better use strftime (or even sprintf) instead"); +# endif # endif #endif diff --git a/lib/time_rz.c b/lib/time_rz.c index 1a91d3778e..601ce5950e 100644 --- a/lib/time_rz.c +++ b/lib/time_rz.c @@ -27,7 +27,6 @@ #include #include -#include #include #include #include diff --git a/lib/unistd.in.h b/lib/unistd.in.h index 57df09ecdf..50f6e56550 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -1143,7 +1143,9 @@ _GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) # endif _GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); # endif +# if __GLIBC__ >= 2 _GL_CXXALIASWARN (getdomainname); +# endif #elif defined GNULIB_POSIXCHECK # undef getdomainname # if HAVE_RAW_DECL_GETDOMAINNAME @@ -2055,7 +2057,7 @@ _GL_CXXALIAS_MDA_CAST (swab, void, (char *from, char *to, int n)); # else # if defined __hpux /* HP-UX */ _GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, int n)); -# elif defined __sun && !defined _XPG4 /* Solaris */ +# elif defined __sun && (defined __SunOS_5_10 || defined __XOPEN_OR_POSIX) && !defined _XPG4 /* Solaris */ _GL_CXXALIAS_SYS (swab, void, (const char *from, char *to, ssize_t n)); # else _GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n)); diff --git a/lib/utimens.c b/lib/utimens.c index 2fa1251850..23b9180935 100644 --- a/lib/utimens.c +++ b/lib/utimens.c @@ -26,7 +26,6 @@ #include #include -#include #include #include #include diff --git a/lib/verify.h b/lib/verify.h index 47b6ee661b..99af802993 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -25,19 +25,19 @@ works as per C11. This is supported by GCC 4.6.0+ and by clang 4+. Define _GL_HAVE__STATIC_ASSERT1 to 1 if _Static_assert (R) works as - per C2x. This is supported by GCC 9.1+. + per C23. This is supported by GCC 9.1+. Support compilers claiming conformance to the relevant standard, and also support GCC when not pedantic. If we were willing to slow 'configure' down we could also use it with other compilers, but since this affects only the quality of diagnostics, why bother? */ #ifndef __cplusplus -# if (201112L <= __STDC_VERSION__ \ +# if (201112 <= __STDC_VERSION__ \ || (!defined __STRICT_ANSI__ \ && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 5 <= __clang_major__))) # define _GL_HAVE__STATIC_ASSERT 1 # endif -# if (202000L <= __STDC_VERSION__ \ +# if (202000 <= __STDC_VERSION__ \ || (!defined __STRICT_ANSI__ && 9 <= __GNUC__)) # define _GL_HAVE__STATIC_ASSERT1 1 # endif @@ -202,12 +202,12 @@ template This macro requires three or more arguments but uses at most the first two, so that the _Static_assert macro optionally defined below supports - both the C11 two-argument syntax and the C2x one-argument syntax. + both the C11 two-argument syntax and the C23 one-argument syntax. Unfortunately, unlike C11, this implementation must appear as an ordinary declaration, and cannot appear inside struct { ... }. */ -#if 200410 <= __cpp_static_assert +#if 202311 <= __STDC_VERSION__ || 200410 <= __cpp_static_assert # define _GL_VERIFY(R, DIAGNOSTIC, ...) static_assert (R, DIAGNOSTIC) #elif defined _GL_HAVE__STATIC_ASSERT # define _GL_VERIFY(R, DIAGNOSTIC, ...) _Static_assert (R, DIAGNOSTIC) @@ -223,11 +223,30 @@ template /* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */ #ifdef _GL_STATIC_ASSERT_H # if !defined _GL_HAVE__STATIC_ASSERT1 && !defined _Static_assert -# define _Static_assert(...) \ - _GL_VERIFY (__VA_ARGS__, "static assertion failed", -) +# define _Static_assert(R, ...) \ + _GL_VERIFY ((R), "static assertion failed", -) # endif -# if __cpp_static_assert < 201411 && !defined static_assert -# define static_assert _Static_assert /* C11 requires this #define. */ +# if (!defined static_assert \ + && __STDC_VERSION__ < 202311 \ + && (!defined __cplusplus \ + || (__cpp_static_assert < 201411 \ + && __GNUG__ < 6 && __clang_major__ < 6))) +# if defined __cplusplus && _MSC_VER >= 1900 && !defined __clang__ +/* MSVC 14 in C++ mode supports the two-arguments static_assert but not + the one-argument static_assert, and it does not support _Static_assert. + We have to play preprocessor tricks to distinguish the two cases. + Since the MSVC preprocessor is not ISO C compliant (cf. + ), the solution is specific + to MSVC. */ +# define _GL_EXPAND(x) x +# define _GL_SA1(a1) static_assert ((a1), "static assertion failed") +# define _GL_SA2 static_assert +# define _GL_SA3 static_assert +# define _GL_SA_PICK(x1,x2,x3,x4,...) x4 +# define static_assert(...) _GL_EXPAND(_GL_SA_PICK(__VA_ARGS__,_GL_SA3,_GL_SA2,_GL_SA1)) (__VA_ARGS__) +# else +# define static_assert _Static_assert /* C11 requires this #define. */ +# endif # endif #endif @@ -303,7 +322,7 @@ template # define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) #elif 1200 <= _MSC_VER # define assume(R) __assume (R) -#elif 202311L <= __STDC_VERSION__ +#elif 202311 <= __STDC_VERSION__ # include # define assume(R) ((R) ? (void) 0 : unreachable ()) #elif (defined GCC_LINT || defined lint) && _GL_HAS_BUILTIN_TRAP diff --git a/m4/assert_h.m4 b/m4/assert_h.m4 new file mode 100644 index 0000000000..c411a34aa7 --- /dev/null +++ b/m4/assert_h.m4 @@ -0,0 +1,60 @@ +# assert-h.m4 +dnl Copyright (C) 2011-2022 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Paul Eggert. + +AC_DEFUN([gl_ASSERT_H], +[ + AC_CACHE_CHECK([for static_assert], [gl_cv_static_assert], + [gl_save_CFLAGS=$CFLAGS + for gl_working in "yes, a keyword" "yes, an macro"; do + AS_CASE([$gl_working], + [*assert.h*], [CFLAGS="$gl_save_CFLAGS -DINCLUDE_ASSERT_H"]) + + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#if defined __clang__ && __STDC_VERSION__ < 202311 + #pragma clang diagnostic error "-Wc2x-extensions" + #endif + #ifdef INCLUDE_ASSERT_H + #include + #endif + static_assert (2 + 2 == 4, "arithmetic does not work"); + static_assert (2 + 2 == 4); + ]], + [[ + static_assert (sizeof (char) == 1, "sizeof does not work"); + static_assert (sizeof (char) == 1); + ]])], + [gl_cv_static_assert=$gl_working], + [gl_cv_static_assert=no]) + CFLAGS=$gl_save_CFLAGS + test "$gl_cv_static_assert" != no && break + done]) + + GL_GENERATE_ASSERT_H=false + AS_CASE([$gl_cv_static_assert], + [yes*keyword*], + [AC_DEFINE([HAVE_C_STATIC_ASSERT], [1], + [Define to 1 if the static_assert keyword works.])], + [no], + [GL_GENERATE_ASSERT_H=true + gl_NEXT_HEADERS([assert.h])]) + + dnl The "zz" puts this toward config.h's end, to avoid potential + dnl collisions with other definitions. #undef assert so that + dnl programs are not tempted to use it without specifically + dnl including assert.h. Break the #undef apart with a comment + dnl so that 'configure' does not comment it out. + AH_VERBATIM([zzstatic_assert], +[#if (!defined HAVE_C_STATIC_ASSERT && !defined assert \ + && (!defined __cplusplus \ + || (__cpp_static_assert < 201411 \ + && __GNUG__ < 6 && __clang_major__ < 6))) + #include + #undef/**/assert +#endif]) +]) diff --git a/m4/gettime.m4 b/m4/gettime.m4 index f0aeb4d0e4..c3e0713b57 100644 --- a/m4/gettime.m4 +++ b/m4/gettime.m4 @@ -1,4 +1,4 @@ -# gettime.m4 serial 11 +# gettime.m4 serial 12 dnl Copyright (C) 2002, 2004-2006, 2009-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,7 +9,34 @@ AC_DEFUN([gl_GETTIME], dnl Prerequisites of lib/gettime.c. AC_REQUIRE([gl_CLOCK_TIME]) AC_REQUIRE([gl_TIMESPEC]) - AC_CHECK_FUNCS_ONCE([timespec_get]) + + AC_REQUIRE([gl_CHECK_FUNC_TIMESPEC_GET]) + if test $gl_cv_func_timespec_get = yes; then + AC_DEFINE([HAVE_TIMESPEC_GET], [1], + [Define if you have the timespec_get function.]) + fi +]) + +dnl Tests whether the function timespec_get exists. +dnl Sets gl_cv_func_timespec_get. +AC_DEFUN([gl_CHECK_FUNC_TIMESPEC_GET], +[ + dnl Persuade OpenBSD to declare timespec_get(). + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + dnl We can't use AC_CHECK_FUNC here, because timespec_get() is defined as a + dnl static inline function in on MSVC 14. + AC_CACHE_CHECK([for timespec_get], [gl_cv_func_timespec_get], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include + struct timespec ts; + ]], + [[return timespec_get (&ts, 0);]]) + ], + [gl_cv_func_timespec_get=yes], + [gl_cv_func_timespec_get=no]) + ]) ]) AC_DEFUN([gl_GETTIME_RES], diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index 8a5daa230e..d17cbec58c 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -1,4 +1,4 @@ -# gnulib-common.m4 serial 73 +# gnulib-common.m4 serial 74 dnl Copyright (C) 2007-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -115,7 +115,7 @@ AC_DEFUN([gl_COMMON_BODY], [ # define _GL_HAS_C_ATTRIBUTE(attr) 0 #endif -]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's _Alignas instead. +]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead. [ /* _GL_ATTRIBUTE_ALLOC_SIZE ((N)) declares that the Nth argument of the function is the size of the returned memory block. diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 0c43dde716..6a5f300678 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -46,6 +46,7 @@ AC_DEFUN([gl_EARLY], # Code from module acl-permissions: # Code from module alloca-opt: # Code from module allocator: + # Code from module assert-h: # Code from module at-internal: # Code from module attribute: # Code from module binary-io: @@ -122,8 +123,8 @@ AC_DEFUN([gl_EARLY], # Code from module intprops: # Code from module inttypes-incomplete: # Code from module largefile: - AC_REQUIRE([AC_SYS_LARGEFILE]) AC_REQUIRE([gl_YEAR2038_EARLY]) + AC_REQUIRE([AC_SYS_LARGEFILE]) # Code from module lchmod: # Code from module libc-config: # Code from module libgmp: @@ -233,6 +234,9 @@ AC_DEFUN([gl_INIT], gl_FUNC_ALLOCA gl_CONDITIONAL_HEADER([alloca.h]) AC_PROG_MKDIR_P + gl_ASSERT_H + gl_CONDITIONAL_HEADER([assert.h]) + AC_PROG_MKDIR_P gl___BUILTIN_EXPECT gl_BYTESWAP gl_CONDITIONAL_HEADER([byteswap.h]) @@ -1214,6 +1218,7 @@ AC_DEFUN([gl_FILE_LIST], [ lib/allocator.c lib/allocator.h lib/arg-nonnull.h + lib/assert.in.h lib/at-func.c lib/attribute.h lib/binary-io.c @@ -1420,6 +1425,7 @@ AC_DEFUN([gl_FILE_LIST], [ m4/absolute-header.m4 m4/acl.m4 m4/alloca.m4 + m4/assert_h.m4 m4/builtin-expect.m4 m4/byteswap.m4 m4/canonicalize.m4 diff --git a/m4/nanosleep.m4 b/m4/nanosleep.m4 index 1964b1ea47..dfe21f56d5 100644 --- a/m4/nanosleep.m4 +++ b/m4/nanosleep.m4 @@ -1,4 +1,4 @@ -# serial 41 +# serial 42 dnl From Jim Meyering. dnl Check for the nanosleep function. @@ -100,15 +100,22 @@ AC_DEFUN([gl_FUNC_NANOSLEEP], #else /* A simpler test for native Windows. */ if (nanosleep (&ts_sleep, &ts_remaining) < 0) return 3; + /* Test for 32-bit mingw bug: negative nanosecond values do not + cause failure. */ + ts_sleep.tv_sec = 1; + ts_sleep.tv_nsec = -1; + if (nanosleep (&ts_sleep, &ts_remaining) != -1) + return 7; #endif return 0; }]])], [gl_cv_func_nanosleep=yes], - [case $? in dnl ( - 4|5|6) gl_cv_func_nanosleep='no (mishandles large arguments)';; dnl ( - *) gl_cv_func_nanosleep=no;; + [case $? in + 4|5|6) gl_cv_func_nanosleep='no (mishandles large arguments)' ;; + 7) gl_cv_func_nanosleep='no (mishandles negative tv_nsec)' ;; + *) gl_cv_func_nanosleep=no ;; esac], - [case "$host_os" in dnl (( + [case "$host_os" in linux*) # Guess it halfway works when the kernel is Linux. gl_cv_func_nanosleep='guessing no (mishandles large arguments)' ;; mingw*) # Guess no on native Windows. diff --git a/m4/stdalign.m4 b/m4/stdalign.m4 index 78577cb2ac..324e91dae2 100644 --- a/m4/stdalign.m4 +++ b/m4/stdalign.m4 @@ -1,4 +1,4 @@ -# Check for stdalign.h that conforms to C11. +# Check for alignas and alignof that conform to C23. dnl Copyright 2011-2022 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -9,12 +9,18 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_STDALIGN_H], [ - AC_CACHE_CHECK([for working stdalign.h], + AC_CACHE_CHECK([for alignas and alignof], [gl_cv_header_working_stdalign_h], - [AC_COMPILE_IFELSE( + [gl_save_CFLAGS=$CFLAGS + for gl_working in "yes, keywords" "yes, macros"; do + AS_CASE([$gl_working], + [*stdalign.h*], [CFLAGS="$gl_save_CFLAGS -DINCLUDE_STDALIGN_H"]) + AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[#include - #include + #ifdef INCLUDE_STDALIGN_H + #include + #endif #include /* Test that alignof yields a result consistent with offsetof. @@ -30,7 +36,7 @@ AC_DEFUN([gl_STDALIGN_H], char test_long[ao (long int) % _Alignof (long int) == 0 ? 1 : -1]; char test_alignof[alignof (double) == _Alignof (double) ? 1 : -1]; - /* Test _Alignas only on platforms where gnulib can help. */ + /* Test alignas only on platforms where gnulib can help. */ #if \ ((defined __cplusplus && 201103 <= __cplusplus) \ || (__TINYC__ && defined __attribute__) \ @@ -45,12 +51,84 @@ AC_DEFUN([gl_STDALIGN_H], ? 1 : -1]; #endif ]])], - [gl_cv_header_working_stdalign_h=yes], - [gl_cv_header_working_stdalign_h=no])]) - - if test $gl_cv_header_working_stdalign_h = yes; then - GL_GENERATE_STDALIGN_H=false - else - GL_GENERATE_STDALIGN_H=true - fi + [gl_cv_header_working_stdalign_h=$gl_working], + [gl_cv_header_working_stdalign_h=no]) + + CFLAGS=$gl_save_CFLAGS + test "$gl_cv_header_working_stdalign_h" != no && break + done]) + + GL_GENERATE_STDALIGN_H=false + AS_CASE([$gl_cv_header_working_stdalign_h], + [no], + [GL_GENERATE_STDALIGN_H=true], + [yes*keyword*], + [AC_DEFINE([HAVE_C_ALIGNASOF], [1], + [Define to 1 if the alignas and alignof keywords work.])]) + + AC_CHECK_HEADERS_ONCE([stdalign.h]) + + dnl The "zz" puts this toward config.h's end, to avoid potential + dnl collisions with other definitions. + AH_VERBATIM([zzalignas], +[#if !defined HAVE_C_ALIGNASOF && __cplusplus < 201103 && !defined alignof +# if HAVE_STDALIGN_H +# include +# else + /* Substitute. Keep consistent with gnulib/lib/stdalign.in.h. */ +# ifndef _GL_STDALIGN_H +# define _GL_STDALIGN_H +# undef _Alignas +# undef _Alignof +# if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \ + || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \ + && !defined __clang__) \ + || (defined __clang__ && __clang_major__ < 8)) +# ifdef __cplusplus +# if (201103 <= __cplusplus || defined _MSC_VER) +# define _Alignof(type) alignof (type) +# else + template struct __alignof_helper { char __a; __t __b; }; +# define _Alignof(type) offsetof (__alignof_helper, __b) +# define _GL_STDALIGN_NEEDS_STDDEF 1 +# endif +# else +# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b) +# define _GL_STDALIGN_NEEDS_STDDEF 1 +# endif +# endif +# if ! (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER)) +# define alignof _Alignof +# endif +# define __alignof_is_defined 1 +# if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 +# if defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER) +# define _Alignas(a) alignas (a) +# elif (!defined __attribute__ \ + && ((defined __APPLE__ && defined __MACH__ \ + ? 4 < __GNUC__ + (1 <= __GNUC_MINOR__) \ + : __GNUC__ && !defined __ibmxl__) \ + || (4 <= __clang_major__) \ + || (__ia64 && (61200 <= __HP_cc || 61200 <= __HP_aCC)) \ + || __ICC || 0x590 <= __SUNPRO_C || 0x0600 <= __xlC__)) +# define _Alignas(a) __attribute__ ((__aligned__ (a))) +# elif 1300 <= _MSC_VER +# define _Alignas(a) __declspec (align (a)) +# endif +# endif +# if ((defined _Alignas \ + && !(defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) \ + || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) +# define alignas _Alignas +# endif +# if (defined alignas \ + || (defined __cplusplus && (201103 <= __cplusplus || defined _MSC_VER))) +# define __alignas_is_defined 1 +# endif +# if _GL_STDALIGN_NEEDS_STDDEF +# include +# endif +# endif /* _GL_STDALIGN_H */ +# endif +#endif]) ]) diff --git a/m4/time_h.m4 b/m4/time_h.m4 index 98d7b6e01b..4ac8fd0075 100644 --- a/m4/time_h.m4 +++ b/m4/time_h.m4 @@ -2,7 +2,7 @@ # Copyright (C) 2000-2001, 2003-2007, 2009-2022 Free Software Foundation, Inc. -# serial 19 +# serial 20 # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -19,6 +19,12 @@ AC_DEFUN_ONCE([gl_TIME_H], gl_NEXT_HEADERS([time.h]) AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[ +#include + ]], [asctime_r ctime_r]) + AC_REQUIRE([AC_C_RESTRICT]) AC_CACHE_CHECK([for TIME_UTC in ], commit c1eb13b32676b288a3ab3826501caf7bcd376b7f Author: Sean Whitton Date: Tue Sep 27 17:49:05 2022 -0700 Maintaining ChangeLog history: add more details * admin/notes/repo (Maintaining ChangeLog history): Add more details. See . diff --git a/admin/notes/repo b/admin/notes/repo index f6004a97db..c2d7f993a0 100644 --- a/admin/notes/repo +++ b/admin/notes/repo @@ -124,6 +124,11 @@ This ChangeLog file is not put into the repository. 'make change-history' copies all newer ChangeLog entries into the start of the newest ChangeLog history file. These ChangeLog entries are thereafter considered to be old, so later uses of 'make ChangeLog' -and/or 'make change-history' will no longer copy the entries. To -alter ChangeLog history, run 'make change-history', then edit -the ChangeLog history files manually and commit your changes. +and/or 'make change-history' will no longer copy the entries. + +To alter ChangeLog history, run 'make change-history' and commit the +changes made by that command. Then edit the ChangeLog history files +manually and commit those changes in a second, distinct commit. +Altering ChangeLog history like this can make things harder for those +who handle merging branches and Emacs releases, so reserve it for +correcting more serious mistakes. commit adaa2fc90e5c5da4d2469bc20614328ec2ddca78 Author: Stefan Kangas Date: Tue Sep 27 23:28:26 2022 +0200 ; * lisp/image/image-dired.el: Fix typo. diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el index 2c2f24be64..f4ae6e9bfd 100644 --- a/lisp/image/image-dired.el +++ b/lisp/image/image-dired.el @@ -361,7 +361,7 @@ This affects the following commands: "Face for the directory name in the header line of the thumbnail buffer." :version "29.1") -(defface -image-dired-thumb-header-file-size +(defface image-dired-thumb-header-file-size '((((class color) (min-colors 88)) :foreground "cadet blue") (((class color) (min-colors 16)) :foreground "black") (default :inherit header-line)) commit 9e0c21ea73e41916322cbeef5751400c5353bd5a Author: Stefan Kangas Date: Tue Sep 27 23:26:07 2022 +0200 Make image-dired-dired-toggle-marked-thumbs faster * lisp/image/image-dired-dired.el (image-dired-dired-toggle-marked-thumbs): Don't show progress, since it makes things slower. diff --git a/lisp/image/image-dired-dired.el b/lisp/image/image-dired-dired.el index 94367b566e..d03c1629da 100644 --- a/lisp/image/image-dired-dired.el +++ b/lisp/image/image-dired-dired.el @@ -83,8 +83,8 @@ previous -ARG, if ARG<0) files." if (overlay-get ov 'put-image) return ov)) (overlay-put overlay 'image-file image-file) (overlay-put overlay 'thumb-file thumb-file))))) - arg ; Show or hide image on ARG next files. - 'show-progress) ; Update dired display after each image is updated. + ;; Show or hide thumbnail on ARG next files. + arg) (add-hook 'dired-after-readin-hook 'image-dired-dired-after-readin-hook nil t)) commit a438e95c105f49492c9b9b4bb8ecc4c6e714a0cf Author: Lin Sun Date: Tue Sep 27 23:14:52 2022 +0200 Load compiled "calc-loaddefs", if any * lisp/calc/calc.el ("calc-loaddefs"): Load the .elc file (if it exists) (bug#58127). diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index c0f87ad3d4..6ea8a4202f 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -1162,7 +1162,7 @@ Used by `calc-user-invocation'.") ;;;; (Autoloads here) -(load "calc-loaddefs.el" nil t) +(load "calc-loaddefs" nil t) ;;;###autoload (define-key ctl-x-map "*" 'calc-dispatch) commit 42290bf8231159f5188d4b3c5861aa02f0489c61 Author: Stefan Kangas Date: Tue Sep 27 22:58:31 2022 +0200 image-dired: Fix header line when file is missing * lisp/image/image-dired.el (image-dired-format-properties-string): Don't error when file has been deleted. diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el index 98bb6b3c5a..2c2f24be64 100644 --- a/lisp/image/image-dired.el +++ b/lisp/image/image-dired.el @@ -768,9 +768,11 @@ comment." 'face 'image-dired-thumb-header-file-name)) (?n . ,(propertize image-count 'face 'image-dired-thumb-header-image-count)) - (?s . ,(propertize (file-size-human-readable - (file-attribute-size - (file-attributes file))) + (?s . ,(propertize (if (file-exists-p file) + (file-size-human-readable + (file-attribute-size + (file-attributes file))) + "") 'face 'image-dired-thumb-header-file-size)) (?t . ,(or props "")) (?c . ,(or comment ""))))) commit e638aaf6e82aa9eeb5e5723b995d3295b53fa6c9 Author: Stefan Monnier Date: Tue Sep 27 15:10:47 2022 -0400 * lisp/files.el (file-backup-file-names): Don't burp if dir doesn't exist diff --git a/lisp/files.el b/lisp/files.el index 1e1ec6127d..b953961aa1 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -6127,16 +6127,17 @@ recent files are first." (let* ((filename (file-name-sans-versions (make-backup-file-name (expand-file-name filename)))) (dir (file-name-directory filename))) - (sort - (seq-filter - (lambda (candidate) - (and (backup-file-name-p candidate) - (string= (file-name-sans-versions candidate) filename))) - (mapcar - (lambda (file) - (concat dir file)) - (file-name-all-completions (file-name-nondirectory filename) dir))) - #'file-newer-than-file-p))) + (when (file-directory-p dir) + (sort + (seq-filter + (lambda (candidate) + (and (backup-file-name-p candidate) + (string= (file-name-sans-versions candidate) filename))) + (mapcar + (lambda (file) + (concat dir file)) + (file-name-all-completions (file-name-nondirectory filename) dir))) + #'file-newer-than-file-p)))) (defun rename-uniquely () "Rename current buffer to a similar name not already taken. commit d322adabf240a2b39f1b937b8e86009c32be9620 Author: Stefan Kangas Date: Tue Sep 27 20:01:38 2022 +0200 Add back useful information from gnus-coding.texi * lisp/international/rfc1843.el: * lisp/net/pop3.el: Improve Commentary by adding back text from deleted file gnus-coding.texi. diff --git a/lisp/international/rfc1843.el b/lisp/international/rfc1843.el index 5050b7c030..73b610c034 100644 --- a/lisp/international/rfc1843.el +++ b/lisp/international/rfc1843.el @@ -1,4 +1,4 @@ -;;; rfc1843.el --- HZ (rfc1843) decoding -*- lexical-binding:t -*- +;;; rfc1843.el --- HZ (RFC 1843) decoding -*- lexical-binding:t -*- ;; Copyright (C) 1998-2022 Free Software Foundation, Inc. @@ -22,6 +22,9 @@ ;;; Commentary: +;; HZ (RFC 1843) decoding. HZ is a data format for exchanging files +;; of arbitrarily mixed Chinese and ASCII characters. +;; ;; Test: ;; (rfc1843-decode-string "~{<:Ky2;S{#,NpJ)l6HK!#~}") diff --git a/lisp/net/pop3.el b/lisp/net/pop3.el index 9d59ddf978..1bd52c7a56 100644 --- a/lisp/net/pop3.el +++ b/lisp/net/pop3.el @@ -23,6 +23,8 @@ ;;; Commentary: +;; Post Office Protocol version 3 (RFC 1460) interface. +;; ;; Most of the standard Post Office Protocol version 3 (RFC 1460) commands ;; are implemented. The LIST command has not been implemented due to lack ;; of actual usefulness. commit f9a072c59298127eaa0d75fafdfc404b08d1483d Author: Stefan Kangas Date: Tue Sep 27 19:32:31 2022 +0200 ; Fix typo diff --git a/doc/emacs/ack.texi b/doc/emacs/ack.texi index 5bdc922fe4..8f75c2c315 100644 --- a/doc/emacs/ack.texi +++ b/doc/emacs/ack.texi @@ -1442,8 +1442,8 @@ zone out in front of Emacs. @item Eli Zaretskii was the was the Emacs (co-)maintainer from Emacs 25 -onwards. He wrote made many standard Emacs features work on MS-DOS -and Microsoft Windows. He also wrote @file{tty-colors.el}, which +onwards. He made many standard Emacs features work on MS-DOS and +Microsoft Windows. He also wrote @file{tty-colors.el}, which implements transparent mapping of X colors to tty colors; and @file{rxvt.el}. He implemented support for bidirectional text, menus on text-mode terminals, and built-in display of line numbers. commit 3d056f6947b1ad2acbfbaa39d660fc19a5986bce Author: Stefan Kangas Date: Tue Sep 27 19:22:22 2022 +0200 * doc/emacs/ack.texi (Acknowledgments): Update maintainers. diff --git a/doc/emacs/ack.texi b/doc/emacs/ack.texi index 52ce8a16e6..5bdc922fe4 100644 --- a/doc/emacs/ack.texi +++ b/doc/emacs/ack.texi @@ -524,8 +524,9 @@ Denis Howe wrote @file{browse-url.el}, a package for invoking a WWW browser to display a URL. @item -Lars Magne Ingebrigtsen did a major redesign of the Gnus news-reader and -wrote many of its parts. Several of these are now general components of +Lars Magne Ingebrigtsen was the Emacs (co-)maintainer from Emacs 27.2 +onwards. He did a major redesign of the Gnus news-reader and wrote +many of its parts. Several of these are now general components of Emacs, including: @file{dns.el} for Domain Name Service lookups; @file{format-spec.el} for formatting arbitrary format strings; @file{netrc.el} for parsing of @file{.netrc} files; and @@ -1440,8 +1441,9 @@ Victor Zandy wrote @file{zone.el}, a package for people who like to zone out in front of Emacs. @item -Eli Zaretskii made many standard Emacs features work on MS-DOS and -Microsoft Windows. He also wrote @file{tty-colors.el}, which +Eli Zaretskii was the was the Emacs (co-)maintainer from Emacs 25 +onwards. He wrote made many standard Emacs features work on MS-DOS +and Microsoft Windows. He also wrote @file{tty-colors.el}, which implements transparent mapping of X colors to tty colors; and @file{rxvt.el}. He implemented support for bidirectional text, menus on text-mode terminals, and built-in display of line numbers. commit 9f84d318b04a30532dfe9712500c22b908f08cfa Author: Lars Ingebrigtsen Date: Tue Sep 27 19:31:35 2022 +0200 Remove gnus-coding.text (bug#58119) diff --git a/doc/misc/gnus-coding.texi b/doc/misc/gnus-coding.texi deleted file mode 100644 index 0858432acf..0000000000 --- a/doc/misc/gnus-coding.texi +++ /dev/null @@ -1,227 +0,0 @@ -\input texinfo - -@setfilename gnus-coding.info -@settitle Gnus Coding Style and Maintenance Guide -@include docstyle.texi -@syncodeindex fn cp -@syncodeindex vr cp -@syncodeindex pg cp - -@copying -Copyright @copyright{} 2004--2005, 2007--2022 Free Software Foundation, -Inc. - -@quotation -Permission is granted to copy, distribute and/or modify this document -under the terms of the GNU Free Documentation License, Version 1.3 or -any later version published by the Free Software Foundation; with no -Invariant Sections, with the Front-Cover Texts being ``A GNU Manual'', -and with the Back-Cover Texts as in (a) below. A copy of the license -is included in the section entitled ``GNU Free Documentation License''. - -(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and -modify this GNU manual.'' -@end quotation -@end copying - - -@titlepage -@title Gnus Coding Style and Maintenance Guide - -@author by Reiner Steib - -@insertcopying -@end titlepage - -@c Obviously this is only a very rudimentary draft. We put it in the -@c repository anyway hoping that it might annoy someone enough to fix -@c it. ;-) Fixing only a paragraph also is appreciated. - -@ifnottex -@node Top -@top Gnus Coding Style and Maintenance Guide -This manual describes @dots{} - -@insertcopying -@end ifnottex - -@menu -* Gnus Coding Style:: Gnus Coding Style -* Gnus Maintenance Guide:: Gnus Maintenance Guide -* GNU Free Documentation License:: The license for this documentation. -@end menu - -@c @ref{Gnus Reference Guide, ,Gnus Reference Guide, gnus, The Gnus Newsreader} - -@node Gnus Coding Style -@chapter Gnus Coding Style -@section Dependencies - -The Gnus distribution contains a lot of libraries that have been written -for Gnus and used intensively for Gnus. But many of those libraries are -useful on their own. E.g., other Emacs Lisp packages might use the -@acronym{MIME} library @xref{Top, ,Top, emacs-mime, The Emacs MIME -Manual}. - -@subsection General purpose libraries - -@table @file - -@item netrc.el -@file{.netrc} parsing functionality. -@c As of 2005-10-21... -There are no Gnus dependencies in this file. - -@item format-spec.el -Functions for formatting arbitrary formatting strings. -@c As of 2005-10-21... -There are no Gnus dependencies in this file. - -@item hex-util.el -Functions to encode/decode hexadecimal string. -@c As of 2007-08-25... -There are no Gnus dependencies in these files. -@end table - -@subsection Encryption and security - -@table @file -@item encrypt.el -File encryption routines -@c As of 2005-10-25... -There are no Gnus dependencies in this file. - -@item password.el -Read passwords from user, possibly using a password cache. -@c As of 2005-10-21... -There are no Gnus dependencies in this file. - -@item sha1.el -SHA1 Secure Hash Algorithm. -@c As of 2007-08-25... -There are no Gnus dependencies in these files. -@end table - -@subsection Networking - -@table @file -@item dig.el -Domain Name System dig interface. -@c As of 2005-10-21... -There are no serious Gnus dependencies in this file. Uses -@code{gnus-run-mode-hooks} (a wrapper function). - -@item dns.el, dns-mode.el -Domain Name Service lookups. -@c As of 2005-10-21... -There are no Gnus dependencies in these files. -@end table - -@subsection Mail and News related RFCs - -@table @file -@item pop3.el -Post Office Protocol (RFC 1460) interface. -@c As of 2005-10-21... -There are no Gnus dependencies in this file. - -@item imap.el -@acronym{IMAP} library. -@c As of 2005-10-21... -There are no Gnus dependencies in this file. - -@item ietf-drums.el -Functions for parsing RFC 2822 headers. -@c As of 2005-10-21... -There are no Gnus dependencies in this file. - -@item rfc1843.el -HZ (rfc1843) decoding. HZ is a data format for exchanging files of -arbitrarily mixed Chinese and @acronym{ASCII} characters. -@c As of 2005-10-21... -@code{rfc1843-gnus-setup} seem to be useful only for Gnus. Maybe this -function should be relocated to remove dependencies on Gnus. Other -minor dependencies: @code{gnus-newsgroup-name} could be eliminated by -using an optional argument to @code{rfc1843-decode-article-body}. - -@item rfc2045.el -Functions for decoding rfc2045 headers -@c As of 2007-08-25... -There are no Gnus dependencies in these files. - -@item rfc2047.el -Functions for encoding and decoding rfc2047 messages -@c As of 2007-08-25... -There are no Gnus dependencies in these files. -@c -Only a couple of tests for gnusy symbols. - -@item rfc2104.el -RFC2104 Hashed Message Authentication Codes -@c As of 2007-08-25... -There are no Gnus dependencies in these files. - -@item rfc2231.el -Functions for decoding rfc2231 headers -@c As of 2007-08-25... -There are no Gnus dependencies in these files. - -@item flow-fill.el -Interpret RFC2646 "flowed" text. -@c As of 2005-10-27... -There are no Gnus dependencies in this file. - -@item uudecode.el -Elisp native uudecode. -@c As of 2005-12-06... -There are no Gnus dependencies in this file. -@c ... but the custom group is gnus-extract. - -@item canlock.el -Functions for Cancel-Lock feature -@c Cf. draft-ietf-usefor-cancel-lock-01.txt -@c Although this draft has expired, Canlock-Lock revived in 2007 when -@c major news providers (e.g., news.individual.org) started to use it. -@c As of 2007-08-25... -There are no Gnus dependencies in these files. - -@end table - -@subsection message - -All message composition from Gnus (both mail and news) takes place in -Message mode buffers. Message mode is intended to be a replacement for -Emacs mail mode. There should be no Gnus dependencies in -@file{message.el}. Alas it is not anymore. Patches and suggestions to -remove the dependencies are welcome. - -@c message.el requires nnheader which requires gnus-util. - -@subsection Emacs @acronym{MIME} - -The files @file{mml*.el} and @file{mm-*.el} provide @acronym{MIME} -functionality for Emacs. - -@acronym{MML} (@acronym{MIME} Meta Language) is supposed to be -independent from Gnus. Alas it is not anymore. Patches and suggestions -to remove the dependencies are welcome. - -@subsection Gnus backends - -The files @file{nn*.el} provide functionality for accessing NNTP -(@file{nntp.el}), IMAP (@file{nnimap.el}) and several other Mail back -ends (probably @file{nnml.el}, @file{nnfolder.el} and -@file{nnmaildir.el} are the most widely used mail back ends). - -@c mm-uu requires nnheader which requires gnus-util. message.el also -@c requires nnheader. - - -@node GNU Free Documentation License -@appendix GNU Free Documentation License -@include doclicense.texi - -@c Local Variables: -@c mode: texinfo -@c coding: utf-8 -@c End: commit c273e26af58aab340b470595874893b23dab208d Author: Michael Albinus Date: Tue Sep 27 18:46:28 2022 +0200 Some tramp-docker.el adaptions * lisp/net/tramp-docker.el (tramp-docker--completion-function): Add ;;;###tramp-autoload cookie. Make implementation more robust. (tramp-methods) Use `tramp-default-remote-shell'. diff --git a/lisp/net/tramp-docker.el b/lisp/net/tramp-docker.el index 40257a4a12..918469908a 100644 --- a/lisp/net/tramp-docker.el +++ b/lisp/net/tramp-docker.el @@ -53,23 +53,26 @@ (defconst tramp-docker-method "docker" "Tramp method name to use to connect to Docker containers.") +;;;###tramp-autoload (defun tramp-docker--completion-function (&rest _args) "List Docker containers available for connection. This function is used by `tramp-set-completion-function', please see its function help for a description of the format." - (let* ((raw-list (shell-command-to-string - (concat tramp-docker-program - " ps --format '{{.ID}}\t{{.Names}}'"))) - (lines (split-string raw-list "\n")) - (names (mapcar (lambda (line) - (let ((words (split-string line "\t"))) - (or (nth 1 words) (nth 0 words)))) - lines)) - (machines (seq-take-while (lambda (name) name) names))) - (mapcar (lambda (m) (list nil m)) machines))) - -;; todo: check tramp-async-args and tramp-direct-async + (when-let ((raw-list (shell-command-to-string + (concat tramp-docker-program + " ps --format '{{.ID}}\t{{.Names}}'"))) + (lines (split-string raw-list "\n" 'omit)) + (names (mapcar + (lambda (line) + (when (string-match + (rx bol (group (1+ nonl)) + "\t" (? (group (1+ nonl))) eol) + line) + (or (match-string 2 line) (match-string 1 line)))) + lines))) + (mapcar (lambda (m) (list nil m)) (delq nil names)))) + ;;;###tramp-autoload (tramp--with-startup (push `(,tramp-docker-method @@ -78,8 +81,8 @@ see its function help for a description of the format." ("-it") ("-u" "%u") ("%h") - ("/bin/sh"))) - (tramp-remote-shell "/bin/sh") + ("%l"))) + (tramp-remote-shell ,tramp-default-remote-shell) (tramp-remote-shell-login ("-l")) (tramp-remote-shell-args ("-i" "-c"))) tramp-methods) commit 49d40cd95320d5f4de4362b32c8ed203a6ef573e Author: Stefan Kangas Date: Tue Sep 27 15:56:22 2022 +0200 ; Simplify wallpaper--format-arg with let-alist * lisp/image/wallpaper.el (wallpaper--format-arg): Use let-alist. diff --git a/lisp/image/wallpaper.el b/lisp/image/wallpaper.el index 4ad09e893c..0a891f9012 100644 --- a/lisp/image/wallpaper.el +++ b/lisp/image/wallpaper.el @@ -422,11 +422,9 @@ FILE is the image file name." (match-string 1 display) "0"))) ;; monitor name - (?M . ,(let* ((attrs (car (display-monitor-attributes-list))) - (source (cdr (assq 'source attrs))) - (monitor (cdr (assq 'name attrs)))) - (if (and monitor (member source '("XRandr" "XRandR 1.5" "Gdk"))) - monitor + (?M . ,(let-alist (car (display-monitor-attributes-list)) + (if (and .name (member .source '("XRandr" "XRandR 1.5" "Gdk"))) + .name "0"))) ;; workspace (?W . ,(or (and (fboundp 'x-window-property) commit 071d811c0ff507e46dcbc53eb4614fe01e519e28 Author: Stefan Kangas Date: Tue Sep 27 15:42:30 2022 +0200 * etc/NEWS.23: Belatedly announce 'format-spec'. diff --git a/etc/NEWS.23 b/etc/NEWS.23 index ef87db79d9..5f13845dcb 100644 --- a/etc/NEWS.23 +++ b/etc/NEWS.23 @@ -2543,6 +2543,8 @@ a list of buffers/files to search for a string/regexp. ** The new major mode 'special-mode' is intended as a parent for major modes such as those that set the "'mode-class 'special" property. +** New package format-spec.el provides 'format-spec'. + ---------------------------------------------------------------------- This file is part of GNU Emacs. commit 1e4f40db3ac4ab46ff22c1a3aaed9053787847af Author: Stefan Kangas Date: Tue Sep 27 15:33:05 2022 +0200 ; * lisp/image/wallpaper.el (wallpaper--format-arg): Fix typo. diff --git a/lisp/image/wallpaper.el b/lisp/image/wallpaper.el index 36bc7e91a6..4ad09e893c 100644 --- a/lisp/image/wallpaper.el +++ b/lisp/image/wallpaper.el @@ -425,7 +425,7 @@ FILE is the image file name." (?M . ,(let* ((attrs (car (display-monitor-attributes-list))) (source (cdr (assq 'source attrs))) (monitor (cdr (assq 'name attrs)))) - (if (and monitor (member source '("XRandr" "XRandr 1.5" "Gdk"))) + (if (and monitor (member source '("XRandr" "XRandR 1.5" "Gdk"))) monitor "0"))) ;; workspace commit 327890dd6c96d55a9471a80ac53c36c2e51ec5d7 Author: Stefan Kangas Date: Tue Sep 27 15:29:33 2022 +0200 Document the new "XRandR 1.5" value * src/xfns.c (Fx_display_monitor_attributes_list): * lisp/frame.el (display-monitor-attributes-list): * doc/lispref/frames.texi (Multiple Terminals): Document the new "XRandR 1.5" value. diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index e38a81d3e7..8db6ad0fd3 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi @@ -407,7 +407,7 @@ Name of the physical monitor as @var{string}. @item source Source of the multi-monitor information as @var{string}; -e.g., @samp{XRandr} or @samp{Xinerama}. +e.g., @samp{XRandR 1.5}, @samp{XRandr} or @samp{Xinerama}. @end table @var{x}, @var{y}, @var{width}, and @var{height} are integers. diff --git a/lisp/frame.el b/lisp/frame.el index 1d7784dc76..400f8a44ee 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -2425,9 +2425,9 @@ It may be less than the total screen size, owing to space taken up by window manager features (docks, taskbars, etc.). The precise details depend on the platform and environment. -The `source' attribute describes the source from which the information -was obtained. On X, this may be one of: \"Gdk\", \"XRandr\", \"Xinerama\", -or \"fallback\". +The `source' attribute describes the source from which the +information was obtained. On X, this may be one of: \"Gdk\", +\"XRandR 1.5\", \"XRandr\", \"Xinerama\", or \"fallback\". A frame is dominated by a physical monitor when either the largest area of the frame resides in the monitor, or the monitor diff --git a/src/xfns.c b/src/xfns.c index 1d0210cb9e..bb75ca5ad1 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -6244,8 +6244,8 @@ In addition to the standard attribute keys listed in the attributes: source -- String describing the source from which multi-monitor - information is obtained, one of \"Gdk\", \"XRandr\", - \"Xinerama\", or \"fallback\" + information is obtained, one of \"Gdk\", \"XRandR 1.5\", + \"XRandr\", \"Xinerama\", or \"fallback\" Internal use only, use `display-monitor-attributes-list' instead. */) (Lisp_Object terminal) commit 37fe62a3bda82d21aa6fa30d28f1c51e4bd8e6b4 Author: Eli Zaretskii Date: Tue Sep 27 16:01:50 2022 +0300 ; Fix documentation of imenu access in DocView * lisp/doc-view.el (doc-view-imenu-enabled) (doc-view--pdf-outline, doc-view-imenu-index): Doc fixes. * doc/emacs/misc.texi (DocView Navigation): Fix typo and wording. diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index f3a6e6c33b..04f7f2e921 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -585,11 +585,11 @@ default size for DocView, customize the variable @code{doc-view-resolution}. @vindex doc-view-imenu-enabled - When the @command{mutool} executable is available, DocView will use + When the @command{mutool} program is available, DocView will use it to generate entries for an outline menu, making it accessible via the -imenu facility (@pxref{Imenu}). To disable this functionality even -when @command{mutool} can be found in your @code{exec-path}, customize -the variable @code{doc-view-imenu-enabled}. +@code{imenu} facility (@pxref{Imenu}). To disable this functionality +even when @command{mutool} can be found on your system, customize +the variable @code{doc-view-imenu-enabled} to the @code{nil} value. @node DocView Searching @subsection DocView Searching diff --git a/lisp/doc-view.el b/lisp/doc-view.el index fe772efcfc..fa583df12b 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -215,7 +215,7 @@ are available (see Info node `(emacs)Document View')." :version "29.1") (defcustom doc-view-imenu-enabled (and (executable-find "mutool") t) - "Whether to generate an imenu outline when mutool is available." + "Whether to generate an imenu outline when \"mutool\" is available." :type 'boolean :version "29.1") @@ -1884,9 +1884,10 @@ If BACKWARD is non-nil, jump to the previous match." "[^\t]+\\(\t+\\)\"\\(.+\\)\"\t#\\(?:page=\\)?\\([0-9]+\\)") (defun doc-view--pdf-outline (&optional file-name) - "Return a describing the outline of FILE-NAME (or current if nil). + "Return a list describing the outline of FILE-NAME. +Return a list describing the current file if FILE-NAME is nil. -Each element in the list contains information about a section's +Each element in the returned list contains information about a section's title, nesting level and page number. The list is flat: its tree structure is extracted by `doc-view--imenu-subtree'." (let* ((outline nil) @@ -1925,11 +1926,11 @@ entries at an upper level." (cons (nreverse index) outline))) (defun doc-view-imenu-index (&optional file-name goto-page-fn) - "Create an imenu index using mutool to extract its outline. + "Create an imenu index using \"mutool\" to extract its outline. -For extensibility, a FILE-NAME other than the current buffer and -a jumping function, GOTO-PAGE-FN other than `doc-view-goto-page' -can be specified." +For extensibility, callers can specify a FILE-NAME to indicate +the buffer other than the current buffer, and a jumping function +GOTO-PAGE-FN other than `doc-view-goto-page'." (let* ((goto (or goto-page-fn 'doc-view-goto-page)) (act (lambda (_name _pos page) (funcall goto page)))) (car (doc-view--imenu-subtree (doc-view--pdf-outline file-name) act)))) commit fe215074392d7cdd965b97119892fa4e5366a051 Author: Po Lu Date: Tue Sep 27 20:04:11 2022 +0800 ; * src/xfns.c (Fx_window_property): Fix markup. diff --git a/src/xfns.c b/src/xfns.c index 539e8c6dbe..1d0210cb9e 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -7739,7 +7739,7 @@ properties are specified as part of the Extended Window Manager Hints and the Inter-Client Communication Conventions Manual, which are located here: - https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html + https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html and commit 60b4fe92c81c4e6a533fb05cfa706a155472fb37 Author: Po Lu Date: Tue Sep 27 20:03:08 2022 +0800 Improve doc of `x-window-property' * src/xfns.c (Fx_window_property): Fix errors in doc string and document where to obtain documentation for standardized window properties. diff --git a/src/xfns.c b/src/xfns.c index 4df5ad890e..539e8c6dbe 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -7711,17 +7711,40 @@ DEFUN ("x-window-property", Fx_window_property, Sx_window_property, doc: /* Value is the value of window property PROP on FRAME. If FRAME is nil or omitted, use the selected frame. -On X Windows, the following optional arguments are also accepted: -If TYPE is nil or omitted, get the property as a string. - Otherwise TYPE is the name of the atom that denotes the expected type. +On X Windows, the following optional arguments are also accepted: If +TYPE is nil or omitted, get the property as a string. Otherwise TYPE +is the name of the atom that denotes the expected type. + +If TYPE is the string "AnyPropertyType", decode and return the data +regardless of what the type really is. + +The format of the data returned is the same as a selection conversion +to the given type. For example, if `x-get-selection-internal' returns +an integer when the selection data is a given type, +`x-window-property' will do the same for that type. + If WINDOW-ID is non-nil, get the property of that window instead of - FRAME's X window; the number 0 denotes the root window. This argument - is separate from FRAME because window IDs are not unique across X - displays or screens on the same display, so FRAME provides context - for the window ID. +FRAME's X window; the number 0 denotes the root window. This argument +is separate from FRAME because window IDs are not unique across X +displays, so FRAME provides context for the window ID. + If DELETE-P is non-nil, delete the property after retrieving it. If VECTOR-RET-P is non-nil, return a vector of values instead of a string. +X allows an arbitrary number of properties to be set on any window. +However, properties are most often set by the window manager or other +programs on the root window or FRAME's X window in order to +communicate information to Emacs and other programs. Most of these +properties are specified as part of the Extended Window Manager Hints +and the Inter-Client Communication Conventions Manual, which are +located here: + + https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html + +and + + https://x.org/releases/X11R7.6/doc/xorg-docs/specs/ICCCM/icccm.html + Return value is nil if FRAME doesn't have a property with name PROP or if PROP has no value of TYPE (always a string in the MS Windows case). */) (Lisp_Object prop, Lisp_Object frame, Lisp_Object type, commit b1c1ff9ee110a9fe739dc4407468f3e9b819484c Author: Jose A. Ortega Ruiz Date: Tue Sep 27 13:53:24 2022 +0200 docview: imenu access to table of contents * lisp/doc-view.el (doc-view-imenu-enabled): user option to disable imenu generation. * lisp/doc-view.el (doc-view--outline-rx): (doc-view--pdf-outline, doc-view--imenu-subtree, doc-view-imenu-index): functions implementing the imenu index generation via mutool. * lisp/doc-view.el (doc-view-imenu-setup, doc-view-mode): setup of the new functionality in doc-view mode. * lisp/imenu.el (imenu-submenus-on-top): (imenu--split-menu): new local variable to optionally inhibit grouping of entries with children at the top of imenu menus. * doc/emacs/misc.texi: documentation for the new functionality (bug#58103). diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 10b44028bb..f3a6e6c33b 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -584,6 +584,13 @@ you instead want the image to be re-rendered at the new size, set default size for DocView, customize the variable @code{doc-view-resolution}. +@vindex doc-view-imenu-enabled + When the @command{mutool} executable is available, DocView will use +to generate entries for an outline menu, making it accessible via the +imenu facility (@pxref{Imenu}). To disable this functionality even +when @command{mutool} can be found in your @code{exec-path}, customize +the variable @code{doc-view-imenu-enabled}. + @node DocView Searching @subsection DocView Searching diff --git a/lisp/doc-view.el b/lisp/doc-view.el index fbd1427946..fe772efcfc 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -214,6 +214,11 @@ are available (see Info node `(emacs)Document View')." :type 'boolean :version "29.1") +(defcustom doc-view-imenu-enabled (and (executable-find "mutool") t) + "Whether to generate an imenu outline when mutool is available." + :type 'boolean + :version "29.1") + (defcustom doc-view-svg-background "white" "Background color for svg images. See `doc-view-mupdf-use-svg'." @@ -1874,6 +1879,69 @@ If BACKWARD is non-nil, jump to the previous match." (y-or-n-p "No more matches before current page. Wrap to last match? ")) (doc-view-goto-page (caar (last doc-view--current-search-matches))))))) +;;;; Imenu support +(defconst doc-view--outline-rx + "[^\t]+\\(\t+\\)\"\\(.+\\)\"\t#\\(?:page=\\)?\\([0-9]+\\)") + +(defun doc-view--pdf-outline (&optional file-name) + "Return a describing the outline of FILE-NAME (or current if nil). + +Each element in the list contains information about a section's +title, nesting level and page number. The list is flat: its tree +structure is extracted by `doc-view--imenu-subtree'." + (let* ((outline nil) + (fn (or file-name (buffer-file-name))) + (fn (shell-quote-argument (expand-file-name fn)))) + (with-temp-buffer + (insert (shell-command-to-string (format "mutool show %s outline" fn))) + (goto-char (point-min)) + (while (re-search-forward doc-view--outline-rx nil t) + (push `((level . ,(length (match-string 1))) + (title . ,(match-string 2)) + (page . ,(string-to-number (match-string 3)))) + outline))) + (nreverse outline))) + +(defun doc-view--imenu-subtree (outline act) + "Construct a tree of imenu items for the given outline list and action. + +This auxliary function constructs recursively all the items for +the first node in the outline and all its siblings at the same +level. Returns that imenu alist together with any other pending outline +entries at an upper level." + (let ((level (alist-get 'level (car outline))) + (index nil)) + (while (and (car outline) (<= level (alist-get 'level (car outline)))) + (let-alist (car outline) + (let ((title (format "%s (%s)" .title .page))) + (if (> .level level) + (let ((sub (doc-view--imenu-subtree outline act)) + (fst (car index))) + (setq index (cdr index)) + (push (cons (car fst) (cons fst (car sub))) index) + (setq outline (cdr sub))) + (push `(,title 0 ,act ,.page) index) + (setq outline (cdr outline)))))) + (cons (nreverse index) outline))) + +(defun doc-view-imenu-index (&optional file-name goto-page-fn) + "Create an imenu index using mutool to extract its outline. + +For extensibility, a FILE-NAME other than the current buffer and +a jumping function, GOTO-PAGE-FN other than `doc-view-goto-page' +can be specified." + (let* ((goto (or goto-page-fn 'doc-view-goto-page)) + (act (lambda (_name _pos page) (funcall goto page)))) + (car (doc-view--imenu-subtree (doc-view--pdf-outline file-name) act)))) + +(defun doc-view-imenu-setup () + "Set up local state in the current buffer for imenu, if needed." + (when (and doc-view-imenu-enabled (executable-find "mutool")) + (setq-local imenu-create-index-function #'doc-view-imenu-index + imenu-submenus-on-top nil + imenu-sort-function nil) + (imenu-add-to-menubar "Outline"))) + ;;;; User interface commands and the mode (put 'doc-view-mode 'mode-class 'special) @@ -2047,7 +2115,7 @@ If BACKWARD is non-nil, jump to the previous match." "Major mode in DocView buffers. DocView Mode is an Emacs document viewer. It displays PDF, PS -and DVI files (as PNG images) in Emacs buffers. +and DVI files (as PNG or SVG images) in Emacs buffers. You can use \\\\[doc-view-toggle-display] to toggle between displaying the document or editing it as text. @@ -2142,6 +2210,7 @@ toggle between displaying the document or editing it as text. (setq mode-name "DocView" buffer-read-only t major-mode 'doc-view-mode) + (doc-view-imenu-setup) (doc-view-initiate-display) ;; Switch off view-mode explicitly, because doc-view-mode is the ;; canonical view mode for PDF/PS/DVI files. This could be diff --git a/lisp/imenu.el b/lisp/imenu.el index c407f501d6..bfc2429100 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -208,6 +208,13 @@ called within a `save-excursion'. See `imenu--index-alist' for the format of the buffer index alist.") +;;;###autoload +(defvar-local imenu-submenus-on-top t + "Flag specifiying whether items with sublists should be kept at top. + +For some indexes, such as those describing sections in a document, it +makes sense to keep their original order even in the menubar.") + ;;;###autoload (defvar-local imenu-prev-index-position-function 'beginning-of-defun "Function for finding the next index position. @@ -373,10 +380,11 @@ The returned alist DOES NOT share structure with MENULIST." (if (memq imenu--rescan-item menulist) (setq keep-at-top (list imenu--rescan-item) menulist (delq imenu--rescan-item menulist))) - (dolist (item menulist) - (when (imenu--subalist-p item) - (push item keep-at-top) - (setq menulist (delq item menulist)))) + (if imenu-submenus-on-top + (dolist (item menulist) + (when (imenu--subalist-p item) + (push item keep-at-top) + (setq menulist (delq item menulist))))) (if imenu-sort-function (setq menulist (sort menulist imenu-sort-function))) (if (> (length menulist) imenu-max-items) commit fd653f5208e8600166003af41660ce2ad0b6362f Author: Richard Hansen Date: Mon Sep 26 02:12:41 2022 -0400 ; whitespace: Add test case for read-only buffers (bug#58082) diff --git a/test/lisp/whitespace-tests.el b/test/lisp/whitespace-tests.el index 97c30c4d62..fb53543c9e 100644 --- a/test/lisp/whitespace-tests.el +++ b/test/lisp/whitespace-tests.el @@ -27,7 +27,8 @@ (defmacro whitespace-tests--with-test-buffer (style &rest body) "Run BODY in a buffer with `whitespace-mode' style STYLE. The buffer is displayed in `selected-window', and -`noninteractive' is set to nil even in batch mode." +`noninteractive' is set to nil even in batch mode. If STYLE is +nil, `whitespace-mode' is left disabled." (declare (debug ((style form) def-body)) (indent 1)) `(ert-with-test-buffer-selected () @@ -37,7 +38,8 @@ The buffer is displayed in `selected-window', and (let ((noninteractive nil) (whitespace-style ,style)) (font-lock-mode 1) - (whitespace-mode 1) + ,(when style + '(whitespace-mode 1)) ,@body))) (defun whitespace-tests--faceup (&rest lines) @@ -310,6 +312,21 @@ buffer's content." "\t\n" " »")))) +(ert-deftest whitespace-tests--empty-bob-eob-read-only-buffer () + (whitespace-tests--with-test-buffer '() + (insert "\nx\n\n") + (should (equal (buffer-string) "\nx\n\n")) + (setq-local buffer-read-only t) + (goto-char 2) + (should (equal (line-number-at-pos) 2)) + (should (equal (- (point) (line-beginning-position)) 0)) + (let ((whitespace-style '(face empty))) + (whitespace-mode 1) + (should (whitespace-tests--faceup "«:whitespace-empty:\n" + "»x\n" + "«:whitespace-empty:\n" + "»"))))) + (provide 'whitespace-tests) ;;; whitespace-tests.el ends here commit 29b7d740006fe2190a729bd1c30ccab9356cee36 Author: Richard Hansen Date: Mon Sep 26 17:07:52 2022 -0400 ert-x: Improve realism of `ert-with-test-buffer-selected' * lisp/emacs-lisp/ert-x.el (ert-with-test-buffer-selected): Set `inhibit-read-only' and `buffer-read-only' to nil when executing the body to provide a more realistic test environment. diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el index f00f1b33d7..bfd796586d 100644 --- a/lisp/emacs-lisp/ert-x.el +++ b/lisp/emacs-lisp/ert-x.el @@ -126,7 +126,15 @@ value is the last form in BODY." (body-function . ,(lambda (window) (select-window window t) - (let ((inhibit-modification-hooks nil)) + ;; body-function is intended to initialize the + ;; contents of a temporary read-only buffer, so + ;; it is executed with some convenience + ;; changes. Undo those changes so that the + ;; test buffer behaves more like an ordinary + ;; buffer while the body executes. + (let ((inhibit-modification-hooks nil) + (inhibit-read-only nil) + (buffer-read-only nil)) (setq ,ret (progn ,@body)))))) nil)) ,ret)))) commit 0b1e3713fea9b7c28891ec094689f40c0dc996c4 Author: Alan Mackenzie Date: Tue Sep 27 10:02:27 2022 +0000 * lisp/progmodes/cc-defs.el (c-let*-maybe-max-specpdl-size): Fix glitches diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 59927f0f2c..77aa3e62bb 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -2633,7 +2633,7 @@ fallback definition for all modes, to break the cycle).") ;; Like let*, but doesn't bind `max-specpdl-size' if that variable ;; is in the bindings list and either doesn't exist or is obsolete. (declare (debug let*) (indent 1)) - (let ((-varlist- varlist) msp-binding) + (let ((-varlist- (copy-sequence varlist)) msp-binding) (if (or (not (boundp 'max-specpdl-size)) (get 'max-specpdl-size 'byte-obsolete-variable)) (cond @@ -2641,7 +2641,7 @@ fallback definition for all modes, to break the cycle).") (setq -varlist- (delq 'max-specpdl-size -varlist-))) ((setq msp-binding (assq 'max-specpdl-size -varlist-)) (setq -varlist- (delq msp-binding -varlist-))))) - `(let* ,varlist ,@body))) + `(let* ,-varlist- ,@body))) (defun c-get-lang-constant (name &optional source-files mode) ;; Used by `c-lang-const'. commit a889977e0bfc6888cc8201133aa65b8a2b773def Author: Alan Mackenzie Date: Tue Sep 27 08:39:05 2022 +0000 CC Mode: Don't bind max-specpdl-size when it doesn't exist or is obsolete This is part of the changes for bug #57911. * lisp/progmodes/cc-defs.el (c-let*-maybe-max-specpdl-size): New macro. (c-get-lang-constant): Use the new macro in place of let*. diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index f867625480..59927f0f2c 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -2629,6 +2629,20 @@ fallback definition for all modes, to break the cycle).") (defconst c-lang--novalue "novalue") +(defmacro c-let*-maybe-max-specpdl-size (varlist &rest body) + ;; Like let*, but doesn't bind `max-specpdl-size' if that variable + ;; is in the bindings list and either doesn't exist or is obsolete. + (declare (debug let*) (indent 1)) + (let ((-varlist- varlist) msp-binding) + (if (or (not (boundp 'max-specpdl-size)) + (get 'max-specpdl-size 'byte-obsolete-variable)) + (cond + ((memq 'max-specpdl-size -varlist-) + (setq -varlist- (delq 'max-specpdl-size -varlist-))) + ((setq msp-binding (assq 'max-specpdl-size -varlist-)) + (setq -varlist- (delq msp-binding -varlist-))))) + `(let* ,varlist ,@body))) + (defun c-get-lang-constant (name &optional source-files mode) ;; Used by `c-lang-const'. @@ -2669,21 +2683,22 @@ fallback definition for all modes, to break the cycle).") ;; In that case we just continue with the "assignment" before ;; the one currently being evaluated, thereby creating the ;; illusion if a `setq'-like sequence of assignments. - (let* ((c-buffer-is-cc-mode mode) - (source-pos - (or (assq sym c-lang-constants-under-evaluation) - (cons sym (vector source nil)))) - ;; Append `c-lang-constants-under-evaluation' even if an - ;; earlier entry is found. It's only necessary to get - ;; the recording of dependencies above correct. - (c-lang-constants-under-evaluation - (cons source-pos c-lang-constants-under-evaluation)) - (fallback (get mode 'c-fallback-mode)) - value - ;; Make sure the recursion limits aren't very low - ;; since the `c-lang-const' dependencies can go deep. - (max-specpdl-size (max max-specpdl-size 3000)) - (max-lisp-eval-depth (max max-lisp-eval-depth 1000))) + (c-let*-maybe-max-specpdl-size + ((c-buffer-is-cc-mode mode) + (source-pos + (or (assq sym c-lang-constants-under-evaluation) + (cons sym (vector source nil)))) + ;; Append `c-lang-constants-under-evaluation' even if an + ;; earlier entry is found. It's only necessary to get + ;; the recording of dependencies above correct. + (c-lang-constants-under-evaluation + (cons source-pos c-lang-constants-under-evaluation)) + (fallback (get mode 'c-fallback-mode)) + value + ;; Make sure the recursion limits aren't very low + ;; since the `c-lang-const' dependencies can go deep. + (max-specpdl-size (max max-specpdl-size 3000)) + (max-lisp-eval-depth (max max-lisp-eval-depth 1000))) (if (if fallback (let ((backup-source-pos (copy-sequence (cdr source-pos)))) commit 00159c086c64147798a4c64bf5d9b94c7e8939de Author: Eli Zaretskii Date: Mon Sep 26 09:35:10 2022 +0300 ; Add commentary to disabled OTF support code in font.c * src/font.c (check_gstring, check_otf_features, otf_tag_symbol) (otf_open, font_otf_capability, generate_otf_features) (font_otf_DeviceTable, font_otf_ValueRecord, font_otf_Anchor): Move closer to the primitives that use them. Add commentary for the purpose of this code. diff --git a/src/font.c b/src/font.c index dcbcbc46be..8f448d9bdc 100644 --- a/src/font.c +++ b/src/font.c @@ -1822,296 +1822,6 @@ font_parse_family_registry (Lisp_Object family, Lisp_Object registry, Lisp_Objec } } - -/* This part (through the next ^L) is still experimental and not - tested much. We may drastically change codes. */ - -/* OTF handler. */ - -#if 0 - -#define LGSTRING_HEADER_SIZE 6 -#define LGSTRING_GLYPH_SIZE 8 - -static int -check_gstring (Lisp_Object gstring) -{ - Lisp_Object val; - ptrdiff_t i; - int j; - - CHECK_VECTOR (gstring); - val = AREF (gstring, 0); - CHECK_VECTOR (val); - if (ASIZE (val) < LGSTRING_HEADER_SIZE) - goto err; - CHECK_FONT_OBJECT (LGSTRING_FONT (gstring)); - if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_LBEARING))) - CHECK_FIXNUM (LGSTRING_SLOT (gstring, LGSTRING_IX_LBEARING)); - if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_RBEARING))) - CHECK_FIXNUM (LGSTRING_SLOT (gstring, LGSTRING_IX_RBEARING)); - if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_WIDTH))) - CHECK_FIXNAT (LGSTRING_SLOT (gstring, LGSTRING_IX_WIDTH)); - if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT))) - CHECK_FIXNUM (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT)); - if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT))) - CHECK_FIXNUM (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT)); - - for (i = 0; i < LGSTRING_GLYPH_LEN (gstring); i++) - { - val = LGSTRING_GLYPH (gstring, i); - CHECK_VECTOR (val); - if (ASIZE (val) < LGSTRING_GLYPH_SIZE) - goto err; - if (NILP (AREF (val, LGLYPH_IX_CHAR))) - break; - CHECK_FIXNAT (AREF (val, LGLYPH_IX_FROM)); - CHECK_FIXNAT (AREF (val, LGLYPH_IX_TO)); - CHECK_CHARACTER (AREF (val, LGLYPH_IX_CHAR)); - if (!NILP (AREF (val, LGLYPH_IX_CODE))) - CHECK_FIXNAT (AREF (val, LGLYPH_IX_CODE)); - if (!NILP (AREF (val, LGLYPH_IX_WIDTH))) - CHECK_FIXNAT (AREF (val, LGLYPH_IX_WIDTH)); - if (!NILP (AREF (val, LGLYPH_IX_ADJUSTMENT))) - { - val = AREF (val, LGLYPH_IX_ADJUSTMENT); - CHECK_VECTOR (val); - if (ASIZE (val) < 3) - goto err; - for (j = 0; j < 3; j++) - CHECK_FIXNUM (AREF (val, j)); - } - } - return i; - err: - error ("Invalid glyph-string format"); - return -1; -} - -static void -check_otf_features (Lisp_Object otf_features) -{ - Lisp_Object val; - - CHECK_CONS (otf_features); - CHECK_SYMBOL (XCAR (otf_features)); - otf_features = XCDR (otf_features); - CHECK_CONS (otf_features); - CHECK_SYMBOL (XCAR (otf_features)); - otf_features = XCDR (otf_features); - for (val = Fcar (otf_features); CONSP (val); val = XCDR (val)) - { - CHECK_SYMBOL (XCAR (val)); - if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4) - error ("Invalid OTF GSUB feature: %s", - SDATA (SYMBOL_NAME (XCAR (val)))); - } - otf_features = XCDR (otf_features); - for (val = Fcar (otf_features); CONSP (val); val = XCDR (val)) - { - CHECK_SYMBOL (XCAR (val)); - if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4) - error ("Invalid OTF GPOS feature: %s", - SDATA (SYMBOL_NAME (XCAR (val)))); - } -} - -#ifdef HAVE_LIBOTF -#include - -Lisp_Object otf_list; - -static Lisp_Object -otf_tag_symbol (OTF_Tag tag) -{ - char name[5]; - - OTF_tag_name (tag, name); - return Fintern (make_unibyte_string (name, 4), Qnil); -} - -static OTF * -otf_open (Lisp_Object file) -{ - Lisp_Object val = Fassoc (file, otf_list, Qnil); - OTF *otf; - - if (! NILP (val)) - otf = xmint_pointer (XCDR (val)); - else - { - otf = STRINGP (file) ? OTF_open (SSDATA (file)) : NULL; - val = make_mint_ptr (otf); - otf_list = Fcons (Fcons (file, val), otf_list); - } - return otf; -} - - -/* Return a list describing which scripts/languages FONT supports by - which GSUB/GPOS features of OpenType tables. See the comment of - (struct font_driver).otf_capability. */ - -Lisp_Object -font_otf_capability (struct font *font) -{ - OTF *otf; - Lisp_Object capability = Fcons (Qnil, Qnil); - int i; - - otf = otf_open (font->props[FONT_FILE_INDEX]); - if (! otf) - return Qnil; - for (i = 0; i < 2; i++) - { - OTF_GSUB_GPOS *gsub_gpos; - Lisp_Object script_list = Qnil; - int j; - - if (OTF_get_features (otf, i == 0) < 0) - continue; - gsub_gpos = i == 0 ? otf->gsub : otf->gpos; - for (j = gsub_gpos->ScriptList.ScriptCount - 1; j >= 0; j--) - { - OTF_Script *script = gsub_gpos->ScriptList.Script + j; - Lisp_Object langsys_list = Qnil; - Lisp_Object script_tag = otf_tag_symbol (script->ScriptTag); - int k; - - for (k = script->LangSysCount; k >= 0; k--) - { - OTF_LangSys *langsys; - Lisp_Object feature_list = Qnil; - Lisp_Object langsys_tag; - int l; - - if (k == script->LangSysCount) - { - langsys = &script->DefaultLangSys; - langsys_tag = Qnil; - } - else - { - langsys = script->LangSys + k; - langsys_tag - = otf_tag_symbol (script->LangSysRecord[k].LangSysTag); - } - for (l = langsys->FeatureCount - 1; l >= 0; l--) - { - OTF_Feature *feature - = gsub_gpos->FeatureList.Feature + langsys->FeatureIndex[l]; - Lisp_Object feature_tag - = otf_tag_symbol (feature->FeatureTag); - - feature_list = Fcons (feature_tag, feature_list); - } - langsys_list = Fcons (Fcons (langsys_tag, feature_list), - langsys_list); - } - script_list = Fcons (Fcons (script_tag, langsys_list), - script_list); - } - - if (i == 0) - XSETCAR (capability, script_list); - else - XSETCDR (capability, script_list); - } - - return capability; -} - -/* Parse OTF features in SPEC and write a proper features spec string - in FEATURES for the call of OTF_drive_gsub/gpos (of libotf). It is - assured that the sufficient memory has already allocated for - FEATURES. */ - -static void -generate_otf_features (Lisp_Object spec, char *features) -{ - Lisp_Object val; - char *p; - bool asterisk; - - p = features; - *p = '\0'; - for (asterisk = 0; CONSP (spec); spec = XCDR (spec)) - { - val = XCAR (spec); - CHECK_SYMBOL (val); - if (p > features) - *p++ = ','; - if (SREF (SYMBOL_NAME (val), 0) == '*') - { - asterisk = 1; - *p++ = '*'; - } - else if (! asterisk) - { - val = SYMBOL_NAME (val); - p += esprintf (p, "%s", SDATA (val)); - } - else - { - val = SYMBOL_NAME (val); - p += esprintf (p, "~%s", SDATA (val)); - } - } - if (CONSP (spec)) - error ("OTF spec too long"); -} - -Lisp_Object -font_otf_DeviceTable (OTF_DeviceTable *device_table) -{ - int len = device_table->StartSize - device_table->EndSize + 1; - - return Fcons (make_fixnum (len), - make_unibyte_string (device_table->DeltaValue, len)); -} - -Lisp_Object -font_otf_ValueRecord (int value_format, OTF_ValueRecord *value_record) -{ - Lisp_Object val = make_nil_vector (8); - - if (value_format & OTF_XPlacement) - ASET (val, 0, make_fixnum (value_record->XPlacement)); - if (value_format & OTF_YPlacement) - ASET (val, 1, make_fixnum (value_record->YPlacement)); - if (value_format & OTF_XAdvance) - ASET (val, 2, make_fixnum (value_record->XAdvance)); - if (value_format & OTF_YAdvance) - ASET (val, 3, make_fixnum (value_record->YAdvance)); - if (value_format & OTF_XPlaDevice) - ASET (val, 4, font_otf_DeviceTable (&value_record->XPlaDevice)); - if (value_format & OTF_YPlaDevice) - ASET (val, 4, font_otf_DeviceTable (&value_record->YPlaDevice)); - if (value_format & OTF_XAdvDevice) - ASET (val, 4, font_otf_DeviceTable (&value_record->XAdvDevice)); - if (value_format & OTF_YAdvDevice) - ASET (val, 4, font_otf_DeviceTable (&value_record->YAdvDevice)); - return val; -} - -Lisp_Object -font_otf_Anchor (OTF_Anchor *anchor) -{ - Lisp_Object val = make_nil_vector (anchor->AnchorFormat + 1); - ASET (val, 0, make_fixnum (anchor->XCoordinate)); - ASET (val, 1, make_fixnum (anchor->YCoordinate)); - if (anchor->AnchorFormat == 2) - ASET (val, 2, make_fixnum (anchor->f.f1.AnchorPoint)); - else - { - ASET (val, 3, font_otf_DeviceTable (&anchor->f.f2.XDeviceTable)); - ASET (val, 4, font_otf_DeviceTable (&anchor->f.f2.YDeviceTable)); - } - return val; -} -#endif /* HAVE_LIBOTF */ -#endif /* 0 */ - /* Font sorting. */ @@ -4657,132 +4367,424 @@ where a fixnum, if it's small enough, otherwise a bignum. */) (Lisp_Object font_object, Lisp_Object character) { - unsigned variations[256]; - struct font *font; - int i, n; - Lisp_Object val; + unsigned variations[256]; + struct font *font; + int i, n; + Lisp_Object val; + + CHECK_FONT_OBJECT (font_object); + CHECK_CHARACTER (character); + font = XFONT_OBJECT (font_object); + if (! font->driver->get_variation_glyphs) + return Qnil; + n = font->driver->get_variation_glyphs (font, XFIXNUM (character), variations); + if (! n) + return Qnil; + val = Qnil; + for (i = 0; i < 255; i++) + if (variations[i]) + { + int vs = (i < 16 ? 0xFE00 + i : 0xE0100 + (i - 16)); + Lisp_Object code = INT_TO_INTEGER (variations[i]); + val = Fcons (Fcons (make_fixnum (vs), code), val); + } + return val; +} + +/* Return a description of the font at POSITION in the current buffer. + If the 2nd optional arg CH is non-nil, it is a character to check + the font instead of the character at POSITION. + + For a graphical display, return a cons (FONT-OBJECT . GLYPH-CODE). + FONT-OBJECT is the font for the character at POSITION in the current + buffer. This is computed from all the text properties and overlays + that apply to POSITION. POSITION may be nil, in which case, + FONT-SPEC is the font for displaying the character CH with the + default face. GLYPH-CODE is the glyph code in the font to use for + the character, it is a fixnum, if it is small enough, otherwise a + bignum. + + For a text terminal, return a nonnegative integer glyph code for + the character, or a negative integer if the character is not + displayable. Terminal glyph codes are system-dependent integers + that represent displayable characters: for example, on a Linux x86 + console they represent VGA code points. + + It returns nil in the following cases: + + (1) The window system doesn't have a font for the character (thus + it is displayed by an empty box). + + (2) The character code is invalid. + + (3) If POSITION is not nil, and the current buffer is not displayed + in any window. + + (4) For a text terminal, the terminal does not report glyph codes. + + In addition, the returned font name may not take into account of + such redisplay engine hooks as what used in jit-lock-mode if + POSITION is currently not visible. */ + + +DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0, + doc: /* For internal use only. */) + (Lisp_Object position, Lisp_Object ch) +{ + ptrdiff_t pos, pos_byte, dummy; + int face_id; + int c; + struct frame *f; + + if (NILP (position)) + { + CHECK_CHARACTER (ch); + c = XFIXNUM (ch); + f = XFRAME (selected_frame); + face_id = lookup_basic_face (NULL, f, DEFAULT_FACE_ID); + pos = -1; + } + else + { + Lisp_Object window; + struct window *w; + + EMACS_INT fixed_pos = fix_position (position); + if (! (BEGV <= fixed_pos && fixed_pos < ZV)) + args_out_of_range_3 (position, make_fixnum (BEGV), make_fixnum (ZV)); + pos = fixed_pos; + pos_byte = CHAR_TO_BYTE (pos); + if (NILP (ch)) + c = FETCH_CHAR (pos_byte); + else + { + CHECK_FIXNAT (ch); + c = XFIXNUM (ch); + } + window = Fget_buffer_window (Fcurrent_buffer (), Qnil); + if (NILP (window)) + return Qnil; + w = XWINDOW (window); + f = XFRAME (w->frame); + face_id = face_at_buffer_position (w, pos, &dummy, + pos + 100, false, -1, 0); + } + if (! CHAR_VALID_P (c)) + return Qnil; + + if (! FRAME_WINDOW_P (f)) + return terminal_glyph_code (FRAME_TERMINAL (f), c); + + /* We need the basic faces to be valid below, so recompute them if + some code just happened to clear the face cache. */ + if (FRAME_FACE_CACHE (f)->used == 0) + recompute_basic_faces (f); + + face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c, pos, Qnil); + struct face *face = FACE_FROM_ID (f, face_id); + if (! face->font) + return Qnil; + unsigned code = face->font->driver->encode_char (face->font, c); + if (code == FONT_INVALID_CODE) + return Qnil; + Lisp_Object font_object; + XSETFONT (font_object, face->font); + return Fcons (font_object, INT_TO_INTEGER (code)); +} + + +/* This part (through the next ^L) is still experimental and not + tested much. We may drastically change codes. */ + +/* This code implements support for extracting OTF features of a font + and exposing them to Lisp, including application of those features + to arbitrary stretches of text. FIXME: it would be good to finish + this work and have this in Emacs. */ + +/* OTF handler. */ + +#if 0 + +#define LGSTRING_HEADER_SIZE 6 +#define LGSTRING_GLYPH_SIZE 8 + +static int +check_gstring (Lisp_Object gstring) +{ + Lisp_Object val; + ptrdiff_t i; + int j; + + CHECK_VECTOR (gstring); + val = AREF (gstring, 0); + CHECK_VECTOR (val); + if (ASIZE (val) < LGSTRING_HEADER_SIZE) + goto err; + CHECK_FONT_OBJECT (LGSTRING_FONT (gstring)); + if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_LBEARING))) + CHECK_FIXNUM (LGSTRING_SLOT (gstring, LGSTRING_IX_LBEARING)); + if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_RBEARING))) + CHECK_FIXNUM (LGSTRING_SLOT (gstring, LGSTRING_IX_RBEARING)); + if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_WIDTH))) + CHECK_FIXNAT (LGSTRING_SLOT (gstring, LGSTRING_IX_WIDTH)); + if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT))) + CHECK_FIXNUM (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT)); + if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT))) + CHECK_FIXNUM (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT)); + + for (i = 0; i < LGSTRING_GLYPH_LEN (gstring); i++) + { + val = LGSTRING_GLYPH (gstring, i); + CHECK_VECTOR (val); + if (ASIZE (val) < LGSTRING_GLYPH_SIZE) + goto err; + if (NILP (AREF (val, LGLYPH_IX_CHAR))) + break; + CHECK_FIXNAT (AREF (val, LGLYPH_IX_FROM)); + CHECK_FIXNAT (AREF (val, LGLYPH_IX_TO)); + CHECK_CHARACTER (AREF (val, LGLYPH_IX_CHAR)); + if (!NILP (AREF (val, LGLYPH_IX_CODE))) + CHECK_FIXNAT (AREF (val, LGLYPH_IX_CODE)); + if (!NILP (AREF (val, LGLYPH_IX_WIDTH))) + CHECK_FIXNAT (AREF (val, LGLYPH_IX_WIDTH)); + if (!NILP (AREF (val, LGLYPH_IX_ADJUSTMENT))) + { + val = AREF (val, LGLYPH_IX_ADJUSTMENT); + CHECK_VECTOR (val); + if (ASIZE (val) < 3) + goto err; + for (j = 0; j < 3; j++) + CHECK_FIXNUM (AREF (val, j)); + } + } + return i; + err: + error ("Invalid glyph-string format"); + return -1; +} + +static void +check_otf_features (Lisp_Object otf_features) +{ + Lisp_Object val; + + CHECK_CONS (otf_features); + CHECK_SYMBOL (XCAR (otf_features)); + otf_features = XCDR (otf_features); + CHECK_CONS (otf_features); + CHECK_SYMBOL (XCAR (otf_features)); + otf_features = XCDR (otf_features); + for (val = Fcar (otf_features); CONSP (val); val = XCDR (val)) + { + CHECK_SYMBOL (XCAR (val)); + if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4) + error ("Invalid OTF GSUB feature: %s", + SDATA (SYMBOL_NAME (XCAR (val)))); + } + otf_features = XCDR (otf_features); + for (val = Fcar (otf_features); CONSP (val); val = XCDR (val)) + { + CHECK_SYMBOL (XCAR (val)); + if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4) + error ("Invalid OTF GPOS feature: %s", + SDATA (SYMBOL_NAME (XCAR (val)))); + } +} + +#ifdef HAVE_LIBOTF +#include + +Lisp_Object otf_list; + +static Lisp_Object +otf_tag_symbol (OTF_Tag tag) +{ + char name[5]; + + OTF_tag_name (tag, name); + return Fintern (make_unibyte_string (name, 4), Qnil); +} + +static OTF * +otf_open (Lisp_Object file) +{ + Lisp_Object val = Fassoc (file, otf_list, Qnil); + OTF *otf; - CHECK_FONT_OBJECT (font_object); - CHECK_CHARACTER (character); - font = XFONT_OBJECT (font_object); - if (! font->driver->get_variation_glyphs) - return Qnil; - n = font->driver->get_variation_glyphs (font, XFIXNUM (character), variations); - if (! n) - return Qnil; - val = Qnil; - for (i = 0; i < 255; i++) - if (variations[i]) - { - int vs = (i < 16 ? 0xFE00 + i : 0xE0100 + (i - 16)); - Lisp_Object code = INT_TO_INTEGER (variations[i]); - val = Fcons (Fcons (make_fixnum (vs), code), val); - } - return val; + if (! NILP (val)) + otf = xmint_pointer (XCDR (val)); + else + { + otf = STRINGP (file) ? OTF_open (SSDATA (file)) : NULL; + val = make_mint_ptr (otf); + otf_list = Fcons (Fcons (file, val), otf_list); + } + return otf; } -/* Return a description of the font at POSITION in the current buffer. - If the 2nd optional arg CH is non-nil, it is a character to check - the font instead of the character at POSITION. - For a graphical display, return a cons (FONT-OBJECT . GLYPH-CODE). - FONT-OBJECT is the font for the character at POSITION in the current - buffer. This is computed from all the text properties and overlays - that apply to POSITION. POSITION may be nil, in which case, - FONT-SPEC is the font for displaying the character CH with the - default face. GLYPH-CODE is the glyph code in the font to use for - the character, it is a fixnum, if it is small enough, otherwise a - bignum. +/* Return a list describing which scripts/languages FONT supports by + which GSUB/GPOS features of OpenType tables. See the comment of + (struct font_driver).otf_capability. */ - For a text terminal, return a nonnegative integer glyph code for - the character, or a negative integer if the character is not - displayable. Terminal glyph codes are system-dependent integers - that represent displayable characters: for example, on a Linux x86 - console they represent VGA code points. +Lisp_Object +font_otf_capability (struct font *font) +{ + OTF *otf; + Lisp_Object capability = Fcons (Qnil, Qnil); + int i; - It returns nil in the following cases: + otf = otf_open (font->props[FONT_FILE_INDEX]); + if (! otf) + return Qnil; + for (i = 0; i < 2; i++) + { + OTF_GSUB_GPOS *gsub_gpos; + Lisp_Object script_list = Qnil; + int j; - (1) The window system doesn't have a font for the character (thus - it is displayed by an empty box). + if (OTF_get_features (otf, i == 0) < 0) + continue; + gsub_gpos = i == 0 ? otf->gsub : otf->gpos; + for (j = gsub_gpos->ScriptList.ScriptCount - 1; j >= 0; j--) + { + OTF_Script *script = gsub_gpos->ScriptList.Script + j; + Lisp_Object langsys_list = Qnil; + Lisp_Object script_tag = otf_tag_symbol (script->ScriptTag); + int k; - (2) The character code is invalid. + for (k = script->LangSysCount; k >= 0; k--) + { + OTF_LangSys *langsys; + Lisp_Object feature_list = Qnil; + Lisp_Object langsys_tag; + int l; - (3) If POSITION is not nil, and the current buffer is not displayed - in any window. + if (k == script->LangSysCount) + { + langsys = &script->DefaultLangSys; + langsys_tag = Qnil; + } + else + { + langsys = script->LangSys + k; + langsys_tag + = otf_tag_symbol (script->LangSysRecord[k].LangSysTag); + } + for (l = langsys->FeatureCount - 1; l >= 0; l--) + { + OTF_Feature *feature + = gsub_gpos->FeatureList.Feature + langsys->FeatureIndex[l]; + Lisp_Object feature_tag + = otf_tag_symbol (feature->FeatureTag); - (4) For a text terminal, the terminal does not report glyph codes. + feature_list = Fcons (feature_tag, feature_list); + } + langsys_list = Fcons (Fcons (langsys_tag, feature_list), + langsys_list); + } + script_list = Fcons (Fcons (script_tag, langsys_list), + script_list); + } - In addition, the returned font name may not take into account of - such redisplay engine hooks as what used in jit-lock-mode if - POSITION is currently not visible. */ + if (i == 0) + XSETCAR (capability, script_list); + else + XSETCDR (capability, script_list); + } + return capability; +} -DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0, - doc: /* For internal use only. */) - (Lisp_Object position, Lisp_Object ch) +/* Parse OTF features in SPEC and write a proper features spec string + in FEATURES for the call of OTF_drive_gsub/gpos (of libotf). It is + assured that the sufficient memory has already allocated for + FEATURES. */ + +static void +generate_otf_features (Lisp_Object spec, char *features) { - ptrdiff_t pos, pos_byte, dummy; - int face_id; - int c; - struct frame *f; + Lisp_Object val; + char *p; + bool asterisk; - if (NILP (position)) - { - CHECK_CHARACTER (ch); - c = XFIXNUM (ch); - f = XFRAME (selected_frame); - face_id = lookup_basic_face (NULL, f, DEFAULT_FACE_ID); - pos = -1; - } - else + p = features; + *p = '\0'; + for (asterisk = 0; CONSP (spec); spec = XCDR (spec)) { - Lisp_Object window; - struct window *w; - - EMACS_INT fixed_pos = fix_position (position); - if (! (BEGV <= fixed_pos && fixed_pos < ZV)) - args_out_of_range_3 (position, make_fixnum (BEGV), make_fixnum (ZV)); - pos = fixed_pos; - pos_byte = CHAR_TO_BYTE (pos); - if (NILP (ch)) - c = FETCH_CHAR (pos_byte); + val = XCAR (spec); + CHECK_SYMBOL (val); + if (p > features) + *p++ = ','; + if (SREF (SYMBOL_NAME (val), 0) == '*') + { + asterisk = 1; + *p++ = '*'; + } + else if (! asterisk) + { + val = SYMBOL_NAME (val); + p += esprintf (p, "%s", SDATA (val)); + } else { - CHECK_FIXNAT (ch); - c = XFIXNUM (ch); + val = SYMBOL_NAME (val); + p += esprintf (p, "~%s", SDATA (val)); } - window = Fget_buffer_window (Fcurrent_buffer (), Qnil); - if (NILP (window)) - return Qnil; - w = XWINDOW (window); - f = XFRAME (w->frame); - face_id = face_at_buffer_position (w, pos, &dummy, - pos + 100, false, -1, 0); } - if (! CHAR_VALID_P (c)) - return Qnil; + if (CONSP (spec)) + error ("OTF spec too long"); +} - if (! FRAME_WINDOW_P (f)) - return terminal_glyph_code (FRAME_TERMINAL (f), c); +Lisp_Object +font_otf_DeviceTable (OTF_DeviceTable *device_table) +{ + int len = device_table->StartSize - device_table->EndSize + 1; - /* We need the basic faces to be valid below, so recompute them if - some code just happened to clear the face cache. */ - if (FRAME_FACE_CACHE (f)->used == 0) - recompute_basic_faces (f); + return Fcons (make_fixnum (len), + make_unibyte_string (device_table->DeltaValue, len)); +} - face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c, pos, Qnil); - struct face *face = FACE_FROM_ID (f, face_id); - if (! face->font) - return Qnil; - unsigned code = face->font->driver->encode_char (face->font, c); - if (code == FONT_INVALID_CODE) - return Qnil; - Lisp_Object font_object; - XSETFONT (font_object, face->font); - return Fcons (font_object, INT_TO_INTEGER (code)); +Lisp_Object +font_otf_ValueRecord (int value_format, OTF_ValueRecord *value_record) +{ + Lisp_Object val = make_nil_vector (8); + + if (value_format & OTF_XPlacement) + ASET (val, 0, make_fixnum (value_record->XPlacement)); + if (value_format & OTF_YPlacement) + ASET (val, 1, make_fixnum (value_record->YPlacement)); + if (value_format & OTF_XAdvance) + ASET (val, 2, make_fixnum (value_record->XAdvance)); + if (value_format & OTF_YAdvance) + ASET (val, 3, make_fixnum (value_record->YAdvance)); + if (value_format & OTF_XPlaDevice) + ASET (val, 4, font_otf_DeviceTable (&value_record->XPlaDevice)); + if (value_format & OTF_YPlaDevice) + ASET (val, 4, font_otf_DeviceTable (&value_record->YPlaDevice)); + if (value_format & OTF_XAdvDevice) + ASET (val, 4, font_otf_DeviceTable (&value_record->XAdvDevice)); + if (value_format & OTF_YAdvDevice) + ASET (val, 4, font_otf_DeviceTable (&value_record->YAdvDevice)); + return val; } -#if 0 +Lisp_Object +font_otf_Anchor (OTF_Anchor *anchor) +{ + Lisp_Object val = make_nil_vector (anchor->AnchorFormat + 1); + ASET (val, 0, make_fixnum (anchor->XCoordinate)); + ASET (val, 1, make_fixnum (anchor->YCoordinate)); + if (anchor->AnchorFormat == 2) + ASET (val, 2, make_fixnum (anchor->f.f1.AnchorPoint)); + else + { + ASET (val, 3, font_otf_DeviceTable (&anchor->f.f2.XDeviceTable)); + ASET (val, 4, font_otf_DeviceTable (&anchor->f.f2.YDeviceTable)); + } + return val; +} +#endif /* HAVE_LIBOTF */ DEFUN ("font-drive-otf", Ffont_drive_otf, Sfont_drive_otf, 6, 6, 0, doc: /* Apply OpenType features on glyph-string GSTRING-IN. @@ -4902,6 +4904,7 @@ corresponding character. */) } #endif /* 0 */ + #ifdef FONT_DEBUG DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0,