From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: [BUG] Inconsistency in src block hiding Date: Mon, 28 Nov 2011 01:09:36 -0700 Message-ID: <87fwh86533.fsf@gmail.com> References: <8739djqfkv.fsf@gmail.com> <87fwhiwwr0.fsf@gmail.com> <87bos6pp1a.fsf@gmail.com> <8739dhnxjs.fsf@gmail.com> <87ipmcxboo.fsf@gmail.com> <87pqgjipu8.fsf@gmail.com> <87y5v6x3lv.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:36733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RUwHi-00010n-5G for emacs-orgmode@gnu.org; Mon, 28 Nov 2011 03:10:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RUwHc-0003tZ-2R for emacs-orgmode@gnu.org; Mon, 28 Nov 2011 03:09:54 -0500 Received: from mail-gx0-f169.google.com ([209.85.161.169]:49400) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RUwHb-0003tV-SF for emacs-orgmode@gnu.org; Mon, 28 Nov 2011 03:09:48 -0500 Received: by ggnq4 with SMTP id q4so699860ggn.0 for ; Mon, 28 Nov 2011 00:09:47 -0800 (PST) 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: Nicolas Goaziou Cc: Org Mode List --=-=-= Content-Type: text/plain >>> >>> Again, drawers are in-line with standard hiding methods. Though, their >>> behaviour with regards to export needs to be changed (i.e. by default >>> simply export contents of the drawer instead of ignoring it). >>> >>> I think we should drop any "#+result:" or "#+name:" hiding and take >>> another route. It's not their job anyway. >>> >> >> Fair enough, I like this idea. > > So let's work towards drawers rehabilitation. > The attached patch entirely removes the #+name and #+results based hiding. Note that the existing "wrap" argument to the ":results" header argument will wrap results in a block which allows easy tab-based result hiding. As this is a relatively large change I hesitate to apply it outright, although I do agree that it leads to simpler more consistent behavior. If general consensus seems to support the application of this patch then I will be happy to apply it. Best, --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-remove-name-and-result-hiding.patch >From 8eec0e67d0e9ea703f0449310ca4db8c600e880f Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Mon, 28 Nov 2011 00:43:35 -0700 Subject: [PATCH] remove #+name and #+result hiding Given that arbitrary regions may already be hidden using a drawer the ability to hide any named entity is redundant. In addition the name based hiding does not mix well with other keywords. Thanks to Nicolas Goaziou for raising this issue and suggesting the removal of #+name based hiding. --- lisp/ob.el | 83 ------------------------------------------------------------ 1 files changed, 0 insertions(+), 83 deletions(-) diff --git a/lisp/ob.el b/lisp/ob.el index dab40f4..5815fe6 100644 --- a/lisp/ob.el +++ b/lisp/ob.el @@ -975,89 +975,6 @@ This can be called with C-c C-c." (when hash (kill-new hash) (message hash)))) (add-hook 'org-ctrl-c-ctrl-c-hook 'org-babel-hash-at-point) -(defun org-babel-result-hide-spec () - "Hide portions of results lines. -Add `org-babel-hide-result' as an invisibility spec for hiding -portions of results lines." - (add-to-invisibility-spec '(org-babel-hide-result . t))) -(add-hook 'org-mode-hook 'org-babel-result-hide-spec) - -(defvar org-babel-hide-result-overlays nil - "Overlays hiding results.") - -(defun org-babel-result-hide-all () - "Fold all results in the current buffer." - (interactive) - (org-babel-show-result-all) - (save-excursion - (while (re-search-forward org-babel-result-regexp nil t) - (save-excursion (goto-char (match-beginning 0)) - (org-babel-hide-result-toggle-maybe))))) - -(defun org-babel-show-result-all () - "Unfold all results in the current buffer." - (mapc 'delete-overlay org-babel-hide-result-overlays) - (setq org-babel-hide-result-overlays nil)) - -;;;###autoload -(defun org-babel-hide-result-toggle-maybe () - "Toggle visibility of result at point." - (interactive) - (let ((case-fold-search t)) - (if (save-excursion - (beginning-of-line 1) - (looking-at org-babel-result-regexp)) - (progn (org-babel-hide-result-toggle) - t) ;; to signal that we took action - nil))) ;; to signal that we did not - -(defun org-babel-hide-result-toggle (&optional force) - "Toggle the visibility of the current result." - (interactive) - (save-excursion - (beginning-of-line) - (if (re-search-forward org-babel-result-regexp nil t) - (let ((start (progn (beginning-of-line 2) (- (point) 1))) - (end (progn - (while (looking-at org-babel-multi-line-header-regexp) - (forward-line 1)) - (goto-char (- (org-babel-result-end) 1)) (point))) - ov) - (if (memq t (mapcar (lambda (overlay) - (eq (overlay-get overlay 'invisible) - 'org-babel-hide-result)) - (overlays-at start))) - (if (or (not force) (eq force 'off)) - (mapc (lambda (ov) - (when (member ov org-babel-hide-result-overlays) - (setq org-babel-hide-result-overlays - (delq ov org-babel-hide-result-overlays))) - (when (eq (overlay-get ov 'invisible) - 'org-babel-hide-result) - (delete-overlay ov))) - (overlays-at start))) - (setq ov (make-overlay start end)) - (overlay-put ov 'invisible 'org-babel-hide-result) - ;; make the block accessible to isearch - (overlay-put - ov 'isearch-open-invisible - (lambda (ov) - (when (member ov org-babel-hide-result-overlays) - (setq org-babel-hide-result-overlays - (delq ov org-babel-hide-result-overlays))) - (when (eq (overlay-get ov 'invisible) - 'org-babel-hide-result) - (delete-overlay ov)))) - (push ov org-babel-hide-result-overlays))) - (error "Not looking at a result line")))) - -;; org-tab-after-check-for-cycling-hook -(add-hook 'org-tab-first-hook 'org-babel-hide-result-toggle-maybe) -;; Remove overlays when changing major mode -(add-hook 'org-mode-hook - (lambda () (org-add-hook 'change-major-mode-hook - 'org-babel-show-result-all 'append 'local))) - (defvar org-file-properties) (defun org-babel-params-from-properties (&optional lang) "Retrieve parameters specified as properties. -- 1.7.4.1 --=-=-= Content-Type: text/plain -- Eric Schulte http://cs.unm.edu/~eschulte/ --=-=-=--