]> git.notmuchmail.org Git - notmuch/blobdiff - emacs/rstdoc.el
emacs: use lexical-bindings in all libraries
[notmuch] / emacs / rstdoc.el
index 41390bbef5d223acf32f4fa750f375adcbc9e4af..c7c130154a582841b084343f38787431e0bbe77a 100644 (file)
@@ -1,4 +1,4 @@
-;;; rstdoc.el --- help generate documentation from docstrings -*-lexical-binding: t-*-
+;;; rstdoc.el --- help generate documentation from docstrings  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2018 David Bremner
 
@@ -32,8 +32,6 @@
 
 ;;; Code:
 
-(provide 'rstdoc)
-
 (defun rstdoc-batch-extract ()
   "Extract docstrings to and from the files on the command line."
   (apply #'rstdoc-extract command-line-args-left))
@@ -42,6 +40,7 @@
   "Write docstrings from IN-FILE to OUT-FILE."
   (load-file in-file)
   (let* ((definitions (cdr (assoc (expand-file-name in-file) load-history)))
+        (text-quoting-style 'grave)
         (doc-hash (make-hash-table :test 'eq)))
     (mapc
      (lambda (elt)
   (insert "\n"))
 
 (defvar rst--escape-alist
-  '(("\\\\='" . "\\\\'")
-    ("\\([^\\]\\)'" . "\\1`")
-    ("^[[:space:]\t]*$" . "|br|")
-    ("^[[:space:]\t]" . "|indent| "))
-  "List of (regex . replacement) pairs.")
+  '( ("\\\\='" . "\001")
+     ("`\\([^\n`']*\\)[`']" . "\002\\1\002") ;; good enough for now...
+     ("`" . "\\\\`")
+     ("\001" . "'")
+     ("\002" . "`")
+     ("^[[:space:]]*$" . "|br|")
+     ("^[[:space:]]" . "|indent| "))
+    "list of (regex . replacement) pairs")
 
 (defun rstdoc--rst-quote-string (str)
   (with-temp-buffer
@@ -82,4 +84,6 @@
        (replace-match (cdr pair))))
     (buffer-substring (point-min) (point-max))))
 
+(provide 'rstdoc)
+
 ;;; rstdoc.el ends here