From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: patch to make descriptive display link type dependent Date: Sun, 26 Jun 2016 18:41:31 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55299) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHIkF-0006nq-B0 for emacs-orgmode@gnu.org; Sun, 26 Jun 2016 18:41:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHIkB-0000eL-1f for emacs-orgmode@gnu.org; Sun, 26 Jun 2016 18:41:38 -0400 Received: from mail-qk0-x22e.google.com ([2607:f8b0:400d:c09::22e]:35635) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHIkA-0000eH-TE for emacs-orgmode@gnu.org; Sun, 26 Jun 2016 18:41:34 -0400 Received: by mail-qk0-x22e.google.com with SMTP id b130so4619863qkc.2 for ; Sun, 26 Jun 2016 15:41:34 -0700 (PDT) Received: from Johns-MacBook-Air.local (c-67-171-67-30.hsd1.pa.comcast.net. [67.171.67.30]) by smtp.gmail.com with ESMTPSA id s13sm1962278qke.6.2016.06.26.15.41.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Jun 2016 15:41:32 -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" To: Emacs Orgmode --=-=-= Content-Type: text/plain 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? --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-make-individual-bracket-links-invisible.patch >From 591cd3487591dca3d55c1c7a6c2c6039771388ef Mon Sep 17 00:00:00 2001 From: John Kitchin 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 --=-=-= Content-Type: text/plain -- 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 --=-=-=--