changeset 437:b460b464f9d2

textmate.el: set default-directory instead of adding a 'cd' command This fixes textmate.el with TRAMP.
author Augie Fackler <raf@durin42.com>
date Tue, 29 Nov 2016 14:21:31 -0500
parents 97f12f43f73b
children 13c11127a79e
files .elisp/textmate.el
diffstat 1 files changed, 21 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/.elisp/textmate.el
+++ b/.elisp/textmate.el
@@ -290,8 +290,8 @@ project root directory before starting t
   (let ((root (textmate-project-root)))
     (when (null root)
       (error "Not in a project area."))
-    (let ((realcommand (concat "cd " root " ; " command)))
-      (compilation-start realcommand mode name-function highlight-regexp))))
+      (let ((default-directory root))
+      (compilation-start command mode name-function highlight-regexp))))
 
 (defun textmate-compile ()
   "Run a command in compilation-mode rooted at the project root."
@@ -387,28 +387,30 @@ specific type of file."
 
 (defun textmate-project-files (root)
   "Finds all files in a given project using either hg, git, or find."
-  (let ((type (textmate-project-root-type root)))
+  (let ((type (textmate-project-root-type root))
+        (default-directory root))
     (cond ((string= type "git") (split-string
-                           (shell-command-to-string
-                            (concat "cd " root " && git ls-files")) "\n" t))
-          ((string= type "hg") (split-string
-                          (shell-command-to-string
-                           (concat "cd " root " && hg locate 'set:added() or modified() or clean()'")) "\n" t))
+                                 (shell-command-to-string
+                                  "git ls-files") "\n" t))
+          ((string= type "hg")
+           (split-string
+            (shell-command-to-string
+             "hg locate 'set:not(ignored() or removed() or unknown())'")
+            "\n" t))
           ((string= type "unknown") (textmate-cached-project-files-find root))
   )))
 
 (defun textmate-project-files-find (root)
   "Finds all files in a given project using find."
-  (split-string
-    (shell-command-to-string
-     (concat
-      "find "
-      root
-      " -type f  | grep -vE '"
-      *textmate-gf-exclude*
-      "' | sed 's:"
-      *textmate-project-root*
-      "/::'")) "\n" t))
+  (let ((default-directory root))
+    (split-string
+     (shell-command-to-string
+      (concat
+       "find . -type f  | grep -vE '"
+       *textmate-gf-exclude*
+       "' | sed 's:"
+       *textmate-project-root*
+       "/::'")) "\n" t)))
 
 (defun textmate-cached-project-files-find (&optional root)
   "Finds and caches all files in a given project using find."
@@ -447,7 +449,7 @@ specific type of file."
   (when (null root) (setq root default-directory))
   (cond
    ((root-matches root *textmate-project-roots*)
-                (expand-file-name root))
+    (expand-file-name root))
    ((equal (expand-file-name root) "/") nil)
    (t (textmate-find-project-root (concat (file-name-as-directory root) "..")))))