summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar FrigoEU <simon.van.casteren@gmail.com>2019-08-03 10:46:18 +0200
committerGravatar FrigoEU <simon.van.casteren@gmail.com>2019-08-03 10:46:18 +0200
commit85287c07fff6682c6d3a935efc30aad623e69179 (patch)
treea17fb959f7e426204627da22a05466b7175c0083
parenta37678c2cf668b4837cdf5d147f4c2f26b2634e9 (diff)
Added emacs functions for getInfo
-rw-r--r--src/elisp/urweb-mode.el26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/elisp/urweb-mode.el b/src/elisp/urweb-mode.el
index 69b0e23c..1eb9a1eb 100644
--- a/src/elisp/urweb-mode.el
+++ b/src/elisp/urweb-mode.el
@@ -925,6 +925,32 @@ Optional argument STYLE is currently ignored."
(urweb-skip-siblings))
fullname)))
+(defun urweb-get-proj-dir (bfn)
+ (locate-dominating-file
+ bfn
+ (lambda (dir)
+ (some (lambda (f) (s-suffix? ".urp" f))
+ (if (f-dir? dir)
+ (directory-files dir)
+ (list '(dir)))))))
+
+(defun urweb-get-info ()
+ (interactive)
+ (let*
+ ((row (line-number-at-pos))
+ (col (evil-column))
+ (bfn (or (buffer-file-name)
+ "/Users/Simon/ur-proj/testje/a.ur"))
+ (proj-dir (urweb-get-proj-dir bfn))
+ (filename (file-relative-name bfn proj-dir))
+ (loc (concat filename ":" (number-to-string row) ":" (number-to-string col)))
+ )
+ (require 'popup)
+ (message (let
+ ((default-directory proj-dir))
+ (shell-command-to-string (concat "urweb -getInfo " loc)))))
+ )
+
(provide 'urweb-mode)
;;; urweb-mode.el ends here