all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* silence append-to-file?
@ 2021-11-12 12:36 Eric S Fraga
  2021-11-12 13:08 ` Marcin Borkowski
  2021-11-12 13:18 ` Gregory Heytings
  0 siblings, 2 replies; 6+ messages in thread
From: Eric S Fraga @ 2021-11-12 12:36 UTC (permalink / raw)
  To: help-gnu-emacs

Hello all,

I have a little timer running in Emacs that appends a line to a log
file.  I use append-to-file for this.  However, every time this gets
invoked, a message gets written to the *Messages* buffer, a message I do
not need and simply adds clutter to that buffer.

Is it possible to silence that function?  I've tracked the code down to
fileio.c (in write-region, line 5501) and I cannot see how to do so
(from elisp).

Alternatively, is there a better function to use for this?

thank you,
eric

-- 
Eric S Fraga with org 9.5 in Emacs 29.0.50 on Debian 11.1




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: silence append-to-file?
  2021-11-12 12:36 silence append-to-file? Eric S Fraga
@ 2021-11-12 13:08 ` Marcin Borkowski
  2021-11-12 13:18 ` Gregory Heytings
  1 sibling, 0 replies; 6+ messages in thread
From: Marcin Borkowski @ 2021-11-12 13:08 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: help-gnu-emacs

On 2021-11-12, at 13:36, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:

> Hello all,
>
> I have a little timer running in Emacs that appends a line to a log
> file.  I use append-to-file for this.  However, every time this gets
> invoked, a message gets written to the *Messages* buffer, a message I do
> not need and simply adds clutter to that buffer.
>
> Is it possible to silence that function?  I've tracked the code down to
> fileio.c (in write-region, line 5501) and I cannot see how to do so
> (from elisp).
>
> Alternatively, is there a better function to use for this?

 -- User Option: message-log-max
     This variable specifies how many lines to keep in the ‘*Messages*’
     buffer.  The value ‘t’ means there is no limit on how many lines to
     keep.  The value ‘nil’ disables message logging entirely.  Here’s
     how to display a message and prevent it from being logged:

          (let (message-log-max)
            (message ...))

Hth,

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: silence append-to-file?
  2021-11-12 12:36 silence append-to-file? Eric S Fraga
  2021-11-12 13:08 ` Marcin Borkowski
@ 2021-11-12 13:18 ` Gregory Heytings
  2021-11-12 13:24   ` Eric S Fraga
                     ` (2 more replies)
  1 sibling, 3 replies; 6+ messages in thread
From: Gregory Heytings @ 2021-11-12 13:18 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: help-gnu-emacs


>
> Alternatively, is there a better function to use for this?
>

(defun append-to-file-quiet (start end filename)
   "Like `append-to-file', but do not log a message in *Messages*"
   (let ((message-log-max nil))
     (append-to-file start end filename)))



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: silence append-to-file?
  2021-11-12 13:18 ` Gregory Heytings
@ 2021-11-12 13:24   ` Eric S Fraga
  2021-11-12 16:10   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-11-12 16:18   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2 siblings, 0 replies; 6+ messages in thread
From: Eric S Fraga @ 2021-11-12 13:24 UTC (permalink / raw)
  To: help-gnu-emacs

On Friday, 12 Nov 2021 at 13:18, Gregory Heytings wrote:
>   (let ((message-log-max nil))
>     (append-to-file start end filename)))

Gregory (& Marcin),

thank you for this.  Works perfectly!

-- 
Eric S Fraga with org 9.5 in Emacs 29.0.50 on Debian 11.1




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: silence append-to-file?
  2021-11-12 13:18 ` Gregory Heytings
  2021-11-12 13:24   ` Eric S Fraga
@ 2021-11-12 16:10   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2021-11-12 16:18   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2 siblings, 0 replies; 6+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-11-12 16:10 UTC (permalink / raw)
  To: help-gnu-emacs

Gregory Heytings wrote:

>> Alternatively, is there a better function to use for this?
>
> (defun append-to-file-quiet (start end filename)
>   "Like `append-to-file', but do not log a message in *Messages*"
>   (let ((message-log-max nil))
>     (append-to-file start end filename)))

Do this for how to improve the docstring ...

(require 'checkdoc)

(setq checkdoc-permit-comma-termination-flag t)

(defun check-package-style ()
  (interactive)
  (let ((msg "Style check..."))
    (message msg)
    (checkdoc-current-buffer t) ; TAKE-NOTES
    (message "%sdone" msg) ))
(defalias 'check-style #'check-package-style)

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: silence append-to-file?
  2021-11-12 13:18 ` Gregory Heytings
  2021-11-12 13:24   ` Eric S Fraga
  2021-11-12 16:10   ` Emanuel Berg via Users list for the GNU Emacs text editor
@ 2021-11-12 16:18   ` Emanuel Berg via Users list for the GNU Emacs text editor
  2 siblings, 0 replies; 6+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-11-12 16:18 UTC (permalink / raw)
  To: help-gnu-emacs

Gregory Heytings wrote:

>> Alternatively, is there a better function to use for this?
>
> (defun append-to-file-quiet (start end filename)
>   "Like `append-to-file', but do not log a message in *Messages*"
>   (let ((message-log-max nil))
>     (append-to-file start end filename)))

Can't one have a list of messages and errors one don't want to
hear ... e.g. Beginning of buffer, Mark set ...

-- 
underground experts united
https://dataswamp.org/~incal




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-12 16:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-12 12:36 silence append-to-file? Eric S Fraga
2021-11-12 13:08 ` Marcin Borkowski
2021-11-12 13:18 ` Gregory Heytings
2021-11-12 13:24   ` Eric S Fraga
2021-11-12 16:10   ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-11-12 16:18   ` Emanuel Berg via Users list for the GNU Emacs text editor

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.