From: Drew Adams <drew.adams@oracle.com>
To: Svend Sorensen <svend@ciffer.net>,
Nicolas Richard <theonewiththeevillook@yahoo.fr>
Cc: 17284@debbugs.gnu.org
Subject: bug#17284: Host name completion in shell mode take 45 seconds
Date: Fri, 3 Apr 2015 09:25:04 -0700 (PDT) [thread overview]
Message-ID: <4982c9c5-f87b-41f0-8e79-30fb65de6e99@default> (raw)
In-Reply-To: <CA+N+ML9Ee+b2Yxsx4Kwovm8XhT0sXCgCuDjkf-C+3TZpskA=XA@mail.gmail.com>
> > > 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)))
next prev parent reply other threads:[~2015-04-03 16:25 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-17 17:47 bug#17284: 24.3.90; Host name completion in shell mode take 45 seconds Svend Sorensen
2015-04-02 17:36 ` bug#17284: " Svend Sorensen
2015-04-03 5:39 ` Nicolas Richard
2015-04-03 9:09 ` Svend Sorensen
2015-04-03 10:36 ` Nicolas Richard
2015-04-03 11:12 ` martin rudalics
2015-04-03 13:28 ` Stefan Monnier
2015-04-04 8:29 ` martin rudalics
2015-04-04 13:54 ` Stefan Monnier
2015-04-04 15:59 ` martin rudalics
2015-04-03 11:42 ` Dmitry Gutov
2015-04-03 11:58 ` Nicolas Richard
2015-04-03 16:25 ` Drew Adams [this message]
2015-04-04 8:29 ` martin rudalics
2015-04-04 14:46 ` Drew Adams
2015-04-04 16:00 ` martin rudalics
2015-04-04 21:38 ` Drew Adams
[not found] ` <cf794d98-4671-4a57-92cf-27a8c59c9211@default>
2016-01-02 3:59 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4982c9c5-f87b-41f0-8e79-30fb65de6e99@default \
--to=drew.adams@oracle.com \
--cc=17284@debbugs.gnu.org \
--cc=svend@ciffer.net \
--cc=theonewiththeevillook@yahoo.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.