unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Stefan Monnier" <monnier+gnu.emacs.help/news/@flint.cs.yale.edu>
Subject: Re: Word  Completion by  Association
Date: 10 Mar 2003 15:09:04 -0500	[thread overview]
Message-ID: <5ladg3nfvj.fsf@rum.cs.yale.edu> (raw)
In-Reply-To: de3ad953.0303031213.1b9df52@posting.google.com

>>>>> "Artist" == Artist  <googleartist@yahoo.com> writes:
> Hi I am looking for mechanism which allows me to complete the word
> based on association.  Example: I have only 4 words : [artist],
> [google], [emacs], [gnu]

How about the following quick hack for a start ?
It changes the behavior of dabbrev along the lines of what you're
asking.  Obviously, we'd want this without losing the old behavior,
but that's for "future work".


        Stefan


--- dabbrev.el.~1.67.~	Wed Feb  5 10:54:43 2003
+++ dabbrev.el	Mon Mar 10 15:07:04 2003
@@ -972,10 +969,12 @@
 Returns the expansion found, or nil if not found.
 Leaves point at the location of the start of the expansion."
   (save-match-data
-    (let ((pattern1 (concat (regexp-quote abbrev)
-			    "\\(" dabbrev--abbrev-char-regexp "\\)"))
-	  (pattern2 (concat (regexp-quote abbrev)
-			   "\\(\\(" dabbrev--abbrev-char-regexp "\\)+\\)"))
+    (let ((pattern1 (concat (mapconcat (lambda (c) (regexp-quote (string c)))
+				       abbrev (concat "\\(?:" dabbrev--abbrev-char-regexp "\\)*"))
+			    "\\(?:" dabbrev--abbrev-char-regexp "\\)"))
+	  (pattern2 (concat (mapconcat (lambda (c) (regexp-quote (string c)))
+				       abbrev (concat "\\(?:" dabbrev--abbrev-char-regexp "\\)*"))
+			    "\\(\\(?:" dabbrev--abbrev-char-regexp "\\)+\\)"))
 	  ;; This makes it possible to find matches in minibuffer prompts
 	  ;; even when they are "inviolable".
 	  (inhibit-point-motion-hooks t)

      parent reply	other threads:[~2003-03-10 20:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-03 20:13 Word Completion by Association Artist
2003-03-03 23:16 ` jean daniel browne
2003-03-03 23:52 ` Unknown
2003-03-04  2:36   ` Artist
2003-03-04  4:06     ` Unknown
2003-03-04 18:51     ` Edward O'Connor
2003-03-05 14:42       ` Artist
2003-03-06 15:39         ` Bijan Soleymani
2003-03-10 20:09 ` Stefan Monnier [this message]

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=5ladg3nfvj.fsf@rum.cs.yale.edu \
    --to=monnier+gnu.emacs.help/news/@flint.cs.yale.edu \
    /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.
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).