               (throw 'done (file-name-nondirectory path))
             (setf path (directory-file-name (file-name-directory path)))))))))
 
-(defun ros-package-for-buffer (buffer)
+(defun ros-package-for-buffer (buffer &optional allow-nonexistent)
   (let ((fn (buffer-file-name buffer)))
     (when fn
-      (ros-package-for-path fn))))
+      (ros-package-for-path fn allow-nonexistent))))
 
 (defun get-buffer-ros-package ()
   (or ros-buffer-package

    (cache-ros-service-locations))
  (rosemacs-lookup-vectors m ros-services ros-service-packages))

(defun ros-package-for-path (path)
  (let ((path (cond ((file-directory-p path)
                     (directory-file-name path))
                    ((file-exists-p path)
                     (directory-file-name (file-name-directory path)))
                    (t nil))))
    (catch 'done

(define-key ros-keymap "H" 'remove-hz-update)
(define-key ros-keymap "T" 'ros-topic-info)
(define-key ros-keymap "g" 'ros-rgrep-package)
(define-key ros-keymap "\C-l" 'ros-launch)


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
