emacs-devel
[Top][All Lists]
Advanced

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

Re: Redirecting standard output


From: Eli Zaretskii
Subject: Re: Redirecting standard output
Date: Sat, 07 May 2011 15:10:03 +0300

> Date: Sat, 07 May 2011 14:34:05 +0300
> From: Eli Zaretskii <address@hidden>
> Cc: address@hidden
> 
> I fixed that; see the diffs for revno 104152.1.2 for the gory details
> (if you are interested).

Btw, while working on this, I noticed that the code fragment shown
below is doing a lot of work that is just thrown away in the case that
`:file' is used to redirect stdout of the child.  That's because we
will never read from that file, so setting up the coding-system to
decode it seems futile.

Should we do all that only when output_to_buffer is non-zero?

  if (NILP (buffer))
    {
      /* If BUFFER is nil, we must read process output once and then
         discard it, so setup coding system but with nil.  */
      setup_coding_system (Qnil, &process_coding);
    }
  else
    {
      Lisp_Object val, *args2;

      val = Qnil;
      if (!NILP (Vcoding_system_for_read))
        val = Vcoding_system_for_read;
      else
        {
          if (EQ (coding_systems, Qt))
            {
              size_t i;

              SAFE_ALLOCA (args2, Lisp_Object *, (nargs + 1) * sizeof *args2);
              args2[0] = Qcall_process;
              for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
              coding_systems
                = Ffind_operation_coding_system (nargs + 1, args2);
            }
          if (CONSP (coding_systems))
            val = XCAR (coding_systems);
          else if (CONSP (Vdefault_process_coding_system))
            val = XCAR (Vdefault_process_coding_system);
          else
            val = Qnil;
        }
      Fcheck_coding_system (val);
      /* In unibyte mode, character code conversion should not take
         place but EOL conversion should.  So, setup raw-text or one
         of the subsidiary according to the information just setup.  */
      if (NILP (BVAR (current_buffer, enable_multibyte_characters))
          && !NILP (val))
        val = raw_text_coding_system (val);
      setup_coding_system (val, &process_coding);
    }

  immediate_quit = 1;
  QUIT;



reply via email to

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