From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: org capture contexts not working? Date: Sun, 20 Apr 2014 13:20:24 +0800 Message-ID: <87d2gcwqp1.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wbk8L-00073Y-RK for emacs-orgmode@gnu.org; Sun, 20 Apr 2014 01:17:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wbk8E-00048U-Ba for emacs-orgmode@gnu.org; Sun, 20 Apr 2014 01:17:41 -0400 Received: from plane.gmane.org ([80.91.229.3]:57977) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wbk8E-00048Q-4V for emacs-orgmode@gnu.org; Sun, 20 Apr 2014 01:17:34 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Wbk8C-0005r5-3W for emacs-orgmode@gnu.org; Sun, 20 Apr 2014 07:17:32 +0200 Received: from 114.248.3.17 ([114.248.3.17]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 20 Apr 2014 07:17:32 +0200 Received: from eric by 114.248.3.17 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 20 Apr 2014 07:17:32 +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 I've got this for three capture templates that should only work in Gnus: (setq org-capture-templates-contexts '(("M" ((in-mode . "gnus-\\(summary\\|article\\)"))) ("P" ((in-mode . "gnus-\\(summary\\|article\\)"))) ("H" ((in-mode . "gnus-\\(summary\\|article\\)"))))) This worked for quite some time, but when I went back to use it again today I found that these templates aren't filtered out in non-Gnus settings. I tried stepping through the code of `org-contextualize-validate-key' and think I've found the problem, though I'll confess to a little confusion. When that function checks the predicates (in-mode, not-in-file, etc), it has this chunk for handling the not-in-file bit: (if (and (eq (car rr) 'not-in-file) (buffer-file-name)) (not (string-match (cdr rr) (buffer-file-name))) t) This was slightly mis-aligned in the source file, leading me to believe it's just a nesting error. As it is, any template which *isn't using* the not-in-file predicate is going to flag as acceptable for the current context. I think it should just be: (when (and (eq (car rr) 'not-in-file) (buffer-file-name)) (not (string-match (cdr rr) (buffer-file-name)))) Testing indicates it works, am I missing anything? Pickaxe search for the string "not-in-file" in git says the last relevant commit was two years ago, so who knows what's going on... Eric