unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ken Mankoff <mankoff@gmail.com>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: 19145@debbugs.gnu.org
Subject: bug#19145: 24.4; prettify-symbols-mode inconsistent behavior
Date: Fri, 21 Nov 2014 14:22:53 -0500	[thread overview]
Message-ID: <m24mtspdde.fsf@gorgonzola.whoi.edu> (raw)
In-Reply-To: <jwv389c8lqy.fsf-monnier+emacsbugs@gnu.org>


* On 2014-11-21 at 13:15, Stefan Monnier wrote:
>> Some symbols are sometimes not being treated correctly depending on
>> what characters follow. For example, I have the following setup for
>> coding Python:
>
>>     (prettify-symbols-mode t)
>>     (global-prettify-symbols-mode t)
>>     (add-hook 'python-mode-hook
>>               (lambda ()
>>                 (push '("**2" . ?²) prettify-symbols-alist)
>>                 (push '("_x" . ?ᵪ) prettify-symbols-alist)
>>                 (push '("delta" . ?δ) prettify-symbols-alist)))
>
> Can you try the patch below and see if it does what you want?
>
>
> diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
> index 5037020..475dd32 100644
> --- a/lisp/progmodes/prog-mode.el
> +++ b/lisp/progmodes/prog-mode.el
> @@ -73,11 +73,13 @@ Regexp match data 0 points to the chars."
>    ;; Check that the chars should really be composed into a symbol.
>    (let* ((start (match-beginning 0))
>  	 (end (match-end 0))
> -	 (syntaxes (if (eq (char-syntax (char-after start)) ?w)
> -		       '(?w ?_) '(?. ?\\)))
> +	 (syntax-beg (if (eq (char-syntax (char-after start)) ?w)
> +                         '(?w ?_) '(?. ?\\)))
> +	 (syntax-end (if (eq (char-syntax (char-before end)) ?w)
> +                         '(?w ?_) '(?. ?\\)))
>  	 match)
> -    (if (or (memq (char-syntax (or (char-before start) ?\s)) syntaxes)
> -	    (memq (char-syntax (or (char-after end) ?\s)) syntaxes)
> +    (if (or (memq (char-syntax (or (char-before start) ?\s)) syntax-beg)
> +	    (memq (char-syntax (or (char-after end) ?\s)) syntax-end)
>              ;; syntax-ppss could modify the match data (bug#14595)
>              (progn (setq match (match-string 0)) (nth 8 (syntax-ppss))))
>  	;; No composition for you.  Let's actually remove any composition


Much improved! Of my examples, only one case no longer works which is
delta_x or foo_x_x_x_x, for example.

  -k.
  





  reply	other threads:[~2014-11-21 19:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-21 17:40 bug#19145: 24.4; prettify-symbols-mode inconsistent behavior Ken Mankoff
2014-11-21 18:15 ` Stefan Monnier
2014-11-21 19:22   ` Ken Mankoff [this message]
2014-11-22 16:23     ` Stefan Monnier
2014-11-22 23:57       ` Ken Mankoff
2014-11-24 14:53         ` Stefan Monnier
2014-11-25  9:49           ` Ted Zlatanov
2014-11-25 14:51             ` Stefan Monnier
2014-11-25 15:17               ` Ted Zlatanov
2014-11-25 17:36                 ` Stefan Monnier
2014-11-25 18:53                   ` Ted Zlatanov
2014-11-26  2:23                     ` Stefan Monnier
2014-11-25 14:53             ` Ken Mankoff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m24mtspdde.fsf@gorgonzola.whoi.edu \
    --to=mankoff@gmail.com \
    --cc=19145@debbugs.gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).