aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp/my
diff options
context:
space:
mode:
Diffstat (limited to 'emacs/.emacs.d/lisp/my')
-rw-r--r--emacs/.emacs.d/lisp/my/my-editing.el13
-rw-r--r--emacs/.emacs.d/lisp/my/my-prog.el2
2 files changed, 15 insertions, 0 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-editing.el b/emacs/.emacs.d/lisp/my/my-editing.el
index a8fe822..47e33a3 100644
--- a/emacs/.emacs.d/lisp/my/my-editing.el
+++ b/emacs/.emacs.d/lisp/my/my-editing.el
@@ -372,5 +372,18 @@ Basically move the line up
(setq beg (point)))
(kill-region beg (point)))))
+(defun my-copy-buffer-file-name (&optional relative)
+ "Copy the file name of the current buffer.
+
+With an prefix-arg, copy the file name relative to project root."
+ (interactive "P")
+ (let ((to-kill
+ (if (and relative (project-current))
+ (file-relative-name (buffer-file-name)
+ (project-root (project-current)))
+ (buffer-file-name))))
+ (kill-new to-kill)
+ (message "Copied %s" to-kill)))
+
(provide 'my-editing)
;;; my-editing.el ends here
diff --git a/emacs/.emacs.d/lisp/my/my-prog.el b/emacs/.emacs.d/lisp/my/my-prog.el
index e38a866..4794ff2 100644
--- a/emacs/.emacs.d/lisp/my/my-prog.el
+++ b/emacs/.emacs.d/lisp/my/my-prog.el
@@ -332,6 +332,8 @@ 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 ":"))