[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Using org-mode for Research and Notetaking
From: |
Florian Beck |
Subject: |
Re: [O] Using org-mode for Research and Notetaking |
Date: |
Tue, 26 Jul 2011 16:17:48 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Bastien <address@hidden> writes:
> Hi Tom,
>
> address@hidden (Thomas S. Dye) writes:
>
>> Aloha all,
>>
>> Perhaps they are [[tag:boxed][already]] here with org-add-link-type? It
>> seems to me that all that's missing is a way to specify a function to
>> determine on screen display. But, I might be missing something.
>
> just as a quick follow-up: I understand the need. I will hack
> org-link-protocols so that they can hold a custom face for each
> link type. But this won't happen for 7.7, only around mid-sept
> if that's okay.
IIUC, entries would be of the form (TYPE FOLLOW EXPORT FACE).
What if instead of FACE you could (alternativly) specify a function that
supplied additional text properties? Possibly a face, of course, but
also interesting are `display' and `help-echo'.
I'm not a programmer, but I got this working with quite small changes
(rather untested, I admit):
diff -c /home/flo/elisp/org-mode/lisp/org.el /home/flo/tmp/org.el
*** /home/flo/elisp/org-mode/lisp/org.el 2011-07-26 15:52:16.160581036
+0200
--- /home/flo/tmp/org.el 2011-07-26 16:16:00.022669409 +0200
***************
*** 5315,5331 ****
(defun org-activate-bracket-links (limit)
"Run through the buffer and add overlays to bracketed links."
(if (re-search-forward org-bracket-link-regexp limit t)
! (let* ((help (concat "LINK: "
! (org-match-string-no-properties 1)))
;; FIXME: above we should remove the escapes.
;; 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)))
! (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
;; may have made some of this invisible.
(org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0))
--- 5315,5348 ----
(defun org-activate-bracket-links (limit)
"Run through the buffer and add overlays to bracketed links."
(if (re-search-forward org-bracket-link-regexp limit t)
! (let* ((path (org-match-string-no-properties 1))
! (help (concat "LINK: " path))
! (type (save-match-data
! (if (string-match
! "^\\(.*?\\):"
! path)
! (org-match-string-no-properties 1 path))))
;; FIXME: above we should remove the escapes.
;; but that requires another match, protecting match data,
;; a lot of overhead for font-lock.
+ (custom-attr-1 (nth 3 (assoc type org-link-protocols)))
+ ;; Check if `org-link-protocols' is a face or a function
+ ;; that returns text properties.
+ (custom-attr
+ (if (and custom-attr-1
+ (facep custom-attr-1))
+ `(face ,custom-attr-1)
+ (funcall (or custom-attr-1 'ignore) path)))
(ip (org-maybe-intangible
(list 'invisible 'org-link
'keymap org-mouse-map 'mouse-face 'highlight
'font-lock-multiline t 'help-echo help)))
! (vp (append
! (list 'keymap org-mouse-map 'mouse-face 'highlight
! 'face 'org-link
! 'font-lock-multiline t 'help-echo help)
! ;; Let custom settings override the default.
! custom-attr)))
;; We need to remove the invisible property here. Table narrowing
;; may have made some of this invisible.
(org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0))
***************
*** 5602,5608 ****
(if (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend)))
(if (memq 'angle lk) '(org-activate-angle-links (0 'org-link t)))
(if (memq 'plain lk) '(org-activate-plain-links))
! (if (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link t)))
(if (memq 'radio lk) '(org-activate-target-links (0 'org-link t)))
(if (memq 'date lk) '(org-activate-dates (0 'org-date t)))
(if (memq 'footnote lk) '(org-activate-footnote-links))
--- 5619,5625 ----
(if (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend)))
(if (memq 'angle lk) '(org-activate-angle-links (0 'org-link t)))
(if (memq 'plain lk) '(org-activate-plain-links))
! (if (memq 'bracket lk) 'org-activate-bracket-links)
(if (memq 'radio lk) '(org-activate-target-links (0 'org-link t)))
(if (memq 'date lk) '(org-activate-dates (0 'org-date t)))
(if (memq 'footnote lk) '(org-activate-footnote-links))
***************
*** 8437,8444 ****
(add-to-list 'org-link-types type t)
(org-make-link-regexps)
(if (assoc type org-link-protocols)
! (setcdr (assoc type org-link-protocols) (list follow export))
! (push (list type follow export) org-link-protocols)))
(defvar org-agenda-buffer-name)
--- 8454,8461 ----
(add-to-list 'org-link-types type t)
(org-make-link-regexps)
(if (assoc type org-link-protocols)
! (setcdr (assoc type org-link-protocols) (list follow export face))
! (push (list type follow export face) org-link-protocols)))
(defvar org-agenda-buffer-name)
Diff finished. Tue Jul 26 16:16:12 2011
--
Florian Beck
- Re: [O] Using org-mode for Research and Notetaking, (continued)
- Re: [O] Using org-mode for Research and Notetaking, Sebastien Vauban, 2011/07/18
- Re: [O] Using org-mode for Research and Notetaking, Bastien, 2011/07/18
- Re: [O] Using org-mode for Research and Notetaking, Florian Beck, 2011/07/14
- Re: [O] Using org-mode for Research and Notetaking, Thomas S. Dye, 2011/07/14
- Re: [O] Using org-mode for Research and Notetaking, Bastien, 2011/07/18
- Re: [O] Using org-mode for Research and Notetaking, Thomas S. Dye, 2011/07/18
- Re: [O] Using org-mode for Research and Notetaking, Florian Beck, 2011/07/18
- Re: [O] Using org-mode for Research and Notetaking, Bastien, 2011/07/26
- Re: [O] Using org-mode for Research and Notetaking,
Florian Beck <=
- Re: [O] Using org-mode for Research and Notetaking, Thomas S. Dye, 2011/07/26
- Re: [O] Using org-mode for Research and Notetaking, Christian Moe, 2011/07/26
Re: [O] RFC: Revisit org-export-content-div (in the context of org-s5), Bastien, 2011/07/11