# HG changeset patch # User Chong Yidong # Date 1226589468 0 # Node ID bdd322f177a668ae990727587dce4eb2f26ac2d0 # Parent 0c311ab3d969f25574be4ae15804588ca7cdfd6e (project-settings-file): New variable. (project-find-settings-file): Use it, instead of hardcoding .dir.settings.el. diff -r 0c311ab3d969 -r bdd322f177a6 lisp/files.el --- a/lisp/files.el Thu Nov 13 15:17:28 2008 +0000 +++ b/lisp/files.el Thu Nov 13 15:17:48 2008 +0000 @@ -3202,6 +3202,13 @@ (setcdr elt list) (push (cons class list) project-class-alist)))) +(defcustom project-settings-file ".dir-settings.el" + "Settings file for per-project settings. Set this to nil if you dont want to load project-specific settings." + :type '(choice + (const :tag "Ignore" nil) + (file :tag "File")) +:group 'files) + (defun project-find-settings-file (file) "Find the settings file for FILE. This searches upward in the directory tree. @@ -3209,21 +3216,22 @@ If the file is in a registered project, a cons from `project-directory-alist' is returned. Otherwise this returns nil." - (setq file (expand-file-name file)) - (let* ((settings (locate-dominating-file file ".dir-settings.el")) - (pda nil)) - ;; `locate-dominating-file' may have abbreviated the name. - (if settings (setq settings (expand-file-name ".dir-settings.el" settings))) - (dolist (x project-directory-alist) - (when (and (eq t (compare-strings file nil (length (car x)) - (car x) nil nil)) - (> (length (car x)) (length (car pda)))) - (setq pda x))) - (if (and settings pda) - (if (> (length (file-name-directory settings)) - (length (car pda))) - settings pda) - (or settings pda)))) + (when project-settings-file + (setq file (expand-file-name file)) + (let* ((settings (locate-dominating-file file project-settings-file)) + (pda nil)) + ;; `locate-dominating-file' may have abbreviated the name. + (if settings (setq settings (expand-file-name ".dir-settings.el" settings))) + (dolist (x project-directory-alist) + (when (and (eq t (compare-strings file nil (length (car x)) + (car x) nil nil)) + (> (length (car x)) (length (car pda)))) + (setq pda x))) + (if (and settings pda) + (if (> (length (file-name-directory settings)) + (length (car pda))) + settings pda) + (or settings pda))))) (defun project-define-from-project-file (settings-file) "Load a settings file and register a new project class and instance.