A majority of emacs users are absolute die-hard fans of org mode, and wouldn’t be able to live without it. And it makes sense too, it’s a tool that you can use in whatever workflow you prefer, which is really powerful. However as a relatively new emacs users (only 2 years!), I couldn’t really get org mode. I never felt satisfied when using it, as for me it seemed like an old technology, especially for a person who’s used to the web apps, which have a totally different UI .
One of my Emacs’ favourite features is Eshell. However recently I wanted to create a function, that automatically toggles eshell, like vscode, and gives priority to the project root (if in project). This little code snippet does exactly that:
(defun binary-eshell/toggle-eshell () (interactive) (let ((eshell-buffer-name (binary-eshell/eshell-buffer-name))) (if (binary-eshell/eshell-toggled-p) (delete-windows-on eshell-buffer-name) (progn (split-window-below) (if (project-current) (let ((default-directory (project-root (project-current)))) (eshell))) (eshell))))) (defun binary-eshell/eshell-toggled-p () "Checks if eshell is toggled." (let ((eshell-buffer-name (binary-eshell/eshell-buffer-name)) (result)) (dolist (element (window-list) result) (if (string= eshell-buffer-name (buffer-name (window-buffer element))) (setq result t))) result)) (defun binary-eshell/eshell-buffer-name () "Returns the name of the eshell buffer.