Blair Zajac <blair_at_orcaware.com> writes:
> I use emacs and always need to load the tools/dev/svn-dev.el by hand,
> which gets old and I forget at times. Is there a way to get that file
> loaded if you're in a svn checkout that is from svn.collabl.net, by
> parsing the .svn/entries?
>
> I'm not an emacs expert and also just switched from xemacs to emacs.
Well, is there ever a time when you wouldn't want to load it? I mean,
you could just load it on every Emacs startup, with
(load-file "/home/blair/CUSTOMIZE_THIS_PATH/subversion/tools/dev/svn-dev.el")
in your .emacs.
However, if there's some reason you need to only load it conditionally
in the way you described, then you could use this:
(defconst svn-dev-el-location
"/home/blair/CUSTOMIZE_THIS_PATH/subversion/tools/dev/svn-dev.el"
"*Initialize this to the location of your svn-dev.el file.")
(defun is-svn-source-file (&optional filename)
"Return non-nil if FILENAME (a path) comes from the Subversion
project repository at http://svn.collab.net/. If FILENAME is
omitted, use the file associated with the current buffer."
(or filename (setq filename (buffer-file-name)))
(let ((entries-file (concat (file-name-directory filename)
(file-name-as-directory ".svn")
"entries"))
found)
(save-excursion
(set-buffer (let (find-file-hook) (find-file-noselect entries-file)))
(if (search-forward "//svn.collab.net/repos/svn/" nil t)
(setq found t))
(kill-buffer nil))
found))
(defun svn-source-find-file-hook ()
"A hook for `find-file-hooks' that loads svn-dev.el when the file in
question is in the Subversion source tree. See `svn-dev-el-location'."
(if (is-svn-source-file)
(load-file svn-dev-el-location)))
(add-hook 'find-file-hook 'svn-source-find-file-hook)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-08-27 22:51:20 CEST