about summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorNicolas Dudebout <nicolas.dudebout@gmail.com>2016-09-26 10:10:03 -0400
committerNicolas Dudebout <nicolas.dudebout@gmail.com>2016-09-26 17:09:06 -0400
commitbb6708b8586e5ecc2ec2a70b19c342843651c5d2 (patch)
tree5fc2e508b732320cf0fa8aced3f1f49e9c57a1cd /pkgs/applications
parent2c570b4fbe1228b4e275ded78117c66ae34ebc70 (diff)
downloadnixlib-bb6708b8586e5ecc2ec2a70b19c342843651c5d2.tar
nixlib-bb6708b8586e5ecc2ec2a70b19c342843651c5d2.tar.gz
nixlib-bb6708b8586e5ecc2ec2a70b19c342843651c5d2.tar.bz2
nixlib-bb6708b8586e5ecc2ec2a70b19c342843651c5d2.tar.lz
nixlib-bb6708b8586e5ecc2ec2a70b19c342843651c5d2.tar.xz
nixlib-bb6708b8586e5ecc2ec2a70b19c342843651c5d2.tar.zst
nixlib-bb6708b8586e5ecc2ec2a70b19c342843651c5d2.zip
emacs: add an option to install the C source
Install the source files, and the associated TAGS files. Use
.dir-locals.el to select the TAGS file automatically.

Turn the option on by default, to get a consistent behavior when using
xref-find-definitions (M-.), whether looking for an elisp (e.g. defun)
or a C (e.g. defalias) definition.
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/editors/emacs/default.nix4
-rw-r--r--pkgs/applications/editors/emacs/install-C-src.patch33
2 files changed, 36 insertions, 1 deletions
diff --git a/pkgs/applications/editors/emacs/default.nix b/pkgs/applications/editors/emacs/default.nix
index 4a729ba3da3f..e10be4ab22d6 100644
--- a/pkgs/applications/editors/emacs/default.nix
+++ b/pkgs/applications/editors/emacs/default.nix
@@ -6,6 +6,7 @@
 , withGTK2 ? true, gtk2 ? null
 , withGTK3 ? false, gtk3 ? null
 , withXwidgets ? false, webkitgtk24x ? null, wrapGAppsHook ? null, glib_networking ? null
+, withCsrc ? true
 , srcRepo ? false, autoconf ? null, automake ? null, texinfo ? null
 }:
 
@@ -31,7 +32,8 @@ stdenv.mkDerivation rec {
     sha256 = "0cwgyiyymnx4xdg99dm2drfxcyhy2jmyf0rkr9fwj9mwwf77kwhr";
   };
 
-  patches = lib.optional stdenv.isDarwin ./at-fdcwd.patch;
+  patches = lib.optional stdenv.isDarwin ./at-fdcwd.patch
+    ++ lib.optional withCsrc ./install-C-src.patch;
 
   nativeBuildInputs = [ pkgconfig ]
     ++ lib.optionals srcRepo [ autoconf automake texinfo ];
diff --git a/pkgs/applications/editors/emacs/install-C-src.patch b/pkgs/applications/editors/emacs/install-C-src.patch
new file mode 100644
index 000000000000..eb980d3e0789
--- /dev/null
+++ b/pkgs/applications/editors/emacs/install-C-src.patch
@@ -0,0 +1,33 @@
+diff --git a/Makefile.in b/Makefile.in
+index 7aac403..c21a396 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -563,7 +563,7 @@ set_installuser=
+ ## work correctly, and therefore no idea when tar can be replaced.
+ ## See also these comments from 2004 about cp -r working fine:
+ ## http://lists.gnu.org/archive/html/autoconf-patches/2004-11/msg00005.html
+-install-arch-indep: lisp install-info install-man ${INSTALL_ARCH_INDEP_EXTRA}
++install-arch-indep: lisp install-info install-man ${INSTALL_ARCH_INDEP_EXTRA} tags
+ 	-set ${COPYDESTS} ; \
+ 	unset CDPATH; \
+ 	$(set_installuser); \
+@@ -617,6 +617,19 @@ install-arch-indep:
+ 	  done; \
+ 	  ${GZIP_PROG} -9n "../etc/publicsuffix.txt"; \
+ 	}
++	for d in src lwlib ; do \
++	  srcdir="$(DESTDIR)${datadir}/emacs/${version}/$$d" ; \
++	  mkdir -p $$srcdir ; \
++	  find $$d -name "*.[chm]" -exec cp {} $$srcdir \; ; \
++	done
++	for d in src lisp lwlib ; do \
++	  srcdir="$(DESTDIR)${datadir}/emacs/${version}/$$d" ; \
++	  cp $$d/TAGS $$srcdir ; \
++	  echo '((nil . ((tags-file-name . "TAGS"))))' > $$srcdir/.dir-locals.el ; \
++	done
++	mkdir -p "$(DESTDIR)${datadir}/emacs/${version}/site-lisp"
++	echo "(setq find-function-C-source-directory \"$(DESTDIR)${datadir}/emacs/${version}/src\")" \
++         > "$(DESTDIR)${datadir}/emacs/${version}/site-lisp/site-start.el"
+ 	-chmod -R a+r "$(DESTDIR)${datadir}/emacs/${version}" ${COPYDESTS}
+ 
+ ## The above chmods are needed because "umask 022; tar ..." is not