> I am trying to develop an Emacs Lisp program that maximizes
> the window. I found and modified the following code, which
> was originally for Carbon Emacs. ...
> It does not act as I want it to.
You might also try the code in frame-cmds.el (e.g. `maximize-frame'):
http://www.emacswiki.org/emacs/download/frame-cmds.el. (It requires a second
library, frame-fns.el: http://www.emacswiki.org/emacs/download/frame-fns.el.)
It does not depend on the frame parameter `fullscreen', which does not exist in
some Emacs builds. It takes into consideration the space available on Mac-OS,
via `mac-display-available-pixel-bounds'.