]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/thingatpt.el (region): Put property bounds-of-thing-at-point, bug#39512
authorJuri Linkov <juri@linkov.net>
Wed, 21 Apr 2021 19:37:05 +0000 (22:37 +0300)
committerJuri Linkov <juri@linkov.net>
Wed, 21 Apr 2021 19:37:05 +0000 (22:37 +0300)
lisp/thingatpt.el

index c52fcfcc051c8b3fa29d4c1475be3476dbce8516..8ca0f429ca13e869d870a25b68237bd1f9ddc568 100644 (file)
@@ -600,10 +600,14 @@ with angle brackets.")
              (buffer-substring-no-properties
               (car boundary-pair) (cdr boundary-pair))))))
 
-;;  Buffer
+;;  Buffer and region
 
 (put 'buffer 'end-op (lambda () (goto-char (point-max))))
 (put 'buffer 'beginning-op (lambda () (goto-char (point-min))))
+(put 'region 'bounds-of-thing-at-point
+     (lambda ()
+       (when (use-region-p)
+         (cons (region-beginning) (region-end)))))
 
 ;; UUID