From: David Bremner <david@tethera.net>
Date: Sun, 31 Jul 2022 11:33:20 +0000 (-0300)
Subject: doc/emacs: split index category from label
X-Git-Tag: 0.37_rc0~5
X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=174221b179380ec76b34088cdf9cb694ecacf241;p=notmuch

doc/emacs: split index category from label

A more verbose category is needed for the index, but not the
description in the manual.
---

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))