[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

files.el: Patch to make project-settings optional/customizable

From: T.V. Raman
Subject: files.el: Patch to make project-settings optional/customizable
Date: Thu, 13 Nov 2008 07:29:55 -0700

Introduces a defcustom for project-settings-file -- rather than
hard-coding the name,
and if set to nil, arranges for function
project-find-settings-file to do nothing.

Index: files.el
RCS file: /sources/emacs/emacs/lisp/files.el,v
retrieving revision 1.1007
diff -u -r1.1007 files.el
--- files.el    30 Oct 2008 04:32:22 -0000      1.1007
+++ files.el    13 Nov 2008 04:53:05 -0000
@@ -3201,6 +3201,12 @@
     (if elt
        (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.
@@ -3209,8 +3215,9 @@
 If the file is in a registered project, a cons from
 `project-directory-alist' is returned.
 Otherwise this returns nil."
+  (when project-settings-file
   (setq file (expand-file-name file))
-  (let* ((settings (locate-dominating-file file ".dir-settings.el"))
+  (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"
@@ -3223,7 +3230,7 @@
         (if (> (length (file-name-directory settings))
                (length (car pda)))
             settings pda)
-      (or 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.

Best Regards,

Email:  address@hidden
WWW:    http://emacspeak.sf.net/raman/
AIM:    emacspeak       GTalk: address@hidden
PGP:    http://emacspeak.sf.net/raman/raman-almaden.asc
Google: tv+raman
IRC:    irc://irc.freenode.net/#emacs

reply via email to

[Prev in Thread] Current Thread [Next in Thread]