From 8a8a56c27715740053d8a7ea2ba6411b781a22f1 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 file changed, 83 deletions(-) diff --git a/lisp/ob.el b/lisp/ob.el index 9ae495455..64c82b880 100644 --- a/lisp/ob.el +++ b/lisp/ob.el @@ -974,89 +974,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. -- git format-patch -1 --stdout -C 8a8a56c27715740053d8a7ea2ba6411b781a22f1