0

it was established in a previous post that (setq org-log-done 'time) should be substituted for (setq org-log-done t) in the init file, so that C-c C-t would close a TODO with a timestamp. I would like to be able to choose between closing with or without a timestamp. How, please?

This is the current setup:

(require 'package)
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
(require 'org)
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
  ;;(setq org-log-done t)
(setq org-log-done 'time)
;; Conventional selection/deletion 
(setq org-support-shift-select t)

1 Answer 1

2

The org-todo command documentation indicates that various prefix arguments can be used to influence the behavior. I thought perhaps this was what you wanted:

With a numeric prefix arg of 0, inhibit note taking for the change.

However, that doesn't seem to work for 'time.

You can create your own command that overrides the org-log-done setting, and bind it to some other key. Here's an example: this will run when org is loaded, define a variant of the org-todo command, and bind it to C-c C-S-t:

(with-eval-after-load 'org

    (defun my-org-todo-quietly ()
      (interactive)
      (let ((org-log-done nil))
        (org-todo)))

  (define-key org-mode-map (kbd "C-c C-S-t") 'my-org-todo-quietly))

You should then be able to use C-c C-t for the default behavior with the timestamp, or C-c C-S-t to skip the timestamp.

6
  • Where is the key?
    – user19777
    Mar 4, 2019 at 20:43
  • Is C-S-t Ctrl-shift-t or Ctrl-upper case s-t? Neither works. Ctrl-uc S invokes schedule.
    – user19777
    Mar 4, 2019 at 21:51
  • C-S-t is Ctrl-Shift-t. You can use a different key if you prefer, that one worked for me and seemed like a logical variant of the default C-c C-t.
    – glucas
    Mar 4, 2019 at 21:53
  • Probably because I did not close the file (is there a way to reload init?), now I did and it worked, thank you.
    – user19777
    Mar 4, 2019 at 21:58
  • 1
    Did you try describe-key from an org-mode buffer? That key is defined in a mode map so it will not be active unless you are currently in org-mode. You may want to take a look at the Emacs manual (which can be read within Emacs -- try C-h r to open it). See Evaluating Emacs Lisp Expressions for how to evaluate some new code in your init file without restarting; and Customizing Key Bindings for more on key maps.
    – glucas
    Mar 4, 2019 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.