I didn't find this information anywhere else, so here it is.
`xmodmap -pke' results in lines like this:
keycode 8 =
keycode 9 = Escape NoSymbol Escape
keycode 10 = 1 exclam 1 exclam
keycode 11 = 2 at 2 at
keycode 12 = 3 numbersign 3 numbersign
keycode 13 = 4 dollar 4 dollar
keycode 14 = 5 percent 5 percent
keycode 15 = 6 asciicircum 6 asciicircum dead_circumflex dead_circumflex dead_circumflex
The format is:
keycode <NNN> = <symbol1> <symbol2> <symbol3> <symbol4> <symbol5> <symbol6> <symbol7> <symbol8>
The story in short is:
Mode_switch selects <symbol3>
Mode_switch+Shift selects <symbol4>
ISO_Level3_Switch selects <symbol5>
ISO_Level3_Switch+Shift selects <symbol6>
(i) You can just dump the whole current keymap via `xmodmap -pke > .Xmodmap'.
(ii) Then edit it all you want. In the editing, you should define some particular key as the Mode_switch or ISO_Level3_Switch. (But, apparently, not both.)
(iii) You may also have to add Mode_switch or ISO_Level3_Switch (which-ever you have chosen) to one of the modifier keys. (It probably isn't required in modern systems. It isn't required in mine.)
(iv) Load the file as the new keymap, via `xmodmap .Xmodmap'.
Two fine pages to learn more are given below. The first link has much which is outdated (at least for my system -- xserver-xorg-core 2:1.12.4-6 -- but the explanation is short and good).
Two lines of my `xmodmap -pke' output say:
keycode 27 = p P p P U2018 NoSymbol U2018
keycode 28 = y Y y Y U2019 NoSymbol U2019
So, using the ISO_Level3_Latch † key, I can directly type Unicode symbols U2018(‘) and U2019(’).
Note that setting keys via `xmodmap' is now deprecated, but it works, and setting them via setxkbmap looks too complicated. (I myself use a patchwork of strange and crazy keymays -- not something to be emulated! You may go about in a clean manner though.)
† For the difference between ISO_Level3_Shift, ISO_Level3_Latch and ISO_Level3_Lock, see another post.