diff options
author | Yuchen Pei <id@ypei.org> | 2023-07-26 00:05:04 +1000 |
---|---|---|
committer | Yuchen Pei <id@ypei.org> | 2023-07-26 00:05:04 +1000 |
commit | 9dd77d4c5f87b3b3c53b7b214a344933125dd150 (patch) | |
tree | 0e67b1f1a5d8f9b62f26db57b262a3ac62619094 /emacs/.emacs.d/lisp/my | |
parent | 39ac1293674147be55d18deebdf2bea91f5e5709 (diff) |
minor fixes
Diffstat (limited to 'emacs/.emacs.d/lisp/my')
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-editing.el | 3 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-prog.el | 22 |
2 files changed, 20 insertions, 5 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-editing.el b/emacs/.emacs.d/lisp/my/my-editing.el index b0af50f..1604e32 100644 --- a/emacs/.emacs.d/lisp/my/my-editing.el +++ b/emacs/.emacs.d/lisp/my/my-editing.el @@ -359,7 +359,8 @@ Basically move the line up (interactive "P") (if arg (my-kill-backward) - (kill-line 0))) + (if (bolp) (delete-char -1) + (kill-line 0)))) (defun my-kill-backward () "Kill towards beginning of line, but not out of sexp." diff --git a/emacs/.emacs.d/lisp/my/my-prog.el b/emacs/.emacs.d/lisp/my/my-prog.el index cb90ca0..96ffac2 100644 --- a/emacs/.emacs.d/lisp/my/my-prog.el +++ b/emacs/.emacs.d/lisp/my/my-prog.el @@ -355,12 +355,26 @@ left and the source buffer on the right. (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))) - (repo-url (vc-git-repository-url file)) - (repo-root (vc-git-root file)) - (path (file-relative-name file repo-root))) + (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 |