Sorry for the delay in reply, but it seems to me that using SetFile would be easier, and more flexible.

(defun mac-set-creator-code-for-file ()
(call-process shell-file-name nil nil t shell-command-switch (concat "/Developer/Tools/SetFile -c EMAx " buffer-file-name))
)
(add-hook 'after-save-hook 'mac-set-creator-code-for-file)

-Steven

On Jun 24, 2005, at 2:05 AM, David Reitter wrote:

I'm posting some code that introduces a function "mac-set-creator" in the Mac (Carbon) port. The function sets the creator code (metadata information) of a file to 'EMAx'. That enables LaunchServices to start up Emacs whenever the file is double-clicked.

In the Aquamacs distribution, I use it as follows:

(defun mac-set-creator-code-for-file ()
  (if (and aquamacs-set-creator-codes-after-writing-files
       buffer-file-name
       (fboundp 'mac-set-creator)
       )
      (mac-set-creator buffer-file-name)
    )
  )

(add-hook 'after-save-hook 'mac-set-creator-code-for-file)

This contains some free code from Apple.


<mac-set-creator.patch>
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel



_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to