Skip to content

Commit a5133f6

Browse files
committed
docs: more docstrings
1 parent 84daead commit a5133f6

File tree

3 files changed

+49
-12
lines changed

3 files changed

+49
-12
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ display in a read-only window.
126126
### Full Validation
127127

128128
* Command `sdml-mode-validate-current-buffer` has the default binding `C-c C-s v`.
129-
* Command `sdml-mode-validate` has the default binding `C-c C-s M-v`.
129+
* Command `sdml-mode-validate-file` has the default binding `C-c C-s M-v`.
130130
* The variable `sdml-mode-validation-level` denotes the level of messages produced
131131
by the validator, with a default of `warnings`.
132132
* The output uses the standard `compilation-mode` with all the common bindings are
@@ -169,11 +169,12 @@ or the keyword `"forall"` replaced with the Unicode `∀`.
169169
* `C-c C-s d` -- open the tree-sitter debug view
170170
* `C-c C-s q` -- open the tree-sitter query builder
171171
* `C-c C-s t` -- open a dependency tree view for the current buffer
172+
* `C-c C-s M-t` -- open a dependency graph image for the current buffer
172173
* `C-c C-s v` -- run the validator, on the current buffer, and show the results in
173174
a compilation window
174175
* `C-c C-s M-v` -- run the validator, on a specified file, and show the results in
175176
a compilation window
176-
* `C-c C-s T` -- run u-ctags for the current project
177+
* `C-c C-s g` -- run u-ctags for the current project
177178

178179
## Add-Ons
179180

sdml-mode-ctags.el

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,20 @@
6363

6464
(defun sdml-mode-ctags-tag-file-path (&optional file-path)
6565
"Return a path to a tag file for the current buffer.
66-
If FILE-PATH is provided the tag file is found relative to that
67-
path instead."
66+
67+
If FILE-PATH is not provided the file name of the current buffer is used
68+
instead.
69+
70+
If the `company-ctags' package is loaded, use the function
71+
`company-ctags-find-table' to find a tag file location.
72+
73+
If the `projectile' package is loaded, use the variable
74+
`projectile-project-root' to determine the directory in which to
75+
put the tag file named `sdml-mode-ctags-output-file-name'.
76+
77+
If neither of these are present the directory containing FILE-NAME
78+
will be used as the location for the tag file named
79+
`sdml-mode-ctags-output-file-name'."
6880
(let* ((current-buffer-dir (file-name-directory
6981
(or file-path (buffer-file-name))))
7082
(fallback (concat current-buffer-dir
@@ -78,29 +90,47 @@ path instead."
7890
(t fallback))))
7991

8092
(defun sdml-mode-ctags-generate ()
81-
"Generate a TAGS file for the current SDML project."
93+
"Generate a TAGS file for the current SDML project.
94+
95+
This command executes the Universal Ctags executable specified in
96+
`sdml-mode-ctags-command' to create a tag file determined by the
97+
function `sdml-mode-ctags-tag-file-path'."
8298
(interactive)
8399
(let ((tag-file-path (sdml-mode-ctags-tag-file-path)))
84100
(shell-command (format "%s -R -e -o %s" sdml-mode-ctags-command tag-file-path))))
85101

102+
103+
;; --------------------------------------------------------------------------
104+
;; Key Bindings
105+
;; --------------------------------------------------------------------------
106+
107+
(defvar sdml-mode-ctags-mode-map
108+
(let ((map (make-sparse-keymap)))
109+
(define-key map (kbd "C-c C-s g") 'sdml-mode-ctags-generate))
110+
"Key map for SDML ctags minor mode.")
111+
112+
86113
;; --------------------------------------------------------------------------
87114
;; Ctags Minor Mode
88115
;; --------------------------------------------------------------------------
89116

90117
;;;###autoload
91118
(define-minor-mode
92119
sdml-mode-ctags-mode
93-
"Minor mode to provide tagging of SDML source."
120+
"Minor mode to provide tagging of SDML source.
121+
122+
Key bindings:
123+
\\{sdml-mode-ctags-mode-map}"
94124

95125
:group 'sdml
96126

97127
:tag "Enable SDML tagging minor mode"
98128

99129
:lighter nil
100130

101-
(let ((map (make-sparse-keymap)))
102-
(define-key map (kbd "C-c C-s T") 'sdml-mode-ctags-generate)
103-
(add-to-list 'minor-mode-map-alist (cons 'sdml-mode-ctags-mode map)))
131+
(add-to-list 'minor-mode-map-alist
132+
(cons 'sdml-mode-ctags-mode
133+
sdml-mode-ctags-mode-map))
104134

105135
(when (featurep 'company-ctags)
106136
(add-to-list 'company-ctags-modes 'sdml-mode)))

sdml-mode.el

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,20 @@
8686
;;
8787

8888
;; `sdml-mode-validate-current-buffer' (\\[sdml-mode-validate-current-buffer]) to
89-
;; validate and show errors for the buffer's current module.
89+
;; validate and show errors for the current buffer's module.
9090
;;
91-
;; Adding this as a save-hook allows validation on every save of a buffer.
91+
;; Adding this as a save-hook allows validation on every save of a buffer.
9292
;;
9393
;; `(add-hook 'after-save-hook 'sdml-validate-current-buffer)'
9494
;;
95+
;; `sdml-mode-validate-file' (\\[sdml-mode-validate-file]) to
96+
;; validate and show errors for a specified file name.
97+
;;
9598
;; `sdml-mode-current-buffer-dependency-tree' (\\[sdml-mode-current-buffer-dependency-tree])
96-
;; to display the dependencies of the curtent buffer's module.
99+
;; to display the dependencies of the current buffer's module as a textual tree.
100+
;;
101+
;; `sdml-mode-current-buffer-dependency-graph' (\\[sdml-mode-current-buffer-dependency-graph])
102+
;; to display the dependencies of the current buffer's module as an SVG directed graph.
97103
;;
98104

99105
;; Extensions

0 commit comments

Comments
 (0)