From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Otterson Subject: Re: bug in org-store-link Date: Wed, 27 Feb 2008 11:05:00 -0800 Message-ID: <47C5B45C.3020703@u.washington.edu> References: <47C47935.7010800@u.washington.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JURaU-0006k2-ON for emacs-orgmode@gnu.org; Wed, 27 Feb 2008 14:05:06 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JURaS-0006jJ-Ty for emacs-orgmode@gnu.org; Wed, 27 Feb 2008 14:05:06 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JURaS-0006jF-LD for emacs-orgmode@gnu.org; Wed, 27 Feb 2008 14:05:04 -0500 Received: from out3.smtp.messagingengine.com ([66.111.4.27]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JURaS-0005wD-5p for emacs-orgmode@gnu.org; Wed, 27 Feb 2008 14:05:04 -0500 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: emacs-orgmode@gnu.org Yeah, I guess that instead of saying it was a small bug, I should have said that it's a bug of small consequence (for most users, but matters to me, least). The ambiguity problem you mention could be solved by matching more than one line. To keep the string stored in the org link short, org-store-link could expand it to another line only when needed for a unique match. Or, it could expand just enough _words_ to ensure uniqueness, plus maybe one word on each end for some insurance against future changes. Future changes are the harder part. In speech recognition, there's an analogous problem where there's a need to match a transcript to recognized speech, which may have a lot of word errors, insertions and deletions. The simplest solution commonly employed is a word-level Levenshtein distance: http://en.wikipedia.org/wiki/Levenshtein_distance (this is for chars, but you get the idea) Scott Carsten Dominik wrote: > Hi Scott, this is not a small bug, but a problem that is really hard > to solve. > Supposed I used the exact line text to search, then you still have two > lines in the buffer > that would match. > > This is really about what strategy should be used to find a location > in a file that has possibly changed. > I have no good answer to that. Do you? > > - Carsten