From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= Subject: Re: [RFC] Change visibility for bracket links Date: Thu, 20 Oct 2016 19:44:46 -0400 Message-ID: <9e35201e-cc6e-8d3e-e1be-b237034dbfd5@gmail.com> References: <87bmyyold3.fsf@nicolasgoaziou.fr> <871szlrkdh.fsf@gmx.us> <87zim9oo2m.fsf@nicolasgoaziou.fr> <87twchomel.fsf@gmx.us> <87h98hoj0m.fsf@nicolasgoaziou.fr> <877f9dohsi.fsf@gmx.us> <87d1j45t41.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="9D7NbhiCgH3pMrhjeSPFwO4hbOsubDpHr" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bxN1B-0008SX-Ko for emacs-orgmode@gnu.org; Thu, 20 Oct 2016 19:45:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bxN16-0004Qt-Pe for emacs-orgmode@gnu.org; Thu, 20 Oct 2016 19:45:01 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:54220) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bxN16-0004Qj-EM for emacs-orgmode@gnu.org; Thu, 20 Oct 2016 19:44:56 -0400 Received: from [18.189.47.170] ([18.189.47.170]) by mrelayeu.kundenserver.de (mreue104) with ESMTPSA (Nemesis) id 0Lgoo2-1clZ3r46Ja-00oJZM for ; Fri, 21 Oct 2016 01:44:54 +0200 In-Reply-To: <87d1j45t41.fsf@nicolasgoaziou.fr> 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" To: emacs-orgmode@gnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --9D7NbhiCgH3pMrhjeSPFwO4hbOsubDpHr Content-Type: multipart/mixed; boundary="kEAJs1MkEL4MXV4iTHRU3cGOeRogPTIib"; protected-headers="v1" From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= To: emacs-orgmode@gnu.org Message-ID: <9e35201e-cc6e-8d3e-e1be-b237034dbfd5@gmail.com> Subject: Re: [O] [RFC] Change visibility for bracket links References: <87bmyyold3.fsf@nicolasgoaziou.fr> <871szlrkdh.fsf@gmx.us> <87zim9oo2m.fsf@nicolasgoaziou.fr> <87twchomel.fsf@gmx.us> <87h98hoj0m.fsf@nicolasgoaziou.fr> <877f9dohsi.fsf@gmx.us> <87d1j45t41.fsf@nicolasgoaziou.fr> In-Reply-To: <87d1j45t41.fsf@nicolasgoaziou.fr> --kEAJs1MkEL4MXV4iTHRU3cGOeRogPTIib Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2016-10-13 08:30, Nicolas Goaziou wrote: > I understand what `prettify-symbols-mode' is. My real problem is > understanding how it can help with links in Org. In particular, I'd lik= e > to see it, or any other mechanism, turn >=20 > [[http://orgmode.org][Org mode]] >=20 > displayed as >=20 > Org mode >=20 > into >=20 > [Org mode] >=20 > when point is near _any_ of the boundaries and doesn't trigger anything= > on anything not related to an Org link. >=20 > I don't know if that would be sufficient to make it useful, but it need= s > to be as subtle as possible. We already have a not-so-subtle solution > with visible square brackets. Hey Nicolas, Something like this? (defvar-local org-show-link--beg nil) (defvar-local org-show-link--end nil) (defun org-show-link--reveal-at-point (&rest _) "Possibly reveal link markup around point." (unless (and org-show-link--beg org-show-link--end) (setq org-show-link--beg (make-marker) org-show-link--end (make-marker))) (when (and (marker-position org-show-link--beg) (marker-position org-show-link--end)) (unless (<=3D org-show-link--beg (point) org-show-link--end) (save-excursion (font-lock-fontify-region org-show-link--beg or= g-show-link--end)) (set-marker org-show-link--beg nil) (set-marker org-show-link--end nil))) (save-excursion (when (org-in-regexp org-bracket-link-regexp 1) (set-marker org-show-link--beg (match-beginning 0)) (set-marker org-show-link--end (match-end 0)) (with-silent-modifications (remove-text-properties (match-beginning 2) (1+ (match-beginn= ing 2)) '(invisible)) (remove-text-properties (1- (match-end 2)) (match-end 2) '(in= visible))))) (message "%S" org-show-link--end)) (defun org-show-link-setup () (add-hook 'post-command-hook #'org-show-link--reveal-at-point t t))= (add-hook 'org-mode-hook #'org-show-link-setup) Running it before opening an Org buffer with links should be enough to ma= ke it work (links brackets will be hidden until point is next to or insid= e the link). It's a quick draft, of course =E2=80=94 there are still sma= ll issues. But it should give an idea of what my original proposal was a= bout. Cheers, Cl=C3=A9ment. --kEAJs1MkEL4MXV4iTHRU3cGOeRogPTIib-- --9D7NbhiCgH3pMrhjeSPFwO4hbOsubDpHr Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYCVbuAAoJEPqg+cTm90wjyuoQAKi2Sz+enF/tRun8Ve8TXfHP mCNJFP4HSKUC06iwo+z2HQNoaWLdjvPUlCoTgHjaLeqHIXzlZS4Vbgae7TBziXe/ BoqusrjuMQsy4CwReoo6yNna1pD9g6s5A1LN0L9SgSMK+87oAKTahwVwpwTKw8t1 qRecaUPgz0m0csRbiTthnzE4OpzxM6G16/qoUpMdw1Rtr2/blbPgPYRue3uiPsBH Gzi2/sLfCxNPA3xa1xBwfai1Y9xOcyoI/RqPGCCsZm2avFSt/EGt6US0N9ISk8qW tGxbPbWquvpLBLKSgZAZdio+ZoDIU+cCV3wC+r1jFi4iwlG2mahLN+bGC/bwlljr aDwUiREVE4+OslamLvcVpcezqAeE7rDRTY+6/Ar73tuJZyFrAtGvAYgpE15SoHEl iMb+Bd5Gj9Bg1Mj5UcdhebU4e5kEego84C4wUD26RCAIEL/8a4wAXVXF4ng/jK89 IcYqVJ+S1Nkbhwm5CiDWlMlwQNqhmErFWRiJi5fheDWn2RjifVGCz2lcHBojSYJn Li9NlPIxSjSoo8NctcHunwHdiwEmmb5emCACtddr4JEZHj82UvoR5CJ2K0S+QvZ8 Yl6LdJxStBxwQM1Q2u5gpddH1PI5mLoCVkP3eWSXykQBfRGcp3kWPKDUnBDfO4eg m2Ss5LiHFs1kFP9hho+W =UL5R -----END PGP SIGNATURE----- --9D7NbhiCgH3pMrhjeSPFwO4hbOsubDpHr--