* canonical way to go beginning of a link
@ 2016-07-04 18:38 John Kitchin
0 siblings, 0 replies; 3+ messages in thread
From: John Kitchin @ 2016-07-04 18:38 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
Is there a canonical way to jump to the beginning of a link in org-mode,
i.e. the first char?
I usually do something this like:
(goto-char (org-element-property :begin (org-element-context)))
but in things like font-lock it seems slow compared to a regexp. I have
not found a reliable regexp approach though. say I want to search back
for "cite:" with point at the ^ position below:
some text cite:a-key
^
If I run (re-search-backward "cite:") at the point above, it does not go
to the point 2 characters back.
Any ideas?
--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: canonical way to go beginning of a link
@ 2016-07-06 10:49 Haustedt, Jens
2016-07-06 12:08 ` John Kitchin
0 siblings, 1 reply; 3+ messages in thread
From: Haustedt, Jens @ 2016-07-06 10:49 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
> but in things like font-lock it seems slow compared to a
> regexp. I have not found a reliable regexp approach though. say
> I want to search back for "cite:" with point at the ^ position
> below:
> some text cite:a-key
> ^
> If I run (re-search-backward "cite:") at the point above, it does not go to the point 2 characters back.
> Any ideas?
Given this setting:
some more text cite:a-key some text cite:a-key
^
When you run (re-search-backward "cite:") at the point above, the result is as follows:
some more text cite:a-key some text cite:a-key
^
This is exactly what I expected it to act. In your example
above, the whole search pattern could not be found in ist entirety from
the indicated point on, so it could not be found at all and point
is not moved.
Maybe it is a good idea to move point forward for at least count
of chars in search pattern before the search executes?
Greets, Jens Haustedt
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: canonical way to go beginning of a link
2016-07-06 10:49 canonical way to go beginning of a link Haustedt, Jens
@ 2016-07-06 12:08 ` John Kitchin
0 siblings, 0 replies; 3+ messages in thread
From: John Kitchin @ 2016-07-06 12:08 UTC (permalink / raw)
To: Haustedt, Jens; +Cc: emacs-orgmode@gnu.org
Haustedt, Jens writes:
> Given this setting:
>
> some more text cite:a-key some text cite:a-key
> ^
> When you run (re-search-backward "cite:") at the point above, the result is as follows:
>
> some more text cite:a-key some text cite:a-key
> ^
>
> This is exactly what I expected it to act. In your example
> above, the whole search pattern could not be found in ist entirety from
> the indicated point on, so it could not be found at all and point
> is not moved.
That is what I expect too, just not what I want ;)
>
> Maybe it is a good idea to move point forward for at least count
> of chars in search pattern before the search executes?
This is a great idea, thanks!
>
> Greets, Jens Haustedt
--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-07-06 12:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-06 10:49 canonical way to go beginning of a link Haustedt, Jens
2016-07-06 12:08 ` John Kitchin
-- strict thread matches above, loose matches on Subject: below --
2016-07-04 18:38 John Kitchin
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).