emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] org-link-search fails if search string contains new lines
@ 2017-03-26 17:35 Matt Lundin
  2017-03-26 20:50 ` Matt Lundin
  0 siblings, 1 reply; 10+ messages in thread
From: Matt Lundin @ 2017-03-26 17:35 UTC (permalink / raw)
  To: Org Mode

Following links fails to locate the appropriate location in text files
if the search string in the link contains new lines.

Steps to reproduce:

/usr/bin/emacs -Q ~/config/minimal.el

where minimal.el contains...

--8<---------------cut here---------------start------------->8---
(add-to-list 'load-path "~/org-mode/lisp/")
(add-to-list 'load-path "~/org-mode/contrib/lisp/")

(setq org-agenda-files '("~/config/test.org"))

(setq org-capture-templates
      '(("n" "Note" entry
	           (file "~/config/test.org")
                   "* Test\n %a\n")))
--8<---------------cut here---------------end--------------->8---

Open a file (~/text.txt) containing....

--8<---------------cut here---------------start------------->8---
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
--8<---------------cut here---------------end--------------->8---

Create an active region covering the third sentence and select the
org-capture "n" template, which creates the following link:

--8<---------------cut here---------------start------------->8---
* Test
 [[file:~/test.txt::Duis%20aute%20irure%20dolor%20in%0Areprehenderit%20in%20voluptate%20velit%20esse%20cillum%20dolore%20eu%20fugiat%20nulla%0Apariatur.]]
--8<---------------cut here---------------end--------------->8---

Try to follow the link. It will open test.txt, but it will also give the
message and fail to locate the correct position in the file:

        "No match for fuzzy expression: Duis aute irure dolor in
        reprehenderit in voluptate velit esse cillum dolore eu fugiat
        nulla pariatur."

For comparison, evaluate (setq org-context-in-file-links 1) and run
capture again. The captured snippet looks like this:

--8<---------------cut here---------------start------------->8---
* Test
 [[file:~/test.txt::Duis%20aute%20irure%20dolor%20in]]
--8<---------------cut here---------------end--------------->8---

Follow the link. The fuzzy search succeeds and finds the correct
position in the text.

Matt

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-04-07 15:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-26 17:35 [BUG] org-link-search fails if search string contains new lines Matt Lundin
2017-03-26 20:50 ` Matt Lundin
2017-03-27 11:37   ` Nicolas Goaziou
2017-03-27 15:15     ` Matt Lundin
2017-03-29 12:19       ` Nicolas Goaziou
2017-03-28 21:34     ` Skip Collins
2017-03-29 12:19       ` Nicolas Goaziou
2017-03-29 15:17         ` Skip Collins
2017-03-30 10:50           ` Nicolas Goaziou
2017-04-07 15:47             ` Skip Collins

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