unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* set-process-filter-multibyte doesn't work well
@ 2008-03-08 13:51 MATSUYAMA Tomohiro
  2008-03-08 15:45 ` Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: MATSUYAMA Tomohiro @ 2008-03-08 13:51 UTC (permalink / raw)
  To: emacs-devel

Hi,

GUD and other extensions using comint have a problem that
it doesn't treat multibyte string on Emacs 23.0.60.1 (and cvs head).

So, I tried to fix this problem by adding
set-process-filter-multibyte into comint-exec like:

    (let ((proc
	   (if (consp command)
	       (open-network-stream name buffer (car command) (cdr command))
	     (comint-exec-1 name buffer command switches))))
      (set-process-filter proc 'comint-output-filter)
+     (set-process-filter-multibyte proc t)
      (make-local-variable 'comint-ptyp)
      (setq comint-ptyp process-connection-type) ; t if pty, nil if pipe.
      ;; Jump to the end, and set the process mark.

But it doesn't work well. After a while, I realized that
set-process-filter-multibyte affects on nothing.

(require 'comint)
(make-comint "jdb" "jdb")
(setq proc (get-process "jdb"))
(set-process-filter-multibyte proc t)
(process-filter-multibyte-p proc) ;; => nil

I don't understand what happened in Fset_process_filter_multibyte :-(

  CHECK_PROCESS (process);
  p = XPROCESS (process);
  p->filter_multibyte = !NILP (flag);
+ printf("%d %d\n", !NILP (flag), p->filter_multibyte); /* 1 0 */
  setup_process_coding_systems (process);

Please help me.

Regards,
Matsuyama




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

* Re: set-process-filter-multibyte doesn't work well
  2008-03-08 13:51 set-process-filter-multibyte doesn't work well MATSUYAMA Tomohiro
@ 2008-03-08 15:45 ` Andreas Schwab
  2008-03-08 20:57   ` Stefan Monnier
  2008-03-10  2:37   ` MATSUYAMA Tomohiro
  0 siblings, 2 replies; 4+ messages in thread
From: Andreas Schwab @ 2008-03-08 15:45 UTC (permalink / raw)
  To: MATSUYAMA Tomohiro; +Cc: emacs-devel

MATSUYAMA Tomohiro <matsuyama3@ariel-networks.com> writes:

> (require 'comint)
> (make-comint "jdb" "jdb")
> (setq proc (get-process "jdb"))
> (set-process-filter-multibyte proc t)
> (process-filter-multibyte-p proc) ;; => nil
>
> I don't understand what happened in Fset_process_filter_multibyte :-(
>
>   CHECK_PROCESS (process);
>   p = XPROCESS (process);
>   p->filter_multibyte = !NILP (flag);
> + printf("%d %d\n", !NILP (flag), p->filter_multibyte); /* 1 0 */
>   setup_process_coding_systems (process);

Does this patch help?  Bitfields declared as int can be either signed or
unsigned, and signed one-bit fields are not particular useful.

--- process.h	09 Jan 2008 10:29:39 +0100	1.41
+++ process.h	08 Mär 2008 16:41:00 +0100	
@@ -102,28 +102,28 @@ struct Lisp_Process
     /* Should we delay reading output from this process.
        Initialized from `Vprocess_adaptive_read_buffering'.
        0 = nil, 1 = t, 2 = other.  */
-    int adaptive_read_buffering : 2;
+    unsigned int adaptive_read_buffering : 2;
     /* Skip reading this process on next read.  */
-    int read_output_skip : 1;
+    unsigned int read_output_skip : 1;
     /* Non-nil means kill silently if Emacs is exited.
        This is the inverse of the `query-on-exit' flag.  */
-    int kill_without_query : 1;
+    unsigned int kill_without_query : 1;
     /* Non-nil if communicating through a pty.  */
-    int pty_flag : 1;
+    unsigned int pty_flag : 1;
     /* Flag to set coding-system of the process buffer from the
        coding_system used to decode process output.  */
-    int inherit_coding_system_flag : 1;
+    unsigned int inherit_coding_system_flag : 1;
     /* Flag to decide the multibyteness of a string given to the
        filter (if any).  It is initialized to the value of
        `default-enable-multibyte-characters' when the process is
        generated, and can be changed by the function
        `set-process-filter-multibyte'. */
-    int filter_multibyte : 1;
+    unsigned int filter_multibyte : 1;
     /* Record the process status in the raw form in which it comes from `wait'.
        This is to avoid consing in a signal handler.  The `raw_status_new'
        flag indicates that `raw_status' contains a new status that still
        needs to be synced to `status'.  */
-    int raw_status_new : 1;
+    unsigned int raw_status_new : 1;
     int raw_status;
 };
 

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




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

* Re: set-process-filter-multibyte doesn't work well
  2008-03-08 15:45 ` Andreas Schwab
@ 2008-03-08 20:57   ` Stefan Monnier
  2008-03-10  2:37   ` MATSUYAMA Tomohiro
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2008-03-08 20:57 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: MATSUYAMA Tomohiro, emacs-devel

>> (require 'comint)
>> (make-comint "jdb" "jdb")
>> (setq proc (get-process "jdb"))
>> (set-process-filter-multibyte proc t)
>> (process-filter-multibyte-p proc) ;; => nil
>> 
>> I don't understand what happened in Fset_process_filter_multibyte :-(

I'd like to phase out process-filter-multibyte, so could you try to
write the code, without (set-)process-filter-multibyte, which (ideally)
should do the right thing, and then make a bug-report if it doesn't do
what it should?

The "multibyteness of a process filter" should just depend on the coding
system used and nothing more.

> Does this patch help?  Bitfields declared as int can be either signed or
> unsigned, and signed one-bit fields are not particular useful.

This is a good change, please install it,


        Stefan


> --- process.h	09 Jan 2008 10:29:39 +0100	1.41
> +++ process.h	08 Mär 2008 16:41:00 +0100	
> @@ -102,28 +102,28 @@ struct Lisp_Process
>      /* Should we delay reading output from this process.
>         Initialized from `Vprocess_adaptive_read_buffering'.
>         0 = nil, 1 = t, 2 = other.  */
> -    int adaptive_read_buffering : 2;
> +    unsigned int adaptive_read_buffering : 2;
>      /* Skip reading this process on next read.  */
> -    int read_output_skip : 1;
> +    unsigned int read_output_skip : 1;
>      /* Non-nil means kill silently if Emacs is exited.
>         This is the inverse of the `query-on-exit' flag.  */
> -    int kill_without_query : 1;
> +    unsigned int kill_without_query : 1;
>      /* Non-nil if communicating through a pty.  */
> -    int pty_flag : 1;
> +    unsigned int pty_flag : 1;
>      /* Flag to set coding-system of the process buffer from the
>         coding_system used to decode process output.  */
> -    int inherit_coding_system_flag : 1;
> +    unsigned int inherit_coding_system_flag : 1;
>      /* Flag to decide the multibyteness of a string given to the
>         filter (if any).  It is initialized to the value of
>         `default-enable-multibyte-characters' when the process is
>         generated, and can be changed by the function
>         `set-process-filter-multibyte'. */
> -    int filter_multibyte : 1;
> +    unsigned int filter_multibyte : 1;
>      /* Record the process status in the raw form in which it comes from `wait'.
>         This is to avoid consing in a signal handler.  The `raw_status_new'
>         flag indicates that `raw_status' contains a new status that still
>         needs to be synced to `status'.  */
> -    int raw_status_new : 1;
> +    unsigned int raw_status_new : 1;
>      int raw_status;
>  };
 

> Andreas.

> -- 
> Andreas Schwab, SuSE Labs, schwab@suse.de
> SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
> PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."





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

* Re: set-process-filter-multibyte doesn't work well
  2008-03-08 15:45 ` Andreas Schwab
  2008-03-08 20:57   ` Stefan Monnier
@ 2008-03-10  2:37   ` MATSUYAMA Tomohiro
  1 sibling, 0 replies; 4+ messages in thread
From: MATSUYAMA Tomohiro @ 2008-03-10  2:37 UTC (permalink / raw)
  To: schwab; +Cc: matsuyama3, emacs-devel

From: Andreas Schwab <schwab@suse.de>
Subject: Re: set-process-filter-multibyte doesn't work well
Date: Sat, 08 Mar 2008 16:45:08 +0100

> MATSUYAMA Tomohiro <matsuyama3@ariel-networks.com> writes:
> 
> > (require 'comint)
> > (make-comint "jdb" "jdb")
> > (setq proc (get-process "jdb"))
> > (set-process-filter-multibyte proc t)
> > (process-filter-multibyte-p proc) ;; => nil
> >
> > I don't understand what happened in Fset_process_filter_multibyte :-(
> >
> >   CHECK_PROCESS (process);
> >   p = XPROCESS (process);
> >   p->filter_multibyte = !NILP (flag);
> > + printf("%d %d\n", !NILP (flag), p->filter_multibyte); /* 1 0 */
> >   setup_process_coding_systems (process);
> 
> Does this patch help?  Bitfields declared as int can be either signed or
> unsigned, and signed one-bit fields are not particular useful.
It seemed to be fixed and also displaying japanese via comint has worked correctly.

Thanks.

  Matsuyama




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

end of thread, other threads:[~2008-03-10  2:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-08 13:51 set-process-filter-multibyte doesn't work well MATSUYAMA Tomohiro
2008-03-08 15:45 ` Andreas Schwab
2008-03-08 20:57   ` Stefan Monnier
2008-03-10  2:37   ` MATSUYAMA Tomohiro

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).