]> git.eshelyaron.com Git - emacs.git/commitdiff
; Fix documentation of recent additions to treesit.el
authorEli Zaretskii <eliz@gnu.org>
Wed, 25 Dec 2024 18:52:45 +0000 (20:52 +0200)
committerEshel Yaron <me@eshelyaron.com>
Fri, 27 Dec 2024 15:34:07 +0000 (16:34 +0100)
* lisp/treesit.el (treesit-language-display-name-alist)
(treesit-language-display-name): Doc fixes.

* etc/NEWS: Fix wording of entry announcing the above.

(cherry picked from commit e96727f0ea0986bffe7ff235e5abc5354e63a64d)

etc/NEWS
lisp/treesit.el

index 4882689aba833ecba92ce0a5bfba69aaa0645045..c3bbc8250307b1b4f658aadc2c126685efacea9b 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -834,10 +834,10 @@ it uses `forward-sexp-default-function'.
 
 +++
 *** New function 'treesit-language-display-name'.
-New function that returns the display name given the language symbol.
-For example, 'cpp' is translated to "C++".  Also adds a new variable
-'treesit-language-display-name-alist' that the function uses to
-translate display names.
+This new function returns the display name of a language given the
+language symbol.  For example, 'cpp' is translated to "C++".  A new
+variable 'treesit-language-display-name-alist' holds the translations of
+language symbols where that translation is not trivial.
 
 +++
 *** New command 'treesit-explore'
index b18e8e281cedde0ae25e5666c3a3d2d3199dffd0..d29b84be73982ac361348d33b9def79a18b4302b 100644 (file)
@@ -850,17 +850,18 @@ omitted, default END to BEG."
     )
   "An alist mapping language symbols to their display names.
 
-Used by `treesit-language-display-name'.  If there's no mapping in this
-alist, `treesit-language-display-name' converts the symbol to display
-name by capitalizing the first letter.  So languages like Java,
-Javascript, Rust don't need an entry in this variable.")
+Used by `treesit-language-display-name'.  If there's no mapping for a
+lamguage in this alist, `treesit-language-display-name' converts the
+symbol to the display name by capitalizing the first letter of the
+symbol's name.  Thus, languages like Java, Javascript, Rust don't need
+an entry in this variable.")
 
 (defun treesit-language-display-name (language)
-  "Returns the display name (a string) of LANGUAGE.
+  "Return the display name (a string) of LANGUAGE (a symbol).
 
 If LANGUAGE has an entry in `treesit-language-display-name-alist', use
-the display name in their.  Otherwise, capitalize the first letter of
-LANGUAGE and return the string."
+the display name from there.  Otherwise, capitalize the first letter of
+LANGUAGE's name and return the resulting string."
   (or (alist-get language treesit-language-display-name-alist)
       (capitalize (symbol-name language))))