I have found a command
M-x project-find-regexp, how can I find out from where it comes from, ELPA/Melpa package or part of GNU/Emacs?
describe-function to get information about a function:
C-h f project-find-regexp RET (or
F1 f project-find-regexp RET). The first line is something like
project-find-regexp is a compiled Lisp function in `project.el'.
Click on the file name, or move the cursor to it and press RET. If you have the source code, this opens the file containing the function definition. Now press
C-h f (
find-file); this comes pre-filled with the path to the directory containing the file. Press
C-g to cancel. (Alternative ways to find the directory include
M-x pwd RET; this makes it harder to copy-paste from.)
From the directory path, you should be able to tell whether it's part of Emacs (e.g. under
/usr/share/emacs/VERSION/lisp on a typical Linux system), a third-party file installed either through an OS-level package or manually (under a directory called
site-lisp), or through Emacs's ELPA package mechanism (under
.emacs.d/elpa in your home directory).
If you don't have the source code of the file that defines the function, you'll only get something like
project-find-regexp is an interactive compiled Lisp function.
In this case, you can run
M-: (find-function 'project-find-regexp). You'll get an error message with the location where Emacs expects to find the source file. Press
ESC ESC ESC to dismiss the error message.