From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#17284: Host name completion in shell mode take 45 seconds Date: Fri, 3 Apr 2015 09:25:04 -0700 (PDT) Message-ID: <4982c9c5-f87b-41f0-8e79-30fb65de6e99@default> References: <87a8ypixcn.fsf@yahoo.fr> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1428078390 27367 80.91.229.3 (3 Apr 2015 16:26:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 3 Apr 2015 16:26:30 +0000 (UTC) Cc: 17284@debbugs.gnu.org To: Svend Sorensen , Nicolas Richard Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Apr 03 18:26:14 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ye4Q8-000093-Id for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Apr 2015 18:26:12 +0200 Original-Received: from localhost ([::1]:34743 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ye4Q7-0000tn-AO for geb-bug-gnu-emacs@m.gmane.org; Fri, 03 Apr 2015 12:26:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56876) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ye4Q3-0000te-DM for bug-gnu-emacs@gnu.org; Fri, 03 Apr 2015 12:26:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ye4Py-0005gI-U7 for bug-gnu-emacs@gnu.org; Fri, 03 Apr 2015 12:26:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54335) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ye4Py-0005gD-Qe for bug-gnu-emacs@gnu.org; Fri, 03 Apr 2015 12:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Ye4Py-0005o5-Eg for bug-gnu-emacs@gnu.org; Fri, 03 Apr 2015 12:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Apr 2015 16:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17284 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17284-submit@debbugs.gnu.org id=B17284.142807831722260 (code B ref 17284); Fri, 03 Apr 2015 16:26:02 +0000 Original-Received: (at 17284) by debbugs.gnu.org; 3 Apr 2015 16:25:17 +0000 Original-Received: from localhost ([127.0.0.1]:44111 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ye4PE-0005mx-Ck for submit@debbugs.gnu.org; Fri, 03 Apr 2015 12:25:16 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:45327) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Ye4PB-0005mh-Dl for 17284@debbugs.gnu.org; Fri, 03 Apr 2015 12:25:13 -0400 Original-Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t33GP6b5023785 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 3 Apr 2015 16:25:06 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.13.8/8.13.8) with ESMTP id t33GP5BP008737 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 3 Apr 2015 16:25:05 GMT Original-Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t33GP5r6025647; Fri, 3 Apr 2015 16:25:05 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8.2 (807160) [OL 12.0.6691.5000 (x86)] X-Source-IP: userv0022.oracle.com [156.151.31.74] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:101158 Archived-At: > > > Does it help to replace (looking-back ",") by (eq ?, (char-before)) ? > >=20 > > 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)))