Tilde, underscore pceemacs

I’m using: SWI-Prolog version: 32-bits 7.2.3 on raspbian stretch, Swedish localisation and Mate desktop for an exercise in designing a web interface.
I’m using the built in prolog console and pce-emacs for editing.
Unfortunately the tilde ~ and underscore _ characters are not available. I can’t find them mapped to any key on the keyboard.
When used in mate terminal emulator, gnome terminal emulator, mate text editor (pluma) swi-prolog terminal these characters are possible to input and visible.
If I edit the prolog file with anorther editor than pceemacs it is possible to use these characters. Is there some flag or setting for pceemacs that I have missed?

Hmmm. In theory SWI-Prolog and all its tools should nicely listen to the locale settings and the X11 input handling should take care of all this. They may be different issues though. There is a problem with some fonts that make the _ (underscore) disappear on certain scaling factors. That should however make the _ show up as a space. If that is a problem, use Control-+ or Control-- to scale the font. By editing the Editor preferences you can set a permanent scale factor or specify a font that is not subject to this problem. This problem also appears in some other applications and is 99% sure a font issue.

The ~ is probably a dead key in Swedish, no?

You can run ?- manpce. That shows a little window. Take Tools/Event viewer. That opens a window with a green area to which you can go and do things with the mouse and keyboard and it should display all the events it receives from X11.

It is of course possible that the binary you have is misconfigured and, for example, locale handling is not properly initialized. Building from source is than your friend. Upgrade to 8.x at the same time :slight_smile:

Thanks Jan! For underscore you are right. when a predicate is finished and pce emacs colourize it, it becomes visible.
For the tilde ~ the problem was resolved. I found that if I started edit from scratch in the pceemacs buffer it is possible to enter the tilde. Then I decided to copy and paste the text from my original code to the scratch buffer and save it with a new file name.
I think the reason is that I started my exercise from an example program that I downloaded from internet. Maybe some hidden control character existed in the original file that screwed up things. Anyhow, now I know how to aviod this problem next time.

Edit: Enter tilde works in scratch pceemacs. But again, when I wanted to edit inside the existing code - the tilde input did not work. For the moment I will have to copy existing ~w sequenses for format(…

FWIW, I haven’t been able to get colorization to play nicely with Emacs. E.g., even when I turn it off (using set_prolog_flag(color_term, false)), I still get some ANSI color control characters for error messages.

Jan: I don’t understand what you mean with a dead key. It exists on a standard Swedish keyboard. To write it I have to press Alt Gr+~ and after that space to get a “clean” ~.

See https://en.wikipedia.org/wiki/Dead_key Your description suggests that is the case. In English mode you can simply press the ~ to get one. Luckily Prolog doesn’t do much with the ~ by default :slight_smile:

Still, it should be X11 that does all the hard work and give an Unicode character to the application. That is, if during the compilation of SWI-Prolog the configuration process went well to recognise the X11 Unicode and locale support functions.

Thanks Jan. Built from source (current stable release) according to your recommendation and now tilde works. Some strange bug disappeared too.