GNU bug report logs -
#22980
Something looks fishy in prettify-symbols-default-compose-p (it depends on (point))
Previous Next
To reply to this bug, email your comments to 22980 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#22980
; Package
emacs
.
(Thu, 10 Mar 2016 17:31:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Clément Pit--Claudel <clement.pitclaudel <at> live.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 10 Mar 2016 17:31:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
The docs of prettify-symbols-default-compose-p and prettify-symbols-compose-predicate don't suggest that the function should depend on the point, but it looks like it does:
(defun prettify-symbols-default-compose-p (start end _match)
"Return true iff the symbol MATCH should be composed.
The symbol starts at position START and ends at position END.
This is the default for `prettify-symbols-compose-predicate'
which is suitable for most programming languages such as C or Lisp."
;; Check that the chars should really be composed into a symbol.
(message "%S %S %S %S" (point) start end _match)
(print (let* ((syntaxes-beg (if (memq (char-syntax (char-after start)) '(?w ?_))
'(?w ?_) '(?. ?\\)))
(syntaxes-end (if (memq (char-syntax (char-before end)) '(?w ?_))
'(?w ?_) '(?. ?\\))))
(not (or (print (memq (char-syntax (or (char-before start) ?\s)) syntaxes-beg))
(print (memq (char-syntax (or (char-after end) ?\s)) syntaxes-end))
(print (nth 8 (syntax-ppss))))))))
^ here
(defvar-local prettify-symbols-compose-predicate
#'prettify-symbols-default-compose-p
"A predicate for deciding if the currently matched symbol is to be composed.
The matched symbol is the car of one entry in `prettify-symbols-alist'.
The predicate receives the match's start and end positions as well
as the match-string as arguments.")
This means that calling (prettify-symbols-default-compose-p 1 2 nil) returns nil or t in the following example returns nil or t depending on the point in the following example:
(* example *)
^ column 1 starts here
This makes it unreliable to prettify ‘*’ as ‘×’ in OCaml, for example.
Fixing this issue is not entirely trivial: calling syntax-ppss on end will work in some cases, and in other cases it would be better on beg. This is because for a two-characters comment starter, syntax-ppss is inconsistent in what it call the “inside” of the comment:
(* comment *)
^ outside ^ inside
This is a follow up to this ML thread: https://lists.gnu.org/archive/html/emacs-devel/2016-03/msg00415.html
[signature.asc (application/pgp-signature, attachment)]
This bug report was last modified 9 years and 97 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.