New user self-registration is disabled due to spam. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!
Bug 1208 - Mode cooking
Summary: Mode cooking
Status: DECISIONNEEDED
Alias: None
Product: Eigen
Classification: Unclassified
Component: Core - general (show other bugs)
Version: unspecified
Hardware: All Linux
: Low Feature Request
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-19 16:04 UTC by Andrea Nicastro
Modified: 2016-04-24 21:36 UTC (History)
3 users (show)



Attachments

Description Andrea Nicastro 2016-04-19 16:04:12 UTC
To whom it may concern,
As an emacs user I have been dealing with the configuration of Semantic to achieve a more agile development. However, the fact that Eigen includes do not have a .h extension makes more difficult to have Emacs parse the library.
Apparently is common practice to add a mode cookie at the beginning of the header file (e.g. the string  "-*- C++ -*-" hints emacs to toggle the c++ mode). It is possible also to define local variable at the end of the header file to be used by parsers in general. For example 
  // Local Variables:
  // mode: c++
  // End:

is there a reason why this useful feature is not present in your headers?
Thank you very much
Andrea Nicastro
Comment 1 Christoph Hertzberg 2016-04-19 17:00:33 UTC
Is this common practice outside the emacs universe, as well?
I would not entirely object adding some hint to our files but this seems to be very editor specific (and very likely other editors/IDEs want other things, which eventually would make maintaining this a mess).
So generally, I would prefer if there was a local workaround (like telling your emacs that certain files should always be opened as C++).
If someone finds one, it would be nice to add it to our wiki:
http://eigen.tuxfamily.org/index.php?title=FAQ#Eigen_and_IDEs
http://eigen.tuxfamily.org/index.php?title=IDEs
Comment 2 Andrea Nicastro 2016-04-21 12:38:34 UTC
hi seems to be mainly an emacs thing. However, also GNU Global has problems parsing the headers without extensions.
On the emacs side I was able to force the c++ mode on eigen's headers using the following code in my init.el

  (add-to-list 'auto-mode-alist '("/eigen/Eigen/"  . c++-mode) t)

Now semantic parses the header, however I believe that Global does not create the tags.
Comment 3 Gael Guennebaud 2016-04-24 21:36:07 UTC
I'm also rather reluctant about adding such hints, though some of our headers already has some hints for vim:

/* vim: set filetype=cpp et sw=2 ts=2 ai: */

A quick search tells me that many editors have plugins to be compatible with emacs and/or vim modelines, so after all, why not...

Note You need to log in before you can comment on or make changes to this bug.