How do I set up to detect .h files that are in fact C++ or Objective-C headers, and use an appropriate mode for them automatically?
And why doesn't it do that out of the box?
@bugaevc Emacs should do that out of the box (tested with emacs -Q and it detected a C++ header file correctly). Does the detection fail every time? Are your .h files distinguishable from C headers?
Indeed, it seems to work out of the box (with -Q) for C++ headers. This means something in Spacemacs, which I'm using, breaks it. But even then, it doesn't seem to work with Objective-C headers?
I don't want to either do project-specific configuration or set up .h to always mean c++-mode — I want it to always do the right thing, automatically.
@bugaevc I don’t use Spacemacs, but this seems to be the culprit: https://www.spacemacs.org/layers/+lang/c-c++/README.html#default-mode-for-header-files. Maybe the autodetection works again if you set it to nil?
I never used Objective-C, so I haven’t a clue about that, sorry.
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!