summaryrefslogtreecommitdiff
path: root/emacs/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/lisp')
-rw-r--r--emacs/lisp/fcuny-commands.el72
1 files changed, 0 insertions, 72 deletions
diff --git a/emacs/lisp/fcuny-commands.el b/emacs/lisp/fcuny-commands.el
deleted file mode 100644
index 842fb3e..0000000
--- a/emacs/lisp/fcuny-commands.el
+++ /dev/null
@@ -1,72 +0,0 @@
-;;; fcuny-commands -- my functions
-
-;;; Commentary:
-;;; Code:
-
-(require 'fcuny-vars)
-(require 'magit)
-(require 'magit-branch)
-(require 'git-link)
-
-(defun rename-this-buffer-and-file ()
- "Renames current buffer and file it is visiting."
- (interactive)
- (let ((name (buffer-name))
- (filename (buffer-file-name))
- (read-file-name-function 'read-file-name-default))
- (if (not (and filename (file-exists-p filename)))
- (error "Buffer '%s' is not visiting a file!" name)
- (let ((new-name (read-file-name "New name: " filename)))
- (cond ((get-buffer new-name)
- (error "A buffer named '%s' already exists!" new-name))
- (t
- (rename-file filename new-name 1)
- (rename-buffer new-name)
- (set-visited-file-name new-name)
- (set-buffer-modified-p nil)
- (message "File '%s' successfully renamed to '%s'" name (file-name-nondirectory new-name))))))))
-
-(defun uniquify-region-lines (beg end)
- "Remove duplicate adjacent lines in region between BEG and END."
- (interactive "*r")
- (save-excursion
- (goto-char beg)
- (while (re-search-forward "^\\(.*\n\\)\\1+" end t)
- (replace-match "\\1"))))
-
-(defun fcuny/clone-repo (url)
- "Clone a repository in the workspace using URL."
- (interactive "sURL:")
- (let* ((repo-name (magit-clone--url-to-name url))
- (target-dir (concat fcuny/path-workspace "/" repo-name)))
- (magit-clone-regular url target-dir nil)))
-
-(defun fcuny/get-sg-remote-from-hostname (hostname)
- "Create a sourcegraph URL from HOSTNAME."
- (format "sourcegraph.rbx.com/%s" hostname))
-
-(defun fcuny/git-link-work-sourcegraph (hostname dirname filename _branch commit start end)
- "Create the link to sourcegraph given a HOSTNAME DIRNAME FILENAME _BRANCH COMMIT START and END."
- ;; Use the default branch of the repository instead of the
- ;; current one (we might be on a feature branch that is not
- ;; available on the remote).
- (let ((sg-base-url (fcuny/get-sg-remote-from-hostname hostname))
- (main-branch (magit-main-branch)))
- (git-link-sourcegraph sg-base-url dirname filename main-branch commit start end)))
-
-(defun fcuny/git-link-commit-work-sourcegraph (hostname dirname commit)
- "Create the link to sourcegraph given a HOSTNAME DIRNAME and COMMIT."
- (let ((sg-base-url (fcuny/get-sg-remote-from-hostname hostname)))
- (git-link-commit-sourcegraph sg-base-url dirname commit)))
-
-;; for work related repositories, open them in our instance of sourcegraph
-(add-to-list 'git-link-remote-alist '("github\\.rbx\\.com" fcuny/git-link-work-sourcegraph))
-(add-to-list 'git-link-commit-remote-alist '("github\\.rbx\\.com" fcuny/git-link-commit-work-sourcegraph))
-
-;; for personal code I use gitea, which is similar to codeberg
-(add-to-list 'git-link-remote-alist '("git\\.fcuny\\.net" git-link-codeberg))
-(add-to-list 'git-link-commit-remote-alist '("git\\.fcuny\\.net" git-link-commit-codeberg))
-
-(provide 'fcuny-commands)
-
-;;; fcuny-commands.el ends here