GNU bug report logs - #19145
24.4; prettify-symbols-mode inconsistent behavior

Previous Next

Package: emacs;

Reported by: Ken Mankoff <mankoff <at> gmail.com>

Date: Fri, 21 Nov 2014 17:54:01 UTC

Severity: minor

Found in version 24.4

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Ken Mankoff <mankoff <at> gmail.com>
Cc: 19145 <at> debbugs.gnu.org
Subject: bug#19145: 24.4; prettify-symbols-mode inconsistent behavior
Date: Fri, 21 Nov 2014 13:15:01 -0500
> 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?


        Stefan


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




This bug report was last modified 10 years and 242 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.