7

I want to be able to view C source code of Emacs functions. For example, I want to be able to do M-: (find-function 'message).

Emacs prompts me for directory the C sources, so it can set find-function-C-source-directory. However, my distro (Arch Linux) has just done the usual make; make install steps (see the package recipe here) so there are no C sources available without manually downloading them.

So, I want to fix the packaging. My questions are:

  1. Are there configuration options Emacs' makefile that mean make install copies the C sources too? I can't see anything obvious.
  2. What's the correct way to set find-function-C-source-directory in the package? Create a site-lisp?
  3. Are there any distros or platforms that already do this?
  • 1
    find-function-C-source-directory uses source-directory internally, therefore things should just work for an Emacs run in its build directory... – wasamasa Feb 27 '16 at 18:07
  • 1
    A brief search for "src" kind of RPM with Emacs shows: rpmfind.net/linux/rpm2html/… there are indeed such creatures. I would try to look into these, however, I'm not sure they set up source lookup (though it might be nice). – wvxvw Feb 27 '16 at 19:41
  • My guess would be that Arch Linux deletes all of the files used during the build, after completing the installation? If so, I suppose you'll need to add a build step to move the relevant files elsewhere. Using a site-lisp .el file to set the directory is correct. – phils Feb 27 '16 at 20:32
  • thought that emacs was written in lisp, not C – user3629249 Feb 29 '16 at 0:46
  • 1
    See "How to include / copy over the src directory when building Emacs": stackoverflow.com/questions/21241967/… – lawlist Nov 30 '16 at 1:47
1

If what you are asking is "how to include source code in my Arch package", it doesn't seem to belong here but maybe https://unix.stackexchange.com/.

Are there configuration options Emacs' makefile that mean make install copies the C sources too?

No.

What's the correct way to set find-function-C-source-directory in the package? Create a site-lisp?

If you know, at build time, where your source code package will be installed, you could patch the source code. But I'd override in site-lisp.

Are there any distros or platforms that already do this?

Not that I know of.

Because you, as a user, can always download Emacs source code, unpack in your home dir, set find-function-C-source-directory accordingly to make it work just fine.

A great thing about find-function is that it doesn't have to know the exact line number. It will, instead, search the function in the source file. So, minor changes or version differences do not affect the ability at all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.