[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to activate hook for a specific buffer...?

From: Ralf Fassel
Subject: Re: How to activate hook for a specific buffer...?
Date: Thu, 26 Apr 2018 09:32:30 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

* Carlo Tambuatco <address@hidden>
| I’ve got some setup code for my org mode in emacs: 
| (defun org-summary-todo (n-done n-not-done)
|   "Switch entry to DONE when all subentries are done, to TODO otherwise."
|   (let (org-log-done org-log-states)   ; turn off logging
|     (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
| (add-hook 'org-after-todo-statistics-hook 'org-summary-todo nil t)
| that I want to run only in specific org buffers. I do not want to set
| this globally. I do not want to turn off logging globally for all org
| buffers.

Change the function so it checks the current buffer and only apply the
'let' if the check yields 't.  Either make a list of those buffers, or
have a special naming convention for those buffers ("starting with
xyz-"), or set a buffer-local variable in the local-variables-section
(assuming the org-buffer is loaded from a plain text file where you can
add lisp-local-variables) and check that in the hook...

I would not put actual code to execute inside the files for obvious
security reasons...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]