From: Drew Adams <drew.adams@oracle.com>
To: martin rudalics <rudalics@gmx.at>,
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: Sat, 4 Apr 2015 07:46:40 -0700 (PDT) [thread overview]
Message-ID: <be21b8ac-c8f7-4bcf-8fcb-46288ca09fd8@default> (raw)
In-Reply-To: <551FA100.2040208@gmx.at>
> (defun string-before-p (string)
> "Return t if string before `point' equals STRING."
> (let ((start (- (point) (length string))))
> (and (>= start (point-min))
> (string-equal
> (buffer-substring-no-properties start (point))
> string))))
`buffer-substring-no-properties' is defined in C. I can't tell
whether this is more efficient because of that or less efficient
because it creates a potentially giant string before starting to
compare. I was trying to compare starting from the far end,
thinking that that might lead to earlier failure detection.
But I'll take your word for it that this is probably better.
(I guess if we were really worried about the long-string case we
could do what Isearch does, for the comparison.)
I didn't mention this before, because my implementation of
`chars-before' uses `char-before'. But with such a function,
if it is defined without using `char-before' then the latter
function could be eliminated: (chars-before "a") instead of
(char-before ?a).
> And for simpler cases giving `char-before' a second argument
> to specify the position of the character before `point' might help too.
Yes. (And that could apply as well to `chars-before', aka
`string-before-p' - optionally specify the start or end position.)
> But many occurrences of `looking-back' in the code base are inherently
> tied to regexps specified via defcustoms or passed as arguments and it
> doesn't seem easy to get rid of them. Hence we should probably add a
> TODO item to fix all occurrences of `looking-back' either via the LIMIT
> argument, by string or character comparison. An appetizing formulation
> of such an item would be very welcome.
Yes. And I think you just formulated it, appetizingly enough. ;-)
next prev parent reply other threads:[~2015-04-04 14:46 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
2015-04-04 8:29 ` martin rudalics
2015-04-04 14:46 ` Drew Adams [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=be21b8ac-c8f7-4bcf-8fcb-46288ca09fd8@default \
--to=drew.adams@oracle.com \
--cc=17284@debbugs.gnu.org \
--cc=rudalics@gmx.at \
--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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).