GNU bug report logs -
#21568
[PATCH] Add prettify-symbols-alist for js-mode
Previous Next
Reported by: Simen Heggestøyl <simenheg <at> gmail.com>
Date: Sat, 26 Sep 2015 11:51:02 UTC
Severity: normal
Tags: patch
Done: Simen Heggestøyl <simenheg <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 21568 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Sat, Sep 26, 2015 at 3:32 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> Thanks, but please add a coding cookie to the file, so that UTF-8
> encoded characters in it will always decoded correctly.
Alright. Better?
From a51d8ceaa7e6114cf775a4f01e16a7cf1403e075 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= <simenheg <at> gmail.com>
Date: Wed, 23 Sep 2015 21:49:24 +0200
Subject: [PATCH] Add prettify-symbols-alist for js-mode
* lisp/progmodes/js.el (js--prettify-symbols-alist): New defconst.
(js-mode): Use it.
---
lisp/progmodes/js.el | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 6a800f8..ab994f3 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1724,6 +1724,12 @@ This performs fontification according to
`js--class-styles'."
(js-syntax-propertize-regexp end))))))
(point) end))
+(defconst js--prettify-symbols-alist
+ '(("=>" . ?⇒)
+ (">=" . ?≥)
+ ("<=" . ?≤))
+ "Alist of symbol prettifications for JavaScript.")
+
;;; Indentation
(defconst js--possibly-braceless-keyword-re
@@ -3495,6 +3501,7 @@ If one hasn't been set, or if it's stale, prompt
for a new one."
(setq-local open-paren-in-column-0-is-defun-start nil)
(setq-local font-lock-defaults (list js--font-lock-keywords))
(setq-local syntax-propertize-function #'js-syntax-propertize)
+ (setq-local prettify-symbols-alist js--prettify-symbols-alist)
(setq-local parse-sexp-ignore-comments t)
(setq-local parse-sexp-lookup-properties t)
@@ -3564,4 +3571,8 @@ If one hasn't been set, or if it's stale, prompt
for a new one."
(provide 'js)
+;; Local Variables:
+;; coding: utf-8
+;; End:
+
;; js.el ends here
--
2.5.3
[Message part 2 (text/html, inline)]
This bug report was last modified 9 years and 240 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.