LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-08-2015, 10:46 PM   #1
rlx
Member
 
Registered: Jul 2009
Location: Montréal
Distribution: Slackware customized
Posts: 50

Rep: Reputation: 13
SCIM, xterm, emacs and Firefox in Slackware64 current


I just wish to share my experience trying to type international characters (European and Chinese mostly) in Xterm, Emacs, and Firefox.

Typing European and Chinese characters in Emacs, xterm, and Firefox worked fine up to 2012 on my 32-bit version of Slackware running XFree86. Of course I had LANG=en_US.UTF-8 as well as LC_CTYPE=en_US.UTF-8.

Unfortunately, after installing Slackware64 and Xorg something was broken and I was never able to have SCIM activate in all those programs. I could no longer type European characters in Emacs. SCIM always activates in Firefox, but sometimes (very rarely) Firefox hanged until I exit SCIM.

I have no deep understanding of how SCIM and Xorg work together, however I found out that the order in which those programs are started is relevant. So, here is my recipe if you will that makes them all work.

Initially, file xorg.conf needs to include the altgr-intl option so the right Alt key can be used as the compose key.

Section "InputDevice"
...
Option "XkbLayout" "us"
Option "XkbVariant" "altgr-intl"
EndSection


Then, to address the problem I had with the deadkeys in Emacs, I needed to add the following line to 'emacs.el' (ref),

(require 'iso-transl)

Now, to get SCIM to work in xterm, I need to insert the following just at the beginning of the .xinitrc file. I added two lines to remove any remaining scim processes and sockets before starting a new X session.

ps -e | grep scim | while read i _; do a="kill -9 $i"; echo $a; eval "$a"; done
rm -f /tmp/scim*socket*${USER}

export XMODIFIERS="@im=SCIM"
export GTK_IM_MODULE="scim"
export QT_IM_MODULE="scim"
export XIM_PROGRAM="/usr/bin/scim -d"
/usr/bin/scim -d

That is quite standard. However if I later kill scim and restart then I can no longer use scim in the xterm's!

There is more. I have always been using the fvwm windows manager, and I now have two monitors. I don't use Xinerama though since I use virtual screens and most often the second monitor is off. So I need to set DISPLAY in the .xinitrc script. The curious point is if I set

export DISPLAY=:0.1

before starting scim above, I can't use SCIM in the xterm's so I need to set DISPLAY AFTER starting scim...

That takes care of the xterm.

Finally, to get SCIM to work in Emacs, I installed scim-bridge.el. scim-bridge.el does not work with a pure scim-1.4.15 since there is no scim-bridge program in SCIM since 1.4.14. There is a patch to scim-bridge.el that should make it work with scim-im-agent, but that did not work on my setup. So I ended up installing scim-bridge-0.4.16-x86_64-5 from Slackware-14.0 and using the unpatched scim-bridge.el package. So I end up with all of SCIM-1.4.15 plus scim-bridge from an earlier version of SCIM!

Before even trying to run SCIM in emacs one needs to start Firefox or Thunderbird. Tnen one can safely load scim-mode in emacs.

So 1) start a xterm, 2) start emacs, but don't start scim-mode yet, 3) start Firefox and finally activate scim-mode in emacs. Humm...

At this point I can claim success. I can have xterm's, emacs and Thunderbird/Firefox all accepting either SCIM input or accented letters (by using the compose key -- the right Alt key).

Please feel free to comment.

Note 1. Changing the above order results is SCIM not working in either xterm or emacs.

Note 2. Although the recipe worked fine last night and this morning, I just restarted X11 at the end of the afternoon and now I can no longer connect to SCIM from xterm's. There is some randomness here as if there was a memory leak somewhere.

Note 3. I still got in the situation where scim did not start with X because of leftover scim processes or sockets. So I added two lines to my .xinitrc to remove those 'scim' processes and sockets before starting 'scim'. According to the book, 'scim' should start automatically when pressing Ctrl-;, but that does not seem to be the case with the 'xterms'.

Last edited by rlx; 07-12-2015 at 11:48 AM.
 
Old 07-10-2015, 12:46 PM   #2
rlx
Member
 
Registered: Jul 2009
Location: Montréal
Distribution: Slackware customized
Posts: 50

Original Poster
Rep: Reputation: 13
My xkb keyboard settings, with an overlay and my Compose choices

After solving my issues with SCIM, my next challenge was to get a consistent experience of typing symbols across xterm, emacs and Firefox/Thunderbird. Unicode provides many symbols; the problem is to type them. Here is what I have found.

1. After some pain, at last I find myself very fortunate to be able to type in English, French (ēèç), Chinese Pinyin (nǐ hǎo), Chinese characters (你好), APL (A←⍳4) and also use a ton of Unicode symbols with a single keyboard, the Compose key (RightAlt) and the Win key.

The SCIM comfiguration was covered in my last post. Here is the xkb configuration I use. That xkb configuration works identically in Emacs, Firefox and xterm with just a small caveat in the case of xterm.

2. xorg.conf. The following keyboard entry in xorg.conf combines the basic US keyboard and an APL overlay (the physical keyboard I use is the typical US PC keyboard). The compose key is not handled directly by xkb but is instead passed to the locale compose table (~/.Xcompose or by default /usr/share/X11/locale/en_US.UTF-8/Compose).

To type APL symbols, just use the Win key as one would use the Shift key. Have a look at the next file for a view of the keyboard.

/etc/X11/xkb/symbols/apl

To build other symbols just use the Compose key (righ Alt key). For example, to type letter 'é' press and release the following keys in the order (Alt ' e); to get ⍋, press (Alt | ∆). Character ∆ is (Win h). One can either release or keep pressed the Alt/Win key when pressing the second key. Both the Alt/Win and the second key need to be released before pressing the third key. The possible combinations are listed in file

/usr/share/X11/locale/en_US.UTF-8/Compose

I initially tried variant altgr-intl but it turns out that the altgr-intl table catches many compose sequences and the interaction between the altgr-intl table and /usr/share/X11/locale/en_US.UTF-8/Compose is a bit confusing. Variant 'euro 'does not catch the Compose key (Have a look at file /etc/X11/xkb/symbols/us).

So here is the keyboard entry in my file /etc/X11/xorg.conf. (I know, I should use xorg.conf.d

Section "InputDevice"
Identifier "Keyboard 1"
Driver "kbd"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "logiex110"
Option "XkbLayout" "us,apl"
Option "XkbVariant" "euro,dyalog"
Option "XKbOptions" "grp:win_switch"
Option "XKbOptions" "compose:ralt"
Option "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection

Unfortunalely, it seems that sometimes Xorg won't understand that section properly at startup (maybe there are errors in my xorg.conf file), so I added the following line at the very start of the .xinitrc file,

setxkbmap -model logiex110 -layout "us,apl" -variant "euro,dyalog" -option "compose:ralt,grp:win_switch"

3. Most people won't use APL; just think or it as a nice simple example of how to build/modify tables by yourself so you can access your favorite symbols with a keyboard overlay. The following files should be included in most Xorg distributions so there is no need to search the net.

/etc/X11/xkb/symbols/apl
/usr/share/X11/locale/en_US.UTF-8/Compose

To modify file Compose, make a local copy to ~/.Xcompose and edit the copy to suit your needs. X will look for that file and use it if it finds one.

4. xterm. As I explained in the SCIM post, one needs to start xterm as follows to use SCIM

XMODIFIERS=@im=SCIM uxterm & # SCIM works but some compose combinations don't.

Using im=SCIM prevents the table /usr/share/X11/locale/en_US.UTF-8/Compose to work properly in xterm, and many compose sequences won't print. Usual accented letters and Pinyin print OK, but other combinations such as ← (Alt < -) don't print. That caveat applies to xterm only; compose works fine here in Emacs and in Firefox.

To make sure that all combinations in /usr/share/X11/locale/en_US.UTF-8/Compose work in a xterm, start xterm as follows,

XMODIFIERS= uxterm & # SCIM does not work but compose combination all work.

I hope that this small note will help other people. As always, please feel free to share any comments. I am just a user trying to get the best out of the typing toolbox. I wish to express my thanks to all those who have contributed to build those marvelous tools in a challenging, open and continually changing environment.

Note 1. Yesterday, I couldn't type accented letters anywhere (xterm,emacs and Firefox). I restarted X a couple of times ending always with the same problem. I found out that the xorg.conf didn't load properly and I ended up adding a line at the very beginning of my .xinitrc to make sure 'xkb' starts as expected. That fix solves the problem (see the end of section 2).

Last edited by rlx; 07-12-2015 at 11:42 AM.
 
Old 09-26-2015, 10:31 PM   #3
rlx
Member
 
Registered: Jul 2009
Location: Montréal
Distribution: Slackware customized
Posts: 50

Original Poster
Rep: Reputation: 13
Hi everyone. Here is an update.

I had some problems lately with my SCIM/Compose setup. I could no longer type Chinese in Emacs using scim (in Slackware) and Emacs no longer recognized the compose key. It looks like that success here depends very much on which versions of the software one is using. So I tried the latest editions of Emacs, SCIM, and scim-bridge.el and I found the following combination to be working.

I still need to have something like Firefox already running for the 'scim-mode' to activate in Emacs. I checked the effect of the .Xresource file and the .emacs.el file as well as the environment variables needed to run emacs with scim-mode. Here are the results that worked
  1. scim-bridge.el version 0.8.2.22. One needs to edit the file and replace (defvar scim-bridge-name "scim-bridge") with (defvar scim-bridge-name "scim-im-agent") since that program was renamed in the latest version of SCIM.

  2. scim-1.4.15
    scim-input-pad-0.1.3.1
    scim-m17n-0.2.3
    scim-pinyin-0.5.92
    scim-tables-0.5.14.1
    I no longer use the scim-bridge program since it has been replaced by scim-im-agent. I looked at the source code and scim-im-agent is basically a rename of scim-bridge.

  3. Emacs-23.4.1 configured with gtk support. 'scim-im-agent.el' failed with later '-24' editions of Emacs.

  4. .emacs.el. Include the following lines in the file.
    (require 'iso-transl)
    (require 'scim-bridge)

  5. .Xresources. I include nothing. Some posts suggest to include a line 'Emacs*useXIM: false' but I don't need it so I removed it.

  6. I start Emacs as follows to use SCIM,
    env LC_ALL= LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8 XMODIFIERS= /usr/bin/emacs

    If the environment variable LC_ALL is set like LC_ALL=posix, the compose key still allows typing accentedcharacters such as é, but others such as ⍋ cannot be typed in Emacs. When starting Emacs with LC_ALL unset as I do above, then all the characters defined in file /usr/share/X11/locale/en_US.UTF-8/Compose can be typed in Emacs and the Emacs scim-mode works fine as well.

Since 'xterm' works with either one of SCIM or Compose, but not with both at the same time, I now use the 'sakurai' editor when I need both since 'sakurai' is based on the gtk toolkit. However I can't get to type some characters such as ⍋ on either 'sakurai', Firefox or Thunderbird even with LC_ALL=''. Please note that the compose sequence of character ⍋ is defined in file /usr/share/X11/locale/en_US.UTF-8/Compose, and the character is also defined in the fonts I use. So there is another layer of software somewhere that filters out the ⍋ character in the GTK toolkit. (The character I use as an example is a triangle overlayed with a vertical bar -- in case your browser uses a font that does not have that character.)

By the way, I installed ibus but I didn't manage to make it work yet so I am using SCIM which I like very much.

Last edited by rlx; 09-27-2015 at 03:59 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
No SCIM input in Terminal or in Emacs but working fine in Firefox / Thunderbird rlx Slackware 1 04-08-2014 03:24 PM
[SOLVED] Humblebundle site in firefox(Slackware64-current) SwiftTimber-Z80 Slackware 1 10-04-2013 11:34 AM
Slackware64 run 32-bit program with scim Breeze Slackware 1 04-29-2011 11:48 AM
Updating from Slackware64-current to Slackware64 13. glore2002 Slackware 4 08-28-2009 06:50 PM
gnome-settings-daemon prevents scim working on Emacs realwhz Debian 0 03-02-2006 07:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration