From 134c2ba772081ee7ca356b0dcabeb131bcb41b3b Mon Sep 17 00:00:00 2001 From: Ilya Shlyakhter Date: Thu, 8 Mar 2012 17:25:18 -0500 Subject: [PATCH 2/2] org-store-link: Fixed a bug where source block edit buffers were not recognized * lisp/org.el (org-store-link): Use a new predicate from org-src.el to test whether we're in a source block edit buffer. * lisp/org-src.el (org-src-edit-buffer-p): New predicate to tell if we're in a source block edit buffer. TINYCHANGE --- lisp/org-src.el | 9 +++++++++ lisp/org.el | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index 9cd56d2..e08fe89 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -374,6 +374,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 e4fb497..6074a01 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8684,7 +8684,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 -- 1.7.9.3