From: Szymon 'tichy'
Subject: [EMACS SLIME] problem witch unicode characters (no labmda for example ;>)
Date: 
Message-ID: <foqh9e$r7n$1@nemesis.news.tpi.pl>
Hi.

In terminal session it works:

··@zbuk:~$ bin/sbcl --noinform --core lib/sbcl/sbcl.core

* (defvar *greek-alphabet*
     '(alpha beta gamma delta epsilon digamma zeta eta theta
       iota kappa lamda mu nu xi omicron pi san archaic_koppa
       rho sigma tau upsilon phi chi psi omega sampi))

*GREEK-ALPHABET*

* (map 'string
        (lambda (x)
          (read-from-string (format nil "#\\GREEK_SMALL_LETTER_~A" x)))
        *greek-alphabet*)

"αβγδεϝζηθικλμνξοπϻϙρστυφχψωϡ"

----------

but in SLIME I got:

"αβ_δ________μ___π___στ______"

I replace boxes with underscore. Characters displayed as boxes
return to normal after copy-paste to another application.
After copy-pasting it back to emacs most characters are displayed
properly, but some of them are still boxes:

"αβγδε_ζηθικλμνξοπ__ρστυφχψω_"

weird :/

unfortunately I set up Ubuntu 3 weeks ago, so my Emacs is 'modified':

GNU Emacs 22.1.1 (i486-pc-linux-gnu, GTK+ Version 2.12.0) of 2007-11-06 on terranova, modified by Ubuntu

I have no idea how to fix this :/ Maybe I should build Emacs from source ?

From: Maciej Katafiasz
Subject: Re: [EMACS SLIME] problem witch unicode characters (no labmda for example ;>)
Date: 
Message-ID: <foqj85$7df$1@news.net.uni-c.dk>
Den Mon, 11 Feb 2008 23:06:04 +0100 skrev Szymon 'tichy':

> but in SLIME I got:
> 
> "αβ_δ________μ___π___στ______"
> 
> I replace boxes with underscore. Characters displayed as boxes return to
> normal after copy-paste to another application. After copy-pasting it
> back to emacs most characters are displayed properly, but some of them
> are still boxes:
> 
> "αβγδε_ζηθικλμνξοπ__ρστυφχψω_"

That indicates missing glyphs in your Emacs font, though I have no idea 
why it'd miss less of them after copy-paste.
 
> unfortunately I set up Ubuntu 3 weeks ago, so my Emacs is 'modified':
> 
> GNU Emacs 22.1.1 (i486-pc-linux-gnu, GTK+ Version 2.12.0) of 2007-11-06
> on terranova, modified by Ubuntu
> 
> I have no idea how to fix this :/ Maybe I should build Emacs from source
> ?

You need to install extra bitmap fonts, most of the apps on your system 
don't need them, because they use Xft, but Emacs still uses core X fonts, 
so it will see different fonts than the rest of your desktop. Take a look 
at packages emacs-intl-fonts, and xfonts-intl-*.

Cheers,
Maciej
From: Szymon 'tichy'
Subject: Re: [EMACS SLIME] problem witch unicode characters (no labmda for   example ;>)
Date: 
Message-ID: <foqluc$c5a$1@atlantis.news.tpi.pl>
Maciej Katafiasz wrote:

> That indicates missing glyphs in your Emacs font, though I have no idea 
> why it'd miss less of them after copy-paste.

Because after two copy-pastes font 'was changed' (or 'changed himself' ;)
from 'normal' to 'italic' and italic terminus with particular
size has more coverage than non-italic one O_o. I hate computers -.-

Regards, Szymon.
From: David Golden
Subject: Re: [EMACS SLIME] problem witch unicode characters (no labmda for example ;>)
Date: 
Message-ID: <q38sj.24496$j7.452271@news.indigo.ie>
Maciej Katafiasz wrote:

> Den Mon, 11 Feb 2008 23:06:04 +0100 skrev Szymon 'tichy':
> 
>> I have no idea how to fix this :/ Maybe I should build Emacs from
>> source ?
> 
> You need to install extra bitmap fonts, most of the apps on your
> system don't need them, because they use Xft, but Emacs still uses
> core X fonts, so it will see different fonts than the rest of your
> desktop. 


N.B. If you are up to building emacs from CVS, it can use Xft, just
./configure --enable-font-backend 
From: Szymon 'tichy'
Subject: Re: [EMACS SLIME] problem witch unicode characters (no labmda for example ;>)
Date: 
Message-ID: <fqncro$rkm$1@nemesis.news.neostrada.pl>
David Golden wrote:
> Maciej Katafiasz wrote:
> 
>> Den Mon, 11 Feb 2008 23:06:04 +0100 skrev Szymon 'tichy':
>>
>>> I have no idea how to fix this :/ Maybe I should build Emacs from
>>> source ?
>> You need to install extra bitmap fonts, most of the apps on your
>> system don't need them, because they use Xft, but Emacs still uses
>> core X fonts, so it will see different fonts than the rest of your
>> desktop. 
> 
> 
> N.B. If you are up to building emacs from CVS, it can use Xft, just
> ../configure --enable-font-backend

Thx... I followed your advice... and I found myself writing 200+
lines of code to use this, ekhem, feature ;) seems to work:

;;; part of (s)zymon's .emacs (GNU Emacs 23.0.60.2).

;;; this crap is free (in public domain)

;; (x-family-fonts ...) as for now for my purpose is unusable :/
;; most of the code is workarounds

;;; commands / interactive fn's:

;; ssb-font-next

;; ssb-font-select

;; ssb-font-shrink

;; ssb-font-enlarge

(setq scalable-fonts-allowed t)

(setq-default font-list-limit 999)

(require 'cl)

(defvar ssb-font-scale-scale 1.25)

(defvar ssb-scalable-font-max 30)

(defvar ssb-scalable-font-min 10)

(defvar ssb-display-lines-max 65)

(defvar ssb-display-lines-min 45)

(defvar ssb-font-priority-list
   '("terminus"         "adobe-courier" "bitstream vera sans mono"
     "dejavu sans mono" "courier"       "courier 10 pitch"
     "freemono"))

(defun %ssb-x-list-fonts (ffamily)
   (x-list-fonts (concat "*" ffamily "*medium-r-normal--*iso10646*")))

(defun %ssb-get-squeezed-ffamily-list ()
   (let ((list (mapcar #'car (delete* nil (x-font-family-list) :key #'cdr)))
         (hash (make-hash-table :test #'equal)))
     (dolist (family-name list)
       (incf (gethash family-name hash 0)))
     (let (result)
       (maphash (lambda (a b) (push a result)) hash)
       result)))

(defvar %ssb-squeezed-ffamily-list
   (%ssb-get-squeezed-ffamily-list))

(defun %ssb-get-all-fonts ()
   (mapcan (lambda (family) (%ssb-x-list-fonts family)) %ssb-squeezed-ffamily-list))

(defun %ssb-create-font-family-list ()
   (let (result)
     (let (current last sub)
       (dolist (x (sort (%ssb-get-all-fonts) #'string<))
         (string-match "^-\\([^-]+\\)-\\([^-]+\\)-" x)
         (setq current (cons (substring x (match-beginning 1) (match-end 1))
                             (substring x (match-beginning 2) (match-end 2))))
         (when (and last (not (equal current last)))
           (push (list last sub) result)
           (setq sub ()))
         (push x sub)
         (setq last current))
       (push (list current sub) result))
     (mapcar (lambda (x)
               (list (if (> (count (cdar x) result :test #'string= :key #'cdar) 1)
                         (concat (caar x) "-" (cdar x))
                       (cdar x))
                     (cadr x)))
             result)))

(defun %ssb-create-font-family-font-list ()
   (let* (priority
          (result
           (delete-if (lambda (x)
                        (when (member (car x) ssb-font-priority-list)
                          (push x priority)
                          t))
                      (%ssb-create-font-family-list))))
     (nconc (mapcan (lambda (ffamily)
                      (let ((tmp (member* ffamily priority :key #'car :test #'string=)))
                        (when tmp
                          (list (car tmp)))))
                    ssb-font-priority-list)
            (sort* result #'string< :key #'car))))

(defvar %ssb-font-family-font-list
   (%ssb-create-font-family-font-list))

(defun %ssb-get-first-font (&optional ffamily)
   (if ffamily
       (caadar (member* ffamily %ssb-font-family-font-list :key #'car :test #'string=))
     (car (caadar %ssb-acceptable-font-ptr))))

(defun %ssb-create-font-family-font-list-add-size (f-f-f-l)
   (mapcar (lambda (entry)
             (if (%ssb-bitmap-font-family-p (car entry))
                 (list (car entry) (mapcar (lambda (x)
                                             (cons x (aref (font-info x) 3)))
                                           (cadr entry)))
               (list (car entry) (cdr entry))))
           f-f-f-l))

(defun ssb-create-font-family-font-list ()
   (%ssb-create-font-family-font-list-add-size %ssb-font-family-font-list))

(defvar %ssb-bitmap-fonts
   (sort (let ((scalable-fonts-allowed nil)) (%ssb-get-all-fonts)) #'string<))

(defvar %ssb-all-fonts
   (sort (let ((scalable-fonts-allowed t)) (%ssb-get-all-fonts)) #'string<))

(defvar %ssb-scalable-fonts
   (sort (set-difference %ssb-all-fonts %ssb-bitmap-fonts :test #'string=) #'string<))

(defun %ssb-scalable-font-p (font-name)
   (when (or (member font-name %ssb-scalable-fonts)
             (string-match-p "-[^-]*-0-0-0-0-[a-z]-0-" font-name))
     font-name))

(defun %ssb-bitmap-font-p (font-name)
   (unless (%ssb-scalable-font-p font-name)
     font-name))

(defun %ssb-scalable-font-family-p (ffamily-name)
   (when (%ssb-scalable-font-p (%ssb-get-first-font ffamily-name))
     ffamily-name))

(defun %ssb-bitmap-font-family-p (ffamily-name)
   (unless (%ssb-scalable-font-family-p ffamily-name)
     ffamily-name))

(defun %ssb-current-font-family-scalable-p ()
   (%ssb-scalable-font-family-p (%ssb-get-current-family)))

(defvar ssb-acceptable-font-list
   (ssb-create-font-family-font-list))

(defvar %ssb-acceptable-font-ptr
   (let ((temp (copy-tree ssb-acceptable-font-list)))
     (rplacd (last temp) temp)
     temp))

(defun %ssb-next-font ()
   (setq %ssb-acceptable-font-ptr (cdr %ssb-acceptable-font-ptr))
   nil)

(defun %ssb-get-sorted-font-list (&optional entry)
   (unless entry (setq entry (car %ssb-acceptable-font-ptr)))
   (sort* (copy-list (cadr entry)) #'< :key #'cdr))

(defun %ssb-get-current-family ()
   (caar %ssb-acceptable-font-ptr))

(defun %ssb-get-fixed-font-size-matching-list (min-lines max-lines &optional entry)
   (delete-if-not (lambda (x)
                    (and (>= x (/ (x-display-pixel-height)
                                  max-lines))
                         (<= x (/ (x-display-pixel-height)
                                  min-lines))))
                  (%ssb-get-sorted-font-list entry)
                  :key #'cdr))

(defun %ssb-get-font (min-lines max-lines)
   (if (%ssb-current-font-family-scalable-p)
       (let ((font (%ssb-get-first-font)))
         (string-match "-[0-9]+-" font)
         (concat (substring font 0 (match-beginning 0))
                 (format "-%d-" (/ (x-display-pixel-height)
                                   (/ (+ max-lines min-lines) 2)))
                 (substring font (match-end 0))))
     (let ((list
            (%ssb-get-fixed-font-size-matching-list min-lines max-lines)))
       (car (nth (/ (length list) 2) list)))))

(defun ssb-get-font (&optional min-lines max-lines)
   (unless min-lines (setq min-lines ssb-display-lines-min))
   (unless max-lines (setq max-lines ssb-display-lines-max))
   (block nil
     (let (temp (catapult 0))
       (while (not (setq temp (%ssb-get-font min-lines max-lines)))
         (when (= (incf catapult) 99) (return))
         (%ssb-next-font))
       temp)))

(defun ssb-set-font ()
   (let ((font (ssb-get-font)))
     (when font
       (set-frame-font font)
       (message font))))

(defun ssb-font-next ()
   (interactive)
   (%ssb-next-font)
   (ssb-set-font))

(defun %ssb-font-scale (scale)
   (let* ((string (frame-parameter (selected-frame) 'font))
          (size (progn
                  (string-match "-\\([0-9]+\\)-" string)
                  (string-to-number (substring string (match-beginning 1) (match-end 1)))))
          (font (%ssb-get-first-font))
          (new-size (ceiling (* scale size))))
     (cond ((> new-size ssb-scalable-font-max)
            (setq new-size ssb-scalable-font-max))
           ((< new-size ssb-scalable-font-min)
            (setq new-size ssb-scalable-font-min)))
     (string-match "-[0-9]+-" font)
     (concat (substring font 0 (match-beginning 0))
             (format "-%d-" new-size)
             (substring font (match-end 0)))))

(defun ssb-font-enlarge ()
   (interactive)
   (let ((fontname
          (if (%ssb-current-font-family-scalable-p)
              (%ssb-font-scale ssb-font-scale-scale)
            (let* ((font-list
                    (%ssb-get-sorted-font-list))
                   (position
                    (1+ (position (frame-char-height) font-list :key #'cdr))))
              (unless (= position (length font-list))
                (car (nth position font-list)))))))
     (when fontname (set-frame-font fontname))))

(defun ssb-font-shrink ()
   (interactive)
   (let ((fontname
          (if (%ssb-current-font-family-scalable-p)
              (%ssb-font-scale (/ 1.0 ssb-font-scale-scale))
            (let* ((font-list
                    (%ssb-get-sorted-font-list))
                   (position
                    (1- (position (frame-char-height) font-list :key #'cdr))))
              (unless (minusp position)
                (car (nth position font-list)))))))
     (when fontname (set-frame-font fontname))))

(defun %ssb-get-font-completion-list (&optional min-lines max-lines)
   (unless min-lines (setq min-lines ssb-display-lines-min))
   (unless max-lines (setq max-lines ssb-display-lines-max))
   (mapcan (lambda (x)
             (when (or (%ssb-scalable-font-family-p (car x))
                       (%ssb-get-fixed-font-size-matching-list min-lines max-lines x))
               (list (car x))))
           ssb-acceptable-font-list))

(defun ssb-font-select (font-name)
   (interactive (list
                 (completing-read "font family: " (%ssb-get-font-completion-list) nil t)))
   (when (and font-name (plusp (length font-name)))
     (setq %ssb-acceptable-font-ptr
           (member* font-name
                    %ssb-acceptable-font-ptr
                    :key #'car
                    :test #'string=))
     (ssb-set-font)))
From: Pascal Bourguignon
Subject: Re: [EMACS SLIME] problem witch unicode characters (no labmda for example ;>)
Date: 
Message-ID: <87skzzi044.fsf@thalassa.informatimago.com>
Szymon 'tichy' <········@glombraz.org> writes:
> Hi.
>
> In terminal session it works:
>
> ··@zbuk:~$ bin/sbcl --noinform --core lib/sbcl/sbcl.core
>
> * (defvar *greek-alphabet*
>     '(alpha beta gamma delta epsilon digamma zeta eta theta
>       iota kappa lamda mu nu xi omicron pi san archaic_koppa
>       rho sigma tau upsilon phi chi psi omega sampi))
>
> *GREEK-ALPHABET*
>
> * (map 'string
>        (lambda (x)
>          (read-from-string (format nil "#\\GREEK_SMALL_LETTER_~A" x)))
>        *greek-alphabet*)
>
> "αβγδεϝζηθικλμνξοπϻϙρστυφχψωϡ"
>
> ----------
>
> but in SLIME I got:
>
> "αβ_δ________μ___π___στ______"
>
> I replace boxes with underscore. Characters displayed as boxes
> return to normal after copy-paste to another application.
> After copy-pasting it back to emacs most characters are displayed
> properly, but some of them are still boxes:
>
> "αβγδε_ζηθικλμνξοπ__ρστυφχψω_"
>
> weird :/
>
> unfortunately I set up Ubuntu 3 weeks ago, so my Emacs is 'modified':
>
> GNU Emacs 22.1.1 (i486-pc-linux-gnu, GTK+ Version 2.12.0) of 2007-11-06 on terranova, modified by Ubuntu
>
> I have no idea how to fix this :/ Maybe I should build Emacs from source ?

You should use a fontset in emacs that contains all the greek
characters.  This problem is only esthetic, it has nothing to do with
slime.  Use S-down-mouse-1 and select one of the fixed fontsets.  They
usually gather a wide range of fonts in the different encodings.

Perhaps you're lacking a non-proportional greek font.  Install more fonts.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
You're always typing.
Well, let's see you ignore my
sitting on your hands.
From: Szymon 'tichy'
Subject: Re: [EMACS SLIME] problem witch unicode characters (no labmda for example ;>)
Date: 
Message-ID: <foqlr4$78o$1@nemesis.news.tpi.pl>
Pascal Bourguignon wrote:
> 
> You should use a fontset in emacs that contains all the greek
> characters.

In both (terminal & emacs) I use 'terminus' font...

What is strange (I just discovered that) not all members of 'terminus'
font family has equal coverage :(

Thanks for the advice, I should blame fontset first but I had
too good opinion about 'terminus' ;) it's very nice and readable font.

Regards, Szymon.
From: Szymon 'tichy'
Subject: Re: [EMACS] problem witch unicode characters.
Date: 
Message-ID: <foqq6q$ej3$1@nemesis.news.tpi.pl>
Szymon 'tichy' wrote:
> Pascal Bourguignon wrote:
>>
>> You should use a fontset in emacs that contains all the greek
>> characters.
> 
> In both (terminal & emacs) I use 'terminus' font...
> 
> What is strange (I just discovered that) not all members of 'terminus'
> font family has equal coverage :(

or 'konsole' is smart and substitute missing characters from
other fonts...
From: Szymon 'tichy'
Subject: Re: Btw. I missed name-char.
Date: 
Message-ID: <foqmf2$8c7$1@nemesis.news.tpi.pl>
Szymon 'tichy' wrote:
> Hi.
> 
> In terminal session it works:
> 
> ··@zbuk:~$ bin/sbcl --noinform --core lib/sbcl/sbcl.core
> 
> * (defvar *greek-alphabet*
>     '(alpha beta gamma delta epsilon digamma zeta eta theta
>       iota kappa lamda mu nu xi omicron pi san archaic_koppa
>       rho sigma tau upsilon phi chi psi omega sampi))
> 
> *GREEK-ALPHABET*
> 
> * (map 'string
>        (lambda (x)

Overkill:

>          (read-from-string (format nil "#\\GREEK_SMALL_LETTER_~A" x)))

should be:

            (name-char (format nil "GREEK_SMALL_LETTER_~A" x)))

>        *greek-alphabet*)


.