Subject: bug#17284: Host name completion in shell mode take 45 seconds

From: Nicolas Richard <[email-masked]>
Date: Fri, 03 Apr 2015 12:36:20 +0200

Le 03/04/2015 11:09, Svend Sorensen a écrit :
> On Thu, Apr 2, 2015 at 10:39 PM, Nicolas Richard
> <[email-masked]> wrote:
>>
>> Does it help to replace (looking-back ",") by (eq ?, (char-before)) ?
> 
> The function runs quickly with that change.

Thanks.

I'm still not confident enough to push my commits without approval from
actual devs so here's what I suggest:

Commit fd89dbb0e9658874f71a75f0b84ce2f1a3021252
References: yf/bug-17284
Author:     Nicolas Richard <[email-masked]>
AuthorDate: Fri Apr 3 12:28:40 2015 +0200
Commit:     Nicolas Richard <[email-masked]>
CommitDate: Fri Apr 3 12:33:42 2015 +0200

    pcmpl-ssh-known-hosts: Use `char-before' instead of `looking-back'.
    
    Fixes: debbugs:17284
    
    * lisp/pcmpl-unix.el (pcmpl-ssh-known-hosts): Use `char-before' instead
    of `looking-back'.

1 parent commit, 2 merged branches, 1 containing branch
 Parent     | 0b914ba ; Tweak the previous change
 Merged     | emacs-24 yf/bug-17284
 Containing | yf/bug-17284
 Follows    | emacs-24.5-rc1 (4152)

2 files changed, 6 insertions(+), 1 deletion(-)
 lisp/ChangeLog     | 5 +++++
 lisp/pcmpl-unix.el | 2 +-

modified   lisp/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-03  Nicolas Richard  <[email-masked]>
+
+	* pcmpl-unix.el (pcmpl-ssh-known-hosts): Use `char-before' instead
+	of `looking-back' (bug#17284).
+
 2015-04-03  Dmitry Gutov  <[email-masked]>
 
 	* progmodes/js.el (js-indent-line): Do nothing when bol is inside
modified   lisp/pcmpl-unix.el
@@ -157,7 +157,7 @@ (defun pcmpl-ssh-known-hosts ()
         (while (re-search-forward (concat "^ *" host-re) nil t)
           (add-to-list 'ssh-hosts-list (concat (match-string 1)
                                                (match-string 2)))
-          (while (and (looking-back ",")
+          (while (and (eq (char-before) ?,)
                       (re-search-forward host-re (line-end-position) t))
             (add-to-list 'ssh-hosts-list (concat (match-string 1)
                                                  (match-string 2)))))

-- 
Nico.