[emacs] No web lsps and add bash aliases to eshell

This commit is contained in:
2024-08-09 10:13:31 -03:00
parent e7a8071ef5
commit 98796b74e2
3 changed files with 20 additions and 2 deletions

View File

@ -112,3 +112,21 @@
;; Or globally
(with-eval-after-load 'org (global-org-modern-mode))
(require 'cl-lib)
(defun eshell-load-bash-aliases ()
"Read Bash aliases and add them to the list of eshell aliases."
;; Bash needs to be run - temporarily - interactively
;; in order to get the list of aliases.
(with-temp-buffer
(call-process "bash" nil '(t nil) nil "-ci" "alias")
(goto-char (point-min))
(cl-letf (((symbol-function 'eshell-write-aliases-list) #'ignore))
(while (re-search-forward "alias \\(.+\\)='\\(.+\\)'$" nil t)
(eshell/alias (match-string 1) (match-string 2))))
(eshell-write-aliases-list)))
;; We only want Bash aliases to be loaded when Eshell loads its own aliases,
;; rather than every time `eshell-mode' is enabled.
(add-hook 'eshell-alias-load-hook 'eshell-load-bash-aliases)