Can I install a program's source as a package?

I see what you are looking for, but things are not quite that simple. Programs like Emacs certainly would benefit from having the source code tree provided as a documentation package. If you want to have the source tree of your binary package available, you need to use the corresponding Fedora source package.

To make a source tree available you first need to install rpmdevtools and rpm-build,

You can download the source package with dnf download --source emacs and then install that package to your home directory: rpm -ivh emacs-26.2-1.fc30.src.rpm or whatever your version happens to be.

At this point the source tree is not yet available so first we have to make sure that all the build dependencies are met: sudo dnf builddep emacs

And now you can build the actual source tree: rpmbuild -bp rpmbuild/SPECS/emacs.spec

The source tree will now be found at ~/rpmbuild/BUILD/emacs-26.2

But yes, the Emacs source tree is used as a documentation so a documentation package would be quite useful.

3 Likes