all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] ispell.el: Ensure trailing wildcard when looking up words with grep
@ 2013-11-07  8:40 Ingo Lohmar
  2013-11-09  1:16 ` Dmitry Gutov
  0 siblings, 1 reply; 3+ messages in thread
From: Ingo Lohmar @ 2013-11-07  8:40 UTC (permalink / raw)
  To: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 340 bytes --]

Hi all,

Using company-mode for plain-text completion on a windows system (no look,
only grep) exhibits a bug where the grep regexp lacks a trailing wildcard.
Attached short patch fixes this and has been working for me for some time
now.

Note: I have signed the FSF papers earlier this week, just waiting for the
confirmation.

Best,
Ingo

[-- Attachment #1.2: Type: text/html, Size: 446 bytes --]

[-- Attachment #2: 0001-Ensure-trailing-wildcard-when-looking-up-words-with-.patch --]
[-- Type: application/octet-stream, Size: 1217 bytes --]

From f60deabc17fcebd08a21e00ff86b1eee5bf67230 Mon Sep 17 00:00:00 2001
From: Ingo Lohmar <i.lohmar@gmail.com>
Date: Thu, 7 Nov 2013 08:18:11 +0100
Subject: [PATCH] Ensure trailing wildcard when looking up words with grep

lisp/textmodes/ispell.el: ispell-lookup-words

The (preferred) `look' program does not need a traling wildcard when
looking up words (eg, for completion purposes).  Falling back on
`grep', however (as on many NTEmacs systems), such a wildcard is
needed.  This patch adds '.*' if necessary.
---
 lisp/textmodes/ispell.el |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index a361bda..53899fa 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -2653,6 +2653,9 @@ if defined."
         (insert "^" word "$")
         (while (search-backward "*" nil t) (insert "."))
         (setq word (buffer-string))
+        ;; ensure trailing wildcard for grep
+        (unless (string= (substring word -2) ".*")
+          (setq word (concat word ".*")))
         (erase-buffer))
       (setq status (apply 'ispell-call-process prog nil t nil
                           (nconc (if (and args (> (length args) 0))
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ispell.el: Ensure trailing wildcard when looking up words with grep
  2013-11-07  8:40 [PATCH] ispell.el: Ensure trailing wildcard when looking up words with grep Ingo Lohmar
@ 2013-11-09  1:16 ` Dmitry Gutov
  2013-11-09  8:10   ` Ingo Lohmar
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Gutov @ 2013-11-09  1:16 UTC (permalink / raw)
  To: Ingo Lohmar; +Cc: emacs-devel

Hi Ingo,

Ingo Lohmar <i.lohmar@gmail.com> writes:

> Using company-mode for plain-text completion on a windows system (no
> look, only grep) exhibits a bug where the grep regexp lacks a trailing
> wildcard. Attached short patch fixes this and has been working for me
> for some time now.

Unfortunately, you patch didn't work for me. At the time you're checking
for trailing ".*", `word' already ends with "$" (so the check always
fails), and when you append ".*", that also goes after "$", which doesn't
seem valid.

I've installed a different patch in revision 115045, please see if it
works for you.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ispell.el: Ensure trailing wildcard when looking up words with grep
  2013-11-09  1:16 ` Dmitry Gutov
@ 2013-11-09  8:10   ` Ingo Lohmar
  0 siblings, 0 replies; 3+ messages in thread
From: Ingo Lohmar @ 2013-11-09  8:10 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

Hi Dmitry,

Sorry for that, you are absolutely correct, of course --- looking at my
"patch" now, I cannot even reconstruct what went wrong.  Thanks for the
fix, it seems the right way to check it.  In case of any problems, I
will report again.



On Sat, Nov 09 2013 02:16 (+0100), Dmitry Gutov wrote:

> Hi Ingo,
>
> Ingo Lohmar <i.lohmar@gmail.com> writes:
>
>> Using company-mode for plain-text completion on a windows system (no
>> look, only grep) exhibits a bug where the grep regexp lacks a trailing
>> wildcard. Attached short patch fixes this and has been working for me
>> for some time now.
>
> Unfortunately, you patch didn't work for me. At the time you're checking
> for trailing ".*", `word' already ends with "$" (so the check always
> fails), and when you append ".*", that also goes after "$", which doesn't
> seem valid.
>
> I've installed a different patch in revision 115045, please see if it
> works for you.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-09  8:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-07  8:40 [PATCH] ispell.el: Ensure trailing wildcard when looking up words with grep Ingo Lohmar
2013-11-09  1:16 ` Dmitry Gutov
2013-11-09  8:10   ` Ingo Lohmar

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.