emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* patch to make descriptive display link type dependent
@ 2016-06-26 22:41 John Kitchin
  0 siblings, 0 replies; only message in thread
From: John Kitchin @ 2016-06-26 22:41 UTC (permalink / raw)
  To: Emacs Orgmode

[-- Attachment #1: Type: text/plain, Size: 637 bytes --]

The attached patch makes it possible to make some links not
descriptively if a variable for the link is defined and its value is not
'org-link.

There are a few scenarios where this would be good. In org-ref I apply
an advice to the activate-bracket-link function to undo the descriptive
link showing for cite links which use the description for additional
information like page numbers.

Another use that inspired this is a set of commenting links that might
look like: [[replace:JK some old text][some new text]] where it might be
desirable to see the whole link, but keep other descriptive links in the
descriptive form.

Thoughts?



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-make-individual-bracket-links-invisible.patch --]
[-- Type: text/x-patch, Size: 1438 bytes --]

From 591cd3487591dca3d55c1c7a6c2c6039771388ef Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Sun, 26 Jun 2016 18:27:51 -0400
Subject: [PATCH] make individual bracket links invisible
To: emacs-orgmode@gnu.org

if org-link-type-visibility is 'org-link or non-existant the link type
will behave normallay. If not, it will not be folded so the path and
descripbtion is visible.
---
 lisp/org.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index f1c500d..b41d139 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6048,11 +6048,17 @@ by a #."
 (defun org-activate-bracket-links (limit)
   "Add text properties for bracketed links."
   (if (and (re-search-forward org-bracket-link-regexp limit t)
-	   (not (org-in-src-block-p)))
+	   (not (org-in-src-block-p))) 
       (let* ((hl (org-match-string-no-properties 1))
 	     (help (concat "LINK: " (save-match-data (org-link-unescape hl))))
+	     (type (save-match-data
+		     (string-match "\\(.*?\\):" hl)
+		     (match-string 1 hl)))
 	     (ip (org-maybe-intangible
-		  (list 'invisible 'org-link
+		  (list 'invisible (let ((li (intern (format
+						      "org-link-%s-invisibility"
+						      type)))) 
+				     (if (boundp li) (symbol-value li) 'org-link))
 			'keymap org-mouse-map 'mouse-face 'highlight
 			'font-lock-multiline t 'help-echo help
 			'htmlize-link `(:uri ,hl))))
-- 
2.4.4


[-- Attachment #3: Type: text/plain, Size: 190 bytes --]


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-06-26 22:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-26 22:41 patch to make descriptive display link type dependent John Kitchin

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