Friday, July 05, 2024

Re: editors/emacs - allow loading site-start.el from /etc/emacs

On Thu, Jul 04, 2024 at 06:06:23PM -0400, aisha wrote:
> Hi,
>
> I've attached a patch for editors/emacs, which adds `/etc/emacs` as an additional directory from which to load the site-start.el.
> I think it's more intuitive to have custom configurations in `/etc/` as opposed to modifying files in `/usr/local/share`, which are generally meant to be examples or fallback configs.
> The patch is small and is backwards compatible, so nothing should break.
>
> OK? comments?

I'm fine with the general idea. FWIW Debian does something similar.

Regarding the diff itself, yours slightly mangles the original
load-path: it drops /usr/local/share/emacs/29.4/site-lisp. The diff
below addresses that and slightly reorganizes your proposal. Tested
with a dummy /etc/emacs/subdirs.el. By the way, note that emacs won't
automatically install /etc/emacs/subdirs.el like done for other
site-lisp directories. So if users install stuff into /etc/emacs/
subdirectories, emacs won't look them up. I don't think it's a
problem.

If the diff below works for you, please commit it (ok jca@).

Index: Makefile
===================================================================
RCS file: /cvs/ports/editors/emacs/Makefile,v
diff -u -p -r1.119 Makefile
--- Makefile 23 Jun 2024 12:55:50 -0000 1.119
+++ Makefile 5 Jul 2024 14:11:15 -0000
@@ -4,6 +4,7 @@ COMMENT= GNU editor: extensible, custom
# Zap post-extract when updating
VERSION= 29.4
DISTNAME= emacs-${VERSION}
+REVISION= 0

CATEGORIES= editors

@@ -26,10 +27,12 @@ FLAVORS= athena gtk2 gtk3 no_x11
FLAVOR?= gtk3

GCCARCH= ${MACHINE_ARCH}-unknown-openbsd
+LOCAL_LISP_PATH= ${SYSCONFDIR}/emacs:${LOCALBASE}/share/emacs/${VERSION:C/[a-z]+$$//}/site-lisp:${LOCALBASE}/share/emacs/site-lisp

CONFIGURE_STYLE= gnu
MODGNU_CONFIG_GUESS_DIRS=${WRKSRC}/build-aux
CONFIGURE_ARGS= --build="${GCCARCH}" \
+ --enable-locallisppath="${LOCAL_LISP_PATH}" \
--without-sound

CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/editors/emacs/pkg/PLIST,v
diff -u -p -r1.30 PLIST
--- pkg/PLIST 2 Aug 2023 11:12:25 -0000 1.30
+++ pkg/PLIST 5 Jul 2024 14:11:15 -0000
@@ -4309,3 +4309,4 @@ share/emacs/site-lisp/
share/emacs/site-lisp/subdirs.el
share/metainfo/
share/metainfo/emacs.metainfo.xml
+@sample ${SYSCONFDIR}/emacs/


--
jca

No comments:

Post a Comment