From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: Outline and org-mode don't insert text into folded sections logically Date: Sat, 22 Oct 2011 15:53:32 +0200 Message-ID: <87wrbxdter.fsf@gnu.org> References: <1315077299.1785.YahooMailClassic@web121520.mail.ne1.yahoo.com> <837h5nh1df.fsf@yahoo.it> <877h3xibb0.fsf@gnu.org> <81ehy5uy0t.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:45897) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RHc0B-00059a-QT for emacs-orgmode@gnu.org; Sat, 22 Oct 2011 09:52:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RHc0A-00048Q-O1 for emacs-orgmode@gnu.org; Sat, 22 Oct 2011 09:52:43 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:53483) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RHc0A-00048H-Ie for emacs-orgmode@gnu.org; Sat, 22 Oct 2011 09:52:42 -0400 Received: by wwf27 with SMTP id 27so1413259wwf.30 for ; Sat, 22 Oct 2011 06:52:41 -0700 (PDT) In-Reply-To: <81ehy5uy0t.fsf@gmail.com> (Jambunathan K.'s message of "Sat, 22 Oct 2011 15:51:54 +0530") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: suvayu ali Cc: emacs-orgmode@gnu.org, Kelly Dean --=-=-= Content-Type: text/plain Jambunathan K writes: >> Good idea. There is `post-self-insert-hook' but there is no >> `pre-self-insert-hook' that would check whether the point is in >> an invisible area of the buffer, and send a warning about this. > > In org-self-insert-command check for visibility at point and take the > required action. That's it. Thanks! Here is a dummy patch that prevents the user from editing invisible parts of the buffer. It doesn't prevent query-and-replace commands. Can people test it and comment it? Maybe throwing an error is a bit too much. Maybe preventing all kind of edition in invisible parts of the buffer is too much as well -- looking forward reading comments on this. Thanks, --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Prevent-self-insert-command-in-invisible-regions.patch >From 442f30b74f3f4eb888b63cb5d2cd04542952f84a Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sat, 22 Oct 2011 15:50:52 +0200 Subject: [PATCH] Prevent `self-insert-command' in invisible regions. * org.el (org-self-insert-command): Throw an error when the user is trying to use self-insert-command in invisible regions. --- lisp/org.el | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index d82ae0c..627faa3 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17328,6 +17328,9 @@ If the cursor is in a table looking at whitespace, the whitespace is overwritten, and the table is not marked as requiring realignment." (interactive "p") (cond + ((eq (car (get-char-property-and-overlay + (point) 'invisible)) 'outline) + (error "Attempt to edit an invisible part of the buffer")) ((and org-use-speed-commands (setq org-speed-command (run-hook-with-args-until-success -- 1.7.6.1 --=-=-= Content-Type: text/plain -- Bastien --=-=-=--