From: Sebastian Fischmeister <sfischme@uwaterloo.ca>
To: emacs-orgmode@gnu.org
Subject: patch to keep the level in refile
Date: Sun, 1 Nov 2015 07:41:05 -0500 [thread overview]
Message-ID: <87y4eh51yz.fsf@uwaterloo.ca> (raw)
Hi,
This allows to specify via a variable whether org-refile should keep the
level of the item when refiling. At the moment, org-refile automatically
creates a sub-item at the next level. This causes problems, when the
level has semantic meaning beyond defining the hierarchy (e.g., level 3
always indicates a task while levels 2 and 1 are project headings).
Maybe it would be better to have this as a parameter to org-refile, but
I'm just looking for feedback and suggestions right now.
Sebastian
diff --git a/lisp/org.el b/lisp/org.el
index 6218a3a..8657be8 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1296,6 +1296,11 @@ commands in the Help buffer using the `?' speed command."
(function)
(sexp))))))
+(defcustom org-refile-keep-level t
+ "Non-nil means entering Org-mode will set keep the level under `org-refile'."
+ :group 'org-structure
+ :type 'boolean)
+
(defcustom org-bookmark-names-plist
'(:last-capture "org-capture-last-stored"
:last-refile "org-refile-last-stored"
@@ -11867,6 +11872,7 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(region-end (and regionp (region-end)))
(filename (buffer-file-name (buffer-base-buffer cbuf)))
(org-refile-keep (if (equal arg 3) t org-refile-keep))
+ (curlevel (funcall outline-level))
pos it nbuf file re level reversed)
(setq last-command nil)
(when regionp
@@ -11959,6 +11965,8 @@ prefix argument (`C-u C-u C-u C-c C-w')."
(goto-char (point-min))
(or (outline-next-heading) (goto-char (point-max)))))
(if (not (bolp)) (newline))
+ (when org-refile-keep-level
+ (setq level curlevel))
(org-paste-subtree level nil nil t)
(when org-log-refile
(org-add-log-setup 'refile nil nil 'findpos org-log-refile)
next reply other threads:[~2015-11-01 12:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-01 12:41 Sebastian Fischmeister [this message]
2015-11-01 14:43 ` patch to keep the level in refile Nicolas Goaziou
2015-11-01 20:32 ` Sebastian Fischmeister
2015-11-08 15:34 ` 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=87y4eh51yz.fsf@uwaterloo.ca \
--to=sfischme@uwaterloo.ca \
--cc=emacs-orgmode@gnu.org \
/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).