From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kyle Meyer Subject: Re: [PATCH] org-timer.el: Allow org-timer-set-timer from non-Org buffers Date: Sun, 17 Nov 2019 18:09:46 -0500 Message-ID: <87v9ri14n9.fsf@kyleam.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:48562) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWTg2-0007hF-Mh for emacs-orgmode@gnu.org; Sun, 17 Nov 2019 18:09:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWTg0-0003hW-6J for emacs-orgmode@gnu.org; Sun, 17 Nov 2019 18:09:54 -0500 Received: from pb-smtp1.pobox.com ([64.147.108.70]:59867) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iWTfy-0003gC-De for emacs-orgmode@gnu.org; Sun, 17 Nov 2019 18:09:51 -0500 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: ian martins , emacs-orgmode@gnu.org ian martins writes: > Subject: [PATCH] org-timer.el: Allow org-timer-set-timer from non-Org buffers > > * org-timer.el (org-timer--get-timer-title): If the current buffer is The file name should include the directory, "lisp/". (I'll add it.) > 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. Makes sense. > @@ -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))))) Looks good. An alternative that avoids repeating the buffer-name call would be (cond [...] ((and (derived-mode-p 'org-mode) (ignore-errors (org-get-heading)))) (t (buffer-name (buffer-base-buffer)))) but I think it's fine as is. Applied and pushed (044e9718c). Thanks.