From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Emacs Orgmode <emacs-orgmode@gnu.org>
Subject: patch to make descriptive display link type dependent
Date: Sun, 26 Jun 2016 18:41:31 -0400 [thread overview]
Message-ID: <m2y45refok.fsf@Johns-MacBook-Air.local> (raw)
[-- 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
reply other threads:[~2016-06-26 22:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2y45refok.fsf@Johns-MacBook-Air.local \
--to=jkitchin@andrew.cmu.edu \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.