unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11046: 24.0.94; Customize: M-TAB moves cursor over tag; clicking button moves cursor over button
@ 2012-03-20 16:02 Drew Adams
  2012-03-20 17:48 ` Eli Zaretskii
  2019-09-30 16:08 ` Mauro Aranda
  0 siblings, 2 replies; 7+ messages in thread
From: Drew Adams @ 2012-03-20 16:02 UTC (permalink / raw)
  To: 11046

emacs -Q

M-x customize-option RET site-run-file RET
 
Click Value Menu button.  Choose String in the menu.
 
1. First bug: Cursor should be in the edit field.  But it is on top of
the Value Menu button.
 
2. Put cursor at beginning of the edit field.  Hit `M-TAB'.
 
You see this error message: "lookup-words: lookup-words error: No plain
word-list found at systemdefault locations.  Customize
`ispell-alternate-dictionary' to set yours."
 
But the cursor is moved back on top of the tag `String:', before the
`:' (second bug).
 
In GNU Emacs 24.0.94.1 (i386-mingw-nt5.1.2600)
 of 2012-03-19 on MARVIN
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.6) --no-opt --enable-checking --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include'
 






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

* bug#11046: 24.0.94; Customize: M-TAB moves cursor over tag; clicking button moves cursor over button
  2012-03-20 16:02 bug#11046: 24.0.94; Customize: M-TAB moves cursor over tag; clicking button moves cursor over button Drew Adams
@ 2012-03-20 17:48 ` Eli Zaretskii
  2012-09-17  0:07   ` Drew Adams
  2019-09-30 16:08 ` Mauro Aranda
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2012-03-20 17:48 UTC (permalink / raw)
  To: Drew Adams; +Cc: 11046

> From: "Drew Adams" <drew.adams@oracle.com>
> Date: Tue, 20 Mar 2012 09:02:30 -0700
> 
> emacs -Q
> 
> M-x customize-option RET site-run-file RET
>  
> Click Value Menu button.  Choose String in the menu.
>  
> 1. First bug: Cursor should be in the edit field.  But it is on top of
> the Value Menu button.

Confirmed.

> 2. Put cursor at beginning of the edit field.  Hit `M-TAB'.
>  
> You see this error message: "lookup-words: lookup-words error: No plain
> word-list found at systemdefault locations.  Customize
> `ispell-alternate-dictionary' to set yours."
>  
> But the cursor is moved back on top of the tag `String:', before the
> `:' (second bug).

I don't get the error message, but a "*Choices*" buffer (because my
ispell-alternate-dictionary _is_ properly configured), but that buffer
shows hits for "String".  Here's a sample:

(0) /Usr/Dict/Web2:190067:String       (1) /Usr/Dict/Web2:190068:Stringboard
(2) /Usr/Dict/Web2:190069:Stringcourse (3) /Usr/Dict/Web2:190070:Stringend

etc. -- quite un-useful.  IOW, it _really_ tries to complete the word
"String", which is not what the user wants.

(Shouldn't the type of the widget be "file" instead of "string"?)





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

* bug#11046: 24.0.94; Customize: M-TAB moves cursor over tag; clicking button moves cursor over button
  2012-03-20 17:48 ` Eli Zaretskii
@ 2012-09-17  0:07   ` Drew Adams
  0 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2012-09-17  0:07 UTC (permalink / raw)
  To: 'Eli Zaretskii'; +Cc: 11046

ping






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

* bug#11046: 24.0.94; Customize: M-TAB moves cursor over tag; clicking button moves cursor over button
  2012-03-20 16:02 bug#11046: 24.0.94; Customize: M-TAB moves cursor over tag; clicking button moves cursor over button Drew Adams
  2012-03-20 17:48 ` Eli Zaretskii
@ 2019-09-30 16:08 ` Mauro Aranda
  2019-10-01 12:33   ` Lars Ingebrigtsen
  1 sibling, 1 reply; 7+ messages in thread
From: Mauro Aranda @ 2019-09-30 16:08 UTC (permalink / raw)
  To: 11046


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

Eli Zaretskii <eliz@gnu.org> writes:

>> From: "Drew Adams" <drew.adams@oracle.com>
>> Date: Tue, 20 Mar 2012 09:02:30 -0700
>>
>> emacs -Q
>>
>> M-x customize-option RET site-run-file RET
>>
>> Click Value Menu button.  Choose String in the menu.
>>
>> 1. First bug: Cursor should be in the edit field.  But it is on top of
>> the Value Menu button.
>
> Confirmed.

This is because widget-button-click-moves-point is set to t for
customize buffers, and also because there is no mechanism implemented
for widgets to "pass focus" to others.  If it is a desired feature, I
can try to come up with something.

>> 2. Put cursor at beginning of the edit field.  Hit `M-TAB'.
>>
>> You see this error message: "lookup-words: lookup-words error: No plain
>> word-list found at systemdefault locations.  Customize
>> `ispell-alternate-dictionary' to set yours."
>>
>> But the cursor is moved back on top of the tag `String:', before the
>> `:' (second bug).
>
> I don't get the error message, but a "*Choices*" buffer (because my
> ispell-alternate-dictionary _is_ properly configured), but that buffer
> shows hits for "String".  Here's a sample:
>
> (0) /Usr/Dict/Web2:190067:String       (1)
/Usr/Dict/Web2:190068:Stringboard
> (2) /Usr/Dict/Web2:190069:Stringcourse (3) /Usr/Dict/Web2:190070:Stringend
>
> etc. -- quite un-useful.  IOW, it _really_ tries to complete the word
> "String", which is not what the user wants.

This is because the completion function used for string widgets is
ispell-complete-word and that command will look back from point until it
finds a word to complete.
I can't think of another way of fixing this other than peeking what will
ispell-complete-word try to complete, so I attach a patch that does
that.

> (Shouldn't the type of the widget be "file" instead of "string"?)

I think so.

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

[-- Attachment #2: 0001-Only-complete-words-inside-of-the-string-widget.patch --]
[-- Type: text/x-patch, Size: 1190 bytes --]

From ce90f6442ca40f030d3de446cd9f57c53804d7fe Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Wed, 25 Sep 2019 19:40:35 -0300
Subject: [PATCH] Only complete words inside of the string widget

* lisp/wid-edit.el ('string widget): Peek the word that
ispell-complete-word will try to complete, and only offer completions
when the word is inside of the field.  (Bug#11046)
---
 lisp/wid-edit.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 916d41a..9a634b7 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -3073,7 +3073,12 @@ 'string
   "A string."
   :tag "String"
   :format "%{%t%}: %v"
-  :complete-function 'ispell-complete-word
+  :complete (lambda (widget)
+              (eval-and-compile (require 'ispell)) ; For `ispell-get-word'.
+              (let ((start (save-excursion (nth 1 (ispell-get-word nil)))))
+                (if (< start (widget-field-start widget))
+                    (message "No word to complete inside field")
+                  (ispell-complete-word))))
   :prompt-history 'widget-string-prompt-value-history)
 
 (define-widget 'regexp 'string
-- 
2.7.4


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

* bug#11046: 24.0.94; Customize: M-TAB moves cursor over tag; clicking button moves cursor over button
  2019-09-30 16:08 ` Mauro Aranda
@ 2019-10-01 12:33   ` Lars Ingebrigtsen
  2019-10-05 13:15     ` Mauro Aranda
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-01 12:33 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 11046

Mauro Aranda <maurooaranda@gmail.com> writes:

> This is because the completion function used for string widgets is
> ispell-complete-word and that command will look back from point until it
> finds a word to complete.
> I can't think of another way of fixing this other than peeking what will
> ispell-complete-word try to complete, so I attach a patch that does
> that.

I think that makes sense...

> -  :complete-function 'ispell-complete-word
> +  :complete (lambda (widget)
> +              (eval-and-compile (require 'ispell)) ; For `ispell-get-word'.

I think the way we usually do this is by just saying (require 'ispell)
in the function, and pacify the compiler by using a `declare-function'.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#11046: 24.0.94; Customize: M-TAB moves cursor over tag; clicking button moves cursor over button
  2019-10-01 12:33   ` Lars Ingebrigtsen
@ 2019-10-05 13:15     ` Mauro Aranda
  2019-10-07  2:00       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Mauro Aranda @ 2019-10-05 13:15 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 11046


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

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Mauro Aranda <maurooaranda@gmail.com> writes:
>
> I think that makes sense...
>
>> -  :complete-function 'ispell-complete-word
>> +  :complete (lambda (widget)
>> +              (eval-and-compile (require 'ispell)) ; For
`ispell-get-word'.
>
> I think the way we usually do this is by just saying (require 'ispell)
> in the function, and pacify the compiler by using a `declare-function'.

Thanks for reviewing.  I attach a patch with that change.

Best regards,
Mauro.

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

[-- Attachment #2: 0001-Only-complete-words-inside-of-the-string-widget.patch --]
[-- Type: text/x-patch, Size: 1451 bytes --]

From 4893dc6633fff6756ba3c8af63279448f1925786 Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Wed, 25 Sep 2019 19:40:35 -0300
Subject: [PATCH] Only complete words inside of the string widget

* lisp/wid-edit.el ('string widget): Peek the word that
ispell-complete-word will try to complete, and only offer completions
when the word is inside of the field.  (Bug#11046)
---
 lisp/wid-edit.el | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 916d41a..28d8dfc 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -58,6 +58,10 @@
 (require 'cl-lib)
 (eval-when-compile (require 'subr-x)) 	; when-let
 
+;; The `string' widget completion uses this.
+(declare-function ispell-get-word "ispell"
+                  (following &optional extra-otherchars))
+
 ;;; Compatibility.
 
 (defun widget-event-point (event)
@@ -3073,7 +3077,12 @@ 'string
   "A string."
   :tag "String"
   :format "%{%t%}: %v"
-  :complete-function 'ispell-complete-word
+  :complete (lambda (widget)
+              (require 'ispell)
+              (let ((start (save-excursion (nth 1 (ispell-get-word nil)))))
+                (if (< start (widget-field-start widget))
+                    (message "No word to complete inside field")
+                  (ispell-complete-word))))
   :prompt-history 'widget-string-prompt-value-history)
 
 (define-widget 'regexp 'string
-- 
2.7.4


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

* bug#11046: 24.0.94; Customize: M-TAB moves cursor over tag; clicking button moves cursor over button
  2019-10-05 13:15     ` Mauro Aranda
@ 2019-10-07  2:00       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-07  2:00 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 11046

Mauro Aranda <maurooaranda@gmail.com> writes:

> Thanks for reviewing.  I attach a patch with that change.

Thanks; looks good.  I've now applied it to the trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2019-10-07  2:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-20 16:02 bug#11046: 24.0.94; Customize: M-TAB moves cursor over tag; clicking button moves cursor over button Drew Adams
2012-03-20 17:48 ` Eli Zaretskii
2012-09-17  0:07   ` Drew Adams
2019-09-30 16:08 ` Mauro Aranda
2019-10-01 12:33   ` Lars Ingebrigtsen
2019-10-05 13:15     ` Mauro Aranda
2019-10-07  2:00       ` Lars Ingebrigtsen

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).