Updates, loads of updates!

This commit is contained in:
2025-06-03 00:34:19 +01:00
parent a60e03f797
commit 4cabfc0c8f
9 changed files with 169 additions and 145 deletions

View File

@@ -41,14 +41,23 @@
"Change to directory `project-root'"
(if (project-current)
(eshell/cd (list (project-root (project-current))))
(setq eshell-last-command-status 1)
(eshell/echo
(format "[%s]: No project in current directory"
(propertize "Error" 'font-lock-face '(:foreground "red"))))))
(defun eshell/sudo-switch (&rest args)
"Switch to a tramp connection sudo in the current directory"
(let ((wrapped-dir (concat "/sudo::" default-directory)))
(eshell/cd wrapped-dir)))
"Switch to and from administrative (sudo) mode in Eshell.
Uses tramp to figure out if we're in sudo mode or not. "
(let ((user (file-remote-p default-directory 'user)))
(cond
((null user)
(let ((wrapped-dir (concat "/sudo::" default-directory)))
(eshell/cd wrapped-dir)))
((string= user "root")
(thread-last 'localname
(file-remote-p default-directory)
eshell/cd)))))
;; Additional functions
(defun +eshell/at-cwd (&optional arg)