emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: Capture mode seems to be easily confused in Emacs 22
Date: Thu, 24 Jun 2010 09:14:51 -0400	[thread overview]
Message-ID: <87iq587et0.fsf@gollum.intra.norang.ca> (raw)
In-Reply-To: <E2F39414-0C00-492B-97BE-1BB7D02621D5@gmail.com> (Carsten Dominik's message of "Thu\, 24 Jun 2010 14\:46\:55 +0200")

Carsten Dominik <carsten.dominik@gmail.com> writes:

> On Jun 24, 2010, at 2:26 PM, Bernt Hansen wrote:
>
>> Carsten Dominik <carsten.dominik@gmail.com> writes:
>>
>>> On Jun 24, 2010, at 4:57 AM, Bernt Hansen wrote:
>>>
>>>> In my Emacs 22 on Debian
>>>>
>>>> GNU Emacs 22.2.1 (i486-pc-linux-gnu, GTK+ Version 2.12.11) of
>>>> 2008-11-09
>>>> on raven, modified by Debian
>>>>
>>>> if I start a capture buffer with C-c c t and then immediately try to
>>>> file it with C-c C-c (with the point still on the heading) it
>>>> prompts
>>>> for tags instead of filing.  This seems to work fine in Emacs 23.
>>>>
>>>> In Emacs 22 I end up in the CAPTURE-refile.org buffer with the
>>>> overlay
>>>> on line 1 stating to use C-c C-c to file and C-c C-k to abort but
>>>> these
>>>> keys no longer work.  Widening the buffer and using C-c C-c on
>>>> the #+STARTUP line refreshes the config and makes it possible to
>>>> continue.
>>>
>>
>>> this is strange, and also a sign that org-capture-mode is not active
>>> in that buffer. My preliminary test show that it works here under
>>> emacs 22.
>>>
>>> Anything suspicious in *Messages* ?
>>
>> The toggling capture mode off message look suspicious.
>>
>> ,----
>> | Loading /home/bernt/git/org-mode/lisp/org-capture.el (source)...done
>> | Template key:
>> | Loading tabify...done
>> | Clipboard pasted as level 1 subtree
>> | Toggling org-capture-mode off; better pass an explicit argument.
>> | Clock starts at [2010-06-24 Thu 08:24] - showing entire task time.
>> `----
>
> Hi Bernt,
>
> I suspect that you use
>
>     (org-capture-mode)
>
> in one of your hook function, in order to check if the mode is on.
> However, this is a function call, and it will TOGGLE the mode, so you
> are turning it off.
>
> Just remove the parenthesis, to test the *variable*
>
>     (if org-capture-mode
>            .........
>
> If you want to protect yourself from running this hook before org- 
> capture
> is is loaded and org-capture-mode defined, you can do
>
>     (if (and (boundp 'org-capture-mode) org-capture-mode
>             ......
>
> I am willing to bet that this is the problem you are experiencing. :-)

*BINGO*.  Duh now I feel stupid :)

Sorry about that snafu.  /me blames it on the guy that named the
variable and function the same thing ;)

After my post to Nick about not being able to use the capture mode
*variable* I promptly updated my clock in to NEXT function to try to use
it and I wrapped org-capture-mode in parens... so it called the
function.

Just FYI this is my new function

,----
| (defun bh/clock-in-to-next (kw)
|   "Switch task from TODO to NEXT when clocking in.
| Skips remember tasks and tasks with subtasks"
|   (if (and (string-equal kw "TODO")
| 	   (not (string-equal (buffer-name) "*Remember*"))
| ;	   (not (string-match "^CAPTURE-.*\.org" (buffer-name) )))
| 	   (not org-capture-mode))
|       (let ((subtree-end (save-excursion (org-end-of-subtree t)))
| 	    (has-subtask nil))
| 	(save-excursion
| 	  (forward-line 1)
| 	  (while (and (not has-subtask)
| 		      (< (point) subtree-end)
| 		      (re-search-forward "^\*+ " subtree-end t))
| 	    (message "Found todo keyword %s" (org-get-todo-state))
| 	    (when (member (org-get-todo-state) org-not-done-keywords)
| 	      (setq has-subtask t))))
| 	(when (not has-subtask)
| 	  "NEXT"))))
`----

and the call to org-capture-mode used to look like this

,----
| 	   (not (org-capture-mode)))
`----

Thank for solving this one!

Best regards,
Bernt

  reply	other threads:[~2010-06-24 13:15 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-22 12:36 New implementation of the Org remember process ready for comments and testing Carsten Dominik
2010-06-22 14:08 ` Sébastien Vauban
2010-06-22 14:20 ` [Patch] " Sebastian Rose
2010-06-22 14:25   ` Carsten Dominik
2010-06-22 14:29     ` Sebastian Rose
2010-06-22 14:42       ` Carsten Dominik
2010-06-22 14:26   ` Carsten Dominik
2010-06-22 14:27   ` Carsten Dominik
2010-06-23  9:38   ` Ulf Stegemann
2010-06-23 10:29     ` Sebastian Rose
2010-06-23 11:28       ` Carsten Dominik
2010-06-23 12:21       ` Ulf Stegemann
2010-06-23 12:49         ` Sebastian Rose
2010-06-23 14:22           ` Carsten Dominik
2010-06-23 14:42             ` Sebastian Rose
2010-06-24 12:41               ` Ulf Stegemann
2010-06-23 14:06   ` Carsten Dominik
2010-06-22 18:58 ` Tassilo Horn
2010-06-23  3:59   ` Carsten Dominik
2010-06-23  6:31     ` Tassilo Horn
2010-06-23  6:44       ` Carsten Dominik
2010-06-22 19:26 ` Eric S Fraga
2010-06-23  7:53   ` Ian Barton
2010-06-22 20:50 ` Bernt Hansen
2010-06-22 23:15   ` Sebastian Rose
2010-06-23  4:35   ` Carsten Dominik
2010-06-22 23:07 ` Sebastian Rose
2010-06-22 23:32   ` [Patch] " Sebastian Rose
2010-06-23  4:18   ` Carsten Dominik
2010-06-23 12:24   ` reuse input (was: New implementation of the Org remember process ready for comments and testing) Memnon Anon
2010-06-22 23:56 ` New implementation of the Org remember process ready for comments and testing Sebastian Rose
2010-06-23  4:23   ` Carsten Dominik
2010-06-23  8:05     ` Sebastian Rose
2010-06-23  8:18       ` Carsten Dominik
2010-06-23  4:01 ` Puneeth
2010-06-23  4:31   ` Carsten Dominik
2010-06-23  9:04     ` Puneeth
2010-06-23  8:39   ` Carsten Dominik
2010-06-23  4:52 ` Manish
2010-06-23  5:40   ` Carsten Dominik
2010-06-23  8:02 ` Ian Barton
2010-06-23 11:30   ` Carsten Dominik
2010-06-23 10:40 ` [Typo] " Sebastian Rose
2010-06-23 11:27   ` Carsten Dominik
2010-06-23 13:53 ` Jason McBrayer
2010-06-23 14:05 ` Darlan Cavalcante Moreira
2010-06-23 15:19   ` Carsten Dominik
2010-06-23 17:00     ` Darlan Cavalcante Moreira
2010-06-24  5:20       ` Carsten Dominik
2010-06-24  1:32 ` Bernt Hansen
2010-06-24  2:25   ` BUG: org-capture saves an incorrect clock marker in org-clock-history Bernt Hansen
2010-06-24  5:39     ` Carsten Dominik
2010-06-24 13:37       ` Bernt Hansen
2010-06-24  2:36   ` Re: New implementation of the Org remember process ready for comments and testing Nick Dokos
2010-06-24  2:37     ` Bernt Hansen
2010-06-24  2:41       ` Bernt Hansen
2010-06-24  2:57         ` Capture mode seems to be easily confused in Emacs 22 Bernt Hansen
2010-06-24  5:44           ` Carsten Dominik
2010-06-24 12:26             ` Bernt Hansen
2010-06-24 12:46               ` Carsten Dominik
2010-06-24 13:14                 ` Bernt Hansen [this message]
2010-06-24 13:21                   ` Carsten Dominik
2010-06-24 13:32                 ` Bernt Hansen
2010-07-05 11:22 ` capture template: %& and %! Memnon Anon
2010-07-05 12:50   ` Carsten Dominik
2010-07-05 13:18     ` Memnon Anon
2010-07-05 13:26       ` Carsten Dominik

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=87iq587et0.fsf@gollum.intra.norang.ca \
    --to=bernt@norang.ca \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public 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).