Browse Source

Remove backend-specific markers after selecting text

When a backend selects its #+begin_backend ... #+end_backend
code, the markers need to be removed so that a package like
org-special-blocks.el does not try to work on the block again.
Carsten Dominik 15 years ago
parent
commit
93552da5be
2 changed files with 9 additions and 1 deletions
  1. 3 0
      lisp/ChangeLog
  2. 6 1
      lisp/org-exp.el

+ 3 - 0
lisp/ChangeLog

@@ -1,5 +1,8 @@
 2009-10-02  Carsten Dominik  <carsten.dominik@gmail.com>
 
+	* org-exp.el (org-export-select-backend-specific-text): Remove the
+	region markers.
+
 	* org-inlinetask.el (org-inlinetask-export-handler): fix bug for
 	tasks without content.
 

+ 6 - 1
lisp/org-exp.el

@@ -1728,7 +1728,12 @@ from the buffer."
 	  (setq end (match-end 0) end-content (match-beginning 0))
 	  (if (eq (car fmt) backend)
 	      ;; yes, keep this
-	      (add-text-properties beg-content end-content '(org-protected t))
+	      (progn
+		(add-text-properties beg-content end-content '(org-protected t))
+		(delete-region (match-beginning 0) (match-end 0))
+		(save-excursion
+		  (goto-char beg)
+		  (delete-region (point) (1+ (point-at-eol)))))
 	    ;; No, this is for a different backend, kill it
 	    (delete-region beg end)))))))