To activate and correctly fontify org [[hyperlinks]] in any major mode, add the following to your .emacs:
(defun orgl-do-font-lock (add-or-remove) "Add or remove font-lock rules for org hyperlinks." (funcall add-or-remove nil '((org-activate-bracket-links (0 'org-link t))))) (defun orgl-enable () "Enable fontification of org-style hyperlinks in the current buffer." (interactive) ;; The following variable has to be bound to a string, or opening links ;; will not work. ;; There is probably a more elegant solution. (unless org-todo-line-tags-regexp (set (make-local-variable 'org-todo-line-tags-regexp) "DSFSFSFSF_UTTER_NONSENSE_TAG_SDSDFSFDF")) (orgl-do-font-lock 'font-lock-add-keywords) (font-lock-fontify-buffer)) (defun orgl-disable () "Disable fontification of org-style hyperlinks in the current buffer." (interactive) (remove-text-properties (point-min) (point-max) '(mouse-face t keymap t org-linked-text t invisible t intangible t org-no-flyspell t)) (orgl-do-font-lock 'font-lock-remove-keywords) (font-lock-fontify-buffer)) ;; Change lisp-mode-hook to whatever you want (add-hook 'lisp-mode-hook 'orgl-enable) I was amazed at how easy this was. The most obvious use for me is to put [[hyperlinks]] in source code comments. The link behaves the same as in org mode, i.e. by default it looks for a matching <<target>>, then searches for the text of the link starting from the top of the buffer. Useful extensions would be: - Figure out how to force hiding of the [[ ... ]] brackets. They disappear only if the text is in the 'default' face. - Fontification of <<targets>> to make them stand out would be useful - Figure out how to define special link types outside org mode proper. eg in an emacs lisp file it would be good if the link [[defun:my-function]] would jump to a "(defun my-function ...." toplevel form. Paul _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode