branch: externals/dape
commit 2255db9b5375b9bbdb6d78c637a3882b72b9c0f6
Author: Daniel Pettersson <dan...@dpettersson.net>
Commit: Daniel Pettersson <dan...@dpettersson.net>

    Clarify usage of `dape--guess-root'
---
 dape.el | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/dape.el b/dape.el
index d70ba8ef99..329084a439 100644
--- a/dape.el
+++ b/dape.el
@@ -821,18 +821,11 @@ Note requires `dape--source-ensure' if source is by 
reference."
    (file-relative-name (buffer-file-name) (dape-command-cwd))))
 
 (defun dape--guess-root (config)
-  "Guess adapter path root from CONFIG."
-  ;; FIXME We need some property on the adapter telling us how it
-  ;;       decided on root
-  ;; FIXME Is this function meant to return root emacs world (with tramp)
-  ;;       or adapter world w/o tramp?
-  (let ((cwd (plist-get config :cwd))
-        (command-cwd (plist-get config 'command-cwd)))
-    (cond
-     ((and cwd (stringp cwd) (file-name-absolute-p cwd))
-      cwd)
-     ((stringp command-cwd) command-cwd)
-     (t default-directory))))
+  "Return best guess root path from CONFIG."
+  (if-let* ((command-cwd (plist-get config 'command-cwd))
+            ((stringp command-cwd)))
+      command-cwd
+    (dape-command-cwd)))
 
 (defun dape-config-autoport (config)
   "Replace :autoport in CONFIG keys `command-args' and `port'.

Reply via email to