diff options
author | ian <ianxm@jhu.edu> | 2019-11-16 13:18:17 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2019-11-17 18:06:00 -0500 |
commit | 044e9718c18be7c1faab6dcf0c8b1cea1761530e (patch) | |
tree | 95d6e43ed32dd6e62fc86e12d9ea0685600e7d29 | |
parent | 69123824000f0192389f5163c2425be5ad8b2e86 (diff) | |
download | org-mode-044e9718c18be7c1faab6dcf0c8b1cea1761530e.tar.gz |
org-timer.el: Allow org-timer-set-timer from non-Org buffers
* lisp/org-timer.el (org-timer--get-timer-title): If the current
buffer is not an Org buffer, use the buffer name as the timer title.
Currently all of the `org-timer-' operations work from any buffer
except `org-timer-set-timer' which must be run from an Org buffer.
This is because `org-timer-set-timer' sets a timer name based on an
Org heading or filename. By setting the timer title to the current
buffer name we can use `org-timer-set-timer' from any buffer and
preserve the timer naming convention of using the buffer name if there
isn't an Org header.
TINYCHANGE
-rw-r--r-- | lisp/org-timer.el | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lisp/org-timer.el b/lisp/org-timer.el index 9674219..68fe966 100644 --- a/lisp/org-timer.el +++ b/lisp/org-timer.el @@ -466,7 +466,8 @@ time is up." (run-hooks 'org-timer-done-hook))))) (defun org-timer--get-timer-title () - "Construct timer title from heading or file name of Org buffer." + "Construct timer title. +Try to use an Org header, otherwise use the buffer name." (cond ((derived-mode-p 'org-agenda-mode) (let* ((marker (or (get-text-property (point) 'org-marker) @@ -482,7 +483,7 @@ time is up." ((derived-mode-p 'org-mode) (or (ignore-errors (org-get-heading)) (buffer-name (buffer-base-buffer)))) - (t (error "Not in an Org buffer")))) + (t (buffer-name (buffer-base-buffer))))) (provide 'org-timer) |