 ;; `outline' (not `outshine') library is loaded.
 
 (use-package outshine
-  :config
+    :config
   (progn
     (setq outshine-use-speed-commands t)
     (setq outshine-org-style-global-cycling-at-bob-p t)
 
-    ;; Source: http://emacs.stackexchange.com/a/2803/115
-    (defun modi/outshine-table-of-contents ()
-      "Create a table of content for outshine headers
-Insert/update the TOC after the line that has the \"// Contents:\" string.
-Don't add \"Revision Control\" heading to TOC.
-"
+    ;; http://emacs.stackexchange.com/a/2803/115
+    (defun modi/outline-table-of-contents ()
+      "Create a table of content for outshine headers.
+Insert/update the TOC after the line that has the “// Contents:” string.
+Here “//” represents 2 comment start characters for any major mode.
+Don't add “Revision Control” heading to TOC."
       (interactive)
       (save-excursion
         (goto-char (point-min))
-        (let* ((headings-list nil)
-               (stars-list nil)
-               heading)
+        (let ((outline-comment-start (concat "^" ; beginning of line
+                                             "\\(\\(\\s<\\|"
+                                             (substring comment-start 0 1)
+                                             "\\)\\{2\\}\\)")) ; 2 comment chars
+              parsed-outline-comment-start
+              headings-list stars-list
+              heading star)
+          ;; (message "%s" outline-comment-start)
           (while (search-forward-regexp
-                  "^// \\*\\(\\**\\) \\(.+\\)" nil :noerror)
-            (setq star    (match-string 1))
-            (setq heading (match-string 2))
-            (message "%s %s" star heading)
+                  (concat outline-comment-start " " ; followed by space
+                          "\\*\\(\\**\\) " ; one or more * chars followed by space
+                          "\\(.+\\)") ; followed by heading
+                  nil :noerror)
+            (setq parsed-outline-comment-start (match-string 1))
+            (setq star                         (match-string 3))
+            (setq heading                      (match-string 4))
+            ;; (message "%s %s %s" parsed-outline-comment-start star heading)
             (when (not (string= heading "Revision Control"))
               (setq stars-list    (cons star stars-list))
               (setq headings-list (cons heading headings-list))))

     ("<M-down>" . nil)
     ("M-n"      . outline-next-visible-heading))

    (key-chord-define outline-minor-mode-map "JJ" 'outshine-imenu)))


(provide 'setup-outshine)

;; Time-stamp: <2015-02-25 15:52:06 kmodi>

;; Outshine
;; https://github.com/tj64/outshine
