bug#58102: [PATCH] Do not use -Q when calculating Emacs site-lisp directory

2022-09-26 Thread Richard Hopkins

This change ensures consistency and compatibility for both GNU Emacs
and XEmacs because:

* XEmacs doesn't support -Q and ignores it; and
* the different releases of GNU Emacs handle it differently, or not at
  all.

With GNU Emacs, '-Q' was added in 22.1, and specifying it on earlier
versions causes an immediate abort.  Also, the meaning of '-Q' changes
in 24.1 where it also implies/uses a new '--no-site-lisp' option.
This new option means it won't add the site-lisp directories to
`load-path', but they need to be there because `am_cv_lispdir' is
looking for them.

Tested on GNU Emacs 21.4, 24.3, 27.2, 28.2, and XEmacs 21.5.

From this testing I think the existing usage of '--no-site-file'
is good to stay as it's the one mentioned in the current GNU Emacs
manual and recognized back to at least 19.34.  Also, whilst the
XEmacs manual and '--help' mention "-no-site-file" it also
supports "--no-site-file".From 38e5c77356f56ac1c1bd50c9ced5bb7607c3ebbf Mon Sep 17 00:00:00 2001
From: Richard Hopkins <>
Date: Mon, 26 Sep 2022 21:25:06 +0100
Subject: [PATCH] Do not use -Q when calculating Emacs site-lisp directory

	* m4/lispdir.m4 (am_cv_lispdir): Remove '-Q' argument.

	* doc/automake.texi (Hard-Coded Install Paths): Remove '-Q'
	argument.

This change ensures consistency and compatibility for both GNU Emacs
and XEmacs because:

* XEmacs doesn't support -Q and ignores it; and
* the different releases of GNU Emacs handle it differently, or not at
  all.

With GNU Emacs, '-Q' was added in 22.1, and specifying it on earlier
versions causes an immediate abort.  Also, the meaning of '-Q' changes
in 24.1 where it also implies/uses a new '--no-site-lisp' option.
This new option means it won't add the site-lisp directories to
`load-path', but they need to be there because `am_cv_lispdir' is
looking for them.
---
 doc/automake.texi | 2 +-
 m4/lispdir.m4 | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/automake.texi b/doc/automake.texi
index 21c49645e..444740bb6 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -13350,7 +13350,7 @@ instance, here is how @code{AM_PATH_LISPDIR} (@pxref{Emacs Lisp})
 computes @samp{$(lispdir)}:
 
 @example
-$EMACS -batch -Q --no-site-file -eval '(while load-path
+$EMACS -batch --no-site-file -eval '(while load-path
   (princ (concat (car load-path) "\n"))
   (setq load-path (cdr load-path)))' >conftest.out
 lispdir=`sed -n
diff --git a/m4/lispdir.m4 b/m4/lispdir.m4
index 6f9b89d2c..cec4b3554 100644
--- a/m4/lispdir.m4
+++ b/m4/lispdir.m4
@@ -34,7 +34,7 @@ AC_DEFUN([AM_PATH_LISPDIR],
   #  which is non-obvious for non-emacs users.
   # Redirecting /dev/null should help a bit; pity we can't detect "broken"
   #  emacsen earlier and avoid running this altogether.
-  AC_RUN_LOG([$EMACS -batch -Q --no-site-file -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' conftest.out])
+  AC_RUN_LOG([$EMACS -batch --no-site-file -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' conftest.out])
 	am_cv_lispdir=`sed -n \
-e 's,/$,,' \
-e '/.*\/lib\/x*emacs\/site-lisp$/{s,.*/lib/\(x*emacs/site-lisp\)$,${libdir}/\1,;p;q;}' \
-- 
2.37.3



bug#58102: [PATCH] Do not use -Q when calculating Emacs site-lisp directory

2022-09-27 Thread Karl Berry
Hi again Richard,

* XEmacs doesn't support -Q and ignores it; and
* the different releases of GNU Emacs handle it differently,
  or not at all.

Thanks. I applied it.

From this testing I think the existing usage of '--no-site-file'

It seemed too confusing to me to use --no-site-file in the documentation
when the other options (-batch, -eval) use single dashes. So I changed
it. And I changed the code in lispdir.m4 to match. OTOH, I kept the code
in lisp.am that's using double dashes (--batch --no-site-file) since
really, both should work, and are assumed to work, so might as well use
both.

It is standard behavior in Emacs (and many other programs) for long
options to be accepted with both single and double dashes. The --help
message for emacs says:

  You can generally also specify long option names with a single -; for
  example, -batch as well as --batch.

Maybe the xemacs help msg or doc also says that? It would have been
quite strange/gratuitous for them to change that.  Documentation often
arbitrarily uses one or two dashes. --thanks, karl.