unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Why does write-region use message_with_string?
@ 2013-10-25 23:27 Jorgen Schaefer
  2013-10-26  1:42 ` Stefan Monnier
  2013-10-27 22:07 ` T.V. Raman
  0 siblings, 2 replies; 6+ messages in thread
From: Jorgen Schaefer @ 2013-10-25 23:27 UTC (permalink / raw)
  To: emacs-devel

Hi!
I'm trying to intercept all output from emacs -batch from within lisp.
This works nicely with a defadvice around `message' and `princ', except
in one case: write-region.

In fileio.c:4995, this function calls message_with_string directly,
circumventing lisp completely.

Is there a particular reason for this, or can this be replaced by the
usual message functions?

Regards,
Jorgen



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

* Re: Why does write-region use message_with_string?
  2013-10-25 23:27 Why does write-region use message_with_string? Jorgen Schaefer
@ 2013-10-26  1:42 ` Stefan Monnier
  2013-10-26  6:41   ` Eli Zaretskii
  2013-10-26  9:16   ` Jorgen Schaefer
  2013-10-27 22:07 ` T.V. Raman
  1 sibling, 2 replies; 6+ messages in thread
From: Stefan Monnier @ 2013-10-26  1:42 UTC (permalink / raw)
  To: Jorgen Schaefer; +Cc: emacs-devel

> In fileio.c:4995, this function calls message_with_string directly,
> circumventing lisp completely.

It can probably be changed to call `message'.  But I'd be surprised if
there aren't other places where you will bump into similar problems.


        Stefan



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

* Re: Why does write-region use message_with_string?
  2013-10-26  1:42 ` Stefan Monnier
@ 2013-10-26  6:41   ` Eli Zaretskii
  2013-10-26  9:16   ` Jorgen Schaefer
  1 sibling, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2013-10-26  6:41 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel, forcer

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Fri, 25 Oct 2013 21:42:46 -0400
> Cc: emacs-devel@gnu.org
> 
> > In fileio.c:4995, this function calls message_with_string directly,
> > circumventing lisp completely.
> 
> It can probably be changed to call `message'.

I think write-region might be called when Emacs is crashing.  At that
time, it might not be safe to call Lisp.

> But I'd be surprised if there aren't other places where you will
> bump into similar problems.

At least do-auto-save does the same.



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

* Re: Why does write-region use message_with_string?
  2013-10-26  1:42 ` Stefan Monnier
  2013-10-26  6:41   ` Eli Zaretskii
@ 2013-10-26  9:16   ` Jorgen Schaefer
  2013-10-28  8:02     ` Andreas Röhler
  1 sibling, 1 reply; 6+ messages in thread
From: Jorgen Schaefer @ 2013-10-26  9:16 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

On Fri, 25 Oct 2013 21:42:46 -0400
Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> > In fileio.c:4995, this function calls message_with_string directly,
> > circumventing lisp completely.
> 
> It can probably be changed to call `message'.  But I'd be surprised if
> there aren't other places where you will bump into similar problems.

My use case is not an all-or-nothing one - I just want less noise when
running emacs -batch, so every unwanted line less helps, even if there
are still some.

But Eli has a point. If this is used when Emacs is crashing, I'd rather
not make it less reliable. But it already checks if a variable is set
for auto-saving. Would it then be an idea to make this a lisp variable
so it can be set from lisp, not only from C?

Jorgen



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

* Why does write-region use message_with_string?
  2013-10-25 23:27 Why does write-region use message_with_string? Jorgen Schaefer
  2013-10-26  1:42 ` Stefan Monnier
@ 2013-10-27 22:07 ` T.V. Raman
  1 sibling, 0 replies; 6+ messages in thread
From: T.V. Raman @ 2013-10-27 22:07 UTC (permalink / raw)
  To: Jorgen Schaefer, emacs-devel

:-) I hit exactly this issue -- see related thread where I
requested the same as you.

-- 
Best Regards,
--raman


On 10/25/13, Jorgen Schaefer <forcer@forcix.cx> wrote:
> Hi!
> I'm trying to intercept all output from emacs -batch from within lisp.
> This works nicely with a defadvice around `message' and `princ', except
> in one case: write-region.
>
> In fileio.c:4995, this function calls message_with_string directly,
> circumventing lisp completely.
>
> Is there a particular reason for this, or can this be replaced by the
> usual message functions?
>
> Regards,
> Jorgen
>
>



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

* Re: Why does write-region use message_with_string?
  2013-10-26  9:16   ` Jorgen Schaefer
@ 2013-10-28  8:02     ` Andreas Röhler
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Röhler @ 2013-10-28  8:02 UTC (permalink / raw)
  To: emacs-devel

Am 26.10.2013 11:16, schrieb Jorgen Schaefer:
> On Fri, 25 Oct 2013 21:42:46 -0400
> Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>
>>> In fileio.c:4995, this function calls message_with_string directly,
>>> circumventing lisp completely.
>>
>> It can probably be changed to call `message'.  But I'd be surprised if
>> there aren't other places where you will bump into similar problems.
>
> My use case is not an all-or-nothing one - I just want less noise when
> running emacs -batch, so every unwanted line less helps, even if there
> are still some.
>
> But Eli has a point. If this is used when Emacs is crashing, I'd rather
> not make it less reliable. But it already checks if a variable is set
> for auto-saving. Would it then be an idea to make this a lisp variable
> so it can be set from lisp, not only from C?
>
> Jorgen
>
>

+1

Sounds cleaning up this would make code-base more regular.



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

end of thread, other threads:[~2013-10-28  8:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-25 23:27 Why does write-region use message_with_string? Jorgen Schaefer
2013-10-26  1:42 ` Stefan Monnier
2013-10-26  6:41   ` Eli Zaretskii
2013-10-26  9:16   ` Jorgen Schaefer
2013-10-28  8:02     ` Andreas Röhler
2013-10-27 22:07 ` T.V. Raman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).