{"id":11350,"date":"2023-05-12T13:01:15","date_gmt":"2023-05-12T17:01:15","guid":{"rendered":"https:\/\/irreal.org\/blog\/?p=11350"},"modified":"2023-05-12T17:57:07","modified_gmt":"2023-05-12T21:57:07","slug":"generating-documents-directly-from-elisp","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=11350","title":{"rendered":"Generating Documents Directly From Elisp"},"content":{"rendered":"<p>I\u2019ve had this in my blog queue since April but it\u2019s too good to let it fall into the bit bucket. \u00c1lvaro Ram\u00edrez has a problem with his <code>chatgpt-shell<\/code> package. He has some documentation in the form of tables, which are easy enough to generate but the package is still under development and the documentation is always changing.<\/p>\n<p>Ram\u00edrez realized that Emacs is the self-documenting editor so it should be <a href=\"https:\/\/xenodium.com\/generating-elisp-org-docs\/\">possible to generate the documentation directly from the Elisp<\/a>. That way, every time he updates the code, the documentation can be automatically regenerated. He had no idea how to do that but the nice thing about Emacs is that there are no secrets. He checked how the apropos commands gathered this information.<\/p>\n<p>It turned out not to be too hard. The secret is to use the <code>mapatoms<\/code> command to cycle through the obarray that contains all the symbols in the current Emacs instance. Then it\u2019s just a matter of checking if the symbol is for <code>chatgpt-shell<\/code> and is a custom variable. Grabbing the documentation for functions is similar. You can check out the code for both in Ram\u00edrez\u2019s post.<\/p>\n<p>There\u2019s nothing specific to <code>chatgpt-shell<\/code> in any of this. You can use the same code, <i>mutatis mutandis<\/i>, for any package so it\u2019s a worthwhile technique to know. If you\u2019re maintaining a package and have even minimal documentation, you should definitely take a look at Ram\u00edrez\u2019s post.<\/p>\n<p><b>UPDATE<\/b> <span class=\"timestamp-wrapper\"><span class=\"timestamp\">[2023-05-12 Fri]<\/span><\/span>: Just noticed that I forgot the link to Ram\u00edrez\u2019s post. Fixed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I\u2019ve had this in my blog queue since April but it\u2019s too good to let it fall into the bit bucket. \u00c1lvaro Ram\u00edrez has a problem with his chatgpt-shell package. He has some documentation in the form of tables, which &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=11350\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[18,4],"class_list":["post-11350","post","type-post","status-publish","format-standard","hentry","category-programming","tag-emacs","tag-org-mode"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11350","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11350"}],"version-history":[{"count":4,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11350\/revisions"}],"predecessor-version":[{"id":11354,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11350\/revisions\/11354"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}