[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#23798: 25.0.90; Underscore for emphasis in Info?
From: |
Eli Zaretskii |
Subject: |
bug#23798: 25.0.90; Underscore for emphasis in Info? |
Date: |
Sun, 03 Jul 2016 06:34:22 +0300 |
> Date: Sat, 2 Jul 2016 13:59:54 -0700 (PDT)
> From: Drew Adams <drew.adams@oracle.com>
> Cc: 23798@debbugs.gnu.org
>
> FWIW -
>
> In my own code I'm using this regexp now (by default - a user option):
>
> "_\\(\\(\\sw\\(\\s-\\|\\sw\\|\\s.\\)*\\)\\|\\(\\(\\s-\\|\\sw\\|\\s.\\)\\sw*\\)\\)_"
>
> It matches word, punctuation, and whitespace chars, plus hyphens,
> with at least one word character. Hyphen is included explicitly
> because it generally has symbol syntax in Info.
>
> This seems to work pretty will. But there are of course some
> places where it does not DTRT.
>
> In my own code I also remove hiding of the enclosing `_' chars
> when emphasis highlighting is turned off:
>
> (while (re-search-forward Info-emphasis-regexp nil t)
> (let ((fn (if Info-fontify-emphasis-flag
> #'add-text-properties
> #'remove-text-properties)))
> (funcall fn (match-beginning 0) (1+ (match-beginning 0))
> '(invisible t front-sticky nil rear-nonsticky t))
> (funcall fn (1- (match-end 0)) (match-end 0)
> '(invisible t front-sticky nil rear-nonsticky t))
> (funcall fn (match-beginning 1) (match-end 1)
> '(font-lock-face info-emphasis))))
I hope one of the Info gurus will chime in at some point.
Thanks.