From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: org-check-for-hidden breaks promote/demote in region Date: Fri, 7 May 2010 09:15:08 +0200 Message-ID: References: <87r5lphy01.fsf@fastmail.fm> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OAHn6-0004t6-47 for emacs-orgmode@gnu.org; Fri, 07 May 2010 03:16:08 -0400 Received: from [140.186.70.92] (port=59987 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OAHmk-0004DA-68 for emacs-orgmode@gnu.org; Fri, 07 May 2010 03:16:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OAHmS-0001xd-1B for emacs-orgmode@gnu.org; Fri, 07 May 2010 03:15:45 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:54318) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OAHmK-0001wM-Ik for emacs-orgmode@gnu.org; Fri, 07 May 2010 03:15:24 -0400 Received: by wyb40 with SMTP id 40so242631wyb.0 for ; Fri, 07 May 2010 00:15:16 -0700 (PDT) In-Reply-To: <87r5lphy01.fsf@fastmail.fm> 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: Matt Lundin Cc: Org Mode Hi Matt, I agree and have applied your patch, thanks. - Carsten On May 6, 2010, at 5:05 PM, Matt Lundin wrote: > 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 > > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode - Carsten