summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2008-11-13 15:17:48 +0000
committerChong Yidong <cyd@stupidchicken.com>2008-11-13 15:17:48 +0000
commitffe89e7639f95036e1e92f27381451f0174114b1 (patch)
tree3bc8a0d03beeaba96a018c4606b672b473351488 /lisp/files.el
parentf30efa7cf0109371193d7862acc4cc811d212ec5 (diff)
downloademacs-ffe89e7639f95036e1e92f27381451f0174114b1.tar.gz
(project-settings-file): New variable.
(project-find-settings-file): Use it, instead of hardcoding .dir.settings.el.
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el38
1 files changed, 23 insertions, 15 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 84a919befa5..1216dff3cef 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3202,6 +3202,13 @@ LIST. The list is processed in order.
(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 a settings file is found, the file name is returned.
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.