all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Katsumi Yamaoka <yamaoka@jpl.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Temporarily turning message logging off
Date: Thu, 24 May 2007 14:03:41 +0900	[thread overview]
Message-ID: <b4m3b1molsi.fsf@jpl.org> (raw)
In-Reply-To: 1179979000.784693.89720@b40g2000prd.googlegroups.com

>>>>> In <1179979000.784693.89720@b40g2000prd.googlegroups.com>
>>>>>	Davin Pearson wrote:

> I would like to temporarily undefine the function message so that
> messages are temporarily turned off.  Here is some Elisp code that I
> have written to achieve this:

> ;;;
> ;;; (progn (message "hello") (sit-for 1))
> ;;;

> (defun my-message--turn-messages-off ()
>   (progn
>     (fset 'message-old (symbol-function 'message))
>     (defun message (string &rest arguments)
>       ))
>   )

> (defun my-message--turn-messages-on ()
>   (progn
>     (fset 'message (symbol-function 'message-old)))
>  )

> Unfortunately it does not appear to work.  For example
> when you save a file with messages turned off, it still
> generates the message "Wrote <filename>"

> What do I have to do to turn message logging off?

It seems that `write-region', which is a built-in function,
issues such messages.  How about this?

;; off
(fset 'write-region-old (symbol-function 'write-region))
(fset 'write-region
      (lambda (start end filename &optional append visit &rest args)
	(apply 'write-region-old start end filename append 'silent args)))

;; on
(fset 'write-region (symbol-function 'write-region-old))

Use this with care, since it also prevents programs from doing
something using the 5th argument VISIT[1].  In other words,
there is no way to do it entirely safely except for modifying
the C source code.

[1] See the documentation of the `write-region' function.

  reply	other threads:[~2007-05-24  5:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-24  3:56 Temporarily turning message logging off Davin Pearson
2007-05-24  5:03 ` Katsumi Yamaoka [this message]
2007-05-24  7:56   ` Eli Zaretskii
     [not found]   ` <mailman.1132.1179993370.32220.help-gnu-emacs@gnu.org>
2007-05-24  8:25     ` Katsumi Yamaoka
2007-05-24 10:47       ` Eli Zaretskii
     [not found]       ` <mailman.1141.1180003694.32220.help-gnu-emacs@gnu.org>
2007-05-24 11:43         ` Katsumi Yamaoka
2007-05-25  6:30         ` Davin Pearson
2007-05-25  7:00           ` Katsumi Yamaoka
2007-05-25  7:44           ` David Hansen
2007-05-24  9:14     ` Tim X

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

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

  git send-email \
    --in-reply-to=b4m3b1molsi.fsf@jpl.org \
    --to=yamaoka@jpl.org \
    --cc=help-gnu-emacs@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.