unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#7779: Miserable widget completion for type 'directory on w32
@ 2011-01-03 21:00 Lennart Borgman
  2011-07-03 18:44 ` Juanma Barranquero
  2019-08-28 15:47 ` Mauro Aranda
  0 siblings, 2 replies; 14+ messages in thread
From: Lennart Borgman @ 2011-01-03 21:00 UTC (permalink / raw)
  To: 7779

Suppose you have a defcustom with a ":type 'directory". Then you are
supposed to be able to use widget-complete to make it easier to fill
in this list. There are (at least) two problems with this on w32:

- The completion is case sensitive. However the file system is case
insensitive on w32.

- widget-complete is bound to M-TAB. This is by default bound to
Alt-Tab which is not available to applications on w32.

GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600) of 2010-12-29 on LENNART-69DE564





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

* bug#7779: Miserable widget completion for type 'directory on w32
  2011-01-03 21:00 bug#7779: Miserable widget completion for type 'directory on w32 Lennart Borgman
@ 2011-07-03 18:44 ` Juanma Barranquero
  2011-07-03 18:48   ` Lennart Borgman
  2019-08-28 15:47 ` Mauro Aranda
  1 sibling, 1 reply; 14+ messages in thread
From: Juanma Barranquero @ 2011-07-03 18:44 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: 7779

On Mon, Jan 3, 2011 at 22:00, Lennart Borgman <lennart.borgman@gmail.com> wrote:

> - The completion is case sensitive.

It is? Can you show a test case?

> - widget-complete is bound to M-TAB. This is by default bound to
> Alt-Tab which is not available to applications on w32.

But you can use <ESC><TAB>, like you yourself discuss in bug#8256.

    Juanma





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

* bug#7779: Miserable widget completion for type 'directory on w32
  2011-07-03 18:44 ` Juanma Barranquero
@ 2011-07-03 18:48   ` Lennart Borgman
  2011-07-03 18:52     ` Juanma Barranquero
  0 siblings, 1 reply; 14+ messages in thread
From: Lennart Borgman @ 2011-07-03 18:48 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 7779

On Sun, Jul 3, 2011 at 20:44, Juanma Barranquero <lekktu@gmail.com> wrote:
> On Mon, Jan 3, 2011 at 22:00, Lennart Borgman <lennart.borgman@gmail.com> wrote:
>
>> - The completion is case sensitive.
>
> It is? Can you show a test case?
>
>> - widget-complete is bound to M-TAB. This is by default bound to
>> Alt-Tab which is not available to applications on w32.
>
> But you can use <ESC><TAB>, like you yourself discuss in bug#8256.

Didn't I say that you can't do that? If you use some vi emulation like Viper.





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

* bug#7779: Miserable widget completion for type 'directory on w32
  2011-07-03 18:48   ` Lennart Borgman
@ 2011-07-03 18:52     ` Juanma Barranquero
  2011-07-03 22:31       ` Lennart Borgman
  0 siblings, 1 reply; 14+ messages in thread
From: Juanma Barranquero @ 2011-07-03 18:52 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: 7779

On Sun, Jul 3, 2011 at 20:48, Lennart Borgman <lennart.borgman@gmail.com> wrote:

>> It is? Can you show a test case?
>>
>>> - widget-complete is bound to M-TAB. This is by default bound to
>>> Alt-Tab which is not available to applications on w32.
>>
>> But you can use <ESC><TAB>, like you yourself discuss in bug#8256.
>
> Didn't I say that you can't do that? If you use some vi emulation like Viper.

Could you answer both questions, not only the second one?

As for that, if M-TAB cannot be reliably used on Windows, and ESC-TAB
cannot be used inside Viper, please propose an alternate binding for
using inside Viper.

    Juanma





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

* bug#7779: Miserable widget completion for type 'directory on w32
  2011-07-03 18:52     ` Juanma Barranquero
@ 2011-07-03 22:31       ` Lennart Borgman
  2011-07-03 22:42         ` Juanma Barranquero
  0 siblings, 1 reply; 14+ messages in thread
From: Lennart Borgman @ 2011-07-03 22:31 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 7779

On Sun, Jul 3, 2011 at 20:52, Juanma Barranquero <lekktu@gmail.com> wrote:
> On Sun, Jul 3, 2011 at 20:48, Lennart Borgman <lennart.borgman@gmail.com> wrote:
>
>>> It is? Can you show a test case?
>>>
>>>> - widget-complete is bound to M-TAB. This is by default bound to
>>>> Alt-Tab which is not available to applications on w32.
>>>
>>> But you can use <ESC><TAB>, like you yourself discuss in bug#8256.
>>
>> Didn't I say that you can't do that? If you use some vi emulation like Viper.
>
> Could you answer both questions, not only the second one?
>
> As for that, if M-TAB cannot be reliably used on Windows, and ESC-TAB
> cannot be used inside Viper, please propose an alternate binding for
> using inside Viper.

That might be a good suggestion, but I am not sure.

As everyone here no vi has two main states: input and command. Beside
that there are the normal Emacs key sequences states during input of
key sequences. (The clash between these states is why ESC-TAB can not
be used.)

For the "command" state the g key is unused. Using it directly would
be a waste, but a sequence beginning with g might be good.

But I am not very sure of the value of it since using it would require
switching to "command" state first. And I think you are most likely to
be in "input" mode if you want to do completion.

ESC is the only "control char" that I am using of those vi recognize
as its own. (The other are less important.)

I suggest finding a key sequence in Emacs that does not use M (Alt).
TAB by itself seems to be the favorite on EmacsWiki. Maybe use two
fast TABs for it by default. And have C-RET as backup?





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

* bug#7779: Miserable widget completion for type 'directory on w32
  2011-07-03 22:31       ` Lennart Borgman
@ 2011-07-03 22:42         ` Juanma Barranquero
  2011-07-03 22:56           ` Lennart Borgman
  0 siblings, 1 reply; 14+ messages in thread
From: Juanma Barranquero @ 2011-07-03 22:42 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: 7779

On Mon, Jul 4, 2011 at 00:31, Lennart Borgman <lennart.borgman@gmail.com> wrote:

> ESC is the only "control char" that I am using of those vi recognize
> as its own. (The other are less important.)
>
> I suggest finding a key sequence in Emacs that does not use M (Alt).
> TAB by itself seems to be the favorite on EmacsWiki. Maybe use two
> fast TABs for it by default. And have C-RET as backup?

Are you proposing changing the default binding? I don't think users
used to the current binding should be penalized for the needs of
Viper. If anything, an expert Viper user like you will surely know how
to integrate a new keybinding into Viper. It is possible to bind
shift-Esc to work from the input state?

And, you still haven't answered the other question: do you still get
case sensitive completion of directories?


-- 
    Juanma





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

* bug#7779: Miserable widget completion for type 'directory on w32
  2011-07-03 22:42         ` Juanma Barranquero
@ 2011-07-03 22:56           ` Lennart Borgman
  2011-07-03 23:04             ` Juanma Barranquero
  0 siblings, 1 reply; 14+ messages in thread
From: Lennart Borgman @ 2011-07-03 22:56 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 7779

On Mon, Jul 4, 2011 at 00:42, Juanma Barranquero <lekktu@gmail.com> wrote:
> On Mon, Jul 4, 2011 at 00:31, Lennart Borgman <lennart.borgman@gmail.com> wrote:
>
>> ESC is the only "control char" that I am using of those vi recognize
>> as its own. (The other are less important.)
>>
>> I suggest finding a key sequence in Emacs that does not use M (Alt).
>> TAB by itself seems to be the favorite on EmacsWiki. Maybe use two
>> fast TABs for it by default. And have C-RET as backup?
>
> Are you proposing changing the default binding? I don't think users
> used to the current binding should be penalized for the needs of
> Viper. If anything, an expert Viper user like you will surely know how
> to integrate a new keybinding into Viper. It is possible to bind
> shift-Esc to work from the input state?

I just tried these and they work (the states are called "vi" and
"insert" - my bad):

(define-key viper-vi-intercept-map [(shift escape)] (lambda ()
(interactive) (message "you pushed shift esc"))) ;; vi state
(define-key viper-insert-intercept-map [(shift escape)] (lambda ()
(interactive) (message "you pushed shift esc"))) ;; insert state

So S-ESC could be used with both default Emacs bindings and in Viper mode.

Yes, I was proposing a change, but I think this should be discussed
more. The main problem is that there are a lot of different
completions. (Something I tried to address experimentally in
tabkey2.el in nXhtml.)

> And, you still haven't answered the other question: do you still get
> case sensitive completion of directories?

Oh, sorry I missed that one. So you want me to test this with the
latest build? (BTW I see problems with my w32 build on Windows 7
64-bit. Should we perhaps provide 64-bit binaries? Can we?)





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

* bug#7779: Miserable widget completion for type 'directory on w32
  2011-07-03 22:56           ` Lennart Borgman
@ 2011-07-03 23:04             ` Juanma Barranquero
  2011-07-03 23:23               ` Lennart Borgman
  0 siblings, 1 reply; 14+ messages in thread
From: Juanma Barranquero @ 2011-07-03 23:04 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: 7779

On Mon, Jul 4, 2011 at 00:56, Lennart Borgman <lennart.borgman@gmail.com> wrote:

> So S-ESC could be used with both default Emacs bindings and in Viper mode.
>
> Yes, I was proposing a change, but I think this should be discussed
> more.

OK, so we have a keybinding that you could use in Viper, and you want
to propose a change. Care to do that in emacs-devel? (I don't think it
will be accepted, but we'll be able to reach a consensus of what to do
with Viper, I hope).

> Oh, sorry I missed that one. So you want me to test this with the
> latest build?

Yes. *AND* provide a precise, step-by-step recipe, starting from
"emacs -Q" (with stock Emacs, not your patched version), and
explaining clearly what you do get and what do you expected to get.

>  (BTW I see problems with my w32 build on Windows 7
> 64-bit.

I don't see problems with stock Emacs on Windows 7 64-bit. If you're
able to reproduce these problems with the standard Emacs, could you
please file bug reports for them? (Again: with recipes and clear
explanations, which you often overlook.)

> Should we perhaps provide 64-bit binaries? Can we?)

It woud be nice, yes, but so far as I know, no one is working on
building a 64-bit Windows Emacs. It isn't trivial, it's not just a
matter of using a 64-bit compiler. But you are welcome to download,
for example, the Twilight Dragon Media 64-bit build of GCC
(http://tdm-gcc.tdragon.net/) and try it.

    Juanma





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

* bug#7779: Miserable widget completion for type 'directory on w32
  2011-07-03 23:04             ` Juanma Barranquero
@ 2011-07-03 23:23               ` Lennart Borgman
  2011-07-03 23:31                 ` Juanma Barranquero
  2011-07-04  1:35                 ` Lennart Borgman
  0 siblings, 2 replies; 14+ messages in thread
From: Lennart Borgman @ 2011-07-03 23:23 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 7779

On Mon, Jul 4, 2011 at 01:04, Juanma Barranquero <lekktu@gmail.com> wrote:
> On Mon, Jul 4, 2011 at 00:56, Lennart Borgman <lennart.borgman@gmail.com> wrote:
>
>> So S-ESC could be used with both default Emacs bindings and in Viper mode.
>>
>> Yes, I was proposing a change, but I think this should be discussed
>> more.
>
> OK, so we have a keybinding that you could use in Viper, and you want
> to propose a change. Care to do that in emacs-devel? (I don't think it
> will be accepted, but we'll be able to reach a consensus of what to do
> with Viper, I hope).

I can do that later. This binding (S-ESC) is trivial, but I do not
know the state of the completion functions now.

>> Oh, sorry I missed that one. So you want me to test this with the
>> latest build?
>
> Yes. *AND* provide a precise, step-by-step recipe, starting from
> "emacs -Q" (with stock Emacs, not your patched version), and
> explaining clearly what you do get and what do you expected to get.

I just have to find the binaries as I said in another thread ... ;-)

>>  (BTW I see problems with my w32 build on Windows 7
>> 64-bit.
>
> I don't see problems with stock Emacs on Windows 7 64-bit. If you're
> able to reproduce these problems with the standard Emacs, could you
> please file bug reports for them? (Again: with recipes and clear
> explanations, which you often overlook.)

Might be a problem with the old 32-bit compiler I used that shows up.

>> Should we perhaps provide 64-bit binaries? Can we?)
>
> It woud be nice, yes, but so far as I know, no one is working on
> building a 64-bit Windows Emacs. It isn't trivial, it's not just a
> matter of using a 64-bit compiler. But you are welcome to download,
> for example, the Twilight Dragon Media 64-bit build of GCC
> (http://tdm-gcc.tdragon.net/) and try it.

Thanks. Have you tried it? What problems did you see?





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

* bug#7779: Miserable widget completion for type 'directory on w32
  2011-07-03 23:23               ` Lennart Borgman
@ 2011-07-03 23:31                 ` Juanma Barranquero
  2011-07-04  1:35                 ` Lennart Borgman
  1 sibling, 0 replies; 14+ messages in thread
From: Juanma Barranquero @ 2011-07-03 23:31 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: 7779

On Mon, Jul 4, 2011 at 01:23, Lennart Borgman <lennart.borgman@gmail.com> wrote:

> I can do that later. This binding (S-ESC) is trivial, but I do not
> know the state of the completion functions now.

OK, thanks.

> I just have to find the binaries as I said in another thread ... ;-)

I just sent the info in the other thread.

> Have you tried it?

No.

    Juanma





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

* bug#7779: Miserable widget completion for type 'directory on w32
  2011-07-03 23:23               ` Lennart Borgman
  2011-07-03 23:31                 ` Juanma Barranquero
@ 2011-07-04  1:35                 ` Lennart Borgman
  2011-07-04  2:59                   ` Juanma Barranquero
  1 sibling, 1 reply; 14+ messages in thread
From: Lennart Borgman @ 2011-07-04  1:35 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 7779

>> Yes. *AND* provide a precise, step-by-step recipe, starting from
>> "emacs -Q" (with stock Emacs, not your patched version), and
>> explaining clearly what you do get and what do you expected to get.

I wrote before:

  "- The completion is case sensitive. However the file system is case
  insensitive on w32."

Testing now with downloaded binaries emacs-20110627-bin-i386.zip
completion behaves even more strange. Try this:

  emacs -Q
  M-x load-library RET eshell RET
  M-x customize-option RET eshell-directory-name RET

Then enter "c:/" in the directory field and do

  M-x widget-complete

I would expect that to return the directory names.

After this I tried "c:/E". I have directories started with "c:/E" and
"c:/e". I only got those with "c:/e" (and some other things that
should not match at all).





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

* bug#7779: Miserable widget completion for type 'directory on w32
  2011-07-04  1:35                 ` Lennart Borgman
@ 2011-07-04  2:59                   ` Juanma Barranquero
  0 siblings, 0 replies; 14+ messages in thread
From: Juanma Barranquero @ 2011-07-04  2:59 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: 7779

On Mon, Jul 4, 2011 at 03:35, Lennart Borgman <lennart.borgman@gmail.com> wrote:

> After this I tried "c:/E". I have directories started with "c:/E" and
> "c:/e". I only got those with "c:/e" (and some other things that
> should not match at all).

It's a bit weird, yes. Sometimes it is "completing" all E's *and* all
directories, sometimes it does it right (but always case sensitive).
Definitely a bug, I'd say.

    Juanma





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

* bug#7779: Miserable widget completion for type 'directory on w32
  2011-01-03 21:00 bug#7779: Miserable widget completion for type 'directory on w32 Lennart Borgman
  2011-07-03 18:44 ` Juanma Barranquero
@ 2019-08-28 15:47 ` Mauro Aranda
  2019-09-06 21:16   ` Noam Postavsky
  1 sibling, 1 reply; 14+ messages in thread
From: Mauro Aranda @ 2019-08-28 15:47 UTC (permalink / raw)
  To: 7779; +Cc: lennart.borgman


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

I can reproduce the bug in the latest master.  On a Windows machine,
and starting with emacs -Q, I do:
M-x customize-option RET tutorial-directory
and try to complete with C-M-i inside the editable-field, with different
names,
and different cases.
It doesn't work, because the completion is made case sensitive, even though
read-file-name-completion-ignore-case is t.

Also, the completion is made not only for directory names,
but also for file names.  This also happens on a GNU/Linux machine.

Since the 'file widget suffers from the first mentioned bug as well,
the attached patch tries to improve the completion for both of these
widgets.

Best regards,
Mauro.

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

[-- Attachment #2: 0001-Improve-file-name-completion-in-file-and-directory-w.patch --]
[-- Type: text/x-patch, Size: 1686 bytes --]

From 24be0bc9760e16af80747b4bc06fd953e050be4f Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@gmail.com>
Date: Wed, 28 Aug 2019 08:29:57 -0300
Subject: [PATCH] Improve file name completion in file and directory widgets
 (Bug#7779)

* lisp/wid-edit.el (widget 'file, widget 'directory): Respect the option
read-file-name-completion-ignore-case.
(widget 'directory): Filter the file names, to only perform directory name
completion.
---
 lisp/wid-edit.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 1ddc461..ad65ca6 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -3083,7 +3083,9 @@ widget-regexp-validate
 (define-widget 'file 'string
   "A file widget.
 It reads a file name from an editable text field."
-  :completions #'completion-file-name-table
+  :completions (completion-table-case-fold
+                #'completion-file-name-table
+                (not read-file-name-completion-ignore-case))
   :prompt-value 'widget-file-prompt-value
   :format "%{%t%}: %v"
   ;; Doesn't work well with terminating newline.
@@ -3118,6 +3120,11 @@ widget-file-prompt-value
 (define-widget 'directory 'file
   "A directory widget.
 It reads a directory name from an editable text field."
+  :completions (apply-partially #'completion-table-with-predicate
+                                (completion-table-case-fold
+                                 #'completion-file-name-table
+                                 (not read-file-name-completion-ignore-case))
+                                #'directory-name-p 'strict)
   :tag "Directory")
 
 (defvar widget-symbol-prompt-value-history nil
-- 
2.7.4


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

* bug#7779: Miserable widget completion for type 'directory on w32
  2019-08-28 15:47 ` Mauro Aranda
@ 2019-09-06 21:16   ` Noam Postavsky
  0 siblings, 0 replies; 14+ messages in thread
From: Noam Postavsky @ 2019-09-06 21:16 UTC (permalink / raw)
  To: Mauro Aranda; +Cc: 7779, lennart.borgman

Mauro Aranda <maurooaranda@gmail.com> writes:

> Since the 'file widget suffers from the first mentioned bug as well,
> the attached patch tries to improve the completion for both of these
> widgets.

Pushed to master.

[1: 5b11751]: 2019-09-06 17:02:08 -0400
  Improve file name completion in file and directory widgets (Bug#7779)
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=5b117511aa1b5c451773891b505a7098a67f9532





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

end of thread, other threads:[~2019-09-06 21:16 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-03 21:00 bug#7779: Miserable widget completion for type 'directory on w32 Lennart Borgman
2011-07-03 18:44 ` Juanma Barranquero
2011-07-03 18:48   ` Lennart Borgman
2011-07-03 18:52     ` Juanma Barranquero
2011-07-03 22:31       ` Lennart Borgman
2011-07-03 22:42         ` Juanma Barranquero
2011-07-03 22:56           ` Lennart Borgman
2011-07-03 23:04             ` Juanma Barranquero
2011-07-03 23:23               ` Lennart Borgman
2011-07-03 23:31                 ` Juanma Barranquero
2011-07-04  1:35                 ` Lennart Borgman
2011-07-04  2:59                   ` Juanma Barranquero
2019-08-28 15:47 ` Mauro Aranda
2019-09-06 21:16   ` Noam Postavsky

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