It is a very typical way of doing things, you just have to read the output and make sure no important packages are in the list.
Your command should be working. It won’t remove manually installed dependencies but should take care of automatic ones. You can check an individual package with apt show and look at the APT-Manual-Installed field.
I already checked with apt show emacs and the output clearly shows emacs-gtk as depends on. And while installing the emacs package with:
sudo apt-get install emacs it installed a ~400Mo package and all dependencies.
So why doesn't sudo apt remove --purge --autoremove emacs removes everything ? I thought this command would be the exact opposite of sudo apt install package-name
Ah, I can duplicate this behavior too. I think it is probably related to emacs being a metapackage. It does not include emacs itself but forces the install of emacs-gtk. In my mind removing the metapackage should allow you to autoremove dependencies, but people have broken their systems badly with this behavior so it may have been changed or it’s stuck behind some configuration option.
Removing emacs-gtk itself will work as you expect. You can also install emacs-nox for a cli-only one that is smaller.
Edit: there is a setting called APT::Never-MarkAuto-Sections that by default includes meta packages and I think is the cause of this.