From 5655c5834131866f55758b509531f403c342486e Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Mon, 14 Jul 2025 17:27:29 +0200 Subject: [PATCH] Remove obsolete shell and ansi-term popup shortcuts Using `project-shell` as a replacement for the shell buffer. I haven't used `ansi-term` in ages, mostly because it does not work on Windows. --- init.el | 2 -- site-lisp/db-utils.el | 47 ------------------------------------------- 2 files changed, 49 deletions(-) diff --git a/init.el b/init.el index 07c0cf4..d1e0490 100644 --- a/init.el +++ b/init.el @@ -458,14 +458,12 @@ split horizontally again, but this extra work should not matter much." (use-package db-utils :commands (endless/fill-or-unfill - db/run-or-hide-shell db/gnus db/org-agenda db/scratch db/find-user-init-file db/find-default-org-file db/find-default-refile-file - db/run-or-hide-ansi-term db/ement-connect db/hex-to-ascii db/text-to-hex diff --git a/site-lisp/db-utils.el b/site-lisp/db-utils.el index a100a50..7b5b785 100644 --- a/site-lisp/db-utils.el +++ b/site-lisp/db-utils.el @@ -38,17 +38,6 @@ ;;; Application Shortcuts -(defun db/run-or-hide-ansi-term () - "Find *ansi-term* buffer or run `ansi-term' with `explicit-shell-file-name'. - -If already in *ansi-term* buffer, bury it." - (interactive) - (if (string= "term-mode" major-mode) - (bury-buffer) - (if (get-buffer "*ansi-term*") - (switch-to-buffer "*ansi-term*") - (ansi-term explicit-shell-file-name)))) - (defun db/gnus () "Switch to the `*Group*' buffer, starting `gnus' if not existent." (interactive) @@ -90,42 +79,6 @@ If already in *ansi-term* buffer, bury it." (user-error "Cannot open default refile file: file «%s» does not exist" db/org-default-refile-file)) (find-file db/org-default-refile-file)) -(defun db/run-or-hide-shell (arg) - "Opens a shell buffer in new window if not already in one. - -Otherwise, closes the current shell window. - -The buffer's name has to start with “*shell-side*” to be recognized by -this function. Otherwise the current buffer is not treated as a shell -buffer. - -With ARG, switch to `default-directory' of the current buffer first." - (interactive "P") - (cl-flet ((change-to-shell () - (if-let ((shell-window (cl-find-if (lambda (window) - (with-current-buffer (window-buffer window) - (and (derived-mode-p 'shell-mode) - (string-match-p "^\\*shell-side\\*" (buffer-name))))) - (window-list-1)))) - (select-window shell-window) - (--if-let (display-buffer (shell (get-buffer-create "*shell-side*"))) - (select-window it) - (error "Could not start shell (`display-buffer' returned nil)"))))) - (if (not arg) - ;; toggle shell window - (if (and (derived-mode-p 'shell-mode) - (string-match-p "^\\*shell-side\\*" (buffer-name))) - (bury-buffer) - (change-to-shell)) - - ;; unconditionally go to shell, and also change to cwd - (let ((current-dir (expand-file-name default-directory))) - (change-to-shell) - (end-of-line) - (comint-kill-input) - (insert (format "cd '%s'" current-dir)) - (comint-send-input))))) - (defun db/ement-connect () "Connect to my matrix account." (interactive)