From: Jambunathan K <kjambunathan@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH 2/2] org-store-link: Fix storing of links to headlines in indirect buffers
Date: Mon, 23 Aug 2010 04:41:20 +0530 [thread overview]
Message-ID: <8162z2tf8n.fsf_-_@gmail.com> (raw)
In-Reply-To: <81fwybeoem.fsf@gmail.com> (Jambunathan K.'s message of "Thu, 19 Aug 2010 00:31:05 +0530")
[-- Attachment #1: Type: text/plain, Size: 1390 bytes --]
Summary:
When org-store-link is invoked on a headline in indirect buffer (as in a
capture buffer), hyperlink gets created to the file and NOT the
headline. This is a bug.
The attached patch fixes this.
Setup:
# ~/.emacs
(defun my-conversation-id ()
(interactive)
(remove-hook 'org-capture-before-finalize-hook 'my-conversation-id)
(let ((org-link-to-org-use-id t))
(call-interactively 'org-store-link)
)
)
# org-capture-templates
("x" "Conversations" entry
(file+headline "~/conversation.org" "Conversations")
"%(progn (add-hook 'org-capture-before-finalize-hook 'my-conversation-id) \"\")** Note taken on %U\n %? " :prepend t :empty-lines 1)
Steps for reproduction:
Trigger org-capture for the above capture entry.
Examine conversation.org before/after the patch is applied. Note the
absence/presence of IDs for the captured entry.
Check for the stored links using C-c C-l. Note the file/headline links.
# file conversation.org before and after the patch
* Conversations
** Note taken on [2010-08-23 Mon 04:33]
:PROPERTIES:
:ID: 7e1974a6-8fa1-43cf-bef3-2adf37d99130
:END:
** Note taken on [2010-08-23 Mon 04:32]
# (org-insert-link) showing stored links before and after the patch
file:~/conversation.org (file:~/conversation.org)
id:7e1974a6-8fa1-43cf-bef3-2adf37d99130 (Note taken on [2010-08-23 Mon 04:33])
Jambunathan K.
[-- Attachment #2: Type: text/plain, Size: 1872 bytes --]
From 90628b45ee4d270b32f8a56618ca75ceb4a16b21 Mon Sep 17 00:00:00 2001
From: Jambunathan K <kjambunathan@gmail.com>
Date: Mon, 23 Aug 2010 02:32:15 +0530
Subject: [PATCH 2/2] org-store-link: Fix storing of links to headlines in indirect buffers
* org.el (org-store-link): Storing of links to headlines in indirect
buffers was broken. Fix it.
TINYCHANGE
---
lisp/org.el | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 5db7aab..15379ef 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -8301,13 +8301,14 @@ For file links, arg negates `org-context-in-file-links'."
(setq cpltxt (concat "file:" file)
link (org-make-link cpltxt))))
- ((and buffer-file-name (org-mode-p))
+ ((and (buffer-file-name (buffer-base-buffer)) (org-mode-p))
(setq custom-id (ignore-errors (org-entry-get nil "CUSTOM_ID")))
(cond
((org-in-regexp "<<\\(.*?\\)>>")
(setq cpltxt
(concat "file:"
- (abbreviate-file-name buffer-file-name)
+ (abbreviate-file-name
+ (buffer-file-name (buffer-base-buffer)))
"::" (match-string 1))
link (org-make-link cpltxt)))
((and (featurep 'org-id)
@@ -8329,11 +8330,13 @@ For file links, arg negates `org-context-in-file-links'."
(error
;; probably before first headline, link to file only
(concat "file:"
- (abbreviate-file-name buffer-file-name))))))
+ (abbreviate-file-name
+ (buffer-file-name (buffer-base-buffer))))))))
(t
;; Just link to current headline
(setq cpltxt (concat "file:"
- (abbreviate-file-name buffer-file-name)))
+ (abbreviate-file-name
+ (buffer-file-name (buffer-base-buffer)))))
;; Add a context search string
(when (org-xor org-context-in-file-links arg)
(setq txt (cond
--
1.7.0.4
[-- Attachment #3: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
next prev parent reply other threads:[~2010-08-22 23:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-27 2:44 feature request: a basic conversation manager Samuel Wales
2008-11-29 18:22 ` Ross Patterson
2008-12-10 5:00 ` Samuel Wales
2008-12-09 10:36 ` Carsten Dominik
2008-12-10 3:59 ` Samuel Wales
2010-08-18 19:01 ` Jambunathan K
2010-08-18 19:12 ` Eric S Fraga
2010-08-28 19:16 ` Jambunathan K
2010-08-22 22:37 ` [PATCH 1/2] org-store-link: Return link when invoked from within agenda buffer Jambunathan K
2010-08-22 22:37 ` Jambunathan K
2010-08-23 10:18 ` [Accepted] [Orgmode, " Carsten Dominik
2010-08-22 22:37 ` [PATCH " Jambunathan K
2010-08-22 23:11 ` Jambunathan K [this message]
2010-08-23 10:14 ` [Accepted] [Orgmode, 2/2] org-store-link: Fix storing of links to headlines in indirect buffers Carsten Dominik
2010-08-28 19:43 ` feature request: a basic conversation manager Samuel Wales
2010-08-28 19:50 ` Samuel Wales
2010-08-28 21:42 ` Jambunathan K
2010-08-28 22:08 ` Samuel Wales
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=8162z2tf8n.fsf_-_@gmail.com \
--to=kjambunathan@gmail.com \
--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).