Making OSX Emacs less broken

If you find that Emacs on OSX fails to pick up the same $PATH setting that you get in command line shells, instead defaulting to an impoverished default that doesn’t include (for instance) anything installed via MacPorts:

(add-hook 'after-init-hook
         #'(lambda ()
             (setenv "PATH"
                 (call-process "/bin/bash"
                               (list (current-buffer) nil)
                               "-l" "-c" "printf %s \"$PATH\"")

I am only embarrassed that I put up with the brokenness for as long as I did.