emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: emacs-orgmode@gnu.org
Subject: [PATCH] adjust C-c C-c behavior on headlines whose text is a link
Date: Sun, 21 Apr 2013 17:37:45 +0800	[thread overview]
Message-ID: <87wqrww7fa.fsf@ericabrahamsen.net> (raw)

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


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


             reply	other threads:[~2013-04-21  9:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-21  9:37 Eric Abrahamsen [this message]
2013-04-21  9:40 ` Eric Abrahamsen

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=87wqrww7fa.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: [PATCH] adjust C-c C-c behavior on headlines whose text is a link' \
    /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

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