bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23798: 25.0.90; Underscore for emphasis in Info?


From: Drew Adams
Subject: bug#23798: 25.0.90; Underscore for emphasis in Info?
Date: Sat, 2 Jul 2016 13:59:54 -0700 (PDT)

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








reply via email to

[Prev in Thread] Current Thread [Next in Thread]