From mboxrd@z Thu Jan 1 00:00:00 1970 From: tony day Subject: PATCH: using ido when inserting links Date: Fri, 14 Sep 2012 18:58:43 +1000 Message-ID: <97F9790D-3C7F-490B-BE9B-1A652BB9F187@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 6.0 \(1486\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_16F53BBB-B334-4019-913D-35CEA637079D" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:51746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCRjk-0001wJ-7f for emacs-orgmode@gnu.org; Fri, 14 Sep 2012 04:59:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TCRje-0004bQ-KQ for emacs-orgmode@gnu.org; Fri, 14 Sep 2012 04:58:56 -0400 Received: from mail-ob0-f169.google.com ([209.85.214.169]:33458) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCRje-0004bL-9L for emacs-orgmode@gnu.org; Fri, 14 Sep 2012 04:58:50 -0400 Received: by obhx4 with SMTP id x4so6503229obh.0 for ; Fri, 14 Sep 2012 01:58:49 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --Apple-Mail=_16F53BBB-B334-4019-913D-35CEA637079D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii I had a look through and couldn't see an obvious reason why you can't = use ido with org-insert-link, so here's a patch to enable it. I haven't looked at using ido for editing links yet, but I figure = org-capture would be a good pattern to do this. The other thought here = is to add an 'org:' link type so you can fire up ido just like = org-capture (not sure what non-ido org-capture looks like). This is my first patch, so please let me know if I'm not doing things = right. Tony --Apple-Mail=_16F53BBB-B334-4019-913D-35CEA637079D Content-Disposition: attachment; filename=0001-org-insert-link-allow-ido-usage-when-inserting-links.patch Content-Type: application/octet-stream; name="0001-org-insert-link-allow-ido-usage-when-inserting-links.patch" Content-Transfer-Encoding: quoted-printable =46rom=20b8138833eba6487c00d38c99000151f883a5543a=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Tony=20Day=20=0ADate:=20= Mon,=2010=20Sep=202012=2013:54:38=20+1000=0ASubject:=20[PATCH]=20= org-insert-link:=20allow=20ido=20usage=20when=20inserting=20links=0A=0A*=20= lisp/org.el=20(org-insert-link):=20added=20all-links=20to=20cleanly=20= create=20prefix+stored=20links=20for=20use=20in=20ido=0A= (org-i-read-file-name):=20new=20defun=20to=20allow=20ido=20to=20read=20a=20= file:=20link=20if=20allowed=0A=0ATINYCHANGE=0A---=0A=20lisp/org.el=20|=20= 39=20+++++++++++++++++++++++++--------------=0A=201=20file=20changed,=20= 25=20insertions(+),=2014=20deletions(-)=0A=0Adiff=20--git=20= a/lisp/org.el=20b/lisp/org.el=0Aindex=201c18d70..a918cfc=20100644=0A---=20= a/lisp/org.el=0A+++=20b/lisp/org.el=0A@@=20-9397,7=20+9397,7=20@@=20be=20= used=20as=20the=20default=20description."=0A=20=09=20tmphist=20;=20= byte-compile=20incorrectly=20complains=20about=20this=0A=20=09=20(link=20= link-location)=0A=20=09=20(abbrevs=20org-link-abbrev-alist-local)=0A-=09=20= entry=20file=20all-prefixes=20auto-desc)=0A+=09=20entry=20file=20= all-links=20all-prefixes=20auto-desc)=0A=20=20=20=20=20(cond=0A=20=20=20=20= =20=20(link-location)=20;=20specified=20by=20arg,=20just=20use=20it.=0A=20= =20=20=20=20=20((org-in-regexp=20org-bracket-link-regexp=201)=0A@@=20= -9443,19=20+9443,19=20@@=20Use=20TAB=20to=20complete=20link=20prefixes,=20= then=20RET=20for=20type-specific=20completion=20support=0A=20=09=09=09=09= =20org-link-types))=0A=20=20=20=20=20=20=20(unwind-protect=0A=20=09=20=20= (progn=0A+=09=20=20=20=20(setq=20all-links=20(append=0A+=09=09=09=20=20=20= =20=20(mapcar=20'car=20org-stored-links)=0A+=09=09=09=20=20=20=20=20= (mapcar=20'cadr=20org-stored-links)=0A+=09=09=09=20=20=20=20=20(mapcar=20= (lambda=20(x)=20(concat=20x=20":"))=0A+=09=09=09=09=20=20=20=20=20= all-prefixes)))=0A+=09=20=20=20=20(setq=20all-links=20(delete=20nil=20= all-links))=0A=20=09=20=20=20=20(setq=20link=0A-=09=09=20=20(let=20= ((org-completion-use-ido=20nil)=0A-=09=09=09(org-completion-use-iswitchb=20= nil))=0A-=09=09=20=20=20=20(org-completing-read=0A-=09=09=20=20=20=20=20= "Link:=20"=0A-=09=09=20=20=20=20=20(append=0A-=09=09=20=20=20=20=20=20= (mapcar=20(lambda=20(x)=20(list=20(concat=20x=20":")))=0A-=09=09=09=20=20= =20=20=20=20all-prefixes)=0A-=09=09=20=20=20=20=20=20(mapcar=20'car=20= org-stored-links)=0A-=09=09=20=20=20=20=20=20(mapcar=20'cadr=20= org-stored-links))=0A-=09=09=20=20=20=20=20nil=20nil=20nil=0A-=09=09=20=20= =20=20=20'tmphist=0A-=09=09=20=20=20=20=20(caar=20org-stored-links))))=0A= +=09=09=20=20(org-completing-read=0A+=09=09=20=20=20"Link:=20"=0A+=09=09=20= =20=20all-links=0A+=09=09=20=20=20nil=20nil=20nil=0A+=09=09=20=20=20= 'tmphist=0A+=09=09=20=20=20(caar=20org-stored-links)))=0A=20=09=20=20=20=20= (if=20(not=20(string-match=20"\\S-"=20link))=0A=20=09=09(error=20"No=20= link=20selected"))=0A=20=09=20=20=20=20(mapc=20(lambda(l)=0A@@=20-9542,7=20= +9542,7=20@@=20Use=20TAB=20to=20complete=20link=20prefixes,=20then=20RET=20= for=20type-specific=20completion=20support=0A=20(defun=20= org-file-complete-link=20(&optional=20arg)=0A=20=20=20"Create=20a=20file=20= link=20using=20completion."=0A=20=20=20(let=20(file=20link)=0A-=20=20=20=20= (setq=20file=20(read-file-name=20"File:=20"))=0A+=20=20=20=20(setq=20= file=20(org-i-read-file-name=20"File:=20"))=0A=20=20=20=20=20(let=20= ((pwd=20(file-name-as-directory=20(expand-file-name=20".")))=0A=20=09=20=20= (pwd1=20(file-name-as-directory=20(abbreviate-file-name=0A=20=09=09=09=09= =09=20(expand-file-name=20".")))))=0A@@=20-9560,6=20+9560,17=20@@=20Use=20= TAB=20to=20complete=20link=20prefixes,=20then=20RET=20for=20= type-specific=20completion=20support=0A=20=20=20=20=20=20=20=20(t=20= (setq=20link=20(concat=20"file:"=20file)))))=0A=20=20=20=20=20link))=0A=20= =0A+(defun=20org-i-read-file-name=20(&rest=20args)=0A+=20=20= "Read-file-name=20using=20`ido-mode'=20speedup=20if=20available."=0A+=20=20= (org-without-partial-completion=0A+=20=20=20(if=20(and=20= org-completion-use-ido=0A+=20=20=20=20=20=20=20=20=20=20=20=20(fboundp=20= 'ido-read-file-name)=0A+=20=20=20=20=20=20=20=20=20=20=20=20(boundp=20= 'ido-mode)=20ido-mode=0A+=20=20=20=20=20=20=20=20=20=20=20=20(listp=20= (second=20args)))=0A+=20=20=20=20=20=20=20(let=20= ((ido-enter-matching-directory=20nil))=0A+=20=20=20=20=20=20=20=20=20= (apply=20'ido-read-file-name=20args))=0A+=20=20=20=20=20(apply=20= 'read-file-name=20args))))=0A+=0A=20(defun=20org-completing-read=20= (&rest=20args)=0A=20=20=20"Completing-read=20with=20SPACE=20being=20a=20= normal=20character."=0A=20=20=20(let=20((enable-recursive-minibuffers=20= t)=0A--=20=0A1.7.12=0A=0A= --Apple-Mail=_16F53BBB-B334-4019-913D-35CEA637079D Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_16F53BBB-B334-4019-913D-35CEA637079D--