GNU bug report logs -
#18913
24.4.51; point going back to bol after every insertion
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18913 in the body.
You can then email your comments to 18913 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18913
; Package
emacs
.
(Fri, 31 Oct 2014 15:53:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 31 Oct 2014 15:53:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello,
I found myself in the situation where cursor would go to bol after every
character I would insert. The reason was I had a compiled function in my
post-self-insert-hook -- its bytecode disassembled to :
byte code:
doc: ...
args: 0
0 varref use-hard-newlines
1 goto-if-nil 1
4 constant set-hard-newline-properties
5 point
6 constant prefix-numeric-value
7 constant nil
8 call 1
9 diff
10 point
11 call 2
12 discard
13:1 save-excursion
14 constant 102025
15 goto-char
16 discard
17 constant beginning-of-line
18 call 0
19 discard
20 constant looking-at
21 constant "[ ]$"
22 call 1
23 goto-if-nil 2
26 constant current-left-margin
27 call 0
28 constant 0
29 gtr
30 goto-if-nil 2
33 point
34 constant line-end-position
35 call 0
36 delete-region
37 discard
38:2 unbind 1
39 constant nil
40 goto-if-not-nil-else-pop 3
43 constant move-to-left-margin
44 constant nil
45 constant t
46 call 2
47:3 return
A bit of grepping shows that this is the following lambda
defined in the function newline (bound to `postproc'):
(lambda ()
;; Mark the newline(s) `hard'.
(if use-hard-newlines
(set-hard-newline-properties
(- (point) (prefix-numeric-value arg)) (point)))
;; If the newline leaves the previous line blank, and we
;; have a left margin, delete that from the blank line.
(save-excursion
(goto-char beforepos)
(beginning-of-line)
(and (looking-at "[ \t]$")
(> (current-left-margin) 0)
(delete-region (point)
(line-end-position))))
;; Indent the line after the newline, except in one case:
;; when we added the newline at the beginning of a line which
;; starts a page.
(or was-page-start
(move-to-left-margin nil t)))
OTOH in that function, post-self-insert-hook is changed in a let binding
or it is protected with unwind-protect, so i don't understand how it
could happen.
FWIW I was in ielm when it happened, and here's the rest of my
post-self-insert-hook => (electric-indent-post-self-insert-function
blink-paren-post-self-insert-function)
In GNU Emacs 24.4.51.2 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2014-10-30 on localhost
Windowing system distributor `The X.Org Foundation', version 11.0.11304000
System Description: Gentoo Base System release 2.2
Configured using:
`configure --with-x-toolkit=lucid --enable-checking --with-wide-int
'CFLAGS= -O0 -g3''
Important settings:
value of $LANG: fr_FR.UTF-8
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Memory information:
((conses 16 2102837 191830)
(symbols 40 93520 37)
(miscs 36 26347 11976)
(strings 16 200774 27097)
(string-bytes 1 6588284)
(vectors 12 83543)
(vector-slots 8 1452046 54417)
(floats 8 1173 1233)
(intervals 36 139920 380)
(buffers 828 237)
(heap 1024 87889 11076))
--
Nicolas Richard
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18913
; Package
emacs
.
(Fri, 31 Oct 2014 20:28:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 18913 <at> debbugs.gnu.org (full text, mbox):
> I found myself in the situation where cursor would go to bol after every
> character I would insert.
Could you rebuild with the patch below (and run with debug-on-error
enabled) and see if you can get those asserts to trigger, which would
give us some information about how/when this happens.
Stefan
=== modified file 'lisp/simple.el'
--- lisp/simple.el 2014-08-18 15:20:27 +0000
+++ lisp/simple.el 2014-10-31 20:25:11 +0000
@@ -28,6 +28,8 @@
;;; Code:
+(eval-when-compile (require 'cl-lib))
+
(declare-function widget-convert "wid-edit" (type &rest args))
(declare-function shell-mode "shell" ())
@@ -428,6 +430,7 @@
;; starts a page.
(or was-page-start
(move-to-left-margin nil t)))))
+ (unwind-protect
(if (not interactive)
;; FIXME: For non-interactive uses, many calls actually just want
;; (insert "\n"), so maybe we should do just that, so as to avoid
@@ -441,7 +444,9 @@
;; We first used let-binding to protect the hook, but that was naive
;; since add-hook affects the symbol-default value of the variable,
;; whereas the let-binding might only protect the buffer-local value.
- (remove-hook 'post-self-insert-hook postproc))))
+ (remove-hook 'post-self-insert-hook postproc)))
+ (cl-assert (not (member postproc post-self-insert-hook)))
+ (cl-assert (not (member postproc (default-value 'post-self-insert-hook))))))
nil)
(defun set-hard-newline-properties (from to)
Added tag(s) wontfix.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Tue, 08 Jan 2019 19:46:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
18913 <at> debbugs.gnu.org and Nicolas Richard <theonewiththeevillook <at> yahoo.fr>
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Tue, 08 Jan 2019 19:46:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 06 Feb 2019 12:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 5 years and 74 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.