From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mathias Dahl Newsgroups: gmane.emacs.devel Subject: Re: Abbrev suggestions - feedback appreciated Date: Sun, 17 Sep 2017 23:56:49 +0200 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="089e08204f6c307248055969b553" X-Trace: blaine.gmane.org 1505685440 25813 195.159.176.226 (17 Sep 2017 21:57:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 17 Sep 2017 21:57:20 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Sep 17 23:57:17 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dthYw-0006ST-IE for ged-emacs-devel@m.gmane.org; Sun, 17 Sep 2017 23:57:14 +0200 Original-Received: from localhost ([::1]:33791 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dthZ3-0002XH-M8 for ged-emacs-devel@m.gmane.org; Sun, 17 Sep 2017 17:57:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dthYt-0002WV-NK for emacs-devel@gnu.org; Sun, 17 Sep 2017 17:57:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dthYs-0005Lb-Pp for emacs-devel@gnu.org; Sun, 17 Sep 2017 17:57:11 -0400 Original-Received: from mail-ua0-x22e.google.com ([2607:f8b0:400c:c08::22e]:54488) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dthYs-0005LH-M0 for emacs-devel@gnu.org; Sun, 17 Sep 2017 17:57:10 -0400 Original-Received: by mail-ua0-x22e.google.com with SMTP id l94so3564897ual.11 for ; Sun, 17 Sep 2017 14:57:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=vZJ4JFoawB5fCa5vKmU80BeO1MpAT/1dV4wPBO5EEVo=; b=q6exxBN8aEdzpg3ipLUtfmC55WYKXm0kqnN4D2eXEzdunWERD5am3h0IHKel/cBV3C vhJBcNDswOYT/at4MUk8WOiwdwIXXd2pzYetd1S/bGhYtI5DTdFhn6cUjTv3LurpHwB3 OLvgb9Qq+EocRFoVh+mYerGjoB2C7aE8kmZ0hQ05KA5+0qwtF9kSbbbePc59E86e2hLz skYCJqgyjrTUOyzhJVeo5FOjos2jdhzyMkiJvmOPN3rJB3a+nTEVyi49wuMcg8+kxqU3 M2zXpnTaL6w4vUiolEId1pnwVGVVe1E/sivbdHRkyGwjlRo63NegkbYlOvdCssOnZr1f fMKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=vZJ4JFoawB5fCa5vKmU80BeO1MpAT/1dV4wPBO5EEVo=; b=QV5/XlHO8pn8EDTW+qIyfEsl9MVdeQPrXqDPrHxQPBu2fZr6Z74sHdrvVLaeR1NsEX /9mmklfv39PP4/XXkwq8OZ9NJJ46Y9rVPEnDJcVBQ+QVc4vl14Utt07hfho2fbwo3bM2 +3ez+foz9f6pB3KOUV42vzCLDfh02Sw/Un9bj/AEV8IkPWecK1VI4ZV5siFw+CJE08q3 5YV9Mo6Q4ELC6WdXEkfAfLok+8mq1PtA1KapEKDjC9cyFlM/2xfesjzTHbkGUMVMwDK+ 1Ia1j+VCeQwqGFjpuRIvb4BsjVxbdwB7iv5rSwOEfwrnOSUUDo4u6H5oZdyiWaTixgAL xIsQ== X-Gm-Message-State: AHPjjUhhCnr0rFOfjFZTtFnnQvYQNsX3emVDJz1AHZvc/RjFRQmbcmNh vER1EqePwsyCg9ZuVwklHEXeC2bGGTze3Z7+1KATEnrB X-Google-Smtp-Source: ADKCNb5qMYM6YKV3Z0/GKLnGBoDW1O+gPMBmRbtEI/Jct5jeFIL9NnHgk0b7TBQNDNK2EtYjTEvwhWSwH+3kDW8SQBg= X-Received: by 10.176.95.152 with SMTP id b24mr28174450uaj.30.1505685429840; Sun, 17 Sep 2017 14:57:09 -0700 (PDT) Original-Received: by 10.176.83.89 with HTTP; Sun, 17 Sep 2017 14:56:49 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400c:c08::22e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:218436 Archived-At: --089e08204f6c307248055969b553 Content-Type: text/plain; charset="UTF-8" > > Actually, my "clever" idea was that you don't read any word at all: just > go though the existing abbreviations, and check for each one of the if > the text before point matches the expansion. > > Admittedly, I don't think we currently have a fast implementation of the > equivalent of (looking-back (regexp-quote expansion)), so I don't know > how well it will perform. > My simple function `asug-get-previous-words' function performs quite well, it seems. I could not get `looking-back' to work across lines. It was very quick though, when words was on the same line. Also, collecting all active abbrev expansions was also very fast (1000 runs takes 0.1 on my not very hot PC) so I did not bother with that optimization. But perhaps I will experiment a bit with that too. All in all this seems to turn out quite nicely. I will try to integrate it properly in abbrev.el and add some option there to toggle this feature on. Thanks for the pointers! --089e08204f6c307248055969b553 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Actually, my "clever&quo= t; idea was that you don't read any word at all: just
go though the existing abbreviations, and check for each one of the if
the text before point matches the expansion.

Admittedly, I don't think we currently have a fast implementation of th= e
equivalent of (looking-back (regexp-quote expansion)), so I don't know<= br> how well it will perform.

My simple fun= ction `asug-get-previous-words' function performs quite well,
it seems. I could not get `looking-back' to work across lines. It was = very quick
though, when words was on the same line.
Also, collecting all active abbrev expansions was also very fas= t (1000 runs
takes 0.1 on my not very hot PC) so I did not bother= with that optimization. But
perhaps I will experiment a bit with= that too.

All in all this seems to turn out quite= nicely. I will try to integrate it properly in
abbrev.el and add= some option there to toggle this feature on.

Than= ks for the pointers!




--089e08204f6c307248055969b553--