unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50900: 27.2; Evaluating open-line with a negative argument changes the behavior of self-insert
@ 2021-09-29 19:05 Rodrigo Morales
  2021-09-29 19:11 ` Lars Ingebrigtsen
  2021-09-29 20:22 ` Rodrigo Morales
  0 siblings, 2 replies; 7+ messages in thread
From: Rodrigo Morales @ 2021-09-29 19:05 UTC (permalink / raw)
  To: 50900


In order to reproduce this bug, I deleted my ~/.config/emacs/init.el
file and made sure that no other Emacs configuration file existed in
$HOME.

Steps to reproduce this bug:

1. Evaluate (open-line -1)
2. Insert text in any buffer

You will see that whenever a character is inserted, the point is moved
to the beginning of the line.





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

* bug#50900: 27.2; Evaluating open-line with a negative argument changes the behavior of self-insert
  2021-09-29 19:05 bug#50900: 27.2; Evaluating open-line with a negative argument changes the behavior of self-insert Rodrigo Morales
@ 2021-09-29 19:11 ` Lars Ingebrigtsen
  2021-09-29 21:07   ` Gregory Heytings
  2021-09-29 20:22 ` Rodrigo Morales
  1 sibling, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-29 19:11 UTC (permalink / raw)
  To: Rodrigo Morales; +Cc: 50900

Rodrigo Morales <moralesrodrigo1100@gmail.com> writes:

> In order to reproduce this bug, I deleted my ~/.config/emacs/init.el
> file and made sure that no other Emacs configuration file existed in
> $HOME.

That shouldn't be necessary -- "emacs -Q" will start an Emacs without
any local customisations.

> Steps to reproduce this bug:
>
> 1. Evaluate (open-line -1)
> 2. Insert text in any buffer

I'm unable to reproduce the problem in Emacs 27.2 (or 28).  I said:

emacs -Q
M-: (open-line -1)

And then I just get this backtrace:

Debugger entered--Lisp error: (error "Negative repetition argument -1")
  self-insert-command(-1)
  newline(-1)
  open-line(-1)
  eval((open-line -1) t)
  eval-expression((open-line -1) nil nil 127)
  funcall-interactively(eval-expression (open-line -1) nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

> You will see that whenever a character is inserted, the point is moved
> to the beginning of the line.

I don't see that, either.  What does `C-h f open-line RET' say for you?

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





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

* bug#50900: 27.2; Evaluating open-line with a negative argument changes the behavior of self-insert
  2021-09-29 19:05 bug#50900: 27.2; Evaluating open-line with a negative argument changes the behavior of self-insert Rodrigo Morales
  2021-09-29 19:11 ` Lars Ingebrigtsen
@ 2021-09-29 20:22 ` Rodrigo Morales
  2021-09-29 20:35   ` Rodrigo Morales
  1 sibling, 1 reply; 7+ messages in thread
From: Rodrigo Morales @ 2021-09-29 20:22 UTC (permalink / raw)
  To: 50900

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

Sorry, I wasn't clear in my previous message.

Before you evaluate the expression, you have to be in a buffer with no
read-only-mode. This means that if you tried to reproduce the issue in
the "*GNU Emacs*" buffer, you didn't fully reproduce the bug. For
some reason, the bug doesn't happen when the expression is evaluated
in a buffer with read-only-mode.

Here are more clearer steps:

1. Execute "emacs -Q"
2. Evaluate (open-line -1) in the "*scratch*" buffer.
3. Move your cursor to the "*scratch*" buffer.
4. Insert any text
5. (At this point, whenever you insert a character, the cursor is
   moved to the beginning of the line which makes it seem that you are
   typing from left to right.)

I was able to reproduce this issue in emacs 27.2 (in two systems) and
emacs 26.2 (in one system).

On Wed, 29 Sept 2021 at 14:07, Rodrigo Morales <moralesrodrigo1100@gmail.com>
wrote:

>
> In order to reproduce this bug, I deleted my ~/.config/emacs/init.el
> file and made sure that no other Emacs configuration file existed in
> $HOME.
>
> Steps to reproduce this bug:
>
> 1. Evaluate (open-line -1)
> 2. Insert text in any buffer
>
> You will see that whenever a character is inserted, the point is moved
> to the beginning of the line.
>

[-- Attachment #2: Type: text/html, Size: 1691 bytes --]

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

* bug#50900: 27.2; Evaluating open-line with a negative argument changes the behavior of self-insert
  2021-09-29 20:22 ` Rodrigo Morales
@ 2021-09-29 20:35   ` Rodrigo Morales
  2021-09-29 20:49     ` Rodrigo Morales
  0 siblings, 1 reply; 7+ messages in thread
From: Rodrigo Morales @ 2021-09-29 20:35 UTC (permalink / raw)
  To: 50900

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

> 5. (At this point, whenever you insert a character, the cursor is
>    moved to the beginning of the line which makes it seem that you are
>    typing from left to right.)

Typo: "right-to-left" instead of "from left to right"

[-- Attachment #2: Type: text/html, Size: 329 bytes --]

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

* bug#50900: 27.2; Evaluating open-line with a negative argument changes the behavior of self-insert
  2021-09-29 20:35   ` Rodrigo Morales
@ 2021-09-29 20:49     ` Rodrigo Morales
  0 siblings, 0 replies; 7+ messages in thread
From: Rodrigo Morales @ 2021-09-29 20:49 UTC (permalink / raw)
  To: 50900

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

This is a response to the message of Lars. Apparently, we get the same
backtrace.

```
Debugger entered--Lisp error: (error "Negative repetition argument -1")
  self-insert-command(-1)
  newline(-1)
  open-line(-1)
  eval((open-line -1) t)
  eval-expression((open-line -1) nil nil 127)
  funcall-interactively(eval-expression (open-line -1) nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)
```

This is what C-h f open-line RET shows

```
open-line is an interactive compiled Lisp function in ‘simple.el’.

It is bound to C-o, <insertline>.

(open-line N)

  Probably introduced at or before Emacs version 19.29.

Insert a newline and leave point before it.
If there is a fill prefix and/or a ‘left-margin’, insert them on
the new line if the line would have been blank.
With arg N, insert N newlines.
```

On Wed, 29 Sept 2021 at 15:38, Rodrigo Morales <moralesrodrigo1100@gmail.com>
wrote:

> > 5. (At this point, whenever you insert a character, the cursor is
> >    moved to the beginning of the line which makes it seem that you are
> >    typing from left to right.)
>
> Typo: "right-to-left" instead of "from left to right"
>

[-- Attachment #2: Type: text/html, Size: 1792 bytes --]

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

* bug#50900: 27.2; Evaluating open-line with a negative argument changes the behavior of self-insert
  2021-09-29 19:11 ` Lars Ingebrigtsen
@ 2021-09-29 21:07   ` Gregory Heytings
  2021-09-30  7:05     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Gregory Heytings @ 2021-09-29 21:07 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 50900, Rodrigo Morales


A recipe:

emacs -Q
M-: (open-line -1)
C-x o
foobar

IOW, do not quit the debugger.  That "bug" was not present in Emacs 24, it 
exists in Emacs 25 and later.  But I'm not sure it qualifies as a "bug".





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

* bug#50900: 27.2; Evaluating open-line with a negative argument changes the behavior of self-insert
  2021-09-29 21:07   ` Gregory Heytings
@ 2021-09-30  7:05     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-30  7:05 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: 50900, Rodrigo Morales

Gregory Heytings <gregory@heytings.org> writes:

> A recipe:
>
> emacs -Q
> M-: (open-line -1)
> C-x o
> foobar
>
> IOW, do not quit the debugger.  That "bug" was not present in Emacs
> 24, it exists in Emacs 25 and later.  But I'm not sure it qualifies as
> a "bug".

Heh.  It's an oddity for sure.  And fixing it's pretty easy -- I've now
made `newline' check the argument earlier (before it starts binding all
those variables that affect...  stuff).

-- 
(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:[~2021-09-30  7:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-29 19:05 bug#50900: 27.2; Evaluating open-line with a negative argument changes the behavior of self-insert Rodrigo Morales
2021-09-29 19:11 ` Lars Ingebrigtsen
2021-09-29 21:07   ` Gregory Heytings
2021-09-30  7:05     ` Lars Ingebrigtsen
2021-09-29 20:22 ` Rodrigo Morales
2021-09-29 20:35   ` Rodrigo Morales
2021-09-29 20:49     ` Rodrigo Morales

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