[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#17284: Host name completion in shell mode take 45 seconds
From: |
Drew Adams |
Subject: |
bug#17284: Host name completion in shell mode take 45 seconds |
Date: |
Fri, 3 Apr 2015 09:25:04 -0700 (PDT) |
> > > Does it help to replace (looking-back ",") by (eq ?, (char-before)) ?
> >
> > The function runs quickly with that change.
>
> Couldn't the byte-compiler warn when `looking-back' is used without
> specifying LIMIT? Making LIMIT non-optional seems too harsh.
1. Is it really about LIMIT? Or is it instead about looking back
at a literal string of chars? And typically a short string.
I'm guessing that that is the use case to pursue here.
2. Instead of (or in addition to) a byte-compiler warning for
`looking-back', how about adding a function `chars-before'?
Since I use multiple Emacs versions, some quite old, I use this.
But I'm sure that a much better (including prettier) definition
can be had for recent Emacs. Or (better) define it in C.
(defun chars-before (chars)
"Return non-nil if the literal string CHARS is right before point."
(let* ((len (length chars))
(idx (1- len))
(pt (point)))
(catch 'chars-before
(dolist (char (append chars ()))
(unless (condition-case nil
(eq char (char-before (- pt idx)))
(error nil))
(throw 'chars-before nil))
(setq idx (1- idx)))
t)))
Likewise (but may be no better than `looking-at' + `regexp-quote'):
(defun chars-after (chars)
"Return non-nil if the literal string CHARS is right after point."
(let* ((len (length chars))
(idx (1- len))
(pt (point)))
(catch 'chars-after
(dolist (char (nreverse (append chars ())))
(unless (condition-case nil
(eq char (char-after (+ pt idx)))
(error nil)) ; e.g. `eobp'
(throw 'chars-after nil))
(setq idx (1- idx)))
t)))
- bug#17284: Host name completion in shell mode take 45 seconds, (continued)
- bug#17284: Host name completion in shell mode take 45 seconds, Nicolas Richard, 2015/04/03
- bug#17284: Host name completion in shell mode take 45 seconds, Svend Sorensen, 2015/04/03
- bug#17284: Host name completion in shell mode take 45 seconds, Nicolas Richard, 2015/04/03
- bug#17284: Host name completion in shell mode take 45 seconds, martin rudalics, 2015/04/03
- bug#17284: Host name completion in shell mode take 45 seconds, Stefan Monnier, 2015/04/03
- bug#17284: Host name completion in shell mode take 45 seconds, martin rudalics, 2015/04/04
- bug#17284: Host name completion in shell mode take 45 seconds, Stefan Monnier, 2015/04/04
- bug#17284: Host name completion in shell mode take 45 seconds, martin rudalics, 2015/04/04
- bug#17284: Host name completion in shell mode take 45 seconds, Dmitry Gutov, 2015/04/03
- bug#17284: Host name completion in shell mode take 45 seconds, Nicolas Richard, 2015/04/03
- bug#17284: Host name completion in shell mode take 45 seconds,
Drew Adams <=
- bug#17284: Host name completion in shell mode take 45 seconds, martin rudalics, 2015/04/04
- bug#17284: Host name completion in shell mode take 45 seconds, Drew Adams, 2015/04/04
- bug#17284: Host name completion in shell mode take 45 seconds, martin rudalics, 2015/04/04
- bug#17284: Host name completion in shell mode take 45 seconds, Drew Adams, 2015/04/04