unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16453: 24.3.50; Motion functions not respecting field boundaries as documented
@ 2014-01-15 16:17 Drew Adams
  2014-01-24 16:15 ` Bastien Guerry
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2014-01-15 16:17 UTC (permalink / raw)
  To: 16453

(elisp) `Introduction to Minibuffers' says this:

 The text in the minibuffer always starts with the "prompt string",
 the text that was specified by the program that is using the minibuffer
 to tell the user what sort of input to type.  This text is marked
 read-only so you won't accidentally delete or change it.  It is also
 marked as a field (*note Fields::), so that certain motion functions,
 including `beginning-of-line', `forward-word', `forward-sentence', and
 `forward-paragraph', stop at the boundary between the prompt and the
 actual text.

So I would expect that `backward-word' and `backward-sexp' would stop at
the field boundary, which is the end of the prompt.  `beginning-of-line'
does indeed do this, as the doc suggests.  But `backward-word' and
`backward-sexp', at least, do not - they move backward into the prompt.

Seems like this is the wrong behavior, and the doc describes the right
behavior.  But perhaps it is the other way around and this is a doc bug.

FWIW, I noticed this because I use a different Lisp symbol completion
function in the minibuffer.  It moves `backward-sexp' and later tries to
delete the text corresponding to the symbol prefix to be completed.  If
that prefix is empty then it raises the error of attempting to modify
read-only text.  If `backward-sexp' did what the doc says then it would
not leave the field and enter the prompt.  This is not important to the
bug report - just mentioning how I happened to notice this.



In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
 of 2014-01-07 on ODIEONE
Bzr revision: 115916 bzg@gnu.org-20140107233629-du2solx6tmxnx0np
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/Devel/emacs/binary --enable-checking=yes,glyphs
 'CFLAGS=-O0 -g3' LDFLAGS=-Lc:/Devel/emacs/lib
 CPPFLAGS=-Ic:/Devel/emacs/include'





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

* bug#16453: 24.3.50; Motion functions not respecting field boundaries as documented
  2014-01-15 16:17 bug#16453: 24.3.50; Motion functions not respecting field boundaries as documented Drew Adams
@ 2014-01-24 16:15 ` Bastien Guerry
  2014-01-27 11:07   ` Bastien Guerry
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien Guerry @ 2014-01-24 16:15 UTC (permalink / raw)
  To: Drew Adams; +Cc: 16453

[-- Attachment #1: Type: text/plain, Size: 1644 bytes --]

Drew Adams <drew.adams@oracle.com> writes:

> (elisp) `Introduction to Minibuffers' says this:
>
>  The text in the minibuffer always starts with the "prompt string",
>  the text that was specified by the program that is using the minibuffer
>  to tell the user what sort of input to type.  This text is marked
>  read-only so you won't accidentally delete or change it.  It is also
>  marked as a field (*note Fields::), so that certain motion functions,
>  including `beginning-of-line', `forward-word', `forward-sentence', and
>  `forward-paragraph', stop at the boundary between the prompt and the
>  actual text.
>
> So I would expect that `backward-word' and `backward-sexp' would stop at
> the field boundary, which is the end of the prompt.  `beginning-of-line'
> does indeed do this, as the doc suggests.  But `backward-word' and
> `backward-sexp', at least, do not - they move backward into the prompt.
>
> Seems like this is the wrong behavior, and the doc describes the right
> behavior.  But perhaps it is the other way around and this is a doc
> bug.

The attached patch let `forward-word' does what the docstring says.
It uses `t' as the value for the ESCAPE-FROM-EDGE parameter within
the call to `constrain-to-field'.

I agree this seems the correct behavior in the minibuffer.

But I'm often frustrated by such constraints for `beginning-of-line'
(e.g. hit G c on a Gnus group and get stuck in a non-selected field
anyone?).

So perhaps the nil value for ESCAPE-FROM-EDGE is intentional here.

In any case, this is just to bring attention to the problem and
a possible solution: I don't know C so I won't commit this myself.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: syntax.c.patch --]
[-- Type: text/x-diff, Size: 562 bytes --]

=== modified file 'src/syntax.c'
*** src/syntax.c	2014-01-01 07:43:34 +0000
--- src/syntax.c	2014-01-24 16:05:37 +0000
***************
*** 1485,1491 ****
  
    /* Avoid jumping out of an input field.  */
    tmp = Fconstrain_to_field (make_number (val), make_number (PT),
! 			     Qt, Qnil, Qnil);
    val = XFASTINT (tmp);
  
    SET_PT (val);
--- 1485,1491 ----
  
    /* Avoid jumping out of an input field.  */
    tmp = Fconstrain_to_field (make_number (val), make_number (PT),
! 			     Qnil, Qnil, Qnil);
    val = XFASTINT (tmp);
  
    SET_PT (val);


[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

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

* bug#16453: 24.3.50; Motion functions not respecting field boundaries as documented
  2014-01-24 16:15 ` Bastien Guerry
@ 2014-01-27 11:07   ` Bastien Guerry
  2014-01-27 14:55     ` Drew Adams
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien Guerry @ 2014-01-27 11:07 UTC (permalink / raw)
  To: Drew Adams; +Cc: 16453

Hi Drew,

Bastien Guerry <bzg@altern.org> writes:

> The attached patch let `forward-word' does what the docstring says.
> It uses `t' as the value for the ESCAPE-FROM-EDGE parameter within
> the call to `constrain-to-field'.

While I'm waiting for a core maintainer to have a look at this,
can you test the patch and report any side-effect?

Thanks,

-- 
 Bastien





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

* bug#16453: 24.3.50; Motion functions not respecting field boundaries as documented
  2014-01-27 11:07   ` Bastien Guerry
@ 2014-01-27 14:55     ` Drew Adams
  2014-02-05 10:32       ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Drew Adams @ 2014-01-27 14:55 UTC (permalink / raw)
  To: Bastien Guerry; +Cc: 16453

> While I'm waiting for a core maintainer to have a look at this,
> can you test the patch and report any side-effect?

No, sorry.  I don't build Emacs from C sources.  I would test
a Lisp patch if one were available.  But you don't really need
me to test it.  I think the bug report is pretty clear, and I'm
sure you understand it OK.  If you are unsure, let me know.
And thanks for working on this.





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

* bug#16453: 24.3.50; Motion functions not respecting field boundaries as documented
  2014-01-27 14:55     ` Drew Adams
@ 2014-02-05 10:32       ` Bastien
  0 siblings, 0 replies; 5+ messages in thread
From: Bastien @ 2014-02-05 10:32 UTC (permalink / raw)
  To: Drew Adams; +Cc: 16453-done

Hi Drew,

Drew Adams <drew.adams@oracle.com> writes:

>> While I'm waiting for a core maintainer to have a look at this,
>> can you test the patch and report any side-effect?
>
> No, sorry.  I don't build Emacs from C sources.  I would test
> a Lisp patch if one were available.  But you don't really need
> me to test it.  I think the bug report is pretty clear, and I'm
> sure you understand it OK.  If you are unsure, let me know.
> And thanks for working on this.

I committed the patch.  Now closing this bug.
Thanks for reporting this,

-- 
 Bastien





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

end of thread, other threads:[~2014-02-05 10:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-15 16:17 bug#16453: 24.3.50; Motion functions not respecting field boundaries as documented Drew Adams
2014-01-24 16:15 ` Bastien Guerry
2014-01-27 11:07   ` Bastien Guerry
2014-01-27 14:55     ` Drew Adams
2014-02-05 10:32       ` Bastien

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