From e19a6523aee6ae092160b08db34f7161054ab053 Mon Sep 17 00:00:00 2001 From: Daanturo Date: Thu, 19 Aug 2021 17:26:22 +0700 Subject: [PATCH] feat(default): may include project name for SPC f Y +default/yank-buffer-path-relative-to-project: with non-nil prefix arg, copy the file name relative to the project root's parent. Sometimes we also want to specify the project name to let others know which is the currently mentioned project. --- modules/config/default/autoload/text.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/config/default/autoload/text.el b/modules/config/default/autoload/text.el index cb9ef34c8..9d3eb12b3 100644 --- a/modules/config/default/autoload/text.el +++ b/modules/config/default/autoload/text.el @@ -46,10 +46,14 @@ (error "Couldn't find filename in current buffer"))) ;;;###autoload -(defun +default/yank-buffer-path-relative-to-project () - "Copy the current buffer's path to the kill ring." - (interactive) - (+default/yank-buffer-path (doom-project-root))) +(defun +default/yank-buffer-path-relative-to-project (&optional include-root) + "Copy the current buffer's path to the kill ring. +With non-nil prefix INCLUDE-ROOT, also include the project's root." + (interactive "P") + (+default/yank-buffer-path + (if include-root + (file-name-directory (directory-file-name (doom-project-root))) + (doom-project-root)))) ;;;###autoload (defun +default/insert-file-path (arg)