[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#37862: [PATCH] Use alternative C++ source files for determining C/C+
From: |
Hong Xu |
Subject: |
bug#37862: [PATCH] Use alternative C++ source files for determining C/C++ header files. |
Date: |
Sun, 27 Oct 2019 13:31:33 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
On 10/27/19 6:30 AM, Alan Mackenzie wrote:
Thanks for writing this proposal.
I think it would be better, given a foo.h, to find all files foo.*, and
test each one in turn for a match in auto-mode-alist. Searching this
alist is really not that slow, particularly as it is only being done a
few times, and not in a tight loop.
I agree with this approach, if it would not be too slow. Perhaps we can set a
limit on the number of files that match foo.*.
For this, we really want a function in the Emacs core which would find
the match in auto-mode-alist. Currently, this functionality is open
coded in set-auto-mode (in .../lisp/files.el).
I like the idea to create a separate function that provides this feature. Do
you mean it's somewhat buried in `set-auto-mode'? It's probably also useful in
other places.
However, I'm a bit sceptical about the use of this proposed facility.
Many projects (possibly most) have .c/.c++ files in a directory called
"src", and .h files in a separate directory called "include". This
proposed facility wouldn't work in such a set up. To extend it to cope
with separate "src"/"include" directories would make it messy.
This is true; but I think no guessing is perfect. At least the proposed
solution should help with some smaller projects.