@@ -70,6 +70,7 @@ in `polymode-minor-mode-map` keymap:
70
70
; ; chunk manipulation
71
71
(define-key map " \M -k" #'polymode-kill-chunk )
72
72
(define-key map " \M -m" #'polymode-mark-or-extend-chunk )
73
+ (define-key map " \M -w" #'polymode-kill-ring-save-chunk )
73
74
(define-key map " \C -t" #'polymode-toggle-chunk-narrowing )
74
75
; ; backends
75
76
(define-key map " e" #'polymode-export )
@@ -244,10 +245,22 @@ Return the number of chunks of the same type moved over."
244
245
(pm-span-to-range span)
245
246
(pm-chunk-range (1- (nth 1 span))))))))
246
247
247
- (defun polymode-kill-ring-save ()
248
- " Copy current chunk into the kill-ring."
248
+ (defun polymode-kill-ring-save-chunk ()
249
+ " Copy current chunk into the kill-ring.
250
+ When in the head of chunk, copy the chunk including the head and tail,
251
+ otherwise only the body span.
252
+ When called interactively, highlight the copie region for `copy-region-blink-delay' ."
249
253
(interactive )
250
- )
254
+ (let ((span (pm-innermost-span)))
255
+ (let ((range (if (memq (car span) '(nil body))
256
+ (pm-span-to-range span)
257
+ (pm-chunk-range))))
258
+ (copy-region-as-kill (car range) (cdr range))
259
+ (when (called-interactively-p 'interactive )
260
+ (let ((overlay (make-overlay (car range) (cdr range))))
261
+ (overlay-put overlay 'face 'highlight )
262
+ (run-with-timer copy-region-blink-delay nil
263
+ (lambda () (delete-overlay overlay))))))))
251
264
252
265
(defun polymode-mark-or-extend-chunk ()
253
266
" DWIM command to repeatedly mark chunk or extend region.
0 commit comments