all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ergus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Juri Linkov <juri@linkov.net>
Cc: Tino Calancha <tino.calancha@gmail.com>,
	npostavs@gmail.com, 39512@debbugs.gnu.org, contovob@tcd.ie,
	Lars Ingebrigtsen <larsi@gnus.org>,
	eliz@gnu.org, drew.adams@oracle.com
Subject: bug#39512: 28.0.50; Add command isearch-yank-region
Date: Sun, 18 Apr 2021 17:34:00 +0200	[thread overview]
Message-ID: <20210418153400.vf5bum44i4zw72i7@Ergus> (raw)
In-Reply-To: <8735vrgx8p.fsf@linkov.net>

On Thu, Apr 15, 2021 at 11:52:03PM +0300, Juri Linkov wrote:
>> So without any other alternative, `M-s M-.` will be good enough. In
>> general it would be better (for consistency) if we "reserve" `M-.`
>> "suffixes" for future thing-at-point-or-region commands right?
>>
>>> In the previous message you sent a link to `ivy-thing-at-point` that
>>> also uses (thing-at-point 'url) and also tries to get a filename at point.
>>> Do you think `thing-at-point-or-region` should do the same?
>>
>> With the interactive experience in mind I think this could make sense as
>> it does in `ivy-thing-at-point`.
>>
>> In my opinion from the api point of view, the important modification
>> could be the method to know the "kind the thing" detected after calling
>> the function (region, word, symbol, url) but also a function to get the
>> bounds instead of the text (like bounds-of-thing-at-point-or-region).
>
>I continued trying to do what you suggested some time ago
>and immediately stumbled upon a question what "thing"
>to use by default as an argument of '(thing-at-point thing)'?
>
>Trying these priorities:
>
>(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.

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.

>2. 'url' returns nil when there is no url at point, good.  But
>   'filename' returns non-nil on any string, not only on real filenames.
>
'filename' must match a local filename or a path... but it may be costly
to check in the filesystem if the match is an existing file... specially
when using tramp... so I don't have a solution for this. But the linked
code uses some ffap api for that.

>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... 



  





  reply	other threads:[~2021-04-18 15:34 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-08 18:04 bug#39512: 28.0.50; Add command isearch-yank-region Tino Calancha
2020-02-08 23:47 ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-02-09  0:31 ` Juri Linkov
2020-02-09 11:21   ` Tino Calancha
2020-02-09 12:38   ` Tino Calancha
2020-02-10  0:45     ` Juri Linkov
2020-02-12 22:10       ` Juri Linkov
2020-08-09 11:28   ` Lars Ingebrigtsen
2020-08-09 23:23     ` Juri Linkov
2020-08-10  1:19       ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-10 23:49         ` Juri Linkov
2020-08-11  1:12           ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-11 23:13             ` Juri Linkov
2020-08-12 17:41               ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-08-12 23:44                 ` Juri Linkov
2020-08-13  3:14                   ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-15 20:52                     ` Juri Linkov
2021-04-18 15:34                       ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-04-20 20:29                         ` Juri Linkov
2021-04-21 20:41                           ` Juri Linkov
2020-08-10 17:00       ` Tino Calancha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210418153400.vf5bum44i4zw72i7@Ergus \
    --to=bug-gnu-emacs@gnu.org \
    --cc=39512@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    --cc=drew.adams@oracle.com \
    --cc=eliz@gnu.org \
    --cc=juri@linkov.net \
    --cc=larsi@gnus.org \
    --cc=npostavs@gmail.com \
    --cc=spacibba@aol.com \
    --cc=tino.calancha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.