     (if (file-exists-p file)
 	(file-name-as-directory dir)
       (let ((parent (parent-directory dir)))
-	(if (endp parent)
+	(if (eq nil parent)
 	    'nil
 	  (mymake-find-config parent))))))
 


(defun mymake-load-config ()
  "Returns an alist with configuration + current directory as 'dir'"
  (let* ((buffer-dir (if (endp (buffer-file-name))
			 default-directory
		       (parent-directory (buffer-file-name))))
	 (dir (mymake-find-config buffer-dir)))
    (if (endp dir)
	;; No config file, we probably want to add the buffer file name as well.
	(list
	 (cons 'dir buffer-dir)
	 (cons 'cmdline
	       (if (or mymake-no-default-input (endp (buffer-file-name)))
		   ""
		 (concat "--default-input " (file-name-nondirectory (buffer-file-name))))))
      (cons

;; Get parent directory or nil if none.
(defun parent-directory (dir)
  (let ((r (file-name-directory (directory-file-name dir))))
    (cond ((eq nil r) 'nil)
	  ((< (length r) (length dir)) r)
	  (t 'nil))))

