emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Patch: option to not hide brackets in org links
@ 2012-05-09 21:07 Paul Sexton
  2012-05-10  7:31 ` Sean O'Halpin
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Sexton @ 2012-05-09 21:07 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-05-13 23:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-09 21:07 Patch: option to not hide brackets in org links Paul Sexton
2012-05-10  7:31 ` Sean O'Halpin
2012-05-10  8:56   ` Paul Sexton
2012-05-13  1:41     ` Sean O'Halpin
2012-05-13 23:43       ` Paul Sexton
2012-05-13 23:50         ` Samuel Wales

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).