emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] How to turn off visibility-state messages from 'org-cycle?


From: Thorsten Jolitz
Subject: Re: [O] How to turn off visibility-state messages from 'org-cycle?
Date: Thu, 18 Jul 2013 11:52:56 +0200
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux)

Thorsten Jolitz <address@hidden> writes:

> Eric S Fraga <address@hidden> writes:
>
>> Thorsten Jolitz <address@hidden> writes:
>>
>>> Hi List,
>>>
>>> when calling Org-mode functionality form an external program, some
>>> functions seem to make use of 'org-cycle', what results in a lot of
>>> "OVERVIEW" messages arriving at stdout/stderr
>>>
>>> ,---------
>>> | OVERVIEW
>>
>> [...]
>>
>>> Is there a way to turn these message off? I found things like
>>
>> Unfortunately, no.  The code that outputs these messages does have a
>> hack to turn off the output when the org file is an attachment in a gnus
>> message but that's about it.
>>
>> I also would like to have these turned off when using an emacs batch
>> command which I often do to synchronise my diary with various online
>> calendars...
>>
>> Should be easy to add a variable and then a condition on each
>> (message...) line in org-cycle-internal-global as all of the relevant
>> message lines are already within a conditional.
>
> yes, adding this defcustom to org.el
>
> #+begin_src emacs-lisp
>   (defcustom org-cycle-silently nil
>     "Non-nil means `org-cycle-internal-global' cycles silently.
>
>   No messages about changing visibility state of the Org-mode
>   buffer will be outputted anymore in that case. This is especially
>   useful to avoid having these messages arrive at stdout or stderr
>   when calling Org-mode functionality from an external program."
>     :group 'org-cycle
>     :type 'boolean)
> #+end_src

or, even better, since more dynamic (untested):

#+begin_src emacs-lisp
  (defvar org-cycle-silently nil
    "Suppress visibility-state-change messages when non-nil.")

  (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 truncate-lines)
            (> (prefix-numeric-value arg) 0)))
    (message "Silent visibility cycling %s"
             (if org-cycle-silently "enabled" "disabled")))
#+end_src

> and then changing the four
>
> #+begin_src emacs-lisp
>   (unless ga (message "CONTENTS..."))
> #+end_src
>
> lines in `org-cycle-internal-global' to something like
>
> #+begin_src emacs-lisp
>   (unless (or ga org-cycle-silently)
>     (message "CONTENTS..."))
> #+end_src
>
> would do the job.

--
cheers,
Thorsten




reply via email to

[Prev in Thread] Current Thread [Next in Thread]