From 9afa1dacf88115adb5153486681745024eecfa95 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 26 Aug 2023 16:22:08 +0300 Subject: chore(tazjin/emacs): remove a bunch of unused code Change-Id: Ife854e83ef97f1e9a26072f2ab2a3b23f5d64840 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9154 Reviewed-by: tazjin Autosubmit: tazjin Tested-by: BuildkiteCI --- users/tazjin/emacs/config/bindings.el | 6 +--- users/tazjin/emacs/config/functions.el | 64 ---------------------------------- users/tazjin/emacs/config/init.el | 36 ++----------------- users/tazjin/emacs/config/modes.el | 4 +-- users/tazjin/emacs/default.nix | 1 - 5 files changed, 5 insertions(+), 106 deletions(-) (limited to 'users') diff --git a/users/tazjin/emacs/config/bindings.el b/users/tazjin/emacs/config/bindings.el index fc33cd1840cf..100fb92223d3 100644 --- a/users/tazjin/emacs/config/bindings.el +++ b/users/tazjin/emacs/config/bindings.el @@ -18,7 +18,6 @@ ;; Start eshell or switch to it if it's active. (global-set-key (kbd "C-x m") 'eshell) -(global-set-key (kbd "C-x C-p") 'browse-repositories) (global-set-key (kbd "M-g M-g") 'goto-line-with-feedback) ;; Miscellaneous editing commands @@ -26,7 +25,7 @@ (global-set-key (kbd "C-c a") 'align-regexp) (global-set-key (kbd "C-c m") 'mc/mark-dwim) -;; Browse URLs (very useful for Gitlab's SSH output!) +;; Browse URLs (very useful for Gerrit's push output, etc!) (global-set-key (kbd "C-c b p") 'browse-url-at-point) (global-set-key (kbd "C-c b b") 'browse-url) @@ -46,9 +45,6 @@ ;; Insert TODO comments (global-set-key (kbd "C-c t") 'insert-todo-comment) -;; Make sharing music easier -(global-set-key (kbd "s-s w") #'songwhip-lookup-url) - ;; Open the depot (global-set-key (kbd "s-s d") #'tvl-depot-status) diff --git a/users/tazjin/emacs/config/functions.el b/users/tazjin/emacs/config/functions.el index 08c4179ba27b..ddb67f1bfd29 100644 --- a/users/tazjin/emacs/config/functions.el +++ b/users/tazjin/emacs/config/functions.el @@ -2,10 +2,6 @@ (require 'dash) (require 'map) -(defun load-file-if-exists (filename) - (if (file-exists-p filename) - (load filename))) - (defun goto-line-with-feedback () "Show line numbers temporarily, while prompting for the line number input" (interactive) @@ -30,11 +26,6 @@ (find-file (concat "/sudo:root@localhost:" (read-file-name "File: "))) (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name)))) -;; Open the NixOS man page -(defun nixos-man () - (interactive) - (man "configuration.nix")) - ;; Get the nix store path for a given derivation. ;; If the derivation has not been built before, this will trigger a build. (defun nix-store-path (derivation) @@ -126,13 +117,6 @@ the GPG agent correctly." (run-at-time (password-store-timeout) nil 'password-store-clear)))) -(defun browse-repositories () - "Select a git repository and open its associated magit buffer." - - (interactive) - (magit-status - (completing-read "Repository: " (magit-list-repos)))) - (defun bottom-right-window-p () "Determines whether the last (i.e. bottom-right) window of the active frame is showing the buffer in which this function is @@ -180,27 +164,6 @@ the GPG agent correctly." mc/mark-more-hydra/mmlte--up mc/mark-more-hydra/nil)) -(defun memespace-region () - "Make a meme out of it." - - (interactive) - (let* ((start (region-beginning)) - (end (region-end)) - (memed - (message - (s-trim-right - (apply #'string - (-flatten - (nreverse - (-reduce-from (lambda (acc x) - (cons (cons x (-repeat (+ 1 (length acc)) 32)) acc)) - '() - (string-to-list (buffer-substring-no-properties start end)))))))))) - - (save-excursion (delete-region start end) - (goto-char start) - (insert memed)))) - (defun insert-todo-comment (prefix todo) "Insert a comment at point with something for me to do." @@ -318,33 +281,6 @@ by looking for a `Cargo.toml' file." (magit-read-file-from-rev "HEAD" "Find file") #'pop-to-buffer-same-window)) -(defun songwhip--handle-result (status &optional cbargs) - ;; TODO(tazjin): Inspect status, which looks different in practice - ;; than the manual claims. - (if-let* ((response (json-parse-string - (buffer-substring url-http-end-of-headers (point-max)))) - (sw-path (ht-get* response "data" "path")) - (link (format "https://songwhip.com/%s" sw-path)) - (select-enable-clipboard t)) - (progn - (kill-new link) - (message "Copied Songwhip link (%s)" link)) - (warn "Something went wrong while retrieving Songwhip link!") - ;; For debug purposes, the buffer is persisted in this case. - (setq songwhip--debug-buffer (current-buffer)))) - -(defun songwhip-lookup-url (url) - "Look up URL on Songwhip and copy the resulting link to the clipboard." - (interactive "sEnter source URL: ") - (let ((songwhip-url "https://songwhip.com/api/") - (url-request-method "POST") - (url-request-extra-headers '(("Content-Type" . "application/json"))) - (url-request-data - (json-serialize `((country . "GB") - (url . ,url))))) - (url-retrieve "https://songwhip.com/api/" #'songwhip--handle-result nil t t) - (message "Requesting Songwhip URL ... please hold the line."))) - (defun rg-in-project (&optional prefix) "Interactively call ripgrep in the current project, or fall back to ripgrep default behaviour if prefix is set." diff --git a/users/tazjin/emacs/config/init.el b/users/tazjin/emacs/config/init.el index ab39095ac140..b16635df86af 100644 --- a/users/tazjin/emacs/config/init.el +++ b/users/tazjin/emacs/config/init.el @@ -10,23 +10,9 @@ (require 'use-package) (require 'seq) -;; TODO(tazjin): Figure out what's up with vc. -;; -;; Leaving vc enabled breaks all find-file operations with messages -;; about .git folders being absent, but in random places. -(require 'vc) -(setq vc-handled-backends nil) - (package-initialize) ;; Initialise all packages installed via Nix. -;; -;; TODO: Generate this section in Nix for all packages that do not -;; require special configuration. - -;; -;; Packages providing generic functionality. -;; (use-package ace-window :bind (("C-x o" . ace-window)) @@ -59,20 +45,6 @@ (eglot-autoshutdown t) (eglot-send-changes-idle-time 0.3)) -(use-package elfeed - :config - (setq elfeed-feeds - '("https://lobste.rs/rss" - "https://www.anti-spiegel.ru/feed/" - "https://www.reddit.com/r/lockdownskepticism/.rss" - "https://www.reddit.com/r/rust/.rss" - "https://news.ycombinator.com/rss" - ("https://xkcd.com/atom.xml" media) - - ;; vlogcreations - ("https://www.youtube.com/feeds/videos.xml?channel_id=UCR0VLWitB2xM4q7tjkoJUPw" media) - ))) - (use-package ht) (use-package hydra) @@ -142,11 +114,9 @@ (use-package restclient) (use-package vterm - :config (progn - (setq vterm-shell "fish") - (setq vterm-exit-functions - (lambda (&rest _) (kill-buffer (current-buffer)))) - (setq vterm-kill-buffer-on-exit t))) + :custom + (vterm-shell "fish") + (vterm-kill-buffer-on-exit t)) ;; vterm removed the ability to set a custom title generator function ;; via the public API, so this overrides its private title generation diff --git a/users/tazjin/emacs/config/modes.el b/users/tazjin/emacs/config/modes.el index 69fb523d0d91..7a51e674772b 100644 --- a/users/tazjin/emacs/config/modes.el +++ b/users/tazjin/emacs/config/modes.el @@ -4,6 +4,7 @@ (add-hook 'prog-mode-hook 'hl-line-mode) ;; Use auto-complete as completion at point +;; TODO(tazjin): what is this? (defun set-auto-complete-as-completion-at-point-function () (setq completion-at-point-functions '(auto-complete))) @@ -31,7 +32,4 @@ ;; Transparently open compressed files (auto-compression-mode t) -;; Configure go-mode for Go2 Alpha -(add-to-list 'auto-mode-alist '("\\.go2$" . go-mode)) - (provide 'modes) diff --git a/users/tazjin/emacs/default.nix b/users/tazjin/emacs/default.nix index 7f1916088e85..4744226fc72d 100644 --- a/users/tazjin/emacs/default.nix +++ b/users/tazjin/emacs/default.nix @@ -36,7 +36,6 @@ pkgs.makeOverridable direnv dockerfile-mode eglot - elfeed elixir-mode elm-mode erlang -- cgit 1.4.1