Skip to content

Commit ccb2f4d

Browse files
authored
Merge pull request #62 from 40ants/fix-ignore-symbol2
Fixed a warning "These symbols are external, but not documented" show…
2 parents 9eb0e14 + 716a47c commit ccb2f4d

File tree

4 files changed

+95
-76
lines changed

4 files changed

+95
-76
lines changed

full/doc.lisp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,8 @@ See full list of changes in the 40ANTS-DOC/CHANGELOG::@CHANGELOG section.
474474
(40ants-doc:*symbols-with-ignored-missing-locations* variable)
475475
(40ants-doc/ignored-words:ignored-words generic-function)
476476
(40ants-doc/ignored-words:supports-ignored-words-p generic-function)
477-
(40ants-doc/ignored-words:ignore-words-in-package macro))
477+
(40ants-doc/ignored-words:ignore-words-in-package macro)
478+
(40ants-doc/ignored-words:ignore-in-package function))
478479

479480

480481
(defsection @cross-referencing (:title "Cross-referencing")

src/autodoc.lisp

Lines changed: 81 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#:registered-subsections
1919
#:register-subsection
2020
#:with-subsection-collector)
21+
(:import-from #:40ants-doc/ignored-words
22+
#:ignore-in-package)
2123
(:export #:defautodoc)
2224
(:documentation "This module is not included into asd file because it requires additional dependencies."))
2325
(in-package #:40ants-doc/autodoc)
@@ -120,81 +122,86 @@
120122

121123
(defun make-package-section (section-name package &key (ignore-symbol-p 'starts-with-percent-p))
122124
(declare (optimize (debug 3)))
123-
(let* ((package-name (package-name package))
124-
(title package-name)
125-
(accessors-and-readers (package-accessors-and-writers package
126-
:ignore-symbol-p ignore-symbol-p))
127-
(entries (loop for symbol being the external-symbols of package
128-
for should-be-documented = (not (funcall ignore-symbol-p
129-
symbol))
130-
;; Usual functions
131-
when (and (fboundp symbol)
132-
should-be-documented
133-
(not (macro-function symbol))
134-
(not (typep (symbol-function symbol) 'generic-function)))
135-
collect (list symbol 'function) into functions
136-
137-
;; Generic functions
138-
when (and (fboundp symbol)
139-
should-be-documented
140-
(typep (symbol-function symbol) 'generic-function)
141-
(not (member symbol accessors-and-readers
142-
:test 'eql)))
143-
collect (list symbol 'generic-function) into generics
144-
145-
;; Macroses
146-
when (and (fboundp symbol)
147-
should-be-documented
148-
(macro-function symbol))
149-
collect (list symbol 'macro) into macros
150-
151-
;; Classes
152-
when (and (find-class symbol nil)
153-
should-be-documented)
154-
collect (make-class-entry symbol package-name
155-
:ignore-symbol-p ignore-symbol-p)
156-
into classes
157-
158-
;; Variables
159-
when (and (documentation symbol 'variable)
160-
should-be-documented)
161-
collect (list symbol 'variable) into variables
162-
163-
;; Types and not classes
164-
when (and (not (find-class symbol nil))
165-
should-be-documented
166-
(or (documentation symbol 'type)
167-
(not (eq (swank-backend:type-specifier-arglist symbol)
168-
:not-available))))
169-
collect (list symbol 'type) into types
125+
(flet ((ignore-symbol-p-wrapper (symbol)
126+
(when (and ignore-symbol-p
127+
(funcall ignore-symbol-p symbol))
128+
(ignore-in-package symbol :package package)
129+
(values t))))
130+
131+
(let* ((package-name (package-name package))
132+
(title package-name)
133+
(accessors-and-readers (package-accessors-and-writers package
134+
:ignore-symbol-p #'ignore-symbol-p-wrapper))
135+
(entries (loop for symbol being the external-symbols of package
136+
for should-be-documented = (not (ignore-symbol-p-wrapper symbol))
137+
;; Usual functions
138+
when (and (fboundp symbol)
139+
should-be-documented
140+
(not (macro-function symbol))
141+
(not (typep (symbol-function symbol) 'generic-function)))
142+
collect (list symbol 'function) into functions
143+
144+
;; Generic functions
145+
when (and (fboundp symbol)
146+
should-be-documented
147+
(typep (symbol-function symbol) 'generic-function)
148+
(not (member symbol accessors-and-readers
149+
:test 'eql)))
150+
collect (list symbol 'generic-function) into generics
151+
152+
;; Macroses
153+
when (and (fboundp symbol)
154+
should-be-documented
155+
(macro-function symbol))
156+
collect (list symbol 'macro) into macros
157+
158+
;; Classes
159+
when (and (find-class symbol nil)
160+
should-be-documented)
161+
collect (make-class-entry symbol package-name
162+
:ignore-symbol-p #'ignore-symbol-p-wrapper)
163+
into classes
164+
165+
;; Variables
166+
when (and (documentation symbol 'variable)
167+
should-be-documented)
168+
collect (list symbol 'variable) into variables
169+
170+
;; Types and not classes
171+
when (and (not (find-class symbol nil))
172+
should-be-documented
173+
(or (documentation symbol 'type)
174+
(not (eq (swank-backend:type-specifier-arglist symbol)
175+
:not-available))))
176+
collect (list symbol 'type) into types
170177

171-
finally (return
172-
(uiop:while-collecting (collect)
173-
(flet ((add-subsection (entries title)
174-
(let* ((section-name (symbolicate "@"
175-
package-name
176-
"?"
177-
title
178-
"-SECTION")))
179-
(when entries
180-
(register-subsection
181-
`(defsection ,section-name (:title ,title
182-
:package ,package-name)
183-
,@(sort (copy-list entries)
184-
#'string<
185-
:key #'first)))
186-
(collect `(,section-name section))))))
187-
(add-subsection classes "Classes")
188-
(add-subsection generics "Generics")
189-
(add-subsection functions "Functions")
190-
(add-subsection macros "Macros")
191-
(add-subsection types "Types")
192-
(add-subsection variables "Variables")))))))
193-
(when entries
194-
`(defsection ,section-name (:title ,title
195-
:package ,package-name)
196-
(,(symbolicate package-name) package)
197-
,@entries))))
178+
finally (return
179+
(uiop:while-collecting (collect)
180+
(flet ((add-subsection (entries title)
181+
(let* ((section-name (symbolicate "@"
182+
package-name
183+
"?"
184+
title
185+
"-SECTION")))
186+
(when entries
187+
(register-subsection
188+
`(defsection ,section-name (:title ,title
189+
:package ,package-name)
190+
,@(sort (copy-list entries)
191+
#'string<
192+
:key #'first)))
193+
(collect `(,section-name section))))))
194+
(add-subsection classes "Classes")
195+
(add-subsection generics "Generics")
196+
(add-subsection functions "Functions")
197+
(add-subsection macros "Macros")
198+
(add-subsection types "Types")
199+
(add-subsection variables "Variables")))))))
200+
(when entries
201+
`(defsection ,section-name (:title ,title
202+
:package ,package-name)
203+
(,(symbolicate package-name) package)
204+
,@entries)))))
198205

199206

200207
(defun make-entries (system &key

src/changelog.lisp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@
155155
"CLEAN-URLS"
156156
;; These objects are not documented yet:
157157
"40ANTS-DOC/COMMONDOC/XREF:XREF"))
158+
(0.24.2 2025-05-26
159+
"* Fixed a warning \"These symbols are external, but not documented\" shown for symboles ignored by passing IGNORE-SYMBOL-P argument.")
158160
(0.24.1 2025-05-26
159161
"* Fixed a bug when class slot accessor or reader was not filtered using a custom function passed as IGNORE-SYMBOL-P argument.")
160162
(0.24.0 2025-05-12

src/ignored-words.lisp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
(:export
44
#:ignored-words
55
#:supports-ignored-words-p
6-
#:ignore-words-in-package))
6+
#:ignore-words-in-package
7+
#:ignore-in-package))
78
(in-package #:40ants-doc/ignored-words)
89

910

@@ -25,6 +26,13 @@
2526
(gethash obj *package-ignore-words*)))
2627

2728

29+
(defun ignore-in-package (symbol-or-string &key (package *package*))
30+
"Adds SYMBOL-OR-STRING to the list of symbols ignored in the given PACKAGE."
31+
(pushnew symbol-or-string
32+
(gethash package *package-ignore-words*)
33+
:test #'equal))
34+
35+
2836
(defmacro ignore-words-in-package (&rest symbols-or-strings)
2937
"Adds given symbols or string to ignore list bound to the current package.
3038
@@ -43,3 +51,4 @@
4351
(member symbol-or-string
4452
(gethash package *package-ignore-words*)
4553
:test #'equal))
54+

0 commit comments

Comments
 (0)