From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: org-check-for-hidden breaks promote/demote in region Date: Thu, 06 May 2010 11:05:02 -0400 Message-ID: <87r5lphy01.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OA2Ur-0000p8-5Z for emacs-orgmode@gnu.org; Thu, 06 May 2010 10:56:17 -0400 Received: from [140.186.70.92] (port=56114 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OA2Up-0000oI-Lf for emacs-orgmode@gnu.org; Thu, 06 May 2010 10:56:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OA2Ul-0006V3-Lo for emacs-orgmode@gnu.org; Thu, 06 May 2010 10:56:15 -0400 Received: from out1.smtp.messagingengine.com ([66.111.4.25]:56930) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OA2Ul-0006UG-Is for emacs-orgmode@gnu.org; Thu, 06 May 2010 10:56:11 -0400 Received: from archdesk (adsl-99-190-87-140.dsl.klmzmi.sbcglobal.net [99.190.87.140]) by mail.messagingengine.com (Postfix) with ESMTPSA id 0EFAB1F700 for ; Thu, 6 May 2010 10:56:09 -0400 (EDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode 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-/" The problem: When the region is active, M-S-/ (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