Subject: bug#27978: Detection of section name in man.el

From: Grégory Mounié <[email-masked]>
Date: Sun, 6 Aug 2017 01:44:19 +0200

When parsing manual in languages with non-ascii letters, the section 
names using non-ascii letters are not added to the table of content.

  I noticed the bug reading the French bash manual: the quite useful 
"COMMANDES INTERNES DE l'INTERPRÉTEUR" section does not appear (SHELL 
BUILTIN COMMAND). (because of the É letter)

  I propose to use Character class instead of ascii interval in the 
appropriate regexp defvar. It should not change anything for english 
manual and it should work for many other languages.

  It works great for the bash manual in French.
  Grégory Mounié
>From f9f8b027bcec6fe7aec2c0009eecdcd7e8880292 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9gory=20Mouni=C3=A9?= <[email-masked]>
Date: Sun, 6 Aug 2017 01:22:58 +0200
Subject: [PATCH] Unicode support for man section name detection

* lisp/man.el: Replace ascii interval by character class in
order to detect correctly the section names in the table of
content (eg. in the french version of the  bash manual).

Copyright-paperwork-exempt: yes
---
 lisp/man.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/man.el b/lisp/man.el
index 0e1c92956b..97a4758e7e 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -278,21 +278,21 @@ Man-cooked-hook
   :type 'hook
   :group 'man)
 
-(defvar Man-name-regexp "[-a-zA-Z0-9_+][-a-zA-Z0-9_.:+]*"
+(defvar Man-name-regexp "[-[:alnum:]_+][-[:alnum:]_.:+]*"
   "Regular expression describing the name of a manpage (without section).")
 
-(defvar Man-section-regexp "[0-9][a-zA-Z0-9+]*\\|[LNln]"
+(defvar Man-section-regexp "[[:digit:]][[:alnum:]+]*\\|[LNln]"
   "Regular expression describing a manpage section within parentheses.")
 
 (defvar Man-page-header-regexp
   (if (string-match "-solaris2\\." system-configuration)
-      (concat "^[-A-Za-z0-9_].*[ \t]\\(" Man-name-regexp
+      (concat "^[-[:alnum:]_].*[ \t]\\(" Man-name-regexp
 	      "(\\(" Man-section-regexp "\\))\\)$")
     (concat "^[ \t]*\\(" Man-name-regexp
 	    "(\\(" Man-section-regexp "\\))\\).*\\1"))
   "Regular expression describing the heading of a page.")
 
-(defvar Man-heading-regexp "^\\([A-Z][A-Z0-9 /-]+\\)$"
+(defvar Man-heading-regexp "^\\([[:upper:]][[:upper:][:digit:] /-]+\\)$"
   "Regular expression describing a manpage heading entry.")
 
 (defvar Man-see-also-regexp "SEE ALSO"
-- 
2.13.3