emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Lundin <mdl@imapmail.org>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: Capture/store link bug
Date: Mon, 25 Mar 2013 17:15:54 -0500	[thread overview]
Message-ID: <8738vjb0hw.fsf@fastmail.fm> (raw)

Hi Bastien,

The changes to org-store-link in commit ecb9e5811 cause a couple of
issues:

1) When an org-capture template is invoked with (a) an active region and
(b) an annotation (i.e., a link), the link is not inserted in the
capture buffer.

Here is a sample org-capture template:

--8<---------------cut here---------------start------------->8---
(setq org-capture-templates
      '(("n" "Note" entry
         (file "~/org/inbox.org")
         "* %^{Title}\n %U\n %a\n\n %i")))
--8<---------------cut here---------------end--------------->8---

When I invoke org capture on a file with the region active (say, using
this draft email), I end up with a capture buffer that looks like this:

--8<---------------cut here---------------start------------->8---
* Title
 [2013-03-25 Mon 17:03]


  When I invoke
--8<---------------cut here---------------end--------------->8---

Note the missing link. Prior to commit ecb9e5811, the capture buffer
looked like this:

--8<---------------cut here---------------start------------->8---
* Title
 [2013-03-25 Mon 17:03]
 [[gnus:nnml:sent#8738vjb0hw.fsf@fastmail.fm][Matt Lundin: Capture/store link bug]] 

  When I invoke
--8<---------------cut here---------------end--------------->8---

2) org-store-links contains multiple entries for each link.

If I set org-stored-links to nil and then invoke org-stored-link *once*
with the region active in a file (say, lines 9305 to 9309 in org.el), I
am given the following options when invoking org-insert-link. Note this
is only after invoking org-stored-link once:

--8<---------------cut here---------------start------------->8---
<no description>                             <file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))>
<no description>                             <file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))
>
<no description>                             <file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))
 (save-excursion
>
<no description>                             <file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))
 (save-excursion>
<no description>                             <file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))
 (save-excursion>
<no description>                             <file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))
 (save-excursion>
<no description>                             <file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))
 (save-excursion>
--8<---------------cut here---------------end--------------->8---

It seems this is a list of duplicates. The value of org-stored-link is
as follows:

--8<---------------cut here---------------start------------->8---
Contains the links stored with `org-store-link'.

Value: ((#("file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))\n (save-excursion" 29 30
    (fontified t)
    30 32
    (face font-lock-keyword-face fontified t)
    33 37
    (fontified t)
    38 59
    (fontified t)
    60 64
    (fontified t)
    65 80
    (fontified t)
    82 83
    (fontified t)
    83 97
    (face font-lock-keyword-face fontified t))
  nil)
 (#("file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))\n (save-excursion" 29 30
    (fontified t)
    30 32
    (face font-lock-keyword-face fontified t)
    33 37
    (fontified t)
    38 59
    (fontified t)
    60 64
    (fontified t)
    65 80
    (fontified t)
    82 83
    (fontified t)
    83 97
    (face font-lock-keyword-face fontified t))
  nil)
 (#("file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))\n (save-excursion" 29 30
    (fontified t)
    30 32
    (face font-lock-keyword-face fontified t)
    33 37
    (fontified t)
    38 59
    (fontified t)
    60 64
    (fontified t)
    65 80
    (fontified t)
    82 83
    (fontified t)
    83 97
    (face font-lock-keyword-face fontified t))
  nil)
 (#("file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))\n (save-excursion" 29 30
    (fontified t)
    30 32
    (face font-lock-keyword-face fontified t)
    33 37
    (fontified t)
    38 59
    (fontified t)
    60 64
    (fontified t)
    65 80
    (fontified t)
    82 83
    (fontified t)
    83 97
    (face font-lock-keyword-face fontified t))
  nil)
 (#("file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))\n (save-excursion\n" 29 30
    (fontified t)
    30 32
    (face font-lock-keyword-face fontified t)
    33 37
    (fontified t)
    38 59
    (fontified t)
    60 64
    (fontified t)
    65 81
    (fontified t)
    82 83
    (fontified t)
    83 97
    (face font-lock-keyword-face fontified t)
    97 98
    (fontified t))
  nil)
 (#("file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))\n" 29 30
    (fontified t)
    30 32
    (face font-lock-keyword-face fontified t)
    33 37
    (fontified t)
    38 59
    (fontified t)
    60 64
    (fontified t)
    65 81
    (fontified t))
  nil)
 (#("file:~/org-mode/lisp/org.el::(if (and (org-region-active-p) (not ignore-region))" 29 30
    (fontified t)
    30 32
    (face font-lock-keyword-face fontified t)
    33 37
    (fontified t)
    38 59
    (fontified t)
    60 64
    (fontified t)
    65 80
    (fontified t))
  nil))
--8<---------------cut here---------------end--------------->8---

Best,
Matt

             reply	other threads:[~2013-03-25 22:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-25 22:15 Matt Lundin [this message]
2013-03-25 22:54 ` Capture/store link bug Bastien
2013-03-26  0:24   ` Matt Lundin
2013-03-26  0:52     ` Matt Lundin
2013-03-27  6:48       ` Bastien
2013-03-28 15:36         ` Matt Lundin

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8738vjb0hw.fsf@fastmail.fm \
    --to=mdl@imapmail.org \
    --cc=emacs-orgmode@gnu.org \
    /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 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).