From 423ce71439a92352b8f5da11c3da3b94f82a2224 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Sun, 16 Nov 2008 20:09:03 +0100 Subject: [PATCH] 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. --- lisp/ChangeLog | 5 +++++ lisp/org.el | 56 +++++++++++++++++++++++++------------------------- 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cb6b41f47..6b336e86c 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2008-11-16 Carsten Dominik + + * org.el (org-edit-fixed-width-region): Fix bug when sarting a new + picture area. + 2008-11-15 Carsten Dominik * org.el (org-open-at-mouse): Ensure correct link abbreviations diff --git a/lisp/org.el b/lisp/org.el index fe41d4250..1319f4d1f 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5608,8 +5608,8 @@ exit by killing the buffer with \\[org-edit-src-exit]." (beginning-of-line 1) (if (looking-at "[ \t]*[^:\n \t]") 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 (if (re-search-backward "^[ \t]*[^:]" nil 'move) (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) (setq end (1- (match-beginning 0))) (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 ()