emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tony day <zygomega@gmail.com>
To: Nicolas Goaziou <n.goaziou@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] org-insert-link: allow ido usage when inserting links
Date: Fri, 12 Oct 2012 14:56:10 +1100	[thread overview]
Message-ID: <0CADA13B-8A22-4F34-91B1-2232997C1F04@gmail.com> (raw)
In-Reply-To: <87k3ux42pr.fsf@gmail.com>



On 11 Oct 2012, at 23:23, Nicolas Goaziou <n.goaziou@gmail.com> wrote:

> Thanks for submitting a patch. Here are a few comments.

Hi Nicolas, thanks for taking the time to go through the code.  I will resubmit the patch in a separate mail (I didn't know whether I could respond to your suggestions and submit a new patch in the same mail).

> Entries should end with a period (not the title, though). Also, if you
> haven't signed FSF papers yet, you should append "TINYCHANGE" on a line
> on its own.

I have signed the FSF papers and they have been processed.

> I don't see the interest of this change nor how it is related to
> allowing ido usage to insert links. Can
> 
>  (append
>    (mapcar (lambda (x) (list (concat x ":"))) all-prefixes)
>            (mapcar 'car org-stored-links)
>            (mapcar 'cadr org-stored-links))
> 
> contain nil values?
> 
> If so, adding a (delq nil (append ...)) should be enough. This should be
> a separate patch anyway.

The problem is actualy the list bit, which causes a bug when using ido (but not when using normal completion).

Having gone through it again, I don't think the append can contain nil values, so I removed that bit.

> Shouldn't `read-file-name' become
> `org-iread-file-name'? 

Agreed and changed.

I don't think the patch can be split into two - the bug from list is only a bug if ido is used.

Here's some test code it case it helps:

- unit test
    #+begin_src emacs-lisp
      ;;(setq org-stored-links nil)
      (setq org-stored-links 
            '((#("file:~/stuff/org/bugz.org::*current debugging" 28 35 (fontified t org-category "bugz" line-prefix #("*" 0 1 (face org-hide)) wrap-prefix #("    " 0 4 (face org-indent)) face org-level-2) 36 45 (fontified t org-category "bugz" line-prefix #("*" 0 1 (face org-hide)) wrap-prefix #("    " 0 4 (face org-indent)) face org-level-2)) "current debugging")))
      ;;(setq org-stored-links
      ;;      '((#("file:~/stuff/org/bugz.org::*test link 2" 28 32 (fontified t line-prefix #("**" 0 2 (face org-hide)) wrap-prefix #("      " 0 6 (face org-indent)) face org-level-3) 33 37 (fontified t line-prefix #("**" 0 2 (face org-hide)) wrap-prefix #("      " 0 6 (face org-indent)) face org-level-3) 38 39 (fontified t line-prefix #("**" 0 2 (face org-hide)) wrap-prefix #("      " 0 6 (face org-indent)) face org-level-3)) "test link 2") (#("file:~/stuff/org/bugz.org::*test link 1" 28 32 (fontified t line-prefix #("**" 0 2 (face org-hide)) wrap-prefix #("      " 0 6 (face org-indent)) face org-level-3) 33 37 (fontified t line-prefix #("**" 0 2 (face org-hide)) wrap-prefix #("      " 0 6 (face org-indent)) face org-level-3) 38 39 (fontified t line-prefix #("**" 0 2 (face org-hide)) wrap-prefix #("      " 0 6 (face org-indent)) face org-level-3)) "test link 1")))
      (setq abbrevs org-link-abbrev-alist-local)
      (setq all-prefixes (append org-link-types
                                 (mapcar 'car abbrevs)
                                 (mapcar 'car org-link-abbrev-alist)))
      (setq all-links (append
                       (mapcar 'cadr org-stored-links)
                       (mapcar (lambda (x) (concat x ":"))
                               all-prefixes)
                       (mapcar 'car org-stored-links)))
      ;;(setq all-links (delete nil all-links))
      (print (loop for link in all-links
                   collect
                   (list link)))  
       
  #+end_src


Tony

  reply	other threads:[~2012-10-12  3:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-11  4:19 [PATCH] org-insert-link: allow ido usage when inserting links tony day
2012-10-11 12:23 ` Nicolas Goaziou
2012-10-12  3:56   ` tony day [this message]
2012-10-11 20:17 ` Samuel Wales
2012-10-11 23:21   ` link creation, ido usage, and headers tony day
  -- strict thread matches above, loose matches on Subject: below --
2012-09-14  9:21 [PATCH] org-insert-link: allow ido usage when inserting links tony day
2012-09-14  9:39 ` Giovanni Ridolfi
2012-09-22 16:17 ` Bastien

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=0CADA13B-8A22-4F34-91B1-2232997C1F04@gmail.com \
    --to=zygomega@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=n.goaziou@gmail.com \
    /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).