From: Mauro Aranda <maurooaranda@gmail.com>
To: 11046@debbugs.gnu.org
Subject: bug#11046: 24.0.94; Customize: M-TAB moves cursor over tag; clicking button moves cursor over button
Date: Mon, 30 Sep 2019 13:08:50 -0300 [thread overview]
Message-ID: <CABczVwcOdHfVmipk+7uSHJbtfDPSY1Vxcb_DaGZWGfBJB4yYZA@mail.gmail.com> (raw)
In-Reply-To: <D3F44E5574A54E74AFD060EB8527AFC4@us.oracle.com>
[-- 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
next prev parent reply other threads:[~2019-09-30 16:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2019-10-01 12:33 ` Lars Ingebrigtsen
2019-10-05 13:15 ` Mauro Aranda
2019-10-07 2:00 ` Lars Ingebrigtsen
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=CABczVwcOdHfVmipk+7uSHJbtfDPSY1Vxcb_DaGZWGfBJB4yYZA@mail.gmail.com \
--to=maurooaranda@gmail.com \
--cc=11046@debbugs.gnu.org \
/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.
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).