aboutsummaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2023-07-26 00:05:04 +1000
committerYuchen Pei <id@ypei.org>2023-07-26 00:05:04 +1000
commit9dd77d4c5f87b3b3c53b7b214a344933125dd150 (patch)
tree0e67b1f1a5d8f9b62f26db57b262a3ac62619094 /emacs
parent39ac1293674147be55d18deebdf2bea91f5e5709 (diff)
minor fixes
Diffstat (limited to 'emacs')
-rw-r--r--emacs/.emacs.d/init/ycp-org.el2
-rw-r--r--emacs/.emacs.d/lisp/my/my-editing.el3
-rw-r--r--emacs/.emacs.d/lisp/my/my-prog.el22
3 files changed, 20 insertions, 7 deletions
diff --git a/emacs/.emacs.d/init/ycp-org.el b/emacs/.emacs.d/init/ycp-org.el
index 72da862..db29697 100644
--- a/emacs/.emacs.d/init/ycp-org.el
+++ b/emacs/.emacs.d/init/ycp-org.el
@@ -58,8 +58,6 @@
my-org-doc-dir)
;; disable auto-indent on RET
(add-hook 'org-mode-hook (lambda () (electric-indent-local-mode -1)))
- ;; disable truncate lines
- (add-hook 'org-mode-hook #'toggle-truncate-lines)
(add-hook 'org-mode-hook (lambda () (setq-local tab-width 2)))
(setq org-adapt-indentation 'headline-data)
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