From: Juri Linkov Date: Wed, 21 Apr 2021 19:37:05 +0000 (+0300) Subject: * lisp/thingatpt.el (region): Put property bounds-of-thing-at-point, bug#39512 X-Git-Tag: emacs-28.0.90~2791 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=57805231b2580d304dc2e0e642644ebe52c24f33;p=emacs.git * lisp/thingatpt.el (region): Put property bounds-of-thing-at-point, bug#39512 --- diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index c52fcfcc051..8ca0f429ca1 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -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