[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: project variable patch #2
From: |
Vagn Johansen |
Subject: |
Re: project variable patch #2 |
Date: |
Mon, 10 Sep 2007 20:07:16 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.1 (windows-nt) |
Tom Tromey <address@hidden> writes:
> Here's the next revision of patch that used to be "project.el".
> +(defun project-find-settings-file (file)
> + (while (and (not (string= dir "/"))
> + (not result))
> + (cond
> + ((setq result (assoc dir project-directory-alist))
> + ;; Nothing else.
> + nil)
> + ((file-exists-p (concat dir ".dir-settings.el"))
> + (setq result (concat dir ".dir-settings.el")))
> + (t
> + (setq dir (file-name-directory (directory-file-name dir))))))
> + result))
This can cause infinite loops on windows because the dir variable will
end up as c:/ and the setq dir at the bottom will set it to c:/ again.
> +(defun project-filter-risky-variables (alist)
> + (setcdr sub-alist
> + (project-filter-risky-variables (cdr sub-alist)))
> + ;; Remove unsafe variables by setting their cars to nil.
> + (dolist (sub-elt sub-alist)
> + (unless (safe-local-variable-p (car sub-elt) (cdr sub-elt))
> + (setcar sub-elt nil)))
> + ;; Now remove all the deleted risky variables.
> + (setcdr elt (assq-delete-all nil sub-alist)))))
> + alist)
> +
This can silently ignore settings. Take a look at
hack-local-variables-confirm in files.el to see how this is handled
for Local Variables.
--
Vagn Johansen