GNU bug report logs -
#39512
28.0.50; Add command isearch-yank-region
Previous Next
Reported by: Tino Calancha <tino.calancha <at> gmail.com>
Date: Sat, 8 Feb 2020 18:06:01 UTC
Severity: wishlist
Tags: fixed, patch
Fixed in version 28.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
Message #65 received at 39512 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
>>(or (thing-at-point 'region)
>> (thing-at-point 'url)
>> ;; (thing-at-point 'filename)
>> ;; (thing-at-point 'list)
>> (thing-at-point 'symbol))
>>
>>has several problems:
>>
>>1. There is no such "thing" as 'region'. Maybe could be added to thingatpt.el?
>>
> This was actually the most important part in the request. Maybe an extra
> optional parameter like use-region could be added to
> bounds-of-thing-at-point that uses the active region when
> region-active-p or use-region-p.
No need to add new arg, because the existing arg 'THING' can be used
to accept another value 'region'.
What I meant is just to add to thingatpt.el these 4 lines:
[bounds-of-thing-at-point-region.patch (text/x-diff, inline)]
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index c52fcfcc05..b9f7c116e3 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -604,6 +604,10 @@ thing-at-point-email-regexp
(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
[Message part 3 (text/plain, inline)]
> As I already mentioned; IMO the idea is to follow the same logic than here:
>
> https://github.com/abo-abo/swiper/blob/471d644d6bdd7d5dc6ca4efb405e6a6389dff245/ivy.el#L427
>
> where `(thing-at-point 'region)` is basically the first branch in the
> cond.
`(thing-at-point 'region)` will work with the patch above.
Then we could add a customizable user option to specify
in what order the user wants to try things at point, e.g.
`(region url file symbol)`
>>3. It would be nice to use (thing-at-point 'list) only when point
>> is on the open/close parens. This is how double-clicking by mouse
>> selects the thing at point of mouse click. When clicked on a paren,
>> the whole list is selected by 'mouse-start-end'.
>> 'isearch-forward-thing-at-point' could be the same logic.
>
> now I use C-M-SPC for this selection and then M-w to copy and C-s
> C-y. If you add the command, then it will save the M-w and the C-y to
> copy the region, because region will be already active... But will
> require the M-s prefix any way... so not 2 but at least 1 bind will be
> saved. You can consider this option in the future if you want...
Yes, this is a nice way to yank the next list to the search with just
C-M-SPC M-.
This bug report was last modified 4 years and 115 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.