From: William Denton <wtd@pobox.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 48681@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#48681: Patch: Make prettify-symbols-mode work with ruby-mode
Date: Wed, 26 May 2021 21:54:55 -0400 (EDT) [thread overview]
Message-ID: <alpine.DEB.2.22.394.2105262148550.47790@shell3.miskatonic.org> (raw)
In-Reply-To: <87y2c19mel.fsf@gnus.org>
[-- Attachment #1: Type: text/plain, Size: 1053 bytes --]
On 27 May 2021, Lars Ingebrigtsen wrote:
> And then later the commented-out ?∧ (etc) stuff was removed, so I'm
> wondering:
>
>> +(defconst ruby--prettify-symbols-alist
>> + '(("and" . ?∧)
>> + ("or" . ?∨))
>> + "Value for `prettify-symbols-alist' in `ruby-mode'.")
>
> Whether this is something that users of symbol prettification would
> appreciate or not. Since I use neither prettification or write Ruby, I
> have no opinion here. Perhaps Stefan has? (Added to the CCs.)
This got me thinking, and I added four more prettifications (see attached patch)
for &&, ||, <= and >=, which are all very basic.
I just hack on Ruby, but I use it a lot. I think that anyone writing Ruby in
Emacs who already has prettify-symbols-mode turned on (and is seeing it work
with Python, R, Org, etc.) would, when they see this start working, say, "Hey,
that's nice."
Thanks for looking at the patch.
Cheers,
Bill
--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-diff; name=prettify-ruby-2.patch, Size: 886 bytes --]
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 0c54a1d27a..a48879bfe6 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -2421,6 +2421,15 @@ ruby-flymake-auto
report-fn
args))
+(defconst ruby--prettify-symbols-alist
+ '(("and" . ?∧)
+ ("&&" . ?∧)
+ ("or" . ?∨)
+ ("||" . ?∨)
+ ("<=" . ?≤)
+ (">=" . ?≥))
+ "Value for `prettify-symbols-alist' in `ruby-mode'.")
+
;;;###autoload
(define-derived-mode ruby-mode prog-mode "Ruby"
"Major mode for editing Ruby code."
@@ -2437,6 +2446,7 @@ ruby-mode
(setq-local font-lock-defaults '((ruby-font-lock-keywords) nil nil
((?_ . "w"))))
+ (setq-local prettify-symbols-alist ruby--prettify-symbols-alist)
(setq-local syntax-propertize-function #'ruby-syntax-propertize))
next prev parent reply other threads:[~2021-05-27 1:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-26 17:26 bug#48681: Patch: Make prettify-symbols-mode work with ruby-mode William Denton
2021-05-26 22:10 ` Lars Ingebrigtsen
2021-05-27 1:54 ` William Denton [this message]
2021-05-27 2:54 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-27 3:52 ` William Denton
2021-05-27 18:02 ` Dmitry Gutov
2021-05-29 6:10 ` Lars Ingebrigtsen
2021-05-29 11:07 ` Dmitry Gutov
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=alpine.DEB.2.22.394.2105262148550.47790@shell3.miskatonic.org \
--to=wtd@pobox.com \
--cc=48681@debbugs.gnu.org \
--cc=larsi@gnus.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).