From 26a7daf0533acecd2507bfab7966e1953dadc76e Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 28 Dec 2016 18:27:49 -0800 Subject: [PATCH] [Emacs] Use github style link icons for heading links --- dotfiles/emacs.d/README.org | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dotfiles/emacs.d/README.org b/dotfiles/emacs.d/README.org index 4c32f379..ff362c22 100644 --- a/dotfiles/emacs.d/README.org +++ b/dotfiles/emacs.d/README.org @@ -44,9 +44,8 @@ this. I'm considering turning this snippet in to a package, so please let me know if that is something you are interested in. -*** Make Headings Link to Themselves -See the [[Make headings in exported html links to themselves][Make headings in exported html links to themselves]]. This is another pretty nasty hack. This is useful when you are browsing the document and you want to grab a link to -the current heading. +*** [[Add link icons in headings that lead to themselves][Add link icons in headings that lead to themselves]] +This is another pretty nasty hack. This is useful when you are browsing the document and you want to grab a link to the current heading. *** Set Background Color Source Blocks For some reason, org-mode uses all of your currently active fontification when exporting EXCEPT for background color. [[Set Background Color of Source Blocks for Export][This]] modification fixes this. ** [[framecontrol][Frame control]] @@ -3298,12 +3297,14 @@ alphanumeric characters only." (puthash datum new-name cache) new-name))))) #+END_SRC -**** Make headings in exported html links to themselves +**** Add link icons in headings that lead to themselves #+BEGIN_SRC emacs-lisp :tangle org-config.el (use-package ox-html :ensure nil :preface (progn + (defvar imalison:link-svg-html + "") (defvar imalison:current-html-headline) (defun imalison:set-current-html-headline (headline &rest args) (setq imalison:current-html-headline headline)) @@ -3313,8 +3314,8 @@ alphanumeric characters only." (let* ((reference (when imalison:current-html-headline (org-export-get-reference imalison:current-html-headline info))) ;; Don't do anything special if the current headline is not set - (new-text (if imalison:current-html-headline - (format "%s" reference text) + (new-text (if reference + (format "%s %s" text reference imalison:link-svg-html) text))) (org-html-format-headline-default-function todo todo-type priority new-text tags info))))