diff --git a/editors/emacs/Makefile b/editors/emacs/Makefile index d9540684098b..6e9c3c45e618 100644 --- a/editors/emacs/Makefile +++ b/editors/emacs/Makefile @@ -1,315 +1,315 @@ PORTNAME= emacs DISTVERSION= 30.2 -PORTREVISION= 2 +PORTREVISION= 3 PORTEPOCH= 3 CATEGORIES= editors MASTER_SITES= GNU .if ${FLAVOR:U} == canna PATCH_SITES+= https://www.gentei.org/~yuuji/software/emacs30canna/:canna PATCHFILES+= emacs30.1-canna-20250224.diff.gz:-p1:canna .endif MAINTAINER= emacs@FreeBSD.org COMMENT= GNU editing macros ${COMMENT_${FLAVOR}} WWW= https://www.gnu.org/software/emacs/ COMMENT_nox= (No X flavor) COMMENT_canna= (Canna Japanese input flavor) COMMENT_wayland= (Wayland flavor) LICENSE= GPLv3+ LICENSE_FILE= ${WRKSRC}/COPYING LIB_DEPENDS= libgmp.so:math/gmp FLAVORS= full canna nox wayland canna_PKGNAMESUFFIX= -canna canna_LIB_DEPENDS= libcanna.so:japanese/canna-lib canna_CONFLICTS_INSTALL= emacs emacs-nox emacs-wayland canna_DESCR= ${.CURDIR}/pkg-descr-canna full_CONFLICTS_INSTALL= emacs-canna emacs-nox emacs-wayland nox_PKGNAMESUFFIX= -nox nox_CONFLICTS_INSTALL= emacs emacs-canna emacs-wayland wayland_PKGNAMESUFFIX= -wayland wayland_CONFLICTS_INSTALL= emacs emacs-canna emacs-nox USES= cpe gmake localbase:ldflags ncurses pkgconfig tar:xz CPE_VENDOR= gnu GNU_CONFIGURE= yes CONFIGURE_ARGS= --disable-build-details \ --localstatedir=/var \ --without-gconf \ --without-libsystemd \ --without-selinux .if ${FLAVOR:U} == canna CONFIGURE_ARGS+= --with-canna .elif ${FLAVOR:U} == nox CONFIGURE_ARGS+= --with-sound=no \ --with-x-toolkit=no \ --without-cairo \ --without-dbus \ --without-gconf \ --without-gif \ --without-gsettings \ --without-imagemagick \ --without-jpeg \ --without-lcms2 \ --without-libotf \ --without-m17n-flt \ --without-pgtk \ --without-png \ --without-rsvg \ --without-tiff \ --without-toolkit-scroll-bars \ --without-webp \ --without-x \ --without-xim \ --without-xpm \ --without-xwidgets .elif ${FLAVOR:U} == wayland CONFIGURE_ARGS+= --without-x .else CONFIGURE_ARGS+= --with-x .endif # See r468320 to determine if/when the next line can be removed CONFIGURE_ENV= ac_cv_header_sys_sysinfo_h=no CONFLICTS_INSTALL= emacs-devel emacs-devel-nox BINARY_ALIAS= makeinfo=true SUB_FILES= default.el pkg-message site-start.el SUB_LIST= EMACS_VER=${DISTVERSION} \ NATIVECOMP_COMMENT_END=${NATIVECOMP_COMMENT_END} \ NATIVECOMP_COMMENT_START=${NATIVECOMP_COMMENT_START} INFO= auth autotype bovine calc ccmode cl dbus dired-x ebrowse ede \ ediff edt efaq eglot eieio eintr elisp emacs emacs-gnutls \ emacs-mime epa erc ert eshell eudc eww flymake forms gnus \ htmlfontify idlwave ido info mairix-el message mh-e \ modus-themes newsticker nxml-mode octave-mode org pcl-cvs pgg \ rcirc reftex remember sasl sc semantic ses sieve smtpmail \ speedbar srecode todo-mode tramp transient url use-package \ vhdl-mode vip viper vtable widget wisent woman INFO_PATH= ${DATADIR_REL}/info .if ${FLAVOR:U} == canna PLIST_FILES+= ${DATADIR}/${DISTVERSION}/lisp/canna.el.gz \ ${DATADIR}/${DISTVERSION}/lisp/canna.elc \ ${DATADIR}/${DISTVERSION}/lisp/isearch-ext.el.gz \ ${DATADIR}/${DISTVERSION}/lisp/isearch-ext.elc .endif PLIST_SUB= EMACS_VER=${DISTVERSION} \ GNU_HOST=${CONFIGURE_TARGET} OPTIONS_DEFINE= ACL DBUS GNUTLS GSETTINGS HARFBUZZ LCMS2 M17N \ MAILUTILS MODULES NATIVECOMP OTF PGTK \ SCROLLBARS SOURCES SQLITE3 THREADS TREESITTER \ XFT XIM XML XWIDGETS OPTIONS_DEFAULT= ACL CAIRO DBUS GIF GNUTLS GSETTINGS GTK3 \ HARFBUZZ JPEG KQUEUE LCMS2 MAILUTILS MODULES \ OSS PNG SCROLLBARS SOURCES SQLITE3 SVG THREADS \ TIFF TREESITTER WEBP XIM XML XPM .if ${FLAVOR:U} != nox OPTIONS_DEFAULT+= NATIVECOMP .endif OPTIONS_GROUP= GRAPHICS OPTIONS_GROUP_GRAPHICS= CAIRO GIF JPEG MAGICK PNG SVG TIFF WEBP XPM OPTIONS_RADIO= FILENOTIFY SOUND X11TOOLKIT OPTIONS_RADIO_FILENOTIFY= GFILE KQUEUE OPTIONS_RADIO_SOUND= ALSA OSS OPTIONS_RADIO_X11TOOLKIT= GTK2 GTK3 MOTIF XAW XAW3D .if ${FLAVOR:U} == wayland OPTIONS_EXCLUDE+= GTK2 MOTIF XAW XAW3D XIM ${PGTK_PREVENTS} \ ${PGTK_IMPLIES:@i@${${i}_PREVENTS}@} OPTIONS_SLAVE+= PGTK ${PGTK_IMPLIES} \ ${PGTK_IMPLIES:@i@${${i}_IMPLIES}@} .elif ${FLAVOR:U} == nox OPTIONS_EXCLUDE+= ALSA CAIRO DBUS GFILE GIF GSETTINGS GTK2 GTK3 \ HARFBUZZ JPEG LCMS2 M17N MAGICK MOTIF OSS OTF \ PGTK PNG SCROLLBARS SVG TIFF WEBP XAW XAW3D XFT \ XIM XPM XWIDGETS .endif OPTIONS_EXCLUDE_armv7= NATIVECOMP OPTIONS_EXCLUDE_powerpc64= NATIVECOMP OPTIONS_SUB= YES ACL_DESC= Access control list support CAIRO_DESC= Cairo graphics library support [implies PNG, prevents XFT] FILENOTIFY_DESC= File notification support GFILE_DESC= File notification via gfile GRAPHICS_DESC= Graphics support GSETTINGS_DESC= GSettings API for application settings HARFBUZZ_DESC= HarfBuzz for text shaping KQUEUE_DESC= File notification via kqueue M17N_DESC= M17N support for text-shaping [implies XFT] MAGICK_DESC= ImageMagick image processing support (deprecated) MAILUTILS_DESC= Mail framework via GNU Mailutils MODULES_DESC= Dynamic modules support NATIVECOMP_DESC= Emacs Lisp native compiler support OTF_DESC= Opentype fonts PGTK_DESC= Pure GTK GUI [implies CAIRO, GTK3] SCROLLBARS_DESC= Toolkit scroll-bars SOURCES_DESC= Install sources SVG_DESC= Scalable vector graphics support [implies PNG] TREESITTER_DESC= tree-sitter support X11TOOLKIT_DESC= X11 toolkit XAW3D_DESC= Athena3D widgets XAW_DESC= Athena widgets XIM_DESC= X Input Method XWIDGETS_DESC= Experimental GTK widgets [implies GTK3] ACL_CONFIGURE_ENABLE= acl ALSA_LIB_DEPENDS= libasound.so:audio/alsa-lib ALSA_CONFIGURE_ON= --with-sound=alsa CAIRO_IMPLIES= PNG CAIRO_PREVENTS= XFT CAIRO_LIB_DEPENDS= libfontconfig.so:x11-fonts/fontconfig \ libfreetype.so:print/freetype2 CAIRO_USE= GNOME=cairo CAIRO_CONFIGURE_WITH= cairo DBUS_LIB_DEPENDS= libdbus-1.so:devel/dbus DBUS_CONFIGURE_WITH= dbus GFILE_USE= GNOME=glib20 GFILE_CONFIGURE_ON= --with-file-notification=gfile GIF_LIB_DEPENDS= libgif.so:graphics/giflib GIF_CONFIGURE_WITH= gif GNUTLS_LIB_DEPENDS= libgnutls.so:security/gnutls GNUTLS_CONFIGURE_WITH= gnutls GSETTINGS_USE= GNOME=glib20 GSETTINGS_CONFIGURE_WITH= gsettings GTK2_LIB_DEPENDS= libfontconfig.so:x11-fonts/fontconfig \ libfreetype.so:print/freetype2 GTK2_USE= GNOME=cairo,gtk20 GTK2_CONFIGURE_ON= --with-x-toolkit=gtk2 GTK3_LIB_DEPENDS= libfontconfig.so:x11-fonts/fontconfig \ libfreetype.so:print/freetype2 GTK3_USE= GNOME=cairo,gtk30 GTK3_CONFIGURE_ON= --with-x-toolkit=gtk3 HARFBUZZ_LIB_DEPENDS= libharfbuzz.so:print/harfbuzz HARFBUZZ_CONFIGURE_WITH= harfbuzz JPEG_USES= jpeg JPEG_CONFIGURE_WITH= jpeg KQUEUE_CONFIGURE_ON= --with-file-notification=kqueue LCMS2_LIB_DEPENDS= liblcms2.so:graphics/lcms2 LCMS2_CONFIGURE_WITH= lcms2 #LTO_CONFIGURE_ON= --enable-link-time-optimization M17N_IMPLIES= XFT M17N_LIB_DEPENDS= libm17n.so:devel/m17n-lib M17N_CONFIGURE_WITH= m17n-flt MAGICK_USES= magick:7 MAGICK_CONFIGURE_WITH= imagemagick MAILUTILS_RUN_DEPENDS= mailutils:mail/mailutils MAILUTILS_CONFIGURE_WITH= mailutils MAILUTILS_CONFIGURE_ENV_OFF= ac_cv_lib_lockfile_maillock=no \ ac_cv_prog_liblockfile=no MODULES_CONFIGURE_WITH= modules MOTIF_USES= motif MOTIF_CONFIGURE_ON= --with-x-toolkit=motif NATIVECOMP_USE= GCC=13 NATIVECOMP_CONFIGURE_WITH= native-compilation=aot OSS_CONFIGURE_ON= --with-sound=oss OTF_LIB_DEPENDS= libotf.so:print/libotf OTF_CONFIGURE_WITH= libotf PGTK_IMPLIES= CAIRO GTK3 SCROLLBARS PGTK_PREVENTS= M17N XFT XPM PGTK_CATEGORIES= wayland PGTK_CONFIGURE_WITH= pgtk PNG_LIB_DEPENDS= libpng16.so:graphics/png PNG_CONFIGURE_WITH= png SCROLLBARS_CONFIGURE_WITH= toolkit-scroll-bars .if ${FLAVOR:U} == canna SOURCES_PLIST_FILES= ${DATADIR}/${DISTVERSION}/src/canna.c .endif SQLITE3_USES= sqlite:3 SQLITE3_CONFIGURE_WITH= sqlite3 SVG_IMPLIES= PNG SVG_USE= GNOME=cairo,librsvg2 SVG_CONFIGURE_WITH= rsvg THREADS_CONFIGURE_WITH= threads TIFF_LIB_DEPENDS= libtiff.so:graphics/tiff TIFF_CONFIGURE_WITH= tiff TREESITTER_IMPLIES= MODULES TREESITTER_LIB_DEPENDS= libtree-sitter.so:devel/tree-sitter TREESITTER_CONFIGURE_WITH= tree-sitter WEBP_LIB_DEPENDS= libwebpdemux.so:graphics/webp WEBP_CONFIGURE_WITH= webp XAW3D_LIB_DEPENDS= libXaw3d.so:x11-toolkits/libXaw3d XAW3D_CONFIGURE_ON= --with-x-toolkit=athena XAW_USE= XORG=xaw XAW_CONFIGURE_ON= --with-x-toolkit=athena \ --without-xaw3d XFT_LIB_DEPENDS= libfontconfig.so:x11-fonts/fontconfig \ libfreetype.so:print/freetype2 XFT_USE= XORG=xft,xrender XFT_CONFIGURE_WITH= xft XIM_CONFIGURE_WITH= xim # keep XML_USES=gnome, because nox flavor does not have USES=gnome XML_USES= gnome XML_USE= GNOME=libxml2 XML_CONFIGURE_WITH= xml2 XPM_USE= XORG=xpm XPM_CONFIGURE_WITH= xpm XWIDGETS_IMPLIES= GTK3 XWIDGETS_LIB_DEPENDS= libsoup-2.4.so:devel/libsoup \ libwebkit2gtk-4.0.so:www/webkit2-gtk@40 XWIDGETS_USE= XORG=xcomposite XWIDGETS_CONFIGURE_WITH= xwidgets .include .if ${PORT_OPTIONS:MNATIVECOMP} NATIVECOMP_COMMENT_END= NATIVECOMP_COMMENT_START= .else NATIVECOMP_COMMENT_END= '*/' NATIVECOMP_COMMENT_START= '/*' .endif .if ${FLAVOR:U} != nox USES+= desktop-file-utils gnome .if !${PORT_OPTIONS:MPGTK} USES+= xorg USE_XORG+= ice sm x11 xcb xcomposite xext xfixes xi xinerama xmu xrandr \ xrender xt .endif .endif .if !${PORT_OPTIONS:MGTK2} && !${PORT_OPTIONS:MGTK3} && !${PORT_OPTIONS:MMOTIF} && \ !${PORT_OPTIONS:MXAW} && !${PORT_OPTIONS:MXAW3D} CONFIGURE_ARGS+= --with-x-toolkit=no .endif # Schema generation is dependent on both PGTK, and GSETTINGS options # as per https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=183936ee8e5 .if ${PORT_OPTIONS:MGSETTINGS} && ${PORT_OPTIONS:MPGTK} GLIB_SCHEMAS+= org.gnu.emacs.defaults.gschema.xml .endif .if ${FLAVOR} == nox # With a desktop entry stage-qa will give a warning about requiring # desktop-file-utils and portlint -C will give a warning about INSTALLS_ICONS, # but don't pull in those dependencies with the nox flavor. post-patch: @${REINPLACE_CMD} -e 's/^Terminal=.*$$/Terminal=true/' ${WRKSRC}/etc/emacs.desktop .endif post-install: @${RM} -r ${STAGEDIR}${PREFIX}/lib/systemd @(cd ${STAGEDIR}${PREFIX} && ${FIND} libexec/emacs/${DISTVERSION}/${CONFIGURE_TARGET}/ -name emacs-*.pdmp >> ${TMPPLIST}) ${INSTALL_DATA} ${WRKDIR}/default.el ${WRKDIR}/site-start.el ${STAGEDIR}${DATADIR}/site-lisp/ post-install-MAILUTILS-on: ${LN} -sf ${PREFIX}/bin/movemail \ ${STAGEDIR}${PREFIX}/libexec/emacs/${DISTVERSION}/${CONFIGURE_TARGET} # Natively compiled elisp files names include build checksum information, so add # these files to the plist after the build. post-install-NATIVECOMP-on: @(cd ${WRKSRC} && ${FIND} native-lisp -type f | ${SED} -e 's,^,lib/emacs/${DISTVERSION}/,') >> ${TMPPLIST} @${FIND} ${STAGEDIR}${PREFIX}/lib/emacs/${DISTVERSION}/native-lisp/ -name '*.eln*' -exec ${STRIP_CMD} {} + post-install-SOURCES-on: @${MKDIR} ${STAGEDIR}${DATADIR}/${DISTVERSION}/src ${INSTALL_DATA} ${WRKSRC}/src/*.[ch] ${STAGEDIR}${DATADIR}/${DISTVERSION}/src .include diff --git a/editors/emacs/files/patch-doc_lispref_parsing.texi b/editors/emacs/files/patch-doc_lispref_parsing.texi new file mode 100644 index 000000000000..8272314fb4d4 --- /dev/null +++ b/editors/emacs/files/patch-doc_lispref_parsing.texi @@ -0,0 +1,82 @@ +--- doc/lispref/parsing.texi.orig 2025-01-04 11:05:28 UTC ++++ doc/lispref/parsing.texi +@@ -1375,7 +1375,7 @@ example, with the following pattern: + @group + ( + (array :anchor (_) @@first (_) @@last :anchor) +- (:equal @@first @@last) ++ (:eq? @@first @@last) + ) + @end group + @end example +@@ -1384,24 +1384,32 @@ group them together. Currently there are three predic + tree-sitter only matches arrays where the first element is equal to + the last element. To attach a predicate to a pattern, we need to + group them together. Currently there are three predicates: +-@code{:equal}, @code{:match}, and @code{:pred}. ++@code{:eq?}, @code{:match?}, and @code{:pred?}. + +-@deffn Predicate :equal arg1 arg2 ++@deffn Predicate :eq? arg1 arg2 + Matches if @var{arg1} is equal to @var{arg2}. Arguments can be either + strings or capture names. Capture names represent the text that the +-captured node spans in the buffer. ++captured node spans in the buffer. Note that this is more like ++@code{equal} in Elisp, but @code{eq?} is the convention used by ++tree-sitter. Previously we supported the @code{:equal} predicate but ++it's now considered deprecated. + @end deffn + +-@deffn Predicate :match regexp capture-name ++@deffn Predicate :match? capture-name regexp + Matches if the text that @var{capture-name}'s node spans in the buffer + matches regular expression @var{regexp}, given as a string literal. +-Matching is case-sensitive. ++Matching is case-sensitive. The ordering of the arguments doesn't ++matter. Previously we supported the @code{:match} predicate but it's ++now considered deprecated. + @end deffn + +-@deffn Predicate :pred fn &rest nodes ++@deffn Predicate :pred? fn &rest nodes + Matches if function @var{fn} returns non-@code{nil} when passed each + node in @var{nodes} as arguments. The function runs with the current +-buffer set to the buffer of node being queried. ++buffer set to the buffer of node being queried. Be very careful when ++using this predicate, since it can be expensive when used in a tight ++loop. Previously we supported the @code{:pred} predicate but it's now ++considered deprecated. + @end deffn + + Note that a predicate can only refer to capture names that appear in +@@ -1456,9 +1464,9 @@ Anchor @code{:anchor} is written as @samp{.}. + @item + @samp{:+} is written as @samp{+}. + @item +-@code{:equal}, @code{:match} and @code{:pred} are written as +-@code{#equal}, @code{#match} and @code{#pred}, respectively. +-In general, predicates change their @samp{:} to @samp{#}. ++@code{:eq?}, @code{:match?} and @code{:pred?} are written as ++@code{#eq?}, @code{#match?} and @code{#pred?}, respectively. In ++general, predicates change the @samp{:} to @samp{#}. + @end itemize + + For example, +@@ -1467,7 +1475,7 @@ For example, + @group + '(( + (compound_expression :anchor (_) @@first (_) :* @@rest) +- (:match "love" @@first) ++ (:match? "love" @@first) + )) + @end group + @end example +@@ -1479,7 +1487,7 @@ is written in string form as + @group + "( + (compound_expression . (_) @@first (_)* @@rest) +- (#match \"love\" @@first) ++ (#match? \"love\" @@first) + )" + @end group + @end example diff --git a/editors/emacs/files/patch-src_treesit.c b/editors/emacs/files/patch-src_treesit.c index f38b3910424e..e5bcbdca1de0 100644 --- a/editors/emacs/files/patch-src_treesit.c +++ b/editors/emacs/files/patch-src_treesit.c @@ -1,56 +1,210 @@ ---- src/treesit.c.orig 2026-03-30 17:46:40 UTC +--- src/treesit.c.orig 2025-07-05 09:56:00 UTC +++ src/treesit.c -@@ -34,7 +34,7 @@ along with GNU Emacs. If not, see = 15 ++ return ts_language_abi_version (ts_lang); ++#else ++ return ts_language_version (ts_lang); ++#endif ++} ++ + /* Load the dynamic library of LANGUAGE_SYMBOL and return the pointer + to the language definition. + +@@ -746,7 +762,7 @@ treesit_load_language (Lisp_Object language_symbol, { *signal_symbol = Qtreesit_load_language_error; *signal_data = list2 (Qversion_mismatch, - make_fixnum (ts_language_version (lang))); -+ make_fixnum (ts_language_abi_version (lang))); ++ make_fixnum (treesit_language_abi_version (lang))); return NULL; } return lang; -@@ -817,7 +817,7 @@ Return nil if a grammar library for LANGUAGE is not av +@@ -817,7 +833,7 @@ Return nil if a grammar library for LANGUAGE is not av &signal_data); if (ts_language == NULL) return Qnil; - uint32_t version = ts_language_version (ts_language); -+ uint32_t version = ts_language_abi_version (ts_language); ++ uint32_t version = treesit_language_abi_version (ts_language); return make_fixnum((ptrdiff_t) version); } } +@@ -2604,12 +2620,12 @@ See Info node `(elisp)Pattern Matching' for detailed e + return Vtreesit_str_star; + if (BASE_EQ (pattern, QCplus)) + return Vtreesit_str_plus; +- if (BASE_EQ (pattern, QCequal)) +- return Vtreesit_str_pound_equal; +- if (BASE_EQ (pattern, QCmatch)) +- return Vtreesit_str_pound_match; +- if (BASE_EQ (pattern, QCpred)) +- return Vtreesit_str_pound_pred; ++ if (BASE_EQ (pattern, QCequal) || BASE_EQ (pattern, QCeq_q)) ++ return Vtreesit_str_pound_eq_question_mark; ++ if (BASE_EQ (pattern, QCmatch) || BASE_EQ (pattern, QCmatch_q)) ++ return Vtreesit_str_pound_match_question_mark; ++ if (BASE_EQ (pattern, QCpred) || BASE_EQ (pattern, QCpred_q)) ++ return Vtreesit_str_pound_pred_question_mark; + Lisp_Object opening_delimeter + = VECTORP (pattern) + ? Vtreesit_str_open_bracket : Vtreesit_str_open_paren; +@@ -2640,7 +2656,9 @@ A PATTERN in QUERY can be + :* + :+ + :equal ++ :eq? + :match ++ :match? + (TYPE PATTERN...) + [PATTERN...] + FIELD-NAME: +@@ -2803,7 +2821,7 @@ treesit_predicate_equal (Lisp_Object args, struct capt + return !NILP (Fstring_equal (text1, text2)); + } + +-/* Handles predicate (#match "regexp" @node). Return true if "regexp" ++/* Handles predicate (#match? "regexp" @node). Return true if "regexp" + matches the text spanned by @node; return false otherwise. + Matching is case-sensitive. If everything goes fine, don't touch + SIGNAL_DATA; if error occurs, set it to a suitable signal data. */ +@@ -2813,26 +2831,24 @@ treesit_predicate_match (Lisp_Object args, struct capt + { + if (list_length (args) != 2) + { +- *signal_data = list2 (build_string ("Predicate `match' requires two " ++ *signal_data = list2 (build_string ("Predicate `match?' requires two " + "arguments but got"), + Flength (args)); + return false; + } +- Lisp_Object regexp = XCAR (args); +- Lisp_Object capture_name = XCAR (XCDR (args)); ++ Lisp_Object arg1 = XCAR (args); ++ Lisp_Object arg2 = XCAR (XCDR (args)); ++ Lisp_Object regexp = SYMBOLP (arg2) ? arg1 : arg2; ++ Lisp_Object capture_name = SYMBOLP (arg2) ? arg2 : arg1; + +- /* It's probably common to get the argument order backwards. Catch +- this mistake early and show helpful explanation, because Emacs +- loves you. (We put the regexp first because that's what +- string-match does.) */ +- if (!STRINGP (regexp)) +- xsignal1 (Qtreesit_query_error, +- build_string ("The first argument to `match' should " +- "be a regexp string, not a capture name")); +- if (!SYMBOLP (capture_name)) +- xsignal1 (Qtreesit_query_error, +- build_string ("The second argument to `match' should " +- "be a capture name, not a string")); ++ if (!STRINGP (regexp) || !SYMBOLP (capture_name)) ++ { ++ *signal_data = list2 (build_string ("Predicate `match?' takes a regexp " ++ "and a node capture (order doesn't " ++ "matter), but got"), ++ Flength (args)); ++ return false; ++ } + + Lisp_Object node = Qnil; + if (!treesit_predicate_capture_name_to_node (capture_name, captures, &node, +@@ -2916,11 +2932,11 @@ treesit_eval_predicates (struct capture_range captures + Lisp_Object predicate = XCAR (tail); + Lisp_Object fn = XCAR (predicate); + Lisp_Object args = XCDR (predicate); +- if (!NILP (Fstring_equal (fn, Vtreesit_str_equal))) ++ if (!NILP (Fstring_equal (fn, Vtreesit_str_eq_question_mark))) + pass &= treesit_predicate_equal (args, captures, signal_data); +- else if (!NILP (Fstring_equal (fn, Vtreesit_str_match))) ++ else if (!NILP (Fstring_equal (fn, Vtreesit_str_match_question_mark))) + pass &= treesit_predicate_match (args, captures, signal_data); +- else if (!NILP (Fstring_equal (fn, Vtreesit_str_pred))) ++ else if (!NILP (Fstring_equal (fn, Vtreesit_str_pred_question_mark))) + pass &= treesit_predicate_pred (args, captures, signal_data); + else + { +@@ -4192,8 +4208,11 @@ syms_of_treesit (void) + DEFSYM (QCstar, ":*"); + DEFSYM (QCplus, ":+"); + DEFSYM (QCequal, ":equal"); ++ DEFSYM (QCeq_q, ":eq?"); + DEFSYM (QCmatch, ":match"); ++ DEFSYM (QCmatch_q, ":match?"); + DEFSYM (QCpred, ":pred"); ++ DEFSYM (QCpred_q, ":pred?"); + + DEFSYM (Qnot_found, "not-found"); + DEFSYM (Qsymbol_error, "symbol-error"); +@@ -4324,12 +4343,12 @@ the symbol of that THING. For example, (or sexp sente + Vtreesit_str_star = build_pure_c_string ("*"); + staticpro (&Vtreesit_str_plus); + Vtreesit_str_plus = build_pure_c_string ("+"); +- staticpro (&Vtreesit_str_pound_equal); +- Vtreesit_str_pound_equal = build_pure_c_string ("#equal"); +- staticpro (&Vtreesit_str_pound_match); +- Vtreesit_str_pound_match = build_pure_c_string ("#match"); +- staticpro (&Vtreesit_str_pound_pred); +- Vtreesit_str_pound_pred = build_pure_c_string ("#pred"); ++ staticpro (&Vtreesit_str_pound_eq_question_mark); ++ Vtreesit_str_pound_eq_question_mark = build_pure_c_string ("#eq?"); ++ staticpro (&Vtreesit_str_pound_match_question_mark); ++ Vtreesit_str_pound_match_question_mark = build_pure_c_string ("#match?"); ++ staticpro (&Vtreesit_str_pound_pred_question_mark); ++ Vtreesit_str_pound_pred_question_mark = build_pure_c_string ("#pred?"); + staticpro (&Vtreesit_str_open_bracket); + Vtreesit_str_open_bracket = build_pure_c_string ("["); + staticpro (&Vtreesit_str_close_bracket); +@@ -4340,12 +4359,12 @@ the symbol of that THING. For example, (or sexp sente + Vtreesit_str_close_paren = build_pure_c_string (")"); + staticpro (&Vtreesit_str_space); + Vtreesit_str_space = build_pure_c_string (" "); +- staticpro (&Vtreesit_str_equal); +- Vtreesit_str_equal = build_pure_c_string ("equal"); +- staticpro (&Vtreesit_str_match); +- Vtreesit_str_match = build_pure_c_string ("match"); +- staticpro (&Vtreesit_str_pred); +- Vtreesit_str_pred = build_pure_c_string ("pred"); ++ staticpro (&Vtreesit_str_eq_question_mark); ++ Vtreesit_str_eq_question_mark = build_pure_c_string ("eq?"); ++ staticpro (&Vtreesit_str_match_question_mark); ++ Vtreesit_str_match_question_mark = build_pure_c_string ("match?"); ++ staticpro (&Vtreesit_str_pred_question_mark); ++ Vtreesit_str_pred_question_mark = build_pure_c_string ("pred?"); + staticpro (&Vtreesit_str_empty); + Vtreesit_str_empty = build_pure_c_string (""); + diff --git a/editors/emacs/files/patch-test_src_treesit-tests.el b/editors/emacs/files/patch-test_src_treesit-tests.el new file mode 100644 index 000000000000..38a118b2b1df --- /dev/null +++ b/editors/emacs/files/patch-test_src_treesit-tests.el @@ -0,0 +1,16 @@ +--- test/src/treesit-tests.el.orig 2025-01-04 11:05:31 UTC ++++ test/src/treesit-tests.el +@@ -434,10 +434,10 @@ BODY is the test body." + ;; String query. + '("(string) @string + (pair key: (_) @keyword) +-((_) @bob (#match \"\\\\`B.b\\\\'\" @bob)) ++((_) @bob (#match? \"\\\\`B.b\\\\'\" @bob)) + (number) @number +-((number) @n3 (#equal \"3\" @n3)) +-((number) @n3p (#pred treesit--ert-pred-last-sibling @n3p))" ++((number) @n3 (#eq? \"3\" @n3)) ++((number) @n3p (#pred? treesit--ert-pred-last-sibling @n3p))" + ;; Sexp query. + ((string) @string + (pair key: (_) @keyword)