Eric S Fraga e.fr...@ucl.ac.uk writes:
Would you wrap it all up in a patch and submit it? It would be great to
have incorporated.
ok, done.
PS
I included this into `outshine.el' too, since outline-cycle showed the
same behaviour.
From 0a4dad9119af9aed8e5160a05e81ac35f2bb0044 Mon Sep 17 00:00:00 2001
From: tj t...@data-driven.de
Date: Fri, 19 Jul 2013 13:47:20 +0200
Subject: [PATCH] Org: Enable silent visibility cycling
* lisp/org.el: add boolean variable `org-cycle-silently'.
add function `org-toggle-silent-cycling'.
(org-cycle-internal-global): make visibility-state-change messages conditional
on `org-cycle-silently'.
The problem here was that, especially in batch use, unconditionally writing a
message for each visibility-state-change might send a lot of clutter to
stdout.
Modified from a patch proposal by Thorsten Jolitz.
---
lisp/org.el | 30 ++
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index fb5099e..1eb511d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6494,6 +6494,9 @@ and subscripts.
(defvar org-inlinetask-min-level)
+(defvar org-cycle-silently nil
+ Suppress visibility-state-change messages when non-nil.)
+
;;;###autoload
(defun org-cycle (optional arg)
TAB-action and visibility cycling for Org-mode.
@@ -6661,6 +6664,21 @@ in special contexts.
(org-back-to-heading)
(org-cycle)))
+(defun org-toggle-silent-cycling (optional arg)
+ Toggle silent cycling between visibility states.
+
+ When silent cycling is off, visibility state-change messages are
+ written to stdout (i.e. the *Messages* buffer), otherwise these
+ messages are suppressed. With prefix argument ARG, cycle silently
+ if ARG is positive, otherwise write state-change messages.
+ (interactive P)
+ (setq org-cycle-silently
+ (if (null arg)
+ (not org-cycle-silently)
+ ( (prefix-numeric-value arg) 0)))
+ (message Silent visibility cycling %s
+ (if org-cycle-silently enabled disabled)))
+
(defun org-cycle-internal-global ()
Do the global cycling action.
;; Hack to avoid display of messages for .org attachments in Gnus
@@ -6672,9 +6690,11 @@ in special contexts.
;; We just created the overview - now do table of contents
;; This can be slow in very large buffers, so indicate action
(run-hook-with-args 'org-pre-cycle-hook 'contents)
- (unless ga (message CONTENTS...))
+ (unless (or ga org-cycle-silently)
+ (message CONTENTS...))
(org-content)
- (unless ga (message CONTENTS...done))
+ (unless (or ga org-cycle-silently)
+ (message CONTENTS...done))
(setq org-cycle-global-status 'contents)
(run-hook-with-args 'org-cycle-hook 'contents))
@@ -6683,7 +6703,8 @@ in special contexts.
;; We just showed the table of contents - now show everything
(run-hook-with-args 'org-pre-cycle-hook 'all)
(show-all)
- (unless ga (message SHOW ALL))
+ (unless (or ga org-cycle-silently)
+ (message SHOW ALL))
(setq org-cycle-global-status 'all)
(run-hook-with-args 'org-cycle-hook 'all))
@@ -6691,7 +6712,8 @@ in special contexts.
;; Default action: go to overview
(run-hook-with-args 'org-pre-cycle-hook 'overview)
(org-overview)
- (unless ga (message OVERVIEW))
+ (unless (or ga org-cycle-silently)
+ (message OVERVIEW))
(setq org-cycle-global-status 'overview)
(run-hook-with-args 'org-cycle-hook 'overview)
--
1.8.2.3
--
cheers,
Thorsten