From: Drew Adams <drew.adams@oracle.com>
To: Rodrigo Morales <moralesrodrigo1100@gmail.com>,
"help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: RE: [External] : Get boundaries of the string at point matching a regular expression
Date: Thu, 18 Nov 2021 20:15:47 +0000 [thread overview]
Message-ID: <SJ0PR10MB5488FC72E71507FEAC4856A1F39B9@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <87lf1li6ck.fsf@gmail.com>
> I know that org-in-regexp can be used to check that the point is inside
> a given regular expression (see minimal working example below). However,
> this has the huge dependency of Org Mode.
>
> #+BEGIN_SRC elisp
> (with-temp-buffer
> (insert "fooooooooo bar")
> (goto-char 1)
> (org-in-regexp "fo+"))
> #+END_SRC
>
> #+RESULTS:
> #+begin_example
> (1 . 11)
> #+end_example
>
> I'm now wondering whether there's a function bundled with Emacs that
> doesn't depend in Org Mode that would do the same of org-in-regexp. I
> was thinking in copying the definition of org-in-regexp, but I would
> like to first ask for other approaches.
Wait for other answers, but my answer is this:
1. I don't think there's any other predefined function
that gives you this.
2. Looking at the definition, `org-in-regexp' is not
about point being inside or at or on a regexp. It's
about point being in a line where some text in the
line matches a given regexp.
3. It looks to me like the def of `org-in-regexp' is
as succinct as it gets for that.
4. Based on #3, I'd say just copy that defun. You can
rename your copy, if you like.
prev parent reply other threads:[~2021-11-18 20:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-18 19:58 Get boundaries of the string at point matching a regular expression Rodrigo Morales
2021-11-18 20:15 ` Drew Adams [this message]
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=SJ0PR10MB5488FC72E71507FEAC4856A1F39B9@SJ0PR10MB5488.namprd10.prod.outlook.com \
--to=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
--cc=moralesrodrigo1100@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.