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

List:       kde-commits
Subject:    KDE/kdesdk/scripts/kde-emacs
From:       David Faure <faure () kde ! org>
Date:       2005-06-06 11:26:25
Message-ID: 1118057185.268149.17143.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 422746 by dfaure:

kde-switch-cpp-h: stop at the first file found, e.g. test.h instead of
continuing the loop and finding test.H too (happens with a NFS directory from e.g. a Mac,
which is case insensitive and finds both test.h and test.H for the same file).

Didn't find how to break out of a dolist (without using throw/catch), so I
used a more manual "iterator" and a while loop.


 M  +10 -5     kde-emacs-general.el  
 M  +1 -0      kde-emacs-utils.el  


--- trunk/KDE/kdesdk/scripts/kde-emacs/kde-emacs-general.el #422745:422746
@@ -48,11 +48,13 @@
 	 (nname (file-name-sans-extension name))
 	 (ext (file-name-extension name))
 	 (path nil)
-	 (ret nil))
+	 (ret nil)
+	 (listit nil))
     (cond
      ((member ext kde-header-files)
-      (dolist (elt kde-source-files nil)
-	(setq path (concat nname "." elt))
+      (setq listit kde-source-files)
+      (while (and listit (not ret)) ; loop over the list but stop once ret is set
+	(setq path (concat nname "." (car listit)))
 	(if (file-readable-p path)
 	    (setq ret (cons path t))
 	); else
@@ -61,6 +63,7 @@
 	(if path
 	    (setq ret (cons path t))
 	  )
+	(setq listit (cdr listit)) ; ++listit
 	)
       ; not found, will create one
       (if (not ret)
@@ -68,8 +71,9 @@
 	))
 
      ((member ext kde-source-files)
-      (dolist (elt kde-header-files nil)
-	(setq path (concat nname "." elt))
+      (setq listit kde-header-files)
+      (while (and listit (not ret)) ; loop over the list but stop once ret is set
+	(setq path (concat nname "." (car listit)))
         ; look in current dir
 	(if (file-readable-p path)
 	    (setq ret (cons path t))
@@ -79,6 +83,7 @@
 	(if path
 	    (setq ret (cons path t))
 	  )
+	(setq listit (cdr listit)) ; ++listit
 	)
       ; not found, will create one
       (if (not ret)
--- trunk/KDE/kdesdk/scripts/kde-emacs/kde-emacs-utils.el #422745:422746
@@ -194,6 +194,7 @@
 
 ;; Switch between the declaration of a class member in .cc/.cpp/.C, and its definition in the .h file
 ;; Written by David and Reggie after much hair tearing
+;; Found since, might be worth looking at: http://www.hendawi.com/emacs/sourcepair.el
 (defun switch-to-function-def ()
   (interactive)
   (let ((n (buffer-file-name))
[prev in list] [next in list] [prev in thread] [next in thread] 

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