I'm using

GNU Emacs (x86_64-apple-darwin14.0.0, NS appkit-1343.14 Version 10.10 (Build 14A389)) of 2014-10-20

And I interesting in knowing how emacs does an icon in the top window frame for certain file extensions, for example:

CPP example

and Swift example

I suspect this is an emacs source code kind of solution since I couldn't find an icon in the swift-mode package.

Can someone shed some light on this? (I want to add an icon for OCaml)

  • Do OCaml files have a special icon in OS X Finder? My guess is that Emacs uses the file type info provided by the OS, and that's where you would need to tweak this. May 1 '15 at 17:18
  • Unfortunately it doesn't, but surely a process can provide its own icon? I will have to check with the OS X people.
    – EdgarArout
    May 1 '15 at 17:20

Emacs does not choose the icon, it is provided by OSX, look at those files in Finder, they'll have that same icon.

This image can be gathered through by using the AppKit class NSWorkspace's function iconForFileType

Grep the source for iconForFileType and you'll find the usage.

So if you wanted to change what a swift file's icon was you'd need to change it for all of OSX. I do not believe you can put your own images in the frame title.

If you want to choose an icon for OSX to use for OCaml files then this is the answer you want: How to set an icon for a file type on Mac?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.