diff options
author | Bastien Guerry <bzg@altern.org> | 2012-03-16 19:24:24 +0100 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2012-03-16 19:24:24 +0100 |
commit | ce8b0963dbb2e7ddb99d3a797ddf129028ed44d2 (patch) | |
tree | 134f66b15d14a9cfeead6ba528510d86f5761fda | |
parent | 8e7f84ea3d021c3513a9fce9b275c2f93fa95f2d (diff) | |
download | org-mode-ce8b0963dbb2e7ddb99d3a797ddf129028ed44d2.tar.gz |
Correctly match source block edit buffers.
* org-src.el (org-src-edit-buffer-p): New function.
* org.el (org-store-link): Use the new function to correctly
match source code buffer.
TINYCHANGE
Thanks to Ilya Shlyakhter for this patch.
-rw-r--r-- | lisp/org-src.el | 11 | ||||
-rw-r--r-- | lisp/org.el | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lisp/org-src.el b/lisp/org-src.el index 70f28f0..5707117 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -41,7 +41,7 @@ (declare-function org-at-table.el-p "org" ()) (declare-function org-get-indentation "org" (&optional line)) (declare-function org-switch-to-buffer-other-window "org" (&rest args)) -(declare-function org-pop-to-buffer-same-window +(declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label)) (defcustom org-edit-src-region-extra nil @@ -372,6 +372,15 @@ buffer." "Construct the buffer name for a source editing buffer." (concat "*Org Src " org-buffer-name "[ " lang " ]*")) +(defun org-src-edit-buffer-p (&optional buffer) + "Test whether BUFFER (or the current buffer if BUFFER is nil) +is a source block editing buffer." + (let ((buffer (org-base-buffer (or buffer (current-buffer))))) + (and (buffer-name buffer) + (string-match "\\`*Org Src " (buffer-name buffer)) + (local-variable-p 'org-edit-src-beg-marker buffer) + (local-variable-p 'org-edit-src-end-marker buffer)))) + (defun org-edit-src-find-buffer (beg end) "Find a source editing buffer that is already editing the region BEG to END." (catch 'exit diff --git a/lisp/org.el b/lisp/org.el index c70b924..fbfac28 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8645,7 +8645,7 @@ For file links, arg negates `org-context-in-file-links'." (setq link (plist-get org-store-link-plist :link) desc (or (plist-get org-store-link-plist :description) link))) - ((equal (buffer-name) "*Org Edit Src Example*") + ((org-src-edit-buffer-p) (let (label gc) (while (or (not label) (save-excursion |