Compare commits

..

12 commits

Author SHA1 Message Date
Peter Oliver
8caa8a9f69 Eliminate “File listed twice” warning. 2025-12-10 15:07:07 +00:00
Peter Oliver
91bcd98e44 Fix Tree-sitter 0.26 patch for Emacs 30. 2025-12-10 13:03:09 +00:00
Peter Oliver
3b048fcb37 Support Tree-sitter version 0.26 and later (rhbz#2420305). 2025-12-10 12:05:42 +00:00
Peter Oliver
b4c76f9a53 Move ownership of %{_libdir}/emacs to emacs-filesystem package. 2025-11-25 13:17:25 +00:00
Peter Oliver
514c0430fb New RPM macro %_emacs_archsitelispdir for Emacs dynamic modules. 2025-11-24 13:18:51 +00:00
Peter Oliver
585fcc155a Set source-directory via site-start.d dropin. 2025-11-24 13:15:12 +00:00
Peter Oliver
8baaa786df Drop alternatives for etags
Since ctags-5.9, there is no-longer any other provider in Fedora, so we can simplify.
2025-11-14 17:19:43 +00:00
Peter Oliver
038733a4d2 Own etags and man page (rhbz#2414055). 2025-11-14 17:07:45 +00:00
Peter Oliver
3b2d62a20f Enable lexical binding in site-start.el and default.el
Emacs 31 will warn when loading an Elisp file that does not specify whether to use lexical binding.  We don’t use dynamic binding in these files, so we may as well switch it on now.

While we’re here, keep `checkdoc` happy.
2025-10-14 14:12:58 +01:00
Peter Oliver
6156d97ca7 Recent vanilla ~/.emacs defaults to lexical binding. 2025-10-14 14:08:43 +01:00
Peter Oliver
2004733785 Rebuild against tree-sitter-0.25.10-1.fc44 2025-09-24 15:20:36 +01:00
Peter Oliver
75773e6606 Rebuild against tree-sitter-0.25.9-1.fc44 2025-09-09 14:39:40 +01:00
5 changed files with 166 additions and 32 deletions

View file

@ -0,0 +1,106 @@
From 16f0be6354ea13331859c861fa7d423a0b54bec7 Mon Sep 17 00:00:00 2001
From: Eli Zaretskii <eliz@gnu.org>
Date: Fri, 17 Oct 2025 14:15:41 +0300
Subject: [PATCH] Support Tree-sitter version 0.26 and later
* src/treesit.c (init_treesit_functions)
[TREE_SITTER_LANGUAGE_VERSION >= 15]: Define prototype for, and
load 'ts_language_abi_version' instead of the deprecated (and
removed in tree-sitter 0.26) 'ts_language_version'.
(ts_language_abi_version) [TREE_SITTER_LANGUAGE_VERSION >= 15]:
Define on WINDOWSNT, instead of 'ts_language_version'.
(treesit_language_abi_version): New compatibility function.
(treesit_load_language, Ftreesit_language_abi_version): Use
'treesit_language_abi_version' instead of 'ts_language_version'.
(Bug#79627)
---
src/treesit.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/src/treesit.c b/src/treesit.c
index e2986c186b8..4d6bf9a5dbd 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -34,7 +34,11 @@ Copyright (C) 2021-2025 Free Software Foundation, Inc.
# include "w32common.h"
/* In alphabetical order. */
+#if TREE_SITTER_LANGUAGE_VERSION >= 15
+#undef ts_language_abi_version
+#else
#undef ts_language_version
+#endif
#undef ts_node_child
#undef ts_node_child_by_field_name
#undef ts_node_child_count
@@ -89,7 +93,11 @@ Copyright (C) 2021-2025 Free Software Foundation, Inc.
#undef ts_tree_get_changed_ranges
#undef ts_tree_root_node
+#if TREE_SITTER_LANGUAGE_VERSION >= 15
+DEF_DLL_FN (uint32_t, ts_language_abi_version, (const TSLanguage *));
+#else
DEF_DLL_FN (uint32_t, ts_language_version, (const TSLanguage *));
+#endif
DEF_DLL_FN (TSNode, ts_node_child, (TSNode, uint32_t));
DEF_DLL_FN (TSNode, ts_node_child_by_field_name,
(TSNode, const char *, uint32_t));
@@ -166,7 +174,11 @@ init_treesit_functions (void)
if (!library)
return false;
+#if TREE_SITTER_LANGUAGE_VERSION >= 15
+ LOAD_DLL_FN (library, ts_language_abi_version);
+#else
LOAD_DLL_FN (library, ts_language_version);
+#endif
LOAD_DLL_FN (library, ts_node_child);
LOAD_DLL_FN (library, ts_node_child_by_field_name);
LOAD_DLL_FN (library, ts_node_child_count);
@@ -224,7 +236,11 @@ init_treesit_functions (void)
return true;
}
+#if TREE_SITTER_LANGUAGE_VERSION >= 15
+#define ts_language_abi_version fn_ts_language_abi_version
+#else
#define ts_language_version fn_ts_language_version
+#endif
#define ts_node_child fn_ts_node_child
#define ts_node_child_by_field_name fn_ts_node_child_by_field_name
#define ts_node_child_count fn_ts_node_child_count
@@ -632,6 +648,22 @@ treesit_load_language_push_for_each_suffix (Lisp_Object lib_base_name,
}
}
+/* This function is a compatibility shim. Tree-sitter 0.25 introduced
+ ts_language_abi_version as a replacement for ts_language_version, and
+ tree-sitter 0.26 removed ts_language_version. Here we use the fact
+ that 0.25 bumped TREE_SITTER_LANGUAGE_VERSION to 15, to use the new
+ function instead of the old one, when Emacs is compiled against
+ tree-sitter version 0.25 or newer. */
+static uint32_t
+treesit_language_abi_version (const TSLanguage *ts_lang)
+{
+#if TREE_SITTER_LANGUAGE_VERSION >= 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.
@@ -817,7 +849,7 @@ DEFUN ("treesit-language-abi-version", Ftreesit_language_abi_version,
&signal_data);
if (ts_language == NULL)
return Qnil;
- uint32_t version = ts_language_version (ts_language);
+ uint32_t version = treesit_language_abi_version (ts_language);
return make_fixnum((ptrdiff_t) version);
}
}
--
2.52.0

View file

@ -1,7 +1,13 @@
;;; default.el - loaded after ".emacs" on startup
;;;
;;; Setting `inhibit-default-init' non-nil in "~/.emacs"
;;; prevents loading of this file. Also the "-q" option to emacs
;;; prevents both "~/.emacs" and this file from being loaded at startup.
;;; default.el --- loaded after ".emacs" on startup -*- lexical-binding: t -*-
;;; Commentary:
;;
;; Setting `inhibit-default-init' non-nil in "~/.emacs"
;; prevents loading of this file. Also the "-q" option to "emacs"
;; prevents both "~/.emacs" and this file from being loaded at startup.
;;; Code:
(setq-default smime-CA-directory "/etc/ssl/certs")
;;; default.el ends here

View file

@ -1,4 +1,4 @@
;; .emacs
;;; -*- lexical-binding: t -*-
(custom-set-variables
;; uncomment to always end a file with a newline

View file

@ -57,6 +57,11 @@ Patch: 0002-Fall-back-to-the-terminal-from-pure-GTK-when-no-disp.patch
# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49505#67
Patch: 0001-Don-t-specify-StartupWMClass-in-emacs.desktop.patch
# Don't wait for Emacs 31 before updating to Tree-sitter 0.26.
# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63555
# https://bugzilla.redhat.com/show_bug.cgi?id=2420305
Patch: 0001-Support-Tree-sitter-version-0.26-and-later.patch
BuildRequires: alsa-lib-devel
BuildRequires: atk-devel
BuildRequires: autoconf
@ -191,7 +196,6 @@ Requires(posttrans): /usr/sbin/alternatives
Requires: emacs-common = %{epoch}:%{version}-%{release}
Requires: libpixbufloader-xpm.so%{?marker}
Supplements: ((libwayland-server and emacs) unless emacs-nw)
Obsoletes: emacs < 1:30.2-4
%description pgtk
%desc
@ -265,7 +269,7 @@ License: GPL-3.0-or-later AND GFDL-1.3-no-invariants-or-later AND BSD-3-Cl
Requires(preun): /usr/sbin/alternatives
Requires(posttrans): /usr/sbin/alternatives
Requires: /usr/bin/readlink
Requires: %{name}-filesystem
Requires: %{name}-filesystem >= 1:30.2
Requires: emacsclient
Requires: libgccjit
Recommends: emacs = %{epoch}:%{version}-%{release}
@ -465,11 +469,37 @@ cat > macros.emacs << EOF
%%_emacs_version %{version}
%%_emacs_ev %{?epoch:%{epoch}:}%{version}
%%_emacs_evr %{?epoch:%{epoch}:}%{version}-%{release}
%%_emacs_archsitelispdir %%{_libdir}/emacs/site-lisp
%%_emacs_sitelispdir %{site_lisp}
%%_emacs_sitestartdir %{site_start_d}
%%_emacs_bytecompile(W) /usr/bin/emacs -batch --no-init-file --no-site-file --eval '(push nil load-path)' %%{-W:--eval '(setq byte-compile-error-on-warn t)' }-f batch-byte-compile %%*
EOF
cat > 00-dynamic-module-dir.el << 'EOF'
;;; 00-dynamic-module-dir.el --- Add arch-specifc dir to load-path -*- lexical-binding: t -*-
;;; Commentary:
;;
;; This directory is for installing Emacs dynamic modules into. See
;; also RPM macro %%_emacs_archsitelispdir.
(add-to-list 'load-path "%{_libdir}/emacs/site-lisp")
;;; 00-dynamic-module-dir.el ends here
EOF
cat > 10-source-directory.el << 'EOF'
;;; 10-source-directory.el --- Set source-directory -*- lexical-binding: t -*-
;;; Commentary:
;;
;; This solves rhbz#474958; Function `update-directory-autoloads' now
;; finally works.
(setq source-directory "%{_datadir}/emacs/%{version}/")
;;; 10-source-directory.el ends here
EOF
%install
%if %{with nw}
@ -524,24 +554,18 @@ ln -s emacs-%{version}-nw %{buildroot}%{_bindir}/emacs-nox
# Make sure movemail isn't setgid
chmod 755 %{buildroot}%{emacs_libexecdir}/movemail
mkdir -p %{buildroot}%{site_lisp}
mkdir -p %{buildroot}%{site_lisp} %{buildroot}%{site_start_d}
install -p -m 0644 %SOURCE5 %{buildroot}%{site_lisp}/site-start.el
install -p -m 0644 %SOURCE6 %{buildroot}%{site_lisp}
install -p -m 0644 00-dynamic-module-dir.el %{buildroot}%{site_start_d}/
install -p -m 0644 10-source-directory.el %{buildroot}%{site_start_d}/
# This solves bz#474958, "update-directory-autoloads" now finally
# works the path is different each version, so we'll generate it here
echo "(setq source-directory \"%{_datadir}/emacs/%{version}/\")" \
>> %{buildroot}%{site_lisp}/site-start.el
mv %{buildroot}%{_bindir}/{etags,etags.emacs}
mv %{buildroot}%{_mandir}/man1/{ctags.1.gz,gctags.1.gz}
mv %{buildroot}%{_mandir}/man1/{etags.1.gz,etags.emacs.1.gz}
mv %{buildroot}%{_bindir}/{ctags,gctags}
# BZ 927996
mv %{buildroot}%{_infodir}/{info.info.gz,info.gz}
mkdir -p %{buildroot}%{site_lisp}/site-start.d
# Default initialization file
mkdir -p %{buildroot}%{_sysconfdir}/skel
install -p -m 0644 %SOURCE4 %{buildroot}%{_sysconfdir}/skel/.emacs
@ -726,13 +750,7 @@ fi
%endif
%preun common
if [ $1 = 0 ]; then
/usr/sbin/alternatives --remove emacs.etags %{_bindir}/etags.emacs || :
fi
%posttrans common
/usr/sbin/alternatives --install %{_bindir}/etags emacs.etags %{_bindir}/etags.emacs 80 \
--slave %{_mandir}/man1/etags.1.gz emacs.etags.man %{_mandir}/man1/etags.emacs.1.gz || :
/usr/sbin/alternatives --remove emacs.etags %{_bindir}/etags.emacs || :
%files
@ -780,8 +798,7 @@ fi
%license build-pgtk/etc/COPYING
%doc build-pgtk/doc/NEWS build-pgtk/BUGS build-pgtk/README
%{_bindir}/ebrowse
%ghost %{_bindir}/etags
%{_bindir}/etags.emacs
%{_bindir}/etags
%{_bindir}/gctags
%{_datadir}/applications/emacs.desktop
%{_datadir}/applications/emacs-mail.desktop
@ -792,13 +809,11 @@ fi
%{_datadir}/icons/hicolor/scalable/mimetypes/emacs-document.svg
%{_mandir}/man1/ebrowse.1*
%{_mandir}/man1/emacs.1*
%{_mandir}/man1/etags.emacs.1*
%ghost %{_mandir}/man1/etags.1.gz
%{_mandir}/man1/etags.1*
%{_mandir}/man1/gctags.1*
%dir %{_datadir}/emacs/%{version}
%{_datadir}/emacs/%{version}/etc
%{_datadir}/emacs/%{version}/site-lisp
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/%{version}
%dir %{native_lisp}
%dir %{_libexecdir}/emacs

View file

@ -1,9 +1,16 @@
;;; loaded before user's ".emacs" file and default.el
;;; site-start.el --- loaded before user's ".emacs" file and default.el -*- lexical-binding: t -*-
;;; Commentary:
;;
;; Load *.el and *.elc in /usr/share/emacs/site-lisp/site-start.d on startup
;;; Code:
;; load *.el and *.elc in /usr/share/emacs/site-lisp/site-start.d on startup
(mapc
'load
(delete-dups
(mapcar 'file-name-sans-extension
(directory-files
"/usr/share/emacs/site-lisp/site-start.d" t "\\.elc?\\'"))))
;;; site-start.el ends here