From 23ef0209d53b0acdf2158da9dd8d4532b437f97e Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sat, 29 Oct 2011 16:08:27 +0200 Subject: [PATCH] org.el: Unfold invisible region at point or right before point when editing. * org.el (org-self-insert-command): Unfold invisible region at point or right before point when editing. Thanks to Suvayu Ali for discussing this. --- lisp/org.el | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index fe45cf7..6c809be 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17393,6 +17393,23 @@ hook. The default setting is `org-speed-command-default-hook'." 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") + (let ((invisible-at-point + (car (get-char-property-and-overlay (point) 'invisible))) + (invisible-before-point + (car (get-char-property-and-overlay (1- (point)) 'invisible)))) + (when (or (eq invisible-at-point 'outline) + (eq invisible-at-point 'org-hide-block) + (eq invisible-before-point 'outline) + (eq invisible-before-point 'org-hide-block)) + (if (or (eq invisible-before-point 'outline) + (eq invisible-before-point 'org-hide-block)) + (goto-char (previous-overlay-change (point)))) + (org-cycle) + (if (or (eq invisible-before-point 'outline) + (eq invisible-before-point 'org-hide-block)) + (forward-char 1)) + (message "Unfolding invisible region around point before editing") + (sit-for 1))) (cond ((and org-use-speed-commands (setq org-speed-command -- 1.7.7.1