Also not a complete answer, but if you use
find /usr/local/texlive/2011/texmf-dist/source/ -name "*.dtx" -exec grep -q "\\\DescribeMacro{.*whiledo.*}" {} \; -print | xargs -n 1 basename | xargs -n 1 bash -c 'texdoc "${0%.dtx}"'
in a unixoid shell (of course, you should have sources installed and you need to put in the right path to your distribution) the documentation of the ifthen package will pop up.
For regular use you'll wish to make a shell script named, for instance lookuptexdoc.sh containing
#!/bin/bash
find /usr/local/texlive/2011/texmf-dist/source/ -name "*.dtx" -exec grep -Eq "\\\DescribeMacro{.*$1.*}|\\\DescribeEnv{.*$1.*}" {} \; -print | xargs -n 1 basename | xargs -n 1 bash -c 'texdoc "${0%.dtx}"'
Then by calling lookuptexdoc.sh comment you'll get the documentation of all packages defining a command or environment whose name contains "comment".
This can be much refined of course, I'm not a skilled shell programmer by far.
\def,\letand similar commands from all macros, at least to make a list of references to the correct packages. Then you can automate the documentation finder and download the correct PDF file if it's not already on the computer. I know, you get plenty of false positives, but there shouldn't be much of such that does not contain@for start. – yo' Mar 17 '12 at 10:11