From mboxrd@z Thu Jan 1 00:00:00 1970 From: "briangpowell ." Subject: Re: [OT] wildcards in autocorrect? Date: Sat, 28 Mar 2015 14:34:33 -0400 Message-ID: References: <97A269DA-728F-4FC4-8B18-36254ACCA6C7@flintfam.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c3bcbc12d37905125d80d7 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40757) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbvZ5-00027j-Vm for emacs-orgmode@gnu.org; Sat, 28 Mar 2015 14:34:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbvZ4-00077e-Ks for emacs-orgmode@gnu.org; Sat, 28 Mar 2015 14:34:35 -0400 Received: from mail-ig0-x234.google.com ([2607:f8b0:4001:c05::234]:38852) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbvZ4-00077W-E1 for emacs-orgmode@gnu.org; Sat, 28 Mar 2015 14:34:34 -0400 Received: by igbqf9 with SMTP id qf9so43797881igb.1 for ; Sat, 28 Mar 2015 11:34:34 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: John Kitchin Cc: Org Mode , "Samuel W. Flint" --001a11c3bcbc12d37905125d80d7 Content-Type: text/plain; charset=UTF-8 Very interesting John, I get it now--that may be very useful--thanks for that. Also, I left out a main reason to use QEmacs: I use it for visually editing very large multi-gigabyte files--I use it for some of the things we discussed--search and replace and/or incremental-search-and-replace. On Sat, Mar 28, 2015 at 2:20 PM, John Kitchin wrote: > This is the code Samuel refers to. It is awesome. I use it less and less > ;) by which I mean everytime I use it is one less time I ever have to use > it. > > ;; > http://endlessparentheses.com/ispell-and-abbrev-the-perfect-auto-correct.html > (define-key ctl-x-map "\C-i" 'endless/ispell-word-then-abbrev) > > (defun endless/ispell-word-then-abbrev (p) > "Call `ispell-word'. Then create an abbrev for the correction made. > With prefix P, create local abbrev. Otherwise it will be global." > (interactive "P") > (let ((bef (downcase (or (thing-at-point 'word) ""))) aft) > (call-interactively 'ispell-word) > (setq aft (downcase (or (thing-at-point 'word) ""))) > (unless (string= aft bef) > (message "\"%s\" now expands to \"%s\" %sally" > bef aft (if p "loc" "glob")) > (define-abbrev > (if p global-abbrev-table local-abbrev-table) > bef aft)))) > > > > John > > ----------------------------------- > Professor John Kitchin > Doherty Hall A207F > Department of Chemical Engineering > Carnegie Mellon University > Pittsburgh, PA 15213 > 412-268-7803 > @johnkitchin > http://kitchingroup.cheme.cmu.edu > > > On Sat, Mar 28, 2015 at 12:57 PM, Samuel W. Flint > wrote: > >> There's something on endless parentheses that will let you generate a >> correction abbrev with a keystroke. >> >> Samuel W. Flint >> Please forgive any typos as this was composed on a screen keyboard. >> >> > On Mar 28, 2015, at 9:19 AM, Matt Price wrote: >> > >> > I make a lot of typing errors (I have an injury to one hand, which >> impedes bilateral cooperation). In Libreoffice I am able to define wildcard >> autocorrect objects, e.g.: >> > >> > oc.* ---> co.* >> > >> > This will correct ocrrect, ocmputer, ocndition, etc. Does anyone know >> a way to do something similar in Emacs? Right now I am using abbrev mode >> and defining my errors one by one -- it is a very slow process since I make >> so many mistakes and have a moderately large vocabulary. >> > >> > I am sure this is possible somehow, I just don't know how. >> > >> > thanks as always, >> > m >> > >> > >> >> > --001a11c3bcbc12d37905125d80d7 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Very interesting John, I get it now--that may be very usef= ul--thanks for that.

Also, I left out a main reason to u= se QEmacs: I use it for visually editing very large multi-gigabyte files--I= use it for some of the things we discussed--search and replace and/or incr= emental-search-and-replace.

On Sat, Mar 28, 2015 at 2:20 PM, John Kitchin <jkitchin@andrew.cmu.edu> wrote:
This is the code Samuel refers to. It is awesom= e. I use it less and less ;) by which I mean everytime I use it is one less= time I ever have to use it.

(define-key ctl-x-map "\C-i" '= ;endless/ispell-word-then-abbrev)

(defun endless/i= spell-word-then-abbrev (p)
=C2=A0 "Call `ispell-word'. T= hen create an abbrev for the correction made.
With prefix P, crea= te local abbrev. Otherwise it will be global."
=C2=A0 (inter= active "P")
=C2=A0 (let ((bef (downcase (or (thing-at-p= oint 'word) ""))) aft)
=C2=A0 =C2=A0 (call-interact= ively 'ispell-word)
=C2=A0 =C2=A0 (setq aft (downcase (or (th= ing-at-point 'word) "")))
=C2=A0 =C2=A0 (unless (st= ring=3D aft bef)
=C2=A0 =C2=A0 =C2=A0 (message "\"%s\&q= uot; now expands to \"%s\" %sally"
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0bef aft (if p "loc" &quo= t;glob"))
=C2=A0 =C2=A0 =C2=A0 (define-abbrev
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 (if p global-abbrev-table local-abbrev-table)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 bef aft))))=C2=A0



John

--------------------------= ---------
Professor John Kitchin=C2=A0
Doherty Hall A207F
Departme= nt of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA = 15213
412-268-7803

On Sat, Mar 28, 2015 at 12:57 PM, Samuel W. = Flint <swflint@flintfam.org> wrote:
There's something on endless parentheses that will let yo= u generate a correction abbrev with a keystroke.

Samuel W. Flint
Please forgive any typos as this was composed on a screen keyboard.

> On Mar 28, 2015, at 9:19 AM, Matt Price <moptop99@gmail.com> wrote:
>
> I make a lot of typing errors (I have an injury to one hand, which imp= edes bilateral cooperation). In Libreoffice I am able to define wildcard au= tocorrect objects, e.g.:
>
> oc.* ---> co.*
>
> This will correct ocrrect, ocmputer, ocndition, etc.=C2=A0 Does anyone= know a way to do something similar in Emacs? Right now I am using abbrev m= ode and defining my errors one by one -- it is a very slow process since I = make so many mistakes and have a moderately large vocabulary.
>
> I am sure this is possible somehow, I just don't know how.
>
> thanks as always,
> m
>
>



--001a11c3bcbc12d37905125d80d7--