From mboxrd@z Thu Jan 1 00:00:00 1970 From: Allen Li Subject: [PATCH] Use the same TODO keyword as the current heading Date: Mon, 16 Oct 2017 12:38:21 -0700 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e4BDT-0000FP-2K for emacs-orgmode@gnu.org; Mon, 16 Oct 2017 15:38:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e4BDS-0004HF-7l for emacs-orgmode@gnu.org; Mon, 16 Oct 2017 15:38:23 -0400 Received: from mail-qt0-x241.google.com ([2607:f8b0:400d:c0d::241]:49965) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e4BDS-0004H2-3K for emacs-orgmode@gnu.org; Mon, 16 Oct 2017 15:38:22 -0400 Received: by mail-qt0-x241.google.com with SMTP id k31so34110768qta.6 for ; Mon, 16 Oct 2017 12:38:21 -0700 (PDT) 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: Nicolas Goaziou Cc: emacs-orgmode@gnu.org This makes org-insert-todo-heading-respect-content use the previous heading of the same level instead of the previous heading regardless of level. Given: * TODO some task ** WAITING other task The original code yields: * TODO some task ** WAITING other task * WAITING This commit yields: * TODO some task ** WAITING other task * TODO * lisp/org.el (org-insert-todo-heading): Use keyword of previous same level heading --- lisp/org.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index d6cd77bf9..100fe9a58 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7947,8 +7947,7 @@ unchecked check box." (org-insert-heading (or (and (equal arg '(16)) '(16)) force-heading)) (save-excursion - (org-back-to-heading) - (outline-previous-heading) + (org-forward-heading-same-level -1) (let ((case-fold-search nil)) (looking-at org-todo-line-regexp))) (let* ((new-mark-x (if (or (equal arg '(4)) -- 2.15.0.rc0.271.g36b669edcc-goog