Przeglądaj źródła

Fix bug with creating a new picture area.

The was a faulty regular expression in this function which never
matched, causing creation of a new picture area to mess up and start
the new area at the end of the previous line instead of the beginning
of the current.

Reported by Bernt Hansen.
Carsten Dominik 16 lat temu
rodzic
commit
423ce71439
2 zmienionych plików z 33 dodań i 28 usunięć
  1. 5 0
      lisp/ChangeLog
  2. 28 28
      lisp/org.el

+ 5 - 0
lisp/ChangeLog

@@ -1,3 +1,8 @@
+2008-11-16  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org.el (org-edit-fixed-width-region): Fix bug when sarting a new
+	picture area.
+
 2008-11-15  Carsten Dominik  <carsten.dominik@gmail.com>
 2008-11-15  Carsten Dominik  <carsten.dominik@gmail.com>
 
 
 	* org.el (org-open-at-mouse): Ensure correct link abbreviations
 	* org.el (org-open-at-mouse): Ensure correct link abbreviations

+ 28 - 28
lisp/org.el

@@ -5608,8 +5608,8 @@ exit by killing the buffer with \\[org-edit-src-exit]."
     (beginning-of-line 1)
     (beginning-of-line 1)
     (if (looking-at "[ \t]*[^:\n \t]")
     (if (looking-at "[ \t]*[^:\n \t]")
 	nil
 	nil
-      (if (looking-at "[ \t]*\\(\n\\|\\'\\)]")
-	  (setq beg (point) end (match-end 0))
+      (if (looking-at "[ \t]*\\(\n\\|\\'\\)")
+	  (setq beg (point) end beg)
 	(save-excursion
 	(save-excursion
 	  (if (re-search-backward "^[ \t]*[^:]" nil 'move)
 	  (if (re-search-backward "^[ \t]*[^:]" nil 'move)
 	      (setq beg (point-at-bol 2))
 	      (setq beg (point-at-bol 2))
@@ -5618,32 +5618,32 @@ exit by killing the buffer with \\[org-edit-src-exit]."
 	  (if (re-search-forward "^[ \t]*[^:]" nil 'move)
 	  (if (re-search-forward "^[ \t]*[^:]" nil 'move)
 	      (setq end (1- (match-beginning 0)))
 	      (setq end (1- (match-beginning 0)))
 	    (setq end (point))))
 	    (setq end (point))))
-	(goto-line line)
-	(if (get-buffer "*Org Edit Picture*")
-	    (kill-buffer "*Org Edit Picture*"))
-	(switch-to-buffer (make-indirect-buffer (current-buffer)
-						"*Org Edit Picture*"))
-	(narrow-to-region beg end)
-	(remove-text-properties beg end '(display nil invisible nil
-						  intangible nil))
-	(when (fboundp 'font-lock-unfontify-region)
-	  (font-lock-unfontify-region (point-min) (point-max)))
-	(cond
-	 ((eq org-edit-fixed-width-region-mode 'artist-mode)
-	  (fundamental-mode)
-	  (artist-mode 1))
-	 (t (funcall org-edit-fixed-width-region-mode)))
-	(set (make-local-variable 'org-edit-src-force-single-line) nil)
-	(set (make-local-variable 'org-edit-src-from-org-mode) org-mode-p)
-	(set (make-local-variable 'org-edit-src-picture) t)
-	(goto-char (point-min))
-	(while (re-search-forward "^[ \t]*: " nil t)
-	  (replace-match ""))
-	(goto-line line)
-	(org-exit-edit-mode)
-	(org-set-local 'header-line-format msg)
-	(message "%s" msg)
-	t))))
+	(goto-line line))
+      (if (get-buffer "*Org Edit Picture*")
+	  (kill-buffer "*Org Edit Picture*"))
+      (switch-to-buffer (make-indirect-buffer (current-buffer)
+					      "*Org Edit Picture*"))
+      (narrow-to-region beg end)
+      (remove-text-properties beg end '(display nil invisible nil
+						intangible nil))
+      (when (fboundp 'font-lock-unfontify-region)
+	(font-lock-unfontify-region (point-min) (point-max)))
+      (cond
+       ((eq org-edit-fixed-width-region-mode 'artist-mode)
+	(fundamental-mode)
+	(artist-mode 1))
+       (t (funcall org-edit-fixed-width-region-mode)))
+      (set (make-local-variable 'org-edit-src-force-single-line) nil)
+      (set (make-local-variable 'org-edit-src-from-org-mode) org-mode-p)
+      (set (make-local-variable 'org-edit-src-picture) t)
+      (goto-char (point-min))
+      (while (re-search-forward "^[ \t]*: ?" nil t)
+	(replace-match ""))
+      (goto-line line)
+      (org-exit-edit-mode)
+      (org-set-local 'header-line-format msg)
+      (message "%s" msg)
+      t)))
 
 
 
 
 (defun org-edit-src-find-region-and-lang ()
 (defun org-edit-src-find-region-and-lang ()