emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Allen Li <vianchielfaura@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode@gnu.org
Subject: [PATCH] Use the same TODO keyword as the current heading
Date: Mon, 16 Oct 2017 12:38:21 -0700	[thread overview]
Message-ID: <CAJr1M6fn9W+7vNmb6xW9nUt+ZBKtt8ZhwKtKbbOoE=6yiRev5A@mail.gmail.com> (raw)

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

             reply	other threads:[~2017-10-16 19:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-16 19:38 Allen Li [this message]
2017-10-17  7:47 ` [PATCH] Use the same TODO keyword as the current heading Nicolas Goaziou
2017-10-17 18:40   ` Allen Li
2017-10-18 20:49     ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJr1M6fn9W+7vNmb6xW9nUt+ZBKtt8ZhwKtKbbOoE=6yiRev5A@mail.gmail.com' \
    --to=vianchielfaura@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).