diff options
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/.emacs.d/init/ycp-editing.el | 1 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-editing.el | 13 | ||||
-rw-r--r-- | emacs/.emacs.d/lisp/my/my-prog.el | 2 |
3 files changed, 16 insertions, 0 deletions
diff --git a/emacs/.emacs.d/init/ycp-editing.el b/emacs/.emacs.d/init/ycp-editing.el index b9ed48b..4b6922e 100644 --- a/emacs/.emacs.d/init/ycp-editing.el +++ b/emacs/.emacs.d/init/ycp-editing.el @@ -60,6 +60,7 @@ "C-c r <RET>" #'my-concat-lines "C-M-y" #'my-yank-primary "C-a" #'my-beginning-of-line-or-indentation + "M-c" #'my-copy-buffer-file-name ; override capitalize ) (electric-pair-mode) ) 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 ":")) |