emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ilya Shlyakhter <ilya_shl@alum.mit.edu>
To: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <jjbc39$cfe$1@dough.gmane.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 10 bytes --]

attached.

[-- Attachment #2: store-link.patch --]
[-- Type: text/plain, Size: 1924 bytes --]

From 134c2ba772081ee7ca356b0dcabeb131bcb41b3b Mon Sep 17 00:00:00 2001
From: Ilya Shlyakhter <ilya_shl@alum.mit.edu>
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


             reply	other threads:[~2012-03-08 22:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-08 22:33 Ilya Shlyakhter [this message]
2012-03-14 15:37 ` [PATCH] org-store-link: Fixed a bug where source block edit buffers were not recognized Shaun Johnson
2012-03-18 17:50   ` David Maus
2012-03-16 18:25 ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='jjbc39$cfe$1@dough.gmane.org' \
    --to=ilya_shl@alum.mit.edu \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).