emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] adjust C-c C-c behavior on headlines whose text is a link
@ 2013-04-21  9:37 Eric Abrahamsen
  2013-04-21  9:40 ` Eric Abrahamsen
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Abrahamsen @ 2013-04-21  9:37 UTC (permalink / raw)
  To: emacs-orgmode

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

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

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

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-org.el-org-ctrl-c-ctrl-c-Set-tags-for-headlines.patch --]
[-- Type: text/x-patch, Size: 1260 bytes --]

From 2980cd31a05a7b2accc04ce431842a6bf27f6c6c Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <eric@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))

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

end of thread, other threads:[~2013-04-21  9:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-21  9:37 [PATCH] adjust C-c C-c behavior on headlines whose text is a link Eric Abrahamsen
2013-04-21  9:40 ` Eric Abrahamsen

Code repositories for project(s) associated with this inbox:


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).