[PATCH 4/7] doc/emacs: split index category from label

Subject:[PATCH 4/7] doc/emacs: split index category from label

Date:Sun, 31 Jul 2022 08:33:20 -0300

To:notmuch@notmuchmail.org

Cc:

From:David Bremner


A more verbose category is needed for the index, but not the
description in the manual.
---
 doc/elisp.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/doc/elisp.py b/doc/elisp.py
index b8b4931b..1b0392e6 100644
--- a/doc/elisp.py
+++ b/doc/elisp.py
@@ -110,6 +110,13 @@ class EmacsLispSymbol(ObjectDescription):
         'defface': 'face'
     }
 
+    category_for_objtype = {
+        'defcustom': 'Emacs variable (customizable)',
+        'defconst': 'Emacs constant',
+        'defvar': 'Emacs variable',
+        'defface': 'Emacs face'
+    }
+
     @property
     def cell(self):
         """The cell in which to store symbol metadata."""
@@ -120,6 +127,11 @@ class EmacsLispSymbol(ObjectDescription):
         """The label for the documented object type."""
         return self.objtype
 
+    @property
+    def category(self):
+        """Index category"""
+        return self.category_for_objtype[self.objtype]
+
     def handle_signature(self, signature, signode):
         """Create nodes in ``signode`` for the ``signature``.
 
@@ -137,7 +149,7 @@ class EmacsLispSymbol(ObjectDescription):
 
     def _add_index(self, name, target):
         index_text = '{name}; {label}'.format(
-            name=name, label=self.label)
+            name=name, label=self.category)
         self.indexnode['entries'].append(
             ('pair', index_text, target, '', None))
 
-- 
2.35.2

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: