Remove dead code from examples-to-info.el

* dev/examples-to-info.el (docs--chop-prefix, docs--chop-suffix)
(github-id, function-summary): Remove unused functions.
(function-to-node): Remove redundant conditions.
master
Basil L. Contovounesios 5 years ago
parent 926eb0b9fc
commit dbbf617c28
No known key found for this signature in database
GPG Key ID: 205AB54A5D5D8CFF
  1. 34
      dev/examples-to-info.el

@ -105,8 +105,8 @@ Based on `describe-function-1'."
it t t))))
(defun function-to-node (function)
(when (and (stringp function)
(string-match "^\\(### [[:upper:]][[:alpha:]- ]+\\)$" function))
(let ((case-fold-search nil))
(string-match "^\\(### [[:upper:]][[:alpha:]- ]+\\)$" function)
(concat (s-replace "### " "* " (match-string 1 function)) "::")))
(defun function-to-info (function)
@ -128,40 +128,10 @@ Based on `describe-function-1'."
(format-docstring docstring)
(mapconcat 'identity (-take 3 examples) "\n")))))
(defun docs--chop-prefix (prefix s)
"Remove PREFIX if it is at the start of S."
(let ((pos (length prefix)))
(if (and (>= (length s) (length prefix))
(string= prefix (substring s 0 pos)))
(substring s pos)
s)))
(defun docs--chop-suffix (suffix s)
"Remove SUFFIX if it is at end of S."
(let ((pos (- (length suffix))))
(if (and (>= (length s) (length suffix))
(string= suffix (substring s pos)))
(substring s 0 pos)
s)))
(defun github-id (command-name signature)
(docs--chop-suffix
"-"
(replace-regexp-in-string "[^a-zA-Z0-9-]+" "-" (docs--chop-prefix
"!"
(format "%S %S" command-name signature)))))
(defun s-replace (old new s)
"Replace OLD with NEW in S."
(replace-regexp-in-string (regexp-quote old) new s t t))
(defun function-summary (function)
(if (stringp function)
(concat "\n" function "\n")
(let ((command-name (car function))
(signature (cadr function)))
(format "* [%s](#%s) `%s`" command-name (github-id command-name signature) signature))))
(defun simplify-quotes ()
(goto-char (point-min))
(while (re-search-forward (rx (or "'nil" "(quote nil)")) nil t)

Loading…
Cancel
Save