emacs-devel
[Top][All Lists]
Advanced

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

Re: ERC completion


From: Stefan Monnier
Subject: Re: ERC completion
Date: Wed, 27 Apr 2011 21:18:43 -0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> The change from 2011-04-26 13:50:09 by Stefan Monnier introduced the
> following changes:

> - Completion is now case-sensitive. I think the old behaviour was a
>   better default (I know I highlight many people with capitalized nick)

Hmm... oh I think I see where is the problem: erc-pcomplete.el sets
pcomplete-ignore-case, but pcomplete-completions-at-point does not obey
this variable.  The patch I just installed (attached) should fix it.

> - erc-complete-functions seems to be ignored, but is still documented as
>   a variable. Could you mark it as obsolete and document how to get the
>   same effect with the new framework?

What makes you think it's ignored?


        Stefan


=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog      2011-04-27 19:51:19 +0000
+++ lisp/ChangeLog      2011-04-28 00:17:24 +0000
@@ -1,3 +1,13 @@
+2011-04-28  Stefan Monnier  <address@hidden>
+
+       * pcomplete.el (pcomplete-completions-at-point):
+       Obey pcomplete-ignore-case.  Don't call pcomplete-norm-func unless
+       pcomplete-seen is non-nil.
+       (pcomplete-comint-setup): Also recognize the new comint/shell
+       completion functions.
+       (pcomplete-do-complete): Don't call pcomplete-norm-func unless
+       pcomplete-seen is non-nil.
+
 2011-04-27  Niels Giesen  <address@hidden>
 
        * calendar/icalendar.el (diary-lib): Add require statement.

=== modified file 'lisp/pcomplete.el'
--- lisp/pcomplete.el   2011-04-19 13:44:55 +0000
+++ lisp/pcomplete.el   2011-04-28 00:14:41 +0000
@@ -522,23 +522,24 @@
                                        (directory-file-name f)))
                             pcomplete-seen))
               (lambda (f)
-                (not (member
+                (not (when pcomplete-seen
+                       (member
                       (funcall pcomplete-norm-func
                                (directory-file-name f))
-                      pcomplete-seen))))))
-
-      (list
-       beg (point)
+                        pcomplete-seen)))))))
+      (unless (zerop (length pcomplete-termination-string))
        ;; Add a space at the end of completion.  Use a terminator-regexp
        ;; that never matches since the terminator cannot appear
        ;; within the completion field anyway.
-       (if (zerop (length pcomplete-termination-string))
-           table
-         (apply-partially 'completion-table-with-terminator
+        (setq table
+              (apply-partially #'completion-table-with-terminator
                           (cons pcomplete-termination-string
                                 "\\`a\\`")
-                          table))
-       :predicate pred))))
+                               table)))
+      (when pcomplete-ignore-case
+        (setq table
+              (apply-partially #'completion-table-case-fold table)))
+      (list beg (point) table :predicate pred))))
 
  ;; I don't think such commands are usable before first setting up buffer-local
  ;; variables to parse args, so there's no point autoloading it.
@@ -781,7 +782,9 @@
   (set (make-local-variable completef-sym)
        (copy-sequence (symbol-value completef-sym)))
   (let* ((funs (symbol-value completef-sym))
-        (elem (or (memq 'shell-dynamic-complete-filename funs)
+        (elem (or (memq 'comint-filename-completion funs)
+                   (memq 'shell-filename-completion funs)
+                   (memq 'shell-dynamic-complete-filename funs)
                   (memq 'comint-dynamic-complete-filename funs))))
     (if elem
        (setcar elem 'pcomplete)
@@ -1248,11 +1251,12 @@
       (setq completions
             (apply-partially 'completion-table-with-predicate
                              completions
+                             (when pcomplete-seen
                              (lambda (f)
                                (not (member
                                      (funcall pcomplete-norm-func
                                               (directory-file-name f))
-                                     pcomplete-seen)))
+                                       pcomplete-seen))))
                              'strict)))
     ;; OK, we've got a list of completions.
     (if pcomplete-show-list




reply via email to

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