summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorblais <blais@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2007-01-11 14:28:06 +0000
committerblais <blais@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2007-01-11 14:28:06 +0000
commit8455621b5632273af46c19a4b3b73180e86f2234 (patch)
tree048fbebbcfd70a693a4a71a7694ca1c4096ab7ac /tools
parentb3eead229ef361bc04539fdb8ff0040e19d26f2b (diff)
downloaddocutils-8455621b5632273af46c19a4b3b73180e86f2234.tar.gz
rst.el: change to accomodate tramp.el
See email below. n 1/11/07, Hans Halvorson <hhalvors@princeton.edu> wrote: > I have been talking with the maintainers of Tramp (remote file editing > over ssh for Emacs) about how to get rst-compile (in rst.el) to work > with Tramp's remote compilation capabilities. The results of this > discussion are pasted in below. Might rst.el be modified to make it > compatible with Tramp? > > Thanks, > Hans Halvorson > > [From Michael Albinus:] > > > [From Hans Halvorson:] > > > > I have pasted in below the definition of the "rst-compile" in rst.el. > > > The problem is with the call to "rst-compile-find-conf" in the first > > > let clause. This function tries to search for a file called > > > "docutils.conf" in all directories above the directory of the current > > > buffer. I do not know if that function is strictly incompatible with > > > Tramp, or whether it just takes a very long time to search on some > > > remote hosts. But I have waited for up to two minutes after calling > > > rst-compile before pressing C-g to cancel. > > > I've modified the code slightly: > > > (let ((file-name "docutils.conf") > > (buffer-file "/ssh:localhost:~/.emacs")) > > ;; Move up in the dir hierarchy till we find a change log file. > > (let ((dir (file-name-directory buffer-file))) > > (while (and (or (not (string= "/" dir)) (setq dir nil) nil) > > (not (file-exists-p (concat dir file-name)))) > > (message dir) > > ;; Move up to the parent dir and try again. > > (setq dir (expand-file-name (file-name-directory > > (directory-file-name > > (file-name-directory dir))))) ) > > (or (and dir (concat dir file-name)) nil) > > )) > > > If you evaluate the code, you'll see something like this in *Messages*: > > > Mark set > > /ssh:albinus@localhost:~/ > > /ssh:albinus@localhost:/home/albinus/ > > /ssh:albinus@localhost:/home/ > > /ssh:albinus@localhost:/ [340 times] > > Quit > > > The point is that the iteration goes via upper directories, and an > > upper directory is computed as > > > (file-name-directory > > (directory-file-name > > (file-name-directory dir))) > > > That is correct, but for "/ssh:albinus@localhost:/" the upper directory > > is "/ssh:albinus@localhost:/" again. The stop condition (string= "/" dir) > > does not match in case of remote files. > > > I fear, Tramp cannot solve the problem; rst.el must take remote files > > into account. Yes. > [From Kai Grossjohann] > > > rst.el could stop when X and (directory-file-name (file-name-directory > > (directory-file-name X))) are equal. That would work whether the > > "root" directory is "/" or "C:/" (say) or "/ssh:foo:/". > > > What do people think? I think Kai is a genius, as always. Yes. I've made the change, see path below, can you test with tramp? thx git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4879 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'tools')
-rw-r--r--tools/editors/emacs/rst.el15
1 files changed, 10 insertions, 5 deletions
diff --git a/tools/editors/emacs/rst.el b/tools/editors/emacs/rst.el
index f80cf965e..22144c0b1 100644
--- a/tools/editors/emacs/rst.el
+++ b/tools/editors/emacs/rst.el
@@ -2310,7 +2310,7 @@ of each paragraph only."
(previous nil valid)
- (curcol (current-column)
+ (curcol (current-column)
(current-column))
(valid (and (= curcol leftcol)
@@ -2323,7 +2323,7 @@ of each paragraph only."
(if (if ,first-only
(and valid (not previous))
valid)
- ,body-consequent
+ ,body-consequent
,body-alternative)
))))
@@ -3203,13 +3203,18 @@ string)) to be used for converting the document.")
(let ((file-name "docutils.conf")
(buffer-file (buffer-file-name)))
;; Move up in the dir hierarchy till we find a change log file.
- (let ((dir (file-name-directory buffer-file)))
- (while (and (or (not (string= "/" dir)) (setq dir nil) nil)
+ (let* ((dir (file-name-directory buffer-file))
+ (prevdir nil))
+ (while (and (or (not (string= dir prevdir))
+ (setq dir nil)
+ nil)
(not (file-exists-p (concat dir file-name))))
;; Move up to the parent dir and try again.
+ (setq prevdir dir)
(setq dir (expand-file-name (file-name-directory
(directory-file-name
- (file-name-directory dir))))) )
+ (file-name-directory dir)))))
+ )
(or (and dir (concat dir file-name)) nil)
)))