[Top][All Lists]

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

Re: gnus should accept UTF8 even if UTF-8 is standard

From: Stefan Monnier
Subject: Re: gnus should accept UTF8 even if UTF-8 is standard
Date: Fri, 31 Oct 2008 17:29:32 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

>> For instance, completing-read could accept a list of alternatives
>> that are valid if entered, but should not affect completion.

>     It's just easier to do a "loose match" than to hardcode a list
>     of alternatives.

> If it works, it's fine.

The following patch (to be applied by hand, or to be read) is a proof
of concept.  It allows the user to do "C-x RET f u8 TAB" and have it
complete to utf-8.


=== modified file 'lisp/international/mule.el'
--- lisp/international/mule.el  2008-07-24 03:10:36 +0000
+++ lisp/international/mule.el  2008-10-31 21:08:00 +0000
@@ -1192,6 +1192,10 @@
                  (goto-char (point-min))
                  (set-auto-coding buffer-file-name (buffer-size))))))
+          (completion-ignore-case t)
+          (completion-pcm--delim-wild-regex
+           (concat completion-pcm--delim-wild-regex
+                   "\\|\\([[:alpha:]]\\)[[:digit:]]"))
           (cs (completing-read (format "Coding system for saving file (default 
%s): " auto-cs)
                                 bcss-table combined-table)

=== modified file 'lisp/minibuffer.el'
--- lisp/minibuffer.el  2008-10-30 00:44:07 +0000
+++ lisp/minibuffer.el  2008-10-31 21:11:08 +0000
@@ -1512,6 +1512,13 @@
            (p0 p))
       (while (setq p (string-match completion-pcm--delim-wild-regex string p))
+        ;; Usually, completion-pcm--delim-wild-regex matches a delimiter,
+        ;; meaning that something can be added *before* it, but it can also
+        ;; match a prefix and postfix, in which case something can be added
+        ;; in-between (e.g. match [[:lower:]][[:upper:]]).
+        ;; This is determined by the presence of a submatch-1 which delimits
+        ;; the prefix.
+        (if (match-end 1) (setq p (match-end 1)))
         (push (substring string p0 p) pattern)
         (if (eq (aref string p) ?*)

reply via email to

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