aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp/my/my-prog.el
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2023-08-12 10:24:17 +1000
committerYuchen Pei <id@ypei.org>2023-08-12 10:24:17 +1000
commitdf7db1301e3a820aeadf0c9af1f956389a3bd5b1 (patch)
tree566ab020b0b3b1b2df3e9b04868a9bcd15654b04 /emacs/.emacs.d/lisp/my/my-prog.el
parent5adae92bf16275c46d91dc43bbe70df2b1155235 (diff)
Moving some github related functions to my-github
also some minor changes in ycp-org and my-buffer
Diffstat (limited to 'emacs/.emacs.d/lisp/my/my-prog.el')
-rw-r--r--emacs/.emacs.d/lisp/my/my-prog.el56
1 files changed, 0 insertions, 56 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-prog.el b/emacs/.emacs.d/lisp/my/my-prog.el
index e84478d..6309f70 100644
--- a/emacs/.emacs.d/lisp/my/my-prog.el
+++ b/emacs/.emacs.d/lisp/my/my-prog.el
@@ -309,62 +309,6 @@ left and the source buffer on the right.
(defun my-gud-comint-set-prompt-regexp ()
(setq comint-prompt-regexp "\\((rr)|(gdb)\\) "))
-;; TODO: generalise the following to common forges, including
-;; savannah, cgit, gitlab etc.
-(defun my-file-loc-to-github (file-loc &optional revision)
- "Convert a file location to a github url."
- (pcase-let* ((`(,file ,line-no) (split-string file-loc ":"))
- (revision (or revision (vc-working-revision file))))
- (my-file-loc-to-github-internal file line-no revision)))
-
-(defun my-file-loc-to-github-internal (file line-no revision)
- "Convert a FILE location at LINE-NO to a github url.
-
-REVISION is the commit hash."
- (let* ((repo-url (vc-git-repository-url file))
- (repo-root (vc-git-root file))
- (path (file-relative-name file repo-root)))
- (format "%s/blob/%s/%s#L%s" repo-url revision path line-no)))
-
-(defun my-kill-github-url-current-file-loc ()
- "Kill the github url from where the point is at."
- (interactive)
- (kill-new (my-file-loc-to-github-internal
- (buffer-file-name)
- (1+ (current-line))
- (vc-working-revision (buffer-file-name)))))
-
-(defun my-org-backtrace-to-github (bt &optional revision)
- (string-join
- (mapcar
- (lambda (link)
- (string-match "\\[\\[\\(.*\\)\\]\\[\\(.*\\)\\]\\]" link)
- (let ((target (match-string 1 link))
- (label (match-string 2 link)))
- (format "[[%s][%s]]"
- (my-file-loc-to-github target revision)
- label)))
- (split-string bt " > "))
- " > "))
-
-(defun my-org-backtrace-to-github-region (beg end)
- (interactive "r")
- (kill-new
- (my-org-backtrace-to-github (buffer-substring-no-properties beg end))))
-
-(defun my-org-backtrace-to-github-slack (beg end)
- (interactive "r")
- (let ((bt (buffer-substring-no-properties beg end))
- (revision (when current-prefix-arg
- (read-string "Rrevision: ")))
- )
- (with-temp-buffer
- (insert "#+options: ^:nil
-")
- (goto-char (point-max))
- (insert (my-org-backtrace-to-github bt revision))
- (org-md-export-as-markdown))))
-
;;; which-func
(defun my-copy-which-func ()
(interactive)