From mboxrd@z Thu Jan 1 00:00:00 1970 From: "William Henney" Subject: Re: apparent bug in org-insert-link with active region Date: Wed, 3 Oct 2007 19:16:38 -0500 Message-ID: <41c818190710031716y7cd93488o10a6faa05579e58a@mail.gmail.com> References: <41c818190710030856i1b0280bdvc88a82e954f738b8@mail.gmail.com> <87abqzsxw4.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IdEOQ-0004YP-2I for emacs-orgmode@gnu.org; Wed, 03 Oct 2007 20:16:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IdEOO-0004YD-KA for emacs-orgmode@gnu.org; Wed, 03 Oct 2007 20:16:40 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IdEOO-0004YA-Dv for emacs-orgmode@gnu.org; Wed, 03 Oct 2007 20:16:40 -0400 Received: from nz-out-0506.google.com ([64.233.162.234]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IdEOO-0007m5-7N for emacs-orgmode@gnu.org; Wed, 03 Oct 2007 20:16:40 -0400 Received: by nz-out-0506.google.com with SMTP id f1so3455519nzc for ; Wed, 03 Oct 2007 17:16:39 -0700 (PDT) In-Reply-To: <87abqzsxw4.fsf@bzg.ath.cx> Content-Disposition: inline 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: Bastien Cc: emacs-orgmode@gnu.org Hi Bastien Thanks for looking into this. On 10/3/07, Bastien wrote: > "William Henney" writes: > > > If I call org-insert-link with the region active, then the region > > content is instantly deleted while I am prompted for the link. This is > > rather disconcerting, but for most link types the region content > > magically reappears as the default value of the description. > > Yes, maybe the region shouldn't be deleted before the link is actually > inserted. > > > However, for "file:" links the default value of the description > > becomes the link itself, and the previous content of the region is > > lost (as far as I can see). Is this intended? > > For me, the default value for the description is *always* the active > region, this one being a simple string or a file link. So I expect the > default value of the description itself being "the link itself", since > it equals the active region... or did I miss something? > Yes, I think you are... I wasn't saying that the active region was of the form "file:something", but rather that the link target was of that form. What happens for me is the following (when I do org-insert-link with the region active) 1. The region is deleted in the org buffer 2. I am shown the "Link:" prompt in the mini-buffer 3. I type in the link (or use arrows or return to grab a stored link) 4. I am shown the "Description:" prompt in the mini-buffer 5a. If the link I entered in step 3 was something like "http://foo.org", then all is well - the deleted region from step 1 appears as the default description. 5b. However, if the link I inserted in step 3 was something like "file:/etc/whatever", then I no longer get the deleted region as the default description. Instead, I just get "file:/etc/whatever" I hope this is clearer. I thought perhaps the problem was with my personal set-up, so I tried it with "emacs -Q -q -l minimal-org.el", where the file minimal-org.el is given below. I still see the problem (that is, behaviour 5b instead of 5a) whenever the link is of the form "file:/path/to/myfile" I have also found another apparent bug. When I do C-u C-c C-l, then (as described in the docs) I get prompted for a filename with path completion. However, this time the default description is blank (whether or not the region was active). Cheers Will ;;;--------------------- minimal-org.el ---------------------------- (add-to-list 'load-path (expand-file-name "~/emacs/lisp/org")) (add-to-list 'auto-mode-alist '("\\.org$" . org-mode)) (define-key global-map "\C-cl" 'org-store-link) (require 'org-install) ;;;--------------------- minimal-org.el ---------------------------- --=20 Dr William Henney, Centro de Radioastronom=EDa y Astrof=EDsica, Universidad Nacional Aut=F3noma de M=E9xico, Campus Morelia