emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Nicolas Goaziou <n.goaziou@gmail.com>
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: [BUG] Inconsistency in src block hiding
Date: Mon, 28 Nov 2011 01:09:36 -0700	[thread overview]
Message-ID: <87fwh86533.fsf@gmail.com> (raw)
In-Reply-To: 87y5v6x3lv.fsf@gmail.com

[-- Attachment #1: Type: text/plain, Size: 908 bytes --]

>>>
>>> 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,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-remove-name-and-result-hiding.patch --]
[-- Type: text/x-diff, Size: 4538 bytes --]

From 8eec0e67d0e9ea703f0449310ca4db8c600e880f Mon Sep 17 00:00:00 2001
From: Eric Schulte <schulte.eric@gmail.com>
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


[-- Attachment #3: Type: text/plain, Size: 47 bytes --]


-- 
Eric Schulte
http://cs.unm.edu/~eschulte/

  reply	other threads:[~2011-11-28  8:10 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-20 10:00 [BUG] Inconsistency in src block hiding Nicolas Goaziou
2011-11-20 15:53 ` Eric Schulte
2011-11-20 19:33   ` Nicolas Goaziou
2011-11-21 18:24     ` Eric Schulte
2011-11-22 16:15       ` Eric Schulte
2011-11-22 18:19       ` Nicolas Goaziou
2011-11-22 23:23         ` Eric Schulte
2011-11-23 15:25           ` Nicolas Goaziou
2011-11-28  8:09             ` Eric Schulte [this message]
2011-12-11 13:53               ` Bastien
2011-12-11 14:08                 ` Nicolas Goaziou
2011-12-11 16:25                   ` Eric Schulte
2011-12-11 16:04                 ` Eric Schulte
2011-12-11 17:04                   ` Bastien
2012-01-17  2:26                   ` Bernt Hansen
2012-01-17 17:49                     ` Nicolas Goaziou
2012-01-17 17:59                       ` Bernt Hansen
2012-01-18 10:45                         ` Leo Alekseyev
2012-01-18 16:02                           ` Rick Frankel
2012-01-18 16:19                             ` Eric Schulte
2012-01-18 17:36                               ` Nicolas Goaziou
2012-01-19 12:10                                 ` Martyn Jago
2012-01-19 14:48                                   ` Eric Schulte
2012-01-19 15:22                                   ` Rick Frankel
2012-01-19 19:18                                   ` Nicolas Goaziou
2012-01-19 14:41                                 ` Eric Schulte
2012-01-19 19:26                                   ` Nicolas Goaziou
2012-01-24  3:41                                     ` Eric Schulte
2012-01-24  4:23                                       ` Leo Alekseyev
2012-01-24  4:44                                         ` Jambunathan K
2012-01-24  7:59                                       ` Andreas Leha
2012-01-24 20:39                                       ` Nicolas Goaziou
2012-01-28 16:08                                       ` Nicolas Goaziou
2012-01-25  0:00                         ` Nick Dokos
2012-01-25  2:23                           ` Bernt Hansen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fwh86533.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=n.goaziou@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).