From: Matt Lundin <mdl@imapmail.org>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: org-check-for-hidden breaks promote/demote in region
Date: Thu, 06 May 2010 11:05:02 -0400 [thread overview]
Message-ID: <87r5lphy01.fsf@fastmail.fm> (raw)
Hi Carsten,
I find that commit 11baa7cf77245cc2a5f44dd55e034157896ad08d (which
changes the behavior of M-left and M-right) makes it impossible to
promote and demote headlines in a region.[1]
In the past, if I marked a region of folded headlines and used M-left or
M-right, org-mode would promote/demote all the headlines in the region.
Now, it simply throws the following error:
"Hidden subtree, open with TAB or use subtree command
M-S-<left>/<right>"
The problem: When the region is active, M-S-<left>/<right> (as in the
past) only moves a single subtree, so AFAICT there is currently no way
to promote/demote all headings in a region.
While I appreciate the new safeguard for single outline headings, IMO
the check is irrelevant when attempting to act on headlines in a region,
since (1) the user chooses to move an entire region and (2) the hidden
headlines are normally included in the region.
Here's a patch that skips the check if the region is active:
--8<---------------cut here---------------start------------->8---
diff --git a/lisp/org.el b/lisp/org.el
index 0385383..463a0eb 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16146,20 +16146,19 @@ this fucntion returns t, nil otherwise."
beg end)
(save-excursion
(catch 'exit
- (if (org-region-active-p)
- (setq beg (region-beginning) end (region-end))
+ (unless (org-region-active-p)
(setq beg (point-at-bol))
(beginning-of-line 2)
(while (and (not (eobp)) ;; this is like `next-line'
(get-char-property (1- (point)) 'invisible))
(beginning-of-line 2))
- (setq end (point)))
- (goto-char beg)
- (goto-char (point-at-eol))
- (setq end (max end (point)))
- (while (re-search-forward re end t)
- (if (get-char-property (match-beginning 0) 'invisible)
- (throw 'exit t)))
+ (setq end (point))
+ (goto-char beg)
+ (goto-char (point-at-eol))
+ (setq end (max end (point)))
+ (while (re-search-forward re end t)
+ (if (get-char-property (match-beginning 0) 'invisible)
+ (throw 'exit t))))
nil))))
(defun org-metaup (&optional arg)
--8<---------------cut here---------------end--------------->8---
Thanks,
Matt
Footnotes:
[1] The change was discussed in this thread: http://mid.gmane.org/l2me4f0b2511004191529s16b84452kb4feea51f06353d4@mail.gmail.com
next reply other threads:[~2010-05-06 14:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-06 15:05 Matt Lundin [this message]
2010-05-07 7:15 ` org-check-for-hidden breaks promote/demote in region Carsten Dominik
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r5lphy01.fsf@fastmail.fm \
--to=mdl@imapmail.org \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.