1
(defun python-components-mode-list-actives (&optional directory)
2
"Return a list, which components will be loaded. "
4
(let ((directory (or directory default-directory))
6
(find-file (concat directory "python-components-mode.el"))
9
(goto-char (point-min))
10
(while (re-search-forward "^[ \t]*(require '\\([^)]+\\))" nil (quote move) 1)
11
(when (save-match-data
12
(string-match "python-components" (match-string-no-properties 0)))
13
(add-to-list 'componentslist (prin1-to-string (match-string-no-properties 1)))))
14
(dolist (ele componentslist)
15
(find-file (concat directory ele)
16
(finds (concat ele ".el")))))))
18
(defun finds-from-programm ()
19
(let ((directory-in default-directory)
20
(directory-out (concat default-directory "doc"))
21
(erg (concat default-directory "python-mode.el"))
22
(buffer (current-buffer)))
23
(message "Lade %s" erg)
25
(finds buffer directory-in directory-out)))
27
(defun finds (&optional buffer directory-in directory-out)
28
"List all commands in file alongside with their documentation. "
30
(let* ((oldbuf (buffer-name (or buffer (current-buffer))))
31
(file (buffer-file-name))
32
(orgname (concat (substring oldbuf 0 (string-match "\\." oldbuf)) ".org"))
33
(reSTname (concat (substring oldbuf 0 (string-match "\\." oldbuf)) ".rst"))
34
(directory-in (or directory-in default-directory))
35
(directory-out-prepare
38
(string-match ".+/$" directory-out)
40
(concat directory-out "/"))
42
(directory-out (unless (and directory-out (string-match ".*/doc" directory-out)) (concat directory-out-prepare "doc/"))))
43
(finds-base oldbuf file orgname reSTname directory-in directory-out)))
45
(defun finds-base (oldbuf file orgname reSTname directory-in directory-out)
49
(goto-char (point-min))
51
(while (re-search-forward "^[ \t]*(defun +\\(\\w+\\|\\s_+\\)+" nil t)
52
(goto-char (match-beginning 1))
53
(when (commandp (symbol-at-point))
54
(lexical-let* ((name (symbol-at-point))
55
(docu (documentation name)))
56
(unless docu (message "don't see docu string for %s" (prin1-to-string name)))
57
(add-to-list 'commandslist (cons (prin1-to-string name) docu))
58
;; (message "%s" (car commandslist))
60
(setq commandslist (nreverse commandslist))
62
(switch-to-buffer (current-buffer))
63
(insert (concat ";; a list of " oldbuf " commands
64
\(setq " oldbuf "-commands (quote "))
65
(insert (prin1-to-string commandslist))
68
(write-file (concat directory-out "commands-" (concat (substring oldbuf 0 (string-match "\\." oldbuf)) ".el"))))
71
(insert (concat (capitalize (substring oldbuf 0 (string-match "\." oldbuf))) " commands" "\n\n"))
72
(dolist (ele commandslist)
73
(insert (concat "* "(car ele) "\n"))
74
(insert (concat " " (cdr ele) "\n")))
75
(write-file (concat directory-out "commands-" orgname))
76
(find-file (concat directory-out "commands-" orgname)))
79
(insert (concat (capitalize (substring oldbuf 0 (string-match "\." oldbuf))) " commands" "\n"))
80
(insert (concat (make-string (length (concat (substring oldbuf 0 (string-match "\." oldbuf)) " commands")) ?\=) "\n\n"))
81
(dolist (ele commandslist)
82
(insert (concat (car ele) "\n"))
83
(insert (concat (make-string (length (car ele)) ?\-) "\n"))
84
(insert (concat (cdr ele) "\n\n")))
85
(write-file (concat directory-out "commands-" reSTname))
86
(find-file (concat directory-out "commands-" reSTname))))))
87
;; (dolist (ele commandslist)))