                    ("\\subsection{%s}"     . "\\subsection*{%s}")
                    ("\\subsubsection{%s}"  . "\\subsubsection*{%s}")))))
 
-;; Below define-key sets to nil not required now that the key bindings in
-;; modi-mode minor mode get the highest priority
-;; (defun my-org-mode-customizations ()
-;;   ;; Remove the org mode binding that conflicts with ace-jump-mode binding
-;;   (define-key org-mode-map (kbd "C-c SPC") nil)
-;;   ;; Override the org-mode binding for `C-j'; use my custom global key binding
-;;   (define-key org-mode-map (kbd "C-j") nil)
-;;   )
-;; (add-hook 'org-mode-hook 'my-org-mode-customizations)
+(defun my-org-mode-customizations ()
+  ;; Reset the `local-set-key' calls
+  (local-unset-key (kbd "<f10>"))
+  (local-unset-key (kbd "<s-f10>"))
+  (local-unset-key (kbd "<S-f10>"))
+  (local-unset-key (kbd "<C-f10>")))
+(add-hook 'org-mode-hook 'my-org-mode-customizations)
 
 ;; Diagrammmms
 ;; Source: http://pages.sachachua.com/.emacs.d/Sacha.html

;; Time-stamp: <2014-09-17 11:32:58 kmodi>

;; Org Mode


 ("C-c b" . org-iswitchb)
 ("C-c c" . org-capture))

;; Updating the #+INCLUDE source code line numbers automatically
;; Source: http://emacs.stackexchange.com/questions/64/how-to-auto-calculate-the-begin-and-end-lines-when-including-source-files-in-org

;; Here is another option. This one is let's you customize the regular
;; expressions on a per-include basis. It should fit better with some
;; workflows as you're not limited to extension-based definitions.

;; * To Use *
;; Do something like the following in your org-file. (The :lines keyword
;; is optional)

;; #+INCLUDE: "code/my-class.sv" :src systemverilog :range-begin "^class"
;;  :range-end "^endclass" :lines "14-80"

;; The function will visit "my-class.sv" and search for those two
;; regexps, and then it will update the :lines keyword according with the
;; match result.

;; If :range-begin is missing, the range will be "-80".
;; If :range-end is missing, the range will be "14-".
;; If both of the above are missing, the `:lines' won't be auto updated

;; Execute the `endless/update-includes' function just before saving the file
(add-hook 'before-save-hook #'endless/update-includes)

;; * The Updater *
;; This is the function that goes through the buffer. You can bind it
;; to a key, or add it to a hook. The following code updates the lines
;; whenever you save the file, but if your use case is different, just
;; find out which hook you need! (org-mode is full of hooks)

(defun endless/update-includes (&rest ignore)
  "Update the line numbers of #+INCLUDE:s in current buffer.
Only looks at INCLUDEs that have either :range-begin or :range-end.
This function does nothing if not in org-mode, so you can safely
add it to `before-save-hook'."
  (interactive)
  (when (derived-mode-p 'org-mode)
    (save-excursion
      (goto-char (point-min))
      (while (search-forward-regexp
              "^\\s-*#\\+INCLUDE: *\"\\([^\"]+\\)\".*:range-\\(begin\\|end\\)"
              nil 'noerror)
        (let* ((file (expand-file-name (match-string-no-properties 1)))
               lines begin end)
          (forward-line 0)
          (when (looking-at "^.*:range-begin *\"\\([^\"]+\\)\"")
            (setq begin (match-string-no-properties 1)))
          (when (looking-at "^.*:range-end *\"\\([^\"]+\\)\"")
            (setq end (match-string-no-properties 1)))
          (setq lines (endless/decide-line-range file begin end))
          (when lines
            (if (looking-at ".*:lines *\"\\([-0-9]+\\)\"")
                (replace-match lines :fixedcase :literal nil 1)
              (goto-char (line-end-position))
              (insert " :lines \"" lines "\""))))))))

;; * The background worker *
;; This is the guy that does most of the work.

(defun endless/decide-line-range (file begin end)
  "Visit FILE and decide which lines to include.
BEGIN and END are regexps which define the line range to use."
  (let (l r)
    (save-match-data
      (with-temp-buffer
        (insert-file file)
        (goto-char (point-min))
        (if (null begin)
            (setq l "")
          (search-forward-regexp begin)
          (setq l (line-number-at-pos (match-beginning 0))))
        (if (null end)
            (setq r "")
          (search-forward-regexp end)
          (setq r (1+ (line-number-at-pos (match-end 0)))))
        (format "%s-%s" l r)))))

;; Execute the `modi/org-include-img-from-pdf' function just before saving the file
(add-hook 'before-save-hook #'modi/org-include-img-from-pdf)
;; Execute the `modi/org-include-img-from-pdf' function before processing the
;; file for export
(add-hook 'org-export-before-processing-hook #'modi/org-include-img-from-pdf)

(defun modi/org-include-img-from-pdf (&rest ignore)
  "Convert the pdf files to image files.

Only looks at #HEADER: lines that have \":convertfrompdf t\".
This function does nothing if not in org-mode, so you can safely
add it to `before-save-hook'."
  (interactive)
  (when (derived-mode-p 'org-mode)
    (save-excursion
      (goto-char (point-min))
      (while (search-forward-regexp
              "^\\s-*#\\+HEADER:.*\\s-:convertfrompdf\\s-+t"
              nil 'noerror)
        (let* (filenoext imgext imgfile pdffile cmd)
          ;; Keep on going on to the next line till it finds a line with
          ;; `[[FILE]]'
          (while (progn
                   (forward-line 1)
                   (not (looking-at "\\[\\[\\(.*\\)\\.\\(.*\\)\\]\\]"))))
          (when (looking-at "\\[\\[\\(.*\\)\\.\\(.*\\)\\]\\]")
            (setq filenoext (match-string-no-properties 1))
            (setq imgext (match-string-no-properties 2))
            (setq imgfile (expand-file-name (concat filenoext "." imgext)))
            (setq pdffile (expand-file-name (concat filenoext "." "pdf")))
            (setq cmd (concat "convert -density 96 -quality 85 "
                              pdffile " " imgfile))
            (when (file-newer-than-file-p pdffile imgfile)
              ;; This block is executed only if pdffile is newer than imgfile
              ;; or if imgfile does not exist
              ;; Source: https://www.gnu.org/software/emacs/manual/html_node/elisp/Testing-Accessibility.html
              (message "%s" cmd)
              (shell-command cmd))))))))

;; Update TODAY macro with current date
(add-hook 'org-export-before-processing-hook #'modi/org-update-TODAY-macro)
(defun modi/org-update-TODAY-macro (&rest ignore)
  "Update TODAY macro to hold string with current date."
  (interactive)
  (when (derived-mode-p 'org-mode)
    (save-excursion
      (goto-char (point-min))
      (while (search-forward-regexp
              "^\\s-*#\\+MACRO:\\s-+TODAY"
              nil 'noerror)
        (forward-line 0)
        (when (looking-at ".*TODAY\\(.*\\)")
          (replace-match
           (concat " "
                   (format-time-string "%b %d %Y, %a" (current-time)))
           :fixedcase :literal nil 1))))))

;; Insert fancybox class to all images
;; Update the below variables as per instructions from
;; http://fancyapps.com/fancybox/#instructions
(setq modi/org-html-fancybox-jquery-library "
#+HTML_HEAD: <!-- Add jQuery library -->
#+HTML_HEAD: <script type=\"text/javascript\" src=\"http://code.jquery.com/jquery-latest.min.js\"></script>
")
(setq modi/org-html-fancybox-html-header "
#+HTML_HEAD: <!-- Add fancyBox -->
#+HTML_HEAD: <link rel=\"stylesheet\" href=\"common/js/fancybox/source/jquery.fancybox.css?v=2.1.5\" type=\"text/css\" media=\"screen\" />
#+HTML_HEAD: <script type=\"text/javascript\" src=\"common/js/fancybox/source/jquery.fancybox.pack.js?v=2.1.5\"></script>
")
(setq modi/org-html-fancybox-html-body "
#+BEGIN_HTML
<!-- Source for fixing the issue of image disappearing about launch of fancybox.
     Using $(\"a.fancybox\").fancybox(); instead of $(\"fancybox\").fancybox();
     The issue is caused because org-mode assign class=\"fancybox\" to both <a> and
     <img> elements. Using \"a.fancybox\" limits the script to just the <a> element.
-->
<script type=\"text/javascript\">
	$(document).ready(function() {
		$(\"a.fancybox\").fancybox();
	});
</script>
#+END_HTML
")
(setq modi/org-html-fancybox-img-file-prefix-regexp "\\(file\\|http\\|https\\)")
(setq modi/org-html-fancybox-img-file-regexp "\\(png\\|jpg\\|svg\\)")
(setq modi/org-html-fancybox-force-inline-img t)
(setq modi/org-html-fancybox-img-highrez-suffix "")
(setq modi/org-html-fancybox-img-thumb-suffix "")
(add-hook 'org-export-before-processing-hook #'modi/org-html-add-fancybox)
;; (add-hook 'before-save-hook #'modi/org-html-add-fancybox)
(remove-hook 'before-save-hook #'modi/org-html-add-fancybox)
(defun modi/org-html-add-fancybox (&rest ignore)
  "Update TODAY macro to hold string with current date and time."
  (interactive)
  (when (derived-mode-p 'org-mode)
    (let* ((enable-fancybox nil))
      (save-excursion
        (goto-char (point-min))
        (while (search-forward-regexp
                "^\\s-*#\\+OPTIONS:.*fancybox:\\s-*t"
                nil 'noerror)
          (forward-line 1)
          ;; Insert jQuery library
          (when (bound-and-true-p modi/org-html-fancybox-jquery-library)
            (insert modi/org-html-fancybox-jquery-library))
          (forward-line 1)
          ;; Insert paths to fancybox css and js
          (when (bound-and-true-p modi/org-html-fancybox-html-header)
            (insert modi/org-html-fancybox-html-header))
          ;; Insert fancybox script in the html body
          (when (bound-and-true-p modi/org-html-fancybox-html-body)
            (insert modi/org-html-fancybox-html-body))
          (setq enable-fancybox t))
        ;; (message "Fancybox status: %s" enable-fancybox)
        (when enable-fancybox
          ;; Go back to top of the buffer
          (goto-char (point-min))
          ;; Search for [[FILE.png]] or [[FILE.jpg]] or
          ;;         or [[FILE.png][FILE.png]] or [[FILE.jpg][FILE.jpg]]
          (while (search-forward-regexp
                  (concat "^\\s-*\\[\\["
                          "\\(" modi/org-html-fancybox-img-file-prefix-regexp ":\\)*" ;; 1=file: 2=file
                          "\\(.*?\\)" ;; 3=img-highrez
                          "\\." modi/org-html-fancybox-img-file-regexp ;; 4=img-highrez-ext
                          "\\]\\s-*\\[*"
                          "\\(" modi/org-html-fancybox-img-file-prefix-regexp ":\\)*" ;; 5=file: 6=file
                          "\\(.*?\\)" ;; 7=img-thumb
                          "\\.*" modi/org-html-fancybox-img-file-regexp "*" ;; 8=img-thumb-ext
                          "\\]*"
                          "\\]")
                  nil 'noerror)
            (let* (file-prefix1 img-highrez img-highrez-ext
                                file-prefix2 img-thumb img-thumb-ext)
              (setq file-prefix1    (match-string-no-properties 1))
              (setq img-highrez     (match-string-no-properties 3))
              (setq img-highrez-ext (match-string-no-properties 4))
              (setq file-prefix2    (match-string-no-properties 5))
              (setq img-thumb       (match-string-no-properties 7))
              (setq img-thumb-ext   (match-string-no-properties 8))

              ;; (message "File prefixes: prefix 1: %s %s prefix 2: %s %s"
              ;;          file-prefix1 (string= file-prefix1 "")
              ;;          file-prefix2 (string= file-prefix2 ""))
              ;; (message "img-highrez: %s %s" img-highrez (string= img-highrez ""))
              ;; (message "img-highrez-ext: %s %s" img-highrez-ext (string= img-highrez-ext ""))
              ;; (message "img-thumb: %s %s" img-thumb (string= img-thumb ""))
              ;; (message "img-thumb-ext: %s %s %s"
              ;;          img-thumb-ext
              ;;          (string= img-thumb-ext "")
              ;;          (not (boundp 'img-thumb-ext)))
              ;; (message "%s %s %s %s %s %s %s %s \n"
              ;;          (match-string-no-properties 1)
              ;;          (match-string-no-properties 2)
              ;;          (match-string-no-properties 3)
              ;;          (match-string-no-properties 4)
              ;;          (match-string-no-properties 5)
              ;;          (match-string-no-properties 6)
              ;;          (match-string-no-properties 7)
              ;;          (match-string-no-properties 8))

              ;; If inserted image is of the style [[FILE.png]] or [[FILE.jpg]],
              ;; auto-populate the 'description' portion of image link so
              ;; that it translates to a hyper-linked inline image in HTML
              ;; NOTE: If the description part of the image link does not have
              ;; the a prefix like file:, the HTML export will show only a
              ;; hyper-linked image path instead of a hyper-linked inline image.
              ;; Source: http://orgmode.org/manual/Images-in-HTML-export.html
              (when (and (string= img-thumb "")
                         (string= img-thumb-ext nil))
                ;; (message "Here1")
                (setq img-thumb     img-highrez)
                (setq img-thumb-ext img-highrez-ext)
                (if (string= file-prefix1 nil)
                    (when modi/org-html-fancybox-force-inline-img
                      (setq file-prefix2 "file:"))
                  ;; set file-prefix2 equal to file-prefix1 if file-prefix1 is
                  ;; non-nil
                  (setq file-prefix2 file-prefix1))
                (forward-line 0)
                (when (looking-at ".*\\[\\[\\(.*\\)\\]\\]")
                  (replace-match (concat file-prefix1
                                         img-highrez
                                         modi/org-html-fancybox-img-highrez-suffix
                                         "." img-highrez-ext
                                         "]["
                                         file-prefix2
                                         img-thumb
                                         modi/org-html-fancybox-img-thumb-suffix
                                         "." img-thumb-ext)
                                 :fixedcase :literal nil 1)))
              ;; If the image link is of the type [[FILE.ext][FILE.ext]] and
              ;; if inline image option is forced, convert the image link to
              ;; [[FILE.ext][file:FILE.ext]]
              (when (and modi/org-html-fancybox-force-inline-img
                         (not (string= img-thumb ""))
                         (not (string= img-thumb-ext nil))
                         (string= file-prefix2 nil))
                (setq file-prefix2 "file:")
                (forward-line 0)
                (when (looking-at ".*\\[\\(.*\\)\\]\\]")
                  (replace-match (concat file-prefix2 img-highrez
                                         "." img-highrez-ext)
                                 :fixedcase :literal nil 1)))
              (forward-line 0)
              (open-line 1)
              (insert "#+ATTR_HTML: :class fancybox")
              (forward-line 2))))))))


;; Fix the issue of fci-mode and html export
(require 'ox-html)
(defun org-html-fontify-code (code lang)
  "Color CODE with htmlize library.
CODE is a string representing the source code to colorize.  LANG
is the language used for CODE, as a string, or nil."
  (when code
    (cond
     ;; Case 1: No lang.  Possibly an example block.
     ((not lang)
      ;; Simple transcoding.
      (org-html-encode-plain-text code))
     ;; Case 2: No htmlize or an inferior version of htmlize
     ((not (and (require 'htmlize nil t) (fboundp 'htmlize-region-for-paste)))
      ;; Emit a warning.
      (message "Cannot fontify src block (htmlize.el >= 1.34 required)")
      ;; Simple transcoding.
      (org-html-encode-plain-text code))
     (t
      ;; Map language
      (setq lang (or (assoc-default lang org-src-lang-modes) lang))
      (let* ((lang-mode (and lang (intern (format "%s-mode" lang)))))
	(cond
	 ;; Case 1: Language is not associated with any Emacs mode
	 ((not (functionp lang-mode))
	  ;; Simple transcoding.
	  (org-html-encode-plain-text code))
	 ;; Case 2: Default.  Fontify code.
	 (t
	  ;; htmlize
	  (setq code (with-temp-buffer
		       ;; Switch to language-specific mode.
		       (funcall lang-mode)
          ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                       (when (require 'fill-column-indicator nil 'noerror)
                         (fci-mode -1))
          ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
		       (insert code)
		       ;; Fontify buffer.
		       (font-lock-fontify-buffer)
		       ;; Remove formatting on newline characters.
		       (save-excursion
			 (let ((beg (point-min))
			       (end (point-max)))
			   (goto-char beg)
			   (while (progn (end-of-line) (< (point) end))
			     (put-text-property (point) (1+ (point)) 'face nil)
			     (forward-char 1))))
		       (org-src-mode)
		       (set-buffer-modified-p nil)
		       ;; Htmlize region.
		       (org-html-htmlize-region-for-paste
			(point-min) (point-max))))
	  ;; Strip any enclosing <pre></pre> tags.
	  (let* ((beg (and (string-match "\\`<pre[^>]*>\n*" code) (match-end 0)))
		 (end (and beg (string-match "</pre>\\'" code))))
	    (if (and beg end) (substring code beg end) code)))))))))

;; Remove HTML tags from the title string; otherwise the tags show up
;; verbatim in browser tabs3
(defun org-html--build-meta-info (info)
  "Return meta tags for exported document.
INFO is a plist used as a communication channel."
  (let ((protect-string
	 (lambda (str)
	   (replace-regexp-in-string
	    "\"" "&quot;" (org-html-encode-plain-text str))))
	(title (org-export-data (plist-get info :title) info))
	(author (and (plist-get info :with-author)
		     (let ((auth (plist-get info :author)))
		       (and auth
			    ;; Return raw Org syntax, skipping non
			    ;; exportable objects.
			    (org-element-interpret-data
			     (org-element-map auth
				 (cons 'plain-text org-element-all-objects)
			       'identity info))))))
	(description (plist-get info :description))
	(keywords (plist-get info :keywords))
	(charset (or (and org-html-coding-system
			  (fboundp 'coding-system-get)
			  (coding-system-get org-html-coding-system
					     'mime-charset))
		     "iso-8859-1")))
    (concat
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     ;; (format "<title>%s</title>\n" title) ;; ORIGINAL
     ;; Remove HTML tags from `title' string
     (format "<title>%s</title>\n"
             (replace-regexp-in-string ".*\\(<.*>\\).*" ""
                                       title :fixedcase :literal 1))
     ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     (when (plist-get info :time-stamp-file)
       (format-time-string
	 (concat "<!-- " org-html-metadata-timestamp-format " -->\n")))
     (format
      (if (org-html-html5-p info)
	  (org-html-close-tag "meta" " charset=\"%s\"" info)
	(org-html-close-tag
	 "meta" " http-equiv=\"Content-Type\" content=\"text/html;charset=%s\""
	 info))
      charset) "\n"
     (org-html-close-tag "meta" " name=\"generator\" content=\"Org-mode\"" info)
     "\n"
     (and (org-string-nw-p author)
	  (concat
	   (org-html-close-tag "meta"
			       (format " name=\"author\" content=\"%s\""
				       (funcall protect-string author))
			       info)
	   "\n"))
     (and (org-string-nw-p description)
	  (concat
	   (org-html-close-tag "meta"
			       (format " name=\"description\" content=\"%s\"\n"
				       (funcall protect-string description))
			       info)
	   "\n"))
     (and (org-string-nw-p keywords)
	  (concat
	   (org-html-close-tag "meta"
			       (format " name=\"keywords\" content=\"%s\""
				       (funcall protect-string keywords))
			       info)
	   "\n")))))

;; Rename the use of "Listings" term in HTML exports
(defun org-html-list-of-listings (info)
  "Build a list of listings.
INFO is a plist used as a communication channel.  Return the list
of listings as a string, or nil if it is empty."
  (let ((lol-entries (org-export-collect-listings info)))
    (when lol-entries
      (concat "<div id=\"list-of-listings\">\n"
	      (format "<h%d>%s</h%d>\n"
		      org-html-toplevel-hlevel
		      (org-html--translate "Code Snippets" info)
		      org-html-toplevel-hlevel)
	      "<div id=\"text-list-of-listings\">\n<ul>\n"
	      (let ((count 0)
		    (initial-fmt (format "<span class=\"listing-number\">%s</span>"
					 (org-html--translate "Code Snippet %d:" info))))
		(mapconcat
		 (lambda (entry)
		   (let ((label (org-element-property :name entry))
			 (title (org-trim
				 (org-export-data
				  (or (org-export-get-caption entry t)
				      (org-export-get-caption entry))
				  info))))
		     (concat
		      "<li>"
		      (if (not label)
			  (concat (format initial-fmt (incf count)) " " title)
			(format "<a href=\"#%s\">%s %s</a>"
				(org-export-solidify-link-text label)
				(format initial-fmt (incf count))
				title))
		      "</li>")))
		 lol-entries "\n"))
	      "\n</ul>\n</div>\n</div>"))))

;; Center align the tables when exporting to HTML
;; Note: This aligns the whole table, not the table columns
(setq org-html-table-default-attributes
      '(:border "2"
                :cellspacing "0"
                :cellpadding "6"
                :rules "groups"
                :frame "hsides"
                :align "center"
                :class "table-striped")) ;; this class requires bootstrap.css ( http://getbootstrap.com )
      ;; '(:border "2" :cellspacing "0" :cellpadding "6" :rules "groups" :frame "hsides"))

;; Customize the HTML postamble
(setq org-html-postamble t) ;; default value = 'auto
(setq org-html-postamble-format
      '(("en" "Exported using <div style=\"display: inline\" class=\"creator\">%c</div> on <div style=\"display: inline\"class=\"date\">%d</div> by %e.")))

;; (setq org-html-htmlize-output-type 'inline-css) ;; default
(setq org-html-htmlize-output-type 'css)
;; (setq org-html-htmlize-font-prefix "") ;; default
(setq org-html-htmlize-font-prefix "org-")

;; Implementing Markdown style link IDs in org-mode
;; Source: http://emacs.stackexchange.com/questions/594/how-to-implement-markdown-style-link-ids-in-org-mode
(org-add-link-type "linkid" 'endless/open-linkid-link 'endless/export-linkid-link)

(defun endless/open-linkid-link (path)
  "Follow an LINKID link to PATH."
  (browse-url (endless/find-linkid-link path)))

(defun endless/export-linkid-link (path desc format)
  "Create the export version of an LINKID link specified by LINK and DESC.
FORMATs understood are 'latex and 'html."
  (setq path (endless/find-linkid-link path))
  (cond
   ((eq format 'html)  (format "<a href=\"%s\">%s</a>" path desc))
   ((eq format 'latex) (format "\\href{%s}{%s}" path desc))
   ((eq format 'ascii) (format "[%s](%s)" desc path))
   (t desc)))

(defun endless/find-linkid-link (linkid &optional noerror)
  "Find \"#+LINK-ID: LINKID\" in current buffer and return the link.
Unless NOERROR is non-nil, throw an error if link not found."
  (save-excursion
    (goto-char (point-min))
    (let ((case-fold-search t))
      (when (search-forward-regexp
             (format "^#\\+LINK-ID: \\b%s\\b +\\(.*\\) *$" linkid)
             nil noerror)
        (match-string-no-properties 1)))))

;; Patched `org-ascii-link' function from `org-ascii.el'
;; Supports LINK TYPES added using `org-add-link-type'.
(setq org-ascii-links-to-notes nil)
(defun org-ascii-link (link desc info)
  "Transcode a LINK object from Org to ASCII.

DESC is the description part of the link, or the empty string.
INFO is a plist holding contextual information."
  (let* ((raw-link (org-element-property :raw-link link))
         (type (org-element-property :type link))
         (raw-path (replace-regexp-in-string
                    "%" "\\%" (org-element-property :path link) nil t))
         (path (cond
                ((member type '("http" "https" "ftp" "mailto"))
                 (concat type ":" raw-path))
                ((and (string= type "file") (file-name-absolute-p raw-path))
                 (concat "file:" raw-path))
                (t raw-path))))
    (cond
     ((string= type "coderef")
      (let ((ref (org-element-property :path link)))
	(format (org-export-get-coderef-format ref desc)
		(org-export-resolve-coderef ref info))))
     ;; Do not apply a special syntax on radio links.  Though, use
     ;; transcoded target's contents as output.
     ((string= type "radio") desc)
     ;; Do not apply a special syntax on fuzzy links pointing to
     ;; targets.
     ((string= type "fuzzy")
      (let ((destination (org-export-resolve-fuzzy-link link info)))
	(if (org-string-nw-p desc) desc
	  (when destination
	    (let ((number
		   (org-export-get-ordinal
		    destination info nil 'org-ascii--has-caption-p)))
	      (when number
		(if (atom number) (number-to-string number)
		  (mapconcat 'number-to-string number "."))))))))
     ;; Link type is handled by a special function.
     ((functionp (setq protocol (nth 2 (assoc type org-link-protocols))))
      (funcall protocol (org-link-unescape path) desc 'ascii))
     (t
      (if (not (org-string-nw-p desc))
          (format "[%s]" raw-link)
	(concat
	 (format "[%s]" desc)
	 (unless org-ascii-links-to-notes (format " (%s)" raw-link))))))))


(provide 'setup-org)

