From: "Simen Heggestøyl" <simenheg@gmail.com>
To: 21568@debbugs.gnu.org
Subject: bug#21568: [PATCH] Add prettify-symbols-alist for js-mode
Date: Sat, 26 Sep 2015 13:49:48 +0200 [thread overview]
Message-ID: <1443268188.7436.0@smtp.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1655 bytes --]
With the introduction of the fat arrow (=>) function notation in
ECMAScript 6, why not make them prettier by default when
prettify-symbols-mode is turned on?
I propose the following patch, which also adds pretty versions of >=
and <= while we're at it:
From fa37953359f50748801717d259350d7e352cff60 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Simen=20Heggest=C3=B8yl?= <simenheg@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 | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 6a800f8..f214015 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)
--
2.5.1
[-- Attachment #2: Type: text/html, Size: 2297 bytes --]
next reply other threads:[~2015-09-26 11:49 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-26 11:49 Simen Heggestøyl [this message]
2015-09-26 13:32 ` bug#21568: [PATCH] Add prettify-symbols-alist for js-mode Eli Zaretskii
2015-09-26 15:59 ` Simen Heggestøyl
2015-09-27 0:39 ` Xue Fuqiao
2015-09-27 2:01 ` Dmitry Gutov
2015-09-27 6:04 ` Eli Zaretskii
2015-09-27 6:12 ` Dmitry Gutov
2015-09-27 7:28 ` Eli Zaretskii
2015-09-27 8:21 ` Dmitry Gutov
2015-09-27 8:39 ` Eli Zaretskii
2015-09-27 8:50 ` Dmitry Gutov
2015-09-27 10:03 ` Eli Zaretskii
2015-09-27 14:11 ` Dmitry Gutov
2015-09-27 18:37 ` Eli Zaretskii
2015-09-27 19:13 ` Dmitry Gutov
2015-09-27 19:46 ` Eli Zaretskii
2015-09-27 20:18 ` Dmitry Gutov
2015-09-27 21:01 ` Eli Zaretskii
2015-09-28 4:16 ` Explicit encoding cookie in Elisp files, was: " Dmitry Gutov
2015-09-28 7:27 ` Explicit encoding cookie in Elisp files " Eli Zaretskii
2015-09-28 7:53 ` Dmitry Gutov
2015-09-28 8:24 ` Eli Zaretskii
2015-09-28 22:54 ` Dmitry Gutov
2015-09-27 8:10 ` bug#21568: [PATCH] " Simen Heggestøyl
2015-09-27 14:28 ` Xue Fuqiao
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1443268188.7436.0@smtp.gmail.com \
--to=simenheg@gmail.com \
--cc=21568@debbugs.gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.