auctex-devel
[Top][All Lists]
Advanced

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

Re: cannot add \frownie to pretty-list


From: David Kastrup
Subject: Re: cannot add \frownie to pretty-list
Date: Thu, 18 Nov 2021 18:13:34 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Uwe Brauer <oub@mat.ucm.es> writes:

> Hi all
>
> I am using now emacs 29 master and enjoy Lars emoji insert menu.
>
> So I thought why not adding emoji to the pretty-symbol list.
> But this symbol seems to cause problems: ☹️. 
>
> Please consider this piece of code
>
> (defun tex--prettify-symbols-compose-p (_start end _match) ; not necessary
>   (or (not (eq ?w (char-syntax (char-before end))))
>       (let* ((after-char (char-after end))
>            (after-syntax (char-syntax after-char)))
>       (not (or
>             ;; Don't compose \alpha@foo.
>             (eq after-char ?@)
>             ;; The \alpha in \alpha2 or \alpha-\beta may be composed but
>             ;; of course \alphax may not.
>             (and (eq after-syntax ?w)
>                  (not (memq after-char
>                             '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?+ ?- ?' ?\"))))
>             ;; Don't compose inside verbatim blocks.
>             (eq 2 (nth 7 (syntax-ppss))))))))
>
> (dolist (el '(
>             ;; doble stack
>               ("\\smiley" . ?🙂); works
>               ("\\frowie" . ?☹️); gives error
>             ("\\varrho" . ?ϱ)))
>   (add-to-list 'tex--prettify-symbols-alist el)) 

For one thing, it would have to be called "\\frownie" rather than
"\\frowie".  For another, you add an unrelated character after the
frownie (the ?☹) that Emacs identifies as

             position: 1115 of 1246 (89%), column: 30
            character: ️ (displayed as ️) (codepoint 65039, #o177017, #xfe0f)
              charset: unicode (Unicode (ISO10646))
code point in charset: 0xFE0F
               syntax: w        which means: word
             category: ^:Combining
             to input: type "C-x 8 RET fe0f" or "C-x 8 RET VARIATION 
SELECTOR-16"
          buffer code: #xEF #xB8 #x8F
            file code: #xEF #xB8 #x8F (encoded by coding system raw-text-unix)
              display: by this font (glyph code)
    ftcrhb:-PfEd-Unifont-normal-normal-normal-*-15-*-*-*-d-0-iso10646-1 (#xDD12)

Character code properties: customize what to show
  name: VARIATION SELECTOR-16
  general-category: Mn (Mark, Nonspacing)
  decomposition: (65039) ('️')

and that has no place in Elisp syntax when encountered on its own.  If
you cannot get your input method to refrain from that insertion, instead
of ?☹ you could just write 9785 .

-- 
David Kastrup



reply via email to

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