bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#13041: 24.2; diacritic-fold-search


From: martin rudalics
Subject: bug#13041: 24.2; diacritic-fold-search
Date: Sun, 02 Dec 2012 18:45:38 +0100

> But nevertheless the `decomposition' property should be used to find
> all decomposable characters.  The question is how to use them in the search.

Whatever solution you find most suitable here, it would be nice to come
up with a similar solution for sorting.  I've been playing around with a
function like

(defun decomposed-string-lessp (string1 string2)
  "Return t if STRING1 is decomposition-less than STRING2."
  (let* ((length1 (length string1))
         (length2 (length string2))
         (min-length (min length1 length2))
         (index 0)
         type1 type2)
    (catch 'found
      (while (< index min-length)
        (setq type1 (car (get-char-code-property
                          (elt string1 index) 'decomposition)))
        (setq type2 (car (get-char-code-property
                          (elt string2 index) 'decomposition)))
        (cond
         ((< type1 type2)
          (throw 'found t))
         ((> type1 type2)
          (throw 'found nil)))
        ;; Continue.
        (setq index (1+ index)))
      ;; Shorter is less.
      (< length1 length2))))

but am not sure whether I'm missing something wrt the return value of
`get-char-code-property'.

martin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]