From a02b179242a55aba20158aa245e5643a04d07576 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 27 Jan 2020 23:04:20 -0800 Subject: [PATCH] Revert the --with-install-srcdir patch Also, update description of debuginfo and sources to match Debian and Red Hat more accurately, and move this sad tale from INSTALL to etc/PROBLEMS which is a better home for it. * Makefile.in (emacs_srcdir, install-c-src): * configure.ac (emacs_srcdir, --with-install-srcdir): * src/epaths.in (PATH_EMACS_SOURCE): * src/lread.c (emacs-source-directory): Remove. All uses removed. * lisp/emacs-lisp/find-func.el (find-function-C-source): Do not worry about compressed C sources. * src/lread.c: Do not include . --- INSTALL | 37 ----------------- Makefile.in | 31 +-------------- configure.ac | 14 ------- etc/NEWS | 10 ----- etc/PROBLEMS | 77 ++++++++++++++++++++++++++++++++++++ lisp/emacs-lisp/find-func.el | 11 ++---- lisp/startup.el | 3 +- src/epaths.in | 4 -- src/lread.c | 10 +---- 9 files changed, 84 insertions(+), 113 deletions(-) diff --git a/INSTALL b/INSTALL index 7a1b46872d4..f1ceb2c1bf8 100644 --- a/INSTALL +++ b/INSTALL @@ -215,43 +215,6 @@ eg 'emacs25'). On Red Hat-based systems, the corresponding command is 'dnf builddep emacs' (on older systems, use 'yum-builddep' instead). -DEBUGGING AN INSTALLED EMACS - -* Installed Emacs source code - -Emacs typically installs a compressed copy of much of its source code, -to make it easy for users to read Emacs source code via commands like -M-x describe-function (C-h f) to display the definition of a function. -This compressed copy ordinarily includes both the Elisp source code -that Emacs is mostly written in, as well as the C source code for the -core Emacs executable. - -* GNU/Linux source and debug packages - -Many GNU/Linux systems provide separate packages containing the -sources and debug symbols of Emacs. They can help you debug the -installed Emacs on the C level. The procedures for installing these -packages depend on the GNU/Linux system that you use. - -Emacs debugging symbols are distributed by a debug package if one -exists for your system. On Debian-based systems, you can -install a debug package of Emacs with a command like 'apt-get install -emacs-dbg' (on older systems, replace 'emacs' with e.g. 'emacs25'). -On Red Hat-based systems, the corresponding command is 'dnf -debuginfo-install emacs'; this may require adding the *-debuginfo -repositories first, via 'dnf config-manager --set-enabled -fedora-debuginfo updates-debuginfo'. - -Some systems also have an Emacs source package that is also helpful -when debugging the installed Emacs. To unpack an Emacs source package -into the current directory on Debian-based systems, you can use a -command like 'apt-get source emacs' (on older systems, replace 'emacs' -with e.g. 'emacs25'); you may first need to add the appropriate -'source' URIs to your sources.list. On Red Hat-based systems, -installing the debugging symbols automatically installs the -corresponding source package in the appropriate location. - - DETAILED BUILDING AND INSTALLATION: (This is for a Unix or Unix-like system. For GNUstep and macOS, diff --git a/Makefile.in b/Makefile.in index adefa98fd02..2c82c49fba5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -266,9 +266,6 @@ etcdir=@etcdir@ # once. archlibdir=@archlibdir@ -# Where to install Emacs C source code, or empty if it is not installed. -emacs_srcdir=@emacs_srcdir@ - # Where to put the etc/DOC file. etcdocdir=@etcdocdir@ @@ -377,7 +374,6 @@ epaths-force: -e 's;\(#.*PATH_BITMAPS\).*$$;\1 "${bitmapdir}";' \ -e 's;\(#.*PATH_X_DEFAULTS\).*$$;\1 "${x_default_search_path}";' \ -e 's;\(#.*PATH_GAME\).*$$;\1 $(PATH_GAME);' \ - -e 's;\(#.*PATH_EMACS_SOURCE\).*$$;\1 "${emacs_srcdir}";' \ -e 's;\(#.*PATH_DOC\).*$$;\1 "${etcdocdir}";') && \ ${srcdir}/build-aux/move-if-change epaths.h.$$$$ src/epaths.h @@ -465,7 +461,7 @@ $(srcdir)/configure: $(srcdir)/configure.ac $(srcdir)/m4/*.m4 # ==================== Installation ==================== .PHONY: install install-arch-dep install-arch-indep install-etcdoc install-info -.PHONY: install-man install-c-src install-etc install-strip install-$(NTDIR) +.PHONY: install-man install-etc install-strip install-$(NTDIR) .PHONY: uninstall uninstall-$(NTDIR) ## If we let lib-src do its own installation, that means we @@ -572,8 +568,7 @@ set_installuser=for installuser in $${LOGNAME} $${USERNAME} $${USER} \ ## work correctly, and therefore no idea when tar can be replaced. ## See also these comments from 2004 about cp -r working fine: ## https://lists.gnu.org/r/autoconf-patches/2004-11/msg00005.html -install-arch-indep: lisp install-info install-man install-c-src \ - $(INSTALL_ARCH_INDEP_EXTRA) +install-arch-indep: lisp install-info install-man ${INSTALL_ARCH_INDEP_EXTRA} umask 022 && $(MKDIR_P) "$(DESTDIR)$(includedir)" $(INSTALL_DATA) src/emacs-module.h "$(DESTDIR)$(includedir)/emacs-module.h" -set ${COPYDESTS} ; \ @@ -705,28 +700,6 @@ install-man: ${GZIP_PROG} -9n "$(DESTDIR)${man1dir}/$${dest}" || true; \ done -install-c-src: -ifneq (,$(emacs_srcdir)) - -unset CDPATH; \ - umask 022; $(MKDIR_P) "$(DESTDIR)$(emacs_srcdir)/src" && \ - exp_sourcesrcdir=`cd "$(DESTDIR)$(emacs_srcdir)/src" && /bin/pwd` && \ - [ "`cd $(srcdir)/src && /bin/pwd`" = "$$exp_sourcesrcdir" ] || { \ - $(set_installuser); \ - printf 'Copying compressed C sources to %s ...\n' \ - "$(DESTDIR)$(emacs_srcdir)/src"; \ - for file in `cd $(srcdir) && echo src/*.[cm]`; do \ - installed_file="$(DESTDIR)$(emacs_srcdir)/$$file" && \ - $(INSTALL_DATA) "$$file" "$$installed_file" && \ - [ -z "$(GZIP_PROG)" ] || { \ - rm -f "$$installed_file.gz" && \ - $(GZIP_PROG) -9n "$$installed_file" && \ - installed_file=$$installed_file.gz; \ - } || exit; \ - chown $$installuser "$$installed_file" || true; \ - done; \ - } -endif - ## Install those items from etc/ that need to end up elsewhere. ## If you prefer, choose "emacs22" at installation time. diff --git a/configure.ac b/configure.ac index 4de83c6b261..27e44dacfb2 100644 --- a/configure.ac +++ b/configure.ac @@ -194,7 +194,6 @@ locallisppath='${datadir}/emacs/${version}/site-lisp:'\ lisppath='${locallisppath}:${standardlisppath}' etcdir='${datadir}/emacs/${version}/etc' archlibdir='${libexecdir}/emacs/${version}/${configuration}' -emacs_srcdir='${datadir}/emacs/${version}' etcdocdir='${datadir}/emacs/${version}/etc' gamedir='${localstatedir}/games/emacs' @@ -541,15 +540,6 @@ elif test "${enableval}" != "yes"; then locallisppath=${enableval} locallisppathset=yes fi) -AC_ARG_ENABLE([install-srcdir], - [AS_HELP_STRING([--disable-install-srcdir], - [do not install low-level Emacs source code useful for debugging.])], - [case $enableval in - yes) ;; - no) emacs_srcdir=;; - *) AC_MSG_ERROR([invalid install-srcdir]);; - esac]) - AC_ARG_ENABLE(checking, [AS_HELP_STRING([--enable-checking@<:@=LIST@:>@], [enable expensive checks. With LIST, @@ -2058,9 +2048,6 @@ if test "${HAVE_NS}" = yes; then dnl This one isn't really used, only archlibdir is. libexecdir="\${ns_appbindir}/libexec" archlibdir="\${ns_appbindir}/libexec" - case $emacs_srcdir in - ?*) emacs_srcdir="\${ns_appresdir}";; - esac etcdocdir="\${ns_appresdir}/etc" etcdir="\${ns_appresdir}/etc" dnl FIXME maybe set datarootdir instead. @@ -5243,7 +5230,6 @@ AC_SUBST(lisppath) AC_SUBST(x_default_search_path) AC_SUBST(etcdir) AC_SUBST(archlibdir) -AC_SUBST([emacs_srcdir]) AC_SUBST(etcdocdir) AC_SUBST(bitmapdir) AC_SUBST(gamedir) diff --git a/etc/NEWS b/etc/NEWS index 276b8f46e81..5395f2ccfb2 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -58,12 +58,6 @@ shaping, so 'configure' now recommends that combination. ** The ftx font backend driver has been removed. It was declared obsolete in Emacs 27.1. ---- -** Emacs now installs a copy of its C source code, used for debugging help. -For example, pressing the first button in the *Help* buffer generated -by 'C-h f car RET' now takes you to a copy of the C-language -implementation of the function 'car'. - * Startup Changes in Emacs 28.1 @@ -148,10 +142,6 @@ called when the function object is garbage-collected. Use ** 'parse-time-string' can now parse ISO 8601 format strings, such as "2020-01-15T16:12:21-08:00". -** The new variable 'emacs-source-directory' gives the location of -a copy of the Emacs source code, which is now typically installed as a -set of compressed source-code files. - * Changes in Emacs 28.1 on Non-Free Operating Systems diff --git a/etc/PROBLEMS b/etc/PROBLEMS index 9e4a631c729..4ce738d9a54 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -318,6 +318,83 @@ element from LD_LIBRARY_PATH before starting emacs proper. Or you could recompile Emacs with an -Wl,-rpath option that gives the location of the correct libotf. +* Problems when reading or debugging Emacs C code + +Because Emacs does not install a copy of its C source code, users +normally cannot easily read that code via commands like 'M-x +describe-function' (C-h f) that display the definition of a function. +However, some GNU/Linux systems provide separate packages containing +this source code which can get C-h f to work if you are willing to do +some tinkering, and some systems also provide packages containing +debug info, which when combined with the source can be used to debug +Emacs at the C level. + +** Debian-based source and debuginfo + +On recent Debian-based systems, you can obtain and use a source +package of Emacs as follows. + +*** Add the appropriate URI to /etc/apt/sources.list. + +To do this, become superuser and uncomment or add the appropriate +'deb-src' line. Details depend on the distribution. + +*** Execute a command like 'apt-get source emacs'. + +On older systems, append the top-level version number, e.g., 'apt-get +source emacs25'. The target directory for unpacking the source tree +is the current directory. + +*** Set find-function-C-source-directory accordingly. + +Once you have installed the source package, for example at +/home/myself/deb-src/emacs-26.3, add the following line to your +startup file: + + (setq find-function-C-source-directory + "/home/myself/deb-src/emacs-26.3/src/") + +The installation directory of the Emacs source package will contain +the exact package name and version number of Emacs that is installed +on your system. If a new Emacs package is installed, the source +package must be reinstalled as well, and the setting in your startup +file must be updated. + +*** Debian-based debuginfo + +You can also install a debug package of Emacs with a command like +'apt-get install emacs-dbg' (on older systems, 'apt-get install +emacs25-dbg'). You need to arrange for GDB to find where you +installed the source code, e.g., by using GDB's 'directory' command. + +** Red Hat-based source and debuginfo + +On recent Red Hat-based systems, you can install source and debug info +via superuser commands like the following: + + # Add the *-debuginfo repositories (exact command depends on system). + dnf config-manager --set-enabled fedora-debuginfo updates-debuginfo' + + # Install Emacs source and debug info. + dnf install emacs-debugsource + +To get describe-function and similar commands to work, you can then +add something like the following to your startup file: + + (setq find-function-C-source-directory + "/usr/src/debug/emacs-26.3-1.fc31.x86_64/src/") + +However, the exact directory name will depend on the system, and you +will need to both upgrade source and debug info when your system +upgrades or patches Emacs, and change your startup file accordingly. + +** Source and debuginfo for other systems + +If your system follows neither the Debian nor the Red Hat patterns, +you can obtain the source and debuginfo by obtaining the source code +of Emacs, building Emacs with the appropriate debug flags enabled, and +running the just-built Emacs. + * General runtime problems ** Lisp problems diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index be53324f141..167ead3ce02 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -219,10 +219,8 @@ LIBRARY should be a string (the name of the library)." (locate-file basename (list dir) (find-library-suffixes))))))) (defvar find-function-C-source-directory - (let ((dir (expand-file-name "src" emacs-source-directory))) - (if (file-accessible-directory-p dir) dir - (setq dir (expand-file-name "src" source-directory)) - (if (file-accessible-directory-p dir) dir))) + (let ((dir (expand-file-name "src" source-directory))) + (if (file-accessible-directory-p dir) dir)) "Directory where the C source files of Emacs can be found. If nil, do not try to find the source code of functions and variables defined in C.") @@ -247,10 +245,7 @@ TYPE should be nil to find a function, or `defvar' to find a variable." (let ((dir (or find-function-C-source-directory (read-directory-name "Emacs C source dir: " nil nil t)))) (setq file (expand-file-name file dir)) - (if (or (file-readable-p file) - (let ((file-gz (concat file ".gz"))) - (and (file-readable-p file-gz) - (setq file file-gz)))) + (if (file-readable-p file) (if (null find-function-C-source-directory) (setq find-function-C-source-directory dir)) (error "The C source file %s is not available" diff --git a/lisp/startup.el b/lisp/startup.el index 676fb35e000..1f545c66922 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -623,8 +623,7 @@ It is the default value of the variable `top-level'." (set pathsym (mapcar (lambda (dir) (decode-coding-string dir coding t)) path))))) - (dolist (filesym '(data-directory doc-directory emacs-source-directory - exec-directory + (dolist (filesym '(data-directory doc-directory exec-directory installation-directory invocation-directory invocation-name source-directory diff --git a/src/epaths.in b/src/epaths.in index 554fdd7228a..3cadd160ecf 100644 --- a/src/epaths.in +++ b/src/epaths.in @@ -73,9 +73,5 @@ along with GNU Emacs. If not, see . */ /* Where Emacs should store game score files. */ #define PATH_GAME "/usr/local/var/games/emacs" -/* Where Emacs should look for its own installed source code, - or the empty string if the source code is not installed. */ -#define PATH_EMACS_SOURCE "/usr/local/share/emacs" - /* Where Emacs should look for the application default file. */ #define PATH_X_DEFAULTS "/usr/lib/X11/%L/%T/%N%C%S:/usr/lib/X11/%l/%T/%N%C%S:/usr/lib/X11/%T/%N%C%S:/usr/lib/X11/%L/%T/%N%S:/usr/lib/X11/%l/%T/%N%S:/usr/lib/X11/%T/%N%S" diff --git a/src/lread.c b/src/lread.c index 274491f0229..69dd73912bc 100644 --- a/src/lread.c +++ b/src/lread.c @@ -44,7 +44,6 @@ along with GNU Emacs. If not, see . */ #include "blockinput.h" #include "pdumper.h" #include -#include #include #ifdef MSDOS @@ -4993,18 +4992,11 @@ and is not meant for users to change. */); DEFVAR_LISP ("source-directory", Vsource_directory, doc: /* Directory in which Emacs sources were found when Emacs was built. -You cannot count on them to still be there! Also see -`emacs-source-directory'. */); +You cannot count on them to still be there! */); Vsource_directory = Fexpand_file_name (build_string ("../"), Fcar (decode_env_path (0, PATH_DUMPLOADSEARCH, 0))); - DEFVAR_LISP ("emacs-source-directory", Vemacs_source_directory, - doc: /* Directory where Emacs sources can be found. */); - Vemacs_source_directory = (IS_ABSOLUTE_FILE_NAME (PATH_EMACS_SOURCE) - ? build_string (PATH_EMACS_SOURCE) - : Vsource_directory); - DEFVAR_LISP ("preloaded-file-list", Vpreloaded_file_list, doc: /* List of files that were preloaded (when dumping Emacs). */); Vpreloaded_file_list = Qnil; -- 2.39.2