Re: [O] [PATCH] Enable silent visibility cycling

2013-09-02 Thread Carsten Dominik

On 19.7.2013, at 19:54, Eric S Fraga e.fr...@ucl.ac.uk wrote:

 Thorsten Jolitz tjol...@gmail.com writes:
 
 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. 
 
 Brilliant!  Thanks.

This works now.

Kind regards

- Carsten

 -- 
 : Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.0.6-341-g338603
 
 




Re: [O] [PATCH] Enable silent visibility cycling

2013-07-25 Thread Thorsten Jolitz
Jambunathan K kjambunat...@gmail.com writes:

 Thorsten Jolitz tjol...@gmail.com writes:

 seems to be a bigger project

 No, it is not.  Unless you consider adding these a bigger project.  

 (defvar org-message-level)

 (defun org-message (level other args)


  )

 s/message/org-message/ at some places.

 Just to remind to you, I am not the gatekeeper for this project, so what
 I say is not binding.

Looks good, better than doing isolated local patches. 

-- 
cheers,
Thorsten




Re: [O] [PATCH] Enable silent visibility cycling

2013-07-22 Thread Thorsten Jolitz
Jambunathan K kjambunat...@gmail.com writes:

 [I have no specific opinions on this patch.]

 The customary way is to put each message at different level.  The
 threshold level that the user wishes to see is configurable.  Any
 logging message that falls below or above that threshold gets filtered.

 This way you don't introduce switches on a case-by-case basis.

 No different from verbosity switches of some command lines or the log
 levels defined by `lwarn' etc.

 In the present case, you can make cycling messages at newbie level.
 An intermediate or an expert user will not see those.  What
 constitutes a level could ofcourse be defined differently ...

Yes, it would of cource be nice to have different levels for (logging)
messages, but that seems to be a bigger project - for all of Org-mode or
even all of Emacs. So I rather propose this special-case patch where
default messaging was a bit too verbose sometimes. 

-- 
cheers,
Thorsten




Re: [O] [PATCH] Enable silent visibility cycling

2013-07-21 Thread Jambunathan K

[I have no specific opinions on this patch.]

The customary way is to put each message at different level.  The
threshold level that the user wishes to see is configurable.  Any
logging message that falls below or above that threshold gets filtered.

This way you don't introduce switches on a case-by-case basis.

No different from verbosity switches of some command lines or the log
levels defined by `lwarn' etc.

In the present case, you can make cycling messages at newbie level.
An intermediate or an expert user will not see those.  What
constitutes a level could ofcourse be defined differently ...



[O] [PATCH] Enable silent visibility cycling (was: How to turn off visibility-state messages from 'org-cycle?)

2013-07-19 Thread Thorsten Jolitz
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


Re: [O] [PATCH] Enable silent visibility cycling

2013-07-19 Thread Eric S Fraga
Thorsten Jolitz tjol...@gmail.com writes:

 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. 

Brilliant!  Thanks.
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.0.6-341-g338603