From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ilya Shlyakhter Subject: [PATCH] org-store-link: Fixed a bug where source block edit buffers were not recognized Date: Thu, 08 Mar 2012 17:33:13 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090506070408070408030409" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:57219) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5ltp-0005S9-98 for emacs-orgmode@gnu.org; Thu, 08 Mar 2012 17:33:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S5ltn-0007Sx-GK for emacs-orgmode@gnu.org; Thu, 08 Mar 2012 17:33:28 -0500 Received: from plane.gmane.org ([80.91.229.3]:38007) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S5ltn-0007Sg-9M for emacs-orgmode@gnu.org; Thu, 08 Mar 2012 17:33:27 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1S5ltk-0003DY-Qt for emacs-orgmode@gnu.org; Thu, 08 Mar 2012 23:33:24 +0100 Received: from gw-outbound.broadinstitute.org ([69.173.127.45]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 08 Mar 2012 23:33:24 +0100 Received: from ilya_shl by gw-outbound.broadinstitute.org with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 08 Mar 2012 23:33:24 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org This is a multi-part message in MIME format. --------------090506070408070408030409 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit attached. --------------090506070408070408030409 Content-Type: text/plain; name="store-link.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="store-link.patch" >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 --------------090506070408070408030409--