summaryrefslogtreecommitdiff
path: root/emacs-config.org
diff options
context:
space:
mode:
authorBlake Romero <blake@blkrom.com>2025-07-10 10:09:18 +0100
committerBlake Romero <blake@blkrom.com>2025-07-10 10:18:26 +0100
commitf51b29743f0e7fc4026e106f0bc250e66bdadc88 (patch)
tree17dbcba36cb8763098e18c6e9cf93ab11510f76a /emacs-config.org
parentdddd5e08c602588b043cc1e6e86d72d156711b66 (diff)
Add advice to copy line or region from cursor point
Diffstat (limited to 'emacs-config.org')
-rw-r--r--emacs-config.org12
1 files changed, 12 insertions, 0 deletions
diff --git a/emacs-config.org b/emacs-config.org
index 26fcab9..86793b8 100644
--- a/emacs-config.org
+++ b/emacs-config.org
@@ -44,6 +44,18 @@ Automatically move cursor point on window split.
:after (lambda (&rest r) (other-window 1)))
#+end_src
+Add advice to copy line at cursor point or region.
+#+begin_src elisp
+ (defadvice kill-ring-save (before dwim-copy activate compile)
+ "Copy the current line at cursor point or region."
+ (interactive
+ (if mark-active
+ (list (region-beginning) (region-end))
+ (message "Line copied")
+ (list (line-beginning-position)
+ (line-beginning-position 2)))))
+#+end_src
+
** Editor
Tab behaviour settings.
#+begin_src elisp