From: Ningyu S. <shi...@gm...> - 2008-04-30 23:25:53
|
Hi Alan, The only two case kde-emacs-core.el handles different with 5.30 is 1. Between Case 5C.2 & Case 5C.3, a new case is added ;; CASE kde hack: ((and inclass-p c-access-key (looking-at c-access-key)) (c-add-syntax 'access-label (c-point 'bonl)) (c-add-class-syntax 'inclass inclass-p paren-state) ) which I have no idea of what it's doing... 2. In Case 5J change line 6279 (version 5.30) (c-safe (c-backward-sexp 1) t) to (c-safe (progn (c-backward-sexp 1) t)) (and (or (looking-at "slots:") (looking-at "Q_SLOTS:")) (c-backward-sexp 1)) which seems to add support for slots stuff. (I think this one is included in 5.31 somehow) On Wed, Apr 30, 2008 at 5:11 PM, Alan Mackenzie <ac...@mu...> wrote: > Hi, Ningyu! > > > On Tue, Apr 29, 2008 at 01:35:54PM -0500, Ningyu Shi wrote: > > On Tue, Apr 29, 2008 at 1:23 PM, Alan Mackenzie <ac...@mu...> wrote: > > > > > On Tue, Apr 22, 2008 at 11:36:23PM +0200, Alain Bertrand wrote: > > > > > > Almost two years ago, Andreas Pakulat filed a bug against kde-scripts > > > > because their use of cc-mode have c-narrow-out-enclosing-class was > > > > breaking things. > > > > (You can get the discussion there : > > > > <http://minilien.com/?8trohms1W5> ) > > > > Unfortunately this bug still exists and then, in the latest Ubuntu > > > > release, cc-mode is recent enough to encounter the problem. > > [ .... ] > > > > > What kde-emacs-core.el does, mostly, is to replace the function > > > `c-guess-basic-syntax' with one written by the author of > > > kde-emacs-core.el. This is the core function which analyses C (and > > > C++, Java, Objective C, Pike, IDL, and AWK) syntax, and is > > > fearsomely complicated. The syntax of C++ (and even of C) is > > > unbelievably difficult. `c-guess-basic-syntax' is coupled tightly > > > enough with other parts of CC Mode, that the versions in > > > kde-emacs-core almost certainly won't work with CC Mode 5.31 at > > > all. > > [ .... ] > > > > > Looking through kde-emacs-core.el, I would recommend removing the > > > bit which redefines `c-guess-basic-syntax'; in my 2-year-old copy > > > here, this extends from lines 174 to 3810. That should solve the > > > problem with the missing function. > > > I have done a diff of the c-guess-basic-syntax function in > > kde-emacs-core.el with that in cc-engine.el 5.30. Surprisingly there > > are only two notable changes (yes, don't be frightened by the big > > chunk, most of them are raw copy...), > > As master of c-guess-basic-syntax, I don't think I'm about to get scared > by a few little changes. ;-) > > > > less than 50 lines in all, which means if you want to get it right, > > you only need to port that two kde-specific case into 5.31 scheme. > > Hmm. "less than 50 lines". Lets just to be clear exactly who it is > that wants to get this right. ;-) There's enough work as it is in CC > Mode that I just can't realistically spare the time to investigate an > unofficial set of patches to a 6 year old version of a very large > function. Especially given the lack of documentation and test cases for > them. > > However, I'm happy to help other people sort out problems, but on the > basis that the aim is to remove c-guess-basic-syntax from > kde-emacs-core.el. If there are any problems in CC Mode 5.31.n which > that unofficial version solves, I really want to fix them in CC Mode > itself. > > Look at the history in the mailing list archives (on the web at > http://cc-mode.sf.net/, following the link to the mailing list, then a > further link to browse). In October 1993 (for example, a thread titled > "CC Mode 5.31" started by Jake Coleman on 2003-10-28), there was some > discussion of QT's "slots" and "signals", which have now been long > incorporated into CC Mode. Is this what kde-emacs-core.el was > originally for? I'm not sure about this, since I just started to hack kde... After looking at the 2003-thread, one of the issue noticed is the Q_OBJECT marco, or any kind of marco which has a semicolmn inside. So code like this, class MainWindow : public QWidget { Q_OBJECT public: // The constructor. MainWindow(QWidget *parent=0); } will be parsed in a wrong way. Here the 'public:' line will have a syntax of (topmost-intro-cont xxx) which is wrong. So it seems this is still a issue now. > > Note that these changes were first discussed long _after_ > kde-emacs-core.el was last changed, so it is likely that kde...el became > redundant at that point (at least, the c-guess-basic-syntax in it), but > nobody took the initiative to delete it. > > > > I think a person with enough elisp experience can fix it in one hour, > > though I'm not one of them > > Without any doc. or test cases, it would take a lot longer than an hour > to figure out what these patches do. My personal feeling is that > c-guess-basic-syntax in CC Mode 5.31.n is fully adequate for KDE. I'd > like you to test this, if you would, by switching off the redeclaration > of c-guess-basic-syntax in kde.....el. Here's a suggestion how to do > this. > > o - Go to the "(cond ..." form at line 180. > o - After "(cond", insert the line > > ((string-match "^5\\.31\\" c-version)) > > . That will mean nothing is to be done for versions 5.31+. Does > anything now not work? After entirely remove c-guess-basic-syntax from kde-emacs-core.el, It seems nothing is broken in any notable way. > > [ .... ] > > > > All in all, this kde-emacs-core.el is written in some bad way, and > > should and could be fixed long time ago. Maybe kde people just don't > > use it anymore. > > Somehow, I suspect a lot do. Unfortunately. > > [ .... ] > > > Ningyu > > -- > Alan Mackenzie (Nuremberg, Germany). > -- Ningyu |