If you've got a headline where the text is a link, C-c C-c on that
headline will only consider the fact that it's in a link, not that it's
in a headline. Ie, you get "can do nothing useful", rather than setting
tags.

This patch checks for this condition and passes the C-c C-c to the
headline.

An alternate version would pass the funcall to the :parent element *no
matter what*, seeing as 'C-c C-c' is currently always a no-op, and
user-defined hooks have already been run. We could just pass it on up
and see what happens...

Eric

>From 2980cd31a05a7b2accc04ce431842a6bf27f6c6c Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <e...@ericabrahamsen.net>
Date: Sun, 21 Apr 2013 17:32:26 +0800
Subject: [PATCH] lisp/org.el (org-ctrl-c-ctrl-c): Set tags for headlines whose
 text is a link

* lisp/org.el (org-ctrl-c-ctrl-c): 'C-c C-c' on a link is usually a
  no-op. If that link is in a headline, act as if the 'C-c C-c' was
  called on the headline, not the link.
---
 lisp/org.el | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lisp/org.el b/lisp/org.el
index 691f880..74d9d61 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -20106,6 +20106,12 @@ This command does many different things, depending on context:
 	    (when (and (eq (org-element-type parent) 'item)
 		       (= (point-at-bol) (org-element-property :begin parent)))
 	      (setq context parent type 'item))))
+	;; When heading text is a link, treat the heading, not the link,
+	;; as the current element
+	(when (eq type 'link)
+	  (let ((parent (org-element-property :parent context)))
+	    (when (and (eq (org-element-type parent) 'headline))
+	      (setq context parent type 'headline))))
 	;; Act according to type of element or object at point.
 	(case type
 	  (clock (org-clock-update-time-maybe))
-- 
1.8.2.1

Reply via email to