Entering emoji

’m working through Julia tutorial in Nteract. The notebook

JuliaTutorials/intro-to-julia/01. Getting started.ipnyb

says that to enter an emoji such as smiley_face, type:

:smi + [TAB]

So I did type “:smi” (without quotes) and pressed TAB in the nteract cell. Nothing happens! In particlar, no list of possible completions to select from.

I tried same thing in a Terminal Julia REPL. Likewise, nothing happens.

Julia 1.6.1 under macOS Big Sur 11.3.’

What’s wrong?

You have missed a \ before the :, it works for me if I do:

julia> \:smi<I tabbed here>
\:smile:       \:smiley:       \:smiling_imp:  \:smirk_cat:
\:smile_cat:   \:smiley_cat:   \:smirk:

julia> \:smile:<then I tabbed again and it become the below>

julia> 😄
3 Likes

With the \ (\:smi <TAB>) I now get the list to choose from, but when I select \:smiley_cat: I get ERROR: syntax: "\" is not a unary operator.

perhaps Tab completion doesn't work on Julia kernel · Issue #5396 · nteract/nteract · GitHub?

1 Like

You have to press TAB again, not Enter.

4 Likes

OK, pressing TAB again after entering \:smiley_cat: does product the expected emoji. But why?

1 Like

Sorry I’m not answering the question for MacOs, but for future reference. In windows os, one can use the key combination: Win+ . to bring up the build-in emoji keyboard. This is my default way of doing Emoji programming :sob:

image
If you continue typing, for example continue typing cry you get Emoji suggestions
cry

Hello @murrayE and welcome to Julia. Please can I ask you to do something? Stick with it. People on this forum are very helpful and will happily answer questions about small issues.
Often there are posts form people who are frustrated that their particular setup does not work first time, or that a certain package does not load.
But if you stick with it and ask questions everything gets solved.

If you write \:smiley_cat and press enter, Julia will interpret it as if you are trying to perform the \ operation on the variable called :smiley_cat. Because \ is an operator that needs two inputs (result = A \ B) the error you get is telling you that this operator expects more than one input.

In the other side what you want to do (write an emoji through some combination of keys) is a different process operated by the REPL or by your IDE, so it has a different way of doing it than evaluating something in the REPL. So basically the answer to “why TAB completion works with TAB and not with enter” would be because it was designed that way (and using enter would conflict with the operations sent to julia).

2 Likes

You can use :watch: :julia::fire:.jl to get the worst out of your smiley programming experience :grin:

1 Like

Heh. I often flag up the Obfuscated Perl contest - which resulted in things like programs written in white space, and Latin.
However I will make an exception - this sounds fun!
Also flags up a feature of Julia which I like - if you do not like or consistently mistype a function just do

nicename = nasty-function-name

1 Like

I have no particular use for emojis in programming. I was just trying to follow along with a very first tutorial introduction and got stuck because of incomplete explanation about :smi etc.

While I appreciate just seeing examples, I expect some insinuation of semantics and syntax for such things.

I have a similar problem!
Entering :rabbit: +tab into Terminal (vscode) gives me a picture of a rabbit, but repeating the same key sequence in the .jl Editor window does not! All that I get is the :rabbit:! I have tried \:rabbit: and /:rabbit:. There is a rabbit character which I can cut & paste from a document, but I would rather know how I can type it in without documents?

Sorry, I should have typed “:rabbit:”, “\:rabbit:” and “/:rabbit:”! They all work so well here, but not on my Editor!

\ :rabbit, \:rabbit, /:rabbit