From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Sexton Subject: Patch: option to not hide brackets in org links Date: Wed, 9 May 2012 21:07:07 +0000 (UTC) Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:60142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSE6c-0001zK-7S for emacs-orgmode@gnu.org; Wed, 09 May 2012 17:07:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SSE6a-0003GM-AX for emacs-orgmode@gnu.org; Wed, 09 May 2012 17:07:29 -0400 Received: from plane.gmane.org ([80.91.229.3]:48238) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SSE6a-0003G8-3K for emacs-orgmode@gnu.org; Wed, 09 May 2012 17:07:28 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1SSE6V-0005Pj-SQ for emacs-orgmode@gnu.org; Wed, 09 May 2012 23:07:26 +0200 Received: from wireless-nat-1.auckland.ac.nz ([130.216.30.112]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 09 May 2012 23:07:23 +0200 Received: from psexton.2a by wireless-nat-1.auckland.ac.nz with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 09 May 2012 23:07:23 +0200 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 I would like to be able to control whether the '[[' ...']]' brackets around links are made invisible during fontification. The motivation is that I have a minor mode that makes org-style links fully active and fontifed in other major modes. But I can imagine some others might want to use it, as behaviour of these invisible brackets is sometimes unpredictable at the end of lines -- sometimes the cursor appears outside the link, but pressing return actually introduces a newline in the link. The following is a patch to org.el that accomplishes this. It introduces a new boolean global variable, defaulting to current behaviour. --- dotemacs/site-lisp/org/lisp/org.el 2012-05-06 10:45:07.000000000 +1200 +++ org-new.el 2012-05-10 09:00:14.000000000 +1200 @@ -1383,6 +1383,17 @@ :group 'org-link :type 'function) + +(defcustom org-hide-link-brackets-p + t + "Should the double square brackets [[...]] around links be invisible? +Default is t." + :group 'org-link + :type 'boolean) + +(put 'org-hide-link-brackets-p 'safe-local-variable 'booleanp) + + (defgroup org-link-store nil "Options concerning storing links in Org-mode." :tag "Org Store Link" @@ -5576,9 +5587,10 @@ ;; but that requires another match, protecting match data, ;; a lot of overhead for font-lock. (ip (org-maybe-intangible - (list 'invisible 'org-link - 'keymap org-mouse-map 'mouse-face 'highlight - 'font-lock-multiline t 'help-echo help))) + (append (list 'keymap org-mouse-map 'mouse-face 'highlight + 'font-lock-multiline t 'help-echo help) + (if org-hide-link-brackets-p + (list 'invisible 'org-link) nil)))) (vp (list 'keymap org-mouse-map 'mouse-face 'highlight 'font-lock-multiline t 'help-echo help))) ;; We need to remove the invisible property here. Table narrowing