[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#18913: 24.4.51; point going back to bol after every insertion
From: |
Nicolas Richard |
Subject: |
bug#18913: 24.4.51; point going back to bol after every insertion |
Date: |
Thu, 30 Oct 2014 13:03:57 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.51 (gnu/linux) |
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
- bug#18913: 24.4.51; point going back to bol after every insertion,
Nicolas Richard <=