From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: [PATCH] adjust C-c C-c behavior on headlines whose text is a link Date: Sun, 21 Apr 2013 17:37:45 +0800 Message-ID: <87wqrww7fa.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:42289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTqci-00027L-TN for emacs-orgmode@gnu.org; Sun, 21 Apr 2013 05:31:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UTqch-0000ij-Qz for emacs-orgmode@gnu.org; Sun, 21 Apr 2013 05:31:52 -0400 Received: from plane.gmane.org ([80.91.229.3]:58845) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTqch-0000iW-KZ for emacs-orgmode@gnu.org; Sun, 21 Apr 2013 05:31:51 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UTqcb-0006S3-Ns for emacs-orgmode@gnu.org; Sun, 21 Apr 2013 11:31:45 +0200 Received: from 114.252.251.82 ([114.252.251.82]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 21 Apr 2013 11:31:45 +0200 Received: from eric by 114.252.251.82 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 21 Apr 2013 11:31:45 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-lisp-org.el-org-ctrl-c-ctrl-c-Set-tags-for-headlines.patch >From 2980cd31a05a7b2accc04ce431842a6bf27f6c6c Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen 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 --=-=-=--