-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
evil-mode text insertion breaks emacs text property inheritance (stickiness of text properties) #1857
base: master
Are you sure you want to change the base?
evil-mode text insertion breaks emacs text property inheritance (stickiness of text properties) #1857
Conversation
Thanks for the bug report @dizzyyogi. I think this is an oversight rather than intentional, so I'd welcome a PR. I guess you'd change |
Many thanks Tom for your prompt reply. Indeed I would at a minimum also change evil-insert-newline-above too, to But I was in fact also wondering about any call to insert/insert-char functions It seems the following functions/commands are potentially impacted:
From the above list, I would think those functions/commands should be fixed:
This should probably not be changed:
And those I am not sure:
I'd definitely like to help, but given I'm fairly new to Emacs and completely Or should I submit a PR only for evil-insert-newline-above/below to start with? |
Thanks for the research! I agree with your list of commands that should be fixed, plus I think This leads me to ask, what are you trying to do, which the current |
Hi. I am trying to provide regexp-based buffer delimitation into cells, cell This might turn into some package I'd love to share with the community, I noticed that functionalities working in vanilla Emacs were broken with |
That's an excellent answer. Please feel free to go ahead with a PR for the functions discussed. |
- evil-ex-put - evil-copy - evil-move - evil-invert-case - evil-replace - evil-visual-paste - evil-insert-digraph - evil-read - evil-replace-backspace - evil-yank-line-handler - evil-yank-block-handler - evil-execute-change
Issue type
Environment
Emacs version: 29.0.91
Operating System: any
Evil version: 1.15.0
Evil installation type: straight.el + use-package
Graphical/Terminal: X
Tested in a
make emacs
session (see CONTRIBUTING.md): YesReproduction steps
For example, from the following initial scratch buffer content:
==============================
;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with C-x C-f and enter text in its buffer.
==============================
Where position 72 corresponds to the first semi-column at the beginning of second line, and position 145 corresponds to the end of the second line
(put-text-property 72 145 'some-text-property t)
M-x evil-open-below ("o")
Type "hello world"
Expected behavior
Because default stickiness of text properties is rear-sticky (see emacs manual, 33.19 Text Properties -> Sticky Properties), the text "hello world" and the newline character added after line 2 should have inherited the text property 'some-text-property set to t in the step 4 above.
By self-insertion of a new line character and "hello world" string in emacs state, the property is correctly inherited:
Place cursor on second line
C-z
C-e
TYpe Return key
Type "hello world"
Place cursor on any of the inserted characters
Use command what-cursor-position with universal arg to get the text properties at point:
C-u C-x =
Any of the inserted characters have inherited property 'some-text-property, because of default rear-stickiness rule.
Actual behavior
After evil-open-below + text insertion
The text property 'some-text-property is not attached to the inserted text "hello world".
Further notes
The functions evil-insert-newline-above/below use (insert "\n").
As indicated in elisp manual, 33.19.6 Stickiness of Text Properties":
"The ordinary text insertion functions, such as 'insert', do not inherit any properties. They insert text with precisely the properties of the string being inserted, and no others."
Shouldnt' function "insert-and-inherit" be used instead?