Browse Source

lisp/org-indent.el: Fix bug in org-indent that changes the selection

* lisp/org-indent.el: (org-indent-add-properties): Use
`with-silent-modificaitons'.
(org-indent-remove-properties): Use `with-silent-modificaitons'.

Julien Danjou writes:

> I'm using org 7.01h with Emacs 24 trunk. When I set org-startup-indented
> to t, I observe the following:
>
> ** TODO Some stuff
>
> I select "stuff" and press M-w. Then I go the the line under and press
> C-y (org-yank).
>
> Now I got:
>
> ** TODO Some stuff
> ** TODO Some
>
> instead of:
>
> ** TODO Some stuff
> stuff
>
> Note that after M-w, `kill-ring' has a correct first entry of "stuff":
>
>   (#("stuff" 0 5
>      (fontified t face org-level-2))
>    ...)
>
> But on C-y (org-yank) something happens, and it paste the wrong text. I
> think it's trying to be smart but it's not.
>
> I've found that setting org-startup-indented to nil fix that behaviour.
Carsten Dominik 14 years ago
parent
commit
e40903a6b6
1 changed files with 3 additions and 3 deletions
  1. 3 3
      lisp/org-indent.el

+ 3 - 3
lisp/org-indent.el

@@ -204,8 +204,8 @@ useful to make it ever so slightly different."
 (defun org-indent-remove-properties (beg end)
   "Remove indentations between BEG and END."
   (let ((inhibit-modification-hooks t))
-    (org-unmodified
-     (remove-text-properties beg end '(line-prefix nil wrap-prefix nil)))))
+    (with-silent-modifications
+      (remove-text-properties beg end '(line-prefix nil wrap-prefix nil)))))
 
 (defun org-indent-remove-properties-from-string (string)
   "Remove indentations between BEG and END."
@@ -222,7 +222,7 @@ Assumes that BEG is at the beginning of a line."
   (when (or t org-indent-mode)
     (let ((inhibit-modification-hooks t)
 	  ov b e n level exit nstars)
-      (org-unmodified
+      (with-silent-modifications
        (save-excursion
 	 (goto-char beg)
 	 (while (not exit)