From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thorsten Jolitz Newsgroups: gmane.emacs.help Subject: Re: post-command-hook to slow? Date: Thu, 05 Jun 2014 23:09:19 +0200 Message-ID: <8761kfqd1c.fsf@gmail.com> References: <8761kf5koy.fsf@kuiper.lan.informatimago.com> <87sinj3y9q.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1402002609 29769 80.91.229.3 (5 Jun 2014 21:10:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Jun 2014 21:10:09 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 05 23:10:02 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WsevA-0007ES-9U for geh-help-gnu-emacs@m.gmane.org; Thu, 05 Jun 2014 23:10:00 +0200 Original-Received: from localhost ([::1]:43779 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wsev9-0003Pw-M1 for geh-help-gnu-emacs@m.gmane.org; Thu, 05 Jun 2014 17:09:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wseur-0003L4-9q for help-gnu-emacs@gnu.org; Thu, 05 Jun 2014 17:09:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wseul-0001ft-DG for help-gnu-emacs@gnu.org; Thu, 05 Jun 2014 17:09:41 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:33735) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wseul-0001fl-66 for help-gnu-emacs@gnu.org; Thu, 05 Jun 2014 17:09:35 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Wseui-0006wa-HF for help-gnu-emacs@gnu.org; Thu, 05 Jun 2014 23:09:32 +0200 Original-Received: from e178189060.adsl.alicedsl.de ([85.178.189.60]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 05 Jun 2014 23:09:32 +0200 Original-Received: from tjolitz by e178189060.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 05 Jun 2014 23:09:32 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 76 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: e178189060.adsl.alicedsl.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:uVxd4MldaFbFYfB7uPDac8yo44g= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:98038 Archived-At: "Pascal J. Bourguignon" writes: > Thorsten Jolitz writes: >> […] >> >> ,----------------------- >> | call-interactively cmd >> `----------------------- >> >> should quickly run cmd and post-command-hook before >> >> ,---------------------------------- >> | copy-content-and-exit-temp-buffer >> `---------------------------------- >> >> is executed - but apparently not. > > > I'm still not sure to understand exactly what you're trying, but if what > you want is to have some function in post-command-hook to be called > after you call-interactively cmd, perhaps you could just do that > explicitely, since indeed, post-command-hooks won't be run while > processing post-command-hooks. Its a bit hard to explain, in fact I don't want to run a post-command-hook, I just want to call an Org function in a temporary buffer - but that function runs a post-command hook, and I have to deal with that (it is somehow run too late, when the temp buffer is already closed). An MWE is difficult unless you are an Org user, but anyway: Evaluate this in an emacs-lisp-mode buffer (without the surrounding #+begin_ and #+end_ delimiters): #+begin_src emacs-lisp (setq org-todo-keywords (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!/!)") (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" "PHONE")))) (with-temp-buffer (org-mode) (insert "* Level 1\nSome Text\n") (org-todo) (message "%s" (buffer-substring-no-properties (point-min) (point-max)))) #+end_src you should be prompted for a state, choose TODO first (t) and it should work. Then evaluate 'with-temp-buffer again, this time chosing a state with an @ in its definition: "WAITING" or "HOLD" or "CANCELLED because thats triggers taking a log note (and calling a post-command-hook function). You should get the error: ,----------------------------------------------- | Error in post-command-hook (org-add-log-note): | (error "Marker does not point anywhere") `----------------------------------------------- When you insert a message statement at the very beginning of `org-add-log-note' that print current-buffer an major-mode, you will see that its called in the emacs-lisp buffer and not in the temp buffer. -- cheers, Thorsten