emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-store-link: Fixed a bug where source block edit buffers were not recognized
@ 2012-03-08 22:33 Ilya Shlyakhter
  2012-03-14 15:37 ` Shaun Johnson
  2012-03-16 18:25 ` Bastien
  0 siblings, 2 replies; 4+ messages in thread
From: Ilya Shlyakhter @ 2012-03-08 22:33 UTC (permalink / raw)
  To: emacs-orgmode

[-- 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] org-store-link: Fixed a bug where source block edit buffers were not recognized
  2012-03-08 22:33 [PATCH] org-store-link: Fixed a bug where source block edit buffers were not recognized Ilya Shlyakhter
@ 2012-03-14 15:37 ` Shaun Johnson
  2012-03-18 17:50   ` David Maus
  2012-03-16 18:25 ` Bastien
  1 sibling, 1 reply; 4+ messages in thread
From: Shaun Johnson @ 2012-03-14 15:37 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: David Maus

On 08/03/2012 22:33, Ilya Shlyakhter wrote:
> attached.

Having just run into this same problem (being unable to create
and store a code reference link using C-l in a source block edit
buffer) I would like to second the inclusion of this or an
equivalent patch. Ilya's patch can be seen on the patchwork server
at:
   http://patchwork.newartisans.com/patch/1209/

I am currently using the following patch to work around this
problem:

diff --git a/lisp/org.el b/lisp/org.el
index ad63213..4a97cc9 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-bound-and-true-p org-edit-src-from-org-mode)
         (let (label gc)
  	 (while (or (not label)
  		    (save-excursion

Shaun Johnson.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] org-store-link: Fixed a bug where source block edit buffers were not recognized
  2012-03-08 22:33 [PATCH] org-store-link: Fixed a bug where source block edit buffers were not recognized Ilya Shlyakhter
  2012-03-14 15:37 ` Shaun Johnson
@ 2012-03-16 18:25 ` Bastien
  1 sibling, 0 replies; 4+ messages in thread
From: Bastien @ 2012-03-16 18:25 UTC (permalink / raw)
  To: Ilya Shlyakhter; +Cc: emacs-orgmode

Hi Ilya,

Ilya Shlyakhter <ilya_shl@alum.mit.edu> writes:

> attached.

Applied, thanks a lot.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] org-store-link: Fixed a bug where source block edit buffers were not recognized
  2012-03-14 15:37 ` Shaun Johnson
@ 2012-03-18 17:50   ` David Maus
  0 siblings, 0 replies; 4+ messages in thread
From: David Maus @ 2012-03-18 17:50 UTC (permalink / raw)
  To: Shaun Johnson; +Cc: David Maus, emacs-orgmode

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

At Wed, 14 Mar 2012 15:37:20 +0000,
Shaun Johnson wrote:
>
> On 08/03/2012 22:33, Ilya Shlyakhter wrote:
> > attached.
>
> Having just run into this same problem (being unable to create
> and store a code reference link using C-l in a source block edit
> buffer) I would like to second the inclusion of this or an
> equivalent patch. Ilya's patch can be seen on the patchwork server
> at:
>   http://patchwork.newartisans.com/patch/1209/
>
> I am currently using the following patch to work around this
> problem:

http://patchwork.newartisans.com/patch/1209/ was recently accepted --
This problem should be fixed now.

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #2: OpenPGP Digital Signature --]
[-- Type: application/pgp-signature, Size: 230 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-03-18 17:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-08 22:33 [PATCH] org-store-link: Fixed a bug where source block edit buffers were not recognized Ilya Shlyakhter
2012-03-14 15:37 ` Shaun Johnson
2012-03-18 17:50   ` David Maus
2012-03-16 18:25 ` Bastien

Code repositories for project(s) associated with this 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).