[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdesdk/scripts/kde-emacs
From:       David Faure <faure () kde ! org>
Date:       2004-03-23 18:54:14
Message-ID: 20040323185414.5AADA9936 () office ! kde ! org
[Download RAW message or body]

CVS commit by faure: 

Improvements in kdab-insert-forward-decl: find first "class Foo;" instead
of last one, since the last one could be "class Private;" inside a class decl.

Also added code to go out of namespace Bar { class Bleh; } before inserting
"class Foo;"


  M +15 -6     klaralv.el   1.18


--- kdesdk/scripts/kde-emacs/klaralv.el  #1.17:1.18
@@ -368,11 +368,20 @@
             (progn
                                         ; No forward decl existed
-              (goto-char (point-max)) ; Using end-of-buffer makes point move, \
                despite save-excursion
-              (if (re-search-backward "^[ \t]*class .*;" nil t)
-                  (progn (end-of-line) (forward-char 1))
+                                        ; Look for other forward declarations and \
insert this one before them +                                        ; (this avoids \
finding class Private; inside a class, or other stuff in the middle of the file) +    \
(if (re-search-forward "^[ \t]*class .*;" nil t) +                  (progn
+                                        ; Exit namespace foo { class bar; } if \
necessary +                                        ; This is a modified version of \
(backward-up-list) which doesn't +                                        ; throw an \
error when not found. +                    (goto-char (or (scan-lists (point) -1 1 \
nil t) (point))) ; ### do multiple times if necessary +                    \
(re-search-backward "^[ \t]*namespace " nil t) ; in case of namespace foo\n{ +        \
                (beginning-of-line))
                                         ; No forward declarations found, lets search \
                for include lines.
-                (if (re-search-backward "#include" nil t)
-                    (progn (end-of-line) (forward-char 1))
-                  (beginning-of-buffer)))
+                                        ; For those we start from the end, because \
we want to leave file.h first. +                (progn (goto-char (point-max))
+                       (if (re-search-backward "#include" nil t)
+                           (progn (end-of-line) (forward-char 1))
+                         (beginning-of-buffer))))
               
               (progn


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic