Re: format-time-string results invalid char with %a of Chinses Monday

2006-09-05 Thread Kenichi Handa
In article <[EMAIL PROTECTED]>, Du Jingwu <[EMAIL PROTECTED]> writes:

> My system locale is zh_CN.GB18030 and I'm using GNU Emacs 23 CVS.
> An example saves thousand words:

> 1. (format-time-string "<%Y-%m-%d %a>" '(17539 62058 675709))
> The expected character is Chinese character of "one". But the result is a 
> strange character like 'h'.

Thank you for the bug report.  I've just installed the
attached fix in HEAD.  That change will be propagated to
emacs-unicode-2 branch when Miles does synchronization next
time.

---
Kenichi Handa
[EMAIL PROTECTED]

Index: editfns.c
===
RCS file: /cvsroot/emacs/emacs/src/editfns.c,v
retrieving revision 1.425
retrieving revision 1.426
diff -u -r1.425 -r1.426
--- editfns.c   1 Sep 2006 13:28:13 -   1.425
+++ editfns.c   6 Sep 2006 06:40:52 -   1.426
@@ -1694,7 +1694,7 @@
SBYTES (format_string),
tm, ut);
   if ((result > 0 && result < size) || (result == 0 && buf[0] == '\0'))
-   return code_convert_string_norecord (make_string (buf, result),
+   return code_convert_string_norecord (make_unibyte_string (buf, result),
 Vlocale_coding_system, 0);
 
   /* If buffer was too small, make it bigger and try again.  */


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


better doc for timer functions

2006-09-05 Thread Drew Adams
timer-create doc string is silly and uninformative.

timer-activate doc string does not describe TRIGGERED-P arg.

cancel-timer-internal has no doc string.

timer-event-last[-1|-2]  have no doc strings.

with-timeout-handler has no doc string.

with-timeout-unsuspend doc string does not describe TIMER-SPEC-LIST arg.


In GNU Emacs 22.0.50.1 (i386-msvc-nt5.1.2600)
 of 2006-07-19 on BOS-CTHEWLAP2
X server distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-msvc (12.00)'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  locale-coding-system: cp1252
  default-enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  encoded-kbd-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
  
  
  
  
  
  
  
  
  
  
  
  
  
  
 
 
 


Recent messages:
Loading dired...
Loading regexp-opt...done
Loading dired...done
Loading help-fns...done
Type C-x 1 to remove help window.   [2 times]
Mark saved where search started
Mark set
Mark saved where search started
Mark set
Loading emacsbug...done



___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: Carbon: window close via accessibility API is broken

2006-09-05 Thread YAMAMOTO Mitsuharu
> On Tue, 05 Sep 2006 09:37:15 +0900, YAMAMOTO Mitsuharu <[EMAIL 
> PROTECTED]> said:

> It can be handled with Carbon events in kEventClassWindow.
> kEventWindowClose for the Close button.  kEventWindowGetIdealSize
> and kEventWindowBoundsChanged for the Maximize button.  The former
> is easy to handle and I'll install a handler.  But the latter is not
> so straightforward and it may conflict with the existing code
> because kEventWindowBoundsChanged is called in various situations.

Here's a patch for the zoom button (sorry, it was not the Maximize
button).

 YAMAMOTO Mitsuharu
[EMAIL PROTECTED]

*** macterm.c.~1.187.~  Tue Sep  5 10:04:06 2006
--- macterm.c   Wed Sep  6 09:47:34 2006
***
*** 5805,5810 
--- 5805,5861 
  #endif /* not TARGET_API_MAC_CARBON */
  }
  
+ static void
+ mac_handle_origin_change (f)
+  struct frame *f;
+ {
+   x_real_positions (f, &f->left_pos, &f->top_pos);
+ }
+ 
+ static void
+ mac_handle_size_change (f, pixelwidth, pixelheight)
+  struct frame *f;
+  int pixelwidth, pixelheight;
+ {
+   int cols, rows;
+ 
+   cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixelwidth);
+   rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelheight);
+ 
+   if (cols != FRAME_COLS (f)
+   || rows != FRAME_LINES (f)
+   || pixelwidth != FRAME_PIXEL_WIDTH (f)
+   || pixelheight != FRAME_PIXEL_HEIGHT (f))
+ {
+   /* We pass 1 for DELAY since we can't run Lisp code inside of
+a BLOCK_INPUT.  */
+   change_frame_size (f, rows, cols, 0, 1, 0);
+   FRAME_PIXEL_WIDTH (f) = pixelwidth;
+   FRAME_PIXEL_HEIGHT (f) = pixelheight;
+   SET_FRAME_GARBAGED (f);
+ 
+   /* If cursor was outside the new size, mark it as off.  */
+   mark_window_cursors_off (XWINDOW (f->root_window));
+ 
+   /* Clear out any recollection of where the mouse highlighting
+was, since it might be in a place that's outside the new
+frame size.  Actually checking whether it is outside is a
+pain in the neck, so don't try--just let the highlighting be
+done afresh with new size.  */
+   cancel_mouse_face (f);
+ 
+ #if TARGET_API_MAC_CARBON
+   if (f->output_data.mac->hourglass_control)
+   {
+ #if USE_CG_DRAWING
+ mac_prepare_for_quickdraw (f);
+ #endif
+ MoveControl (f->output_data.mac->hourglass_control,
+  pixelwidth - HOURGLASS_WIDTH, 0);
+   }
+ #endif
+ }
+ }
  
  
  /* Calculate the absolute position in frame F
***
*** 5885,5891 
ConstrainWindowToScreen (FRAME_MAC_WINDOW (f), kWindowTitleBarRgn,
   kWindowConstrainMoveRegardlessOfFit
   | kWindowConstrainAllowPartial, NULL, NULL);
!   x_real_positions (f, &f->left_pos, &f->top_pos);
  #else
{
  Rect inner, outer, screen_rect, dummy;
--- 5936,5945 
ConstrainWindowToScreen (FRAME_MAC_WINDOW (f), kWindowTitleBarRgn,
   kWindowConstrainMoveRegardlessOfFit
   | kWindowConstrainAllowPartial, NULL, NULL);
! #if USE_CARBON_EVENTS
!   if (!NILP (tip_frame) && XFRAME (tip_frame) == f)
! #endif
! mac_handle_origin_change (f);
  #else
{
  Rect inner, outer, screen_rect, dummy;
***
*** 5959,6008 
x_wm_set_size_hint (f, (long) 0, 0);
  
SizeWindow (FRAME_MAC_WINDOW (f), pixelwidth, pixelheight, 0);
- #if TARGET_API_MAC_CARBON
-   if (f->output_data.mac->hourglass_control)
- {
- #if USE_CG_DRAWING
-   mac_prepare_for_quickdraw (f);
- #endif
-   MoveControl (f->output_data.mac->hourglass_control,
-  pixelwidth - HOURGLASS_WIDTH, 0);
- }
- #endif
  
!   /* Now, strictly speaking, we can't be sure that this is accurate,
!  but the window manager will get around to dealing with the size
!  change request eventually, and we'll hear how it went when the
!  ConfigureNotify event gets here.
! 
!  We could just not bother storing any of this information here,
!  and let the ConfigureNotify event set everything up, but that
!  might be kind of confusing to the Lisp code, since size changes
!  wouldn't be reported in the frame parameters until some random
!  point in the future when the ConfigureNotify event arrives.
! 
!  We pass 1 for DELAY since we can't run Lisp code inside of
!  a BLOCK_INPUT.  */
!   change_frame_size (f, rows, cols, 0, 1, 0);
!   FRAME_PIXEL_WIDTH (f) = pixelwidth;
!   FRAME_PIXEL_HEIGHT (f) = pixelheight;
! 
!   /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to
!  receive in the ConfigureNotify event; if we get what we asked
!  for, then the event won't cause the screen to become garbaged, so
!  we have to make sure to do it here.  */
!   SET_FRAME_GARBAGED (f);
! 
!   XFlush (FRAME_X_DISPLAY (f));
! 
!   /* If cursor was outside the new size, mark it as off.  */
!   mark_wind

cfengine-mode fails to colorize escaped double-quoted

2006-09-05 Thread Cyril Bouthors
cfengine-mode fails to colorize escaped double-quoted

Here's the smallest file I can reproduce the bug with:

# -*- mode: cfengine -*-

editfiles:
  { /etc/lilo.conf
InsertLine "append=\"ip=dhcp\""
  }

In GNU Emacs 22.0.50.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2006-08-06 on pacem, modified by Debian
 (Debian emacs-snapshot package, version 1:20060806-1)
configured using `configure '--build' 'i486-linux-gnu' '--host' 
'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' 
'--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' 
'--mandir=/usr/share/man' '--with-pop=yes' 
'--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/22.0.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/22.0.50/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/22.0.50/leim'
 '--with-x=yes' '--with-x-toolkit=athena' '--with-toolkit-scroll-bars' 
'CFLAGS=-DDEBIAN -g -O2' 'build_alias=i486-linux-gnu' 
'host_alias=i486-linux-gnu''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: Group

Minor modes in effect:
  gnus-topic-mode: t
  gnus-undo-mode: t
  iswitchb-mode: t
  icomplete-mode: t
  desktop-save-mode: t
  shell-dirtrack-mode: t
  encoded-kbd-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
{ C-t C-_ C-d C-f C-f D SPC DEL C-p C-a C-x k RET y 
h C-n C-n ESC h ESC h R ESC } ESC { C-x k RET h C-n 
C-n ESC h ESC h C-g h ESC u q s g n n n n n n n n n 
n p n n n n n n n n n n j d e TAB ESC DEL r o TAB RET 
RET ESC > SPC h h h h q ESC x r e p o TAB r t - e m 
TAB b TAB RET

Recent messages:
Quit
(No changes need to be saved)
Saving file /home/cyb/.newsrc.eld...
Wrote /home/cyb/.newsrc.eld
compressing 2801.gz...done
compressing 5698.gz...done
Mark set
uncompressing 3272.gz...done
Making completion list...
Loading emacsbug...done
-- 
Cyril Bouthors


pgphQgD1IeUFT.pgp
Description: PGP signature
___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: Emacs crashes when displaying the Euro character

2006-09-05 Thread Chong Yidong
Richard Stallman <[EMAIL PROTECTED]> writes:

> How about making X protocol errors fatal only when glyph debugging is
> on?  When it is off, we can print the error message to stderr.
>
> I don't think that printing on stderr is very useful.  People won't
> see it.  After the release we should make these errors display as
> warnings in a buffer.
>
> This ought to cause the BadName error to be ignored.  Does it work?

I'm certain the patch is correct, but I have no way of testing it.

> *** xterm.c   25 Aug 2006 03:47:19 -0400  1.924
> --- xterm.c   04 Sep 2006 14:55:40 -0400  
> ***
> *** 7501,7507 
>   static struct x_error_message_stack *x_error_message;
>   
>   /* An X error handler which stores the error message in
> !x_error_message_string.  This is called from x_error_handler if
>  x_catch_errors is in effect.  */
>   
>   static void
> --- 7501,7507 
>   static struct x_error_message_stack *x_error_message;
>   
>   /* An X error handler which stores the error message in
> !*x_error_message.  This is called from x_error_handler if
>  x_catch_errors is in effect.  */
>   
>   static void
> ***
> *** 7520,7526 
>   
>  After calling this function, X protocol errors no longer cause
>  Emacs to exit; instead, they are recorded in the string
> !stored in x_error_message_string.
>   
>  Calling x_check_errors signals an Emacs error if an X error has
>  occurred since the last call to x_catch_errors or x_check_errors.
> --- 7520,7526 
>   
>  After calling this function, X protocol errors no longer cause
>  Emacs to exit; instead, they are recorded in the string
> !stored in *x_error_message.
>   
>  Calling x_check_errors signals an Emacs error if an X error has
>  occurred since the last call to x_catch_errors or x_check_errors.
> ***
> *** 7780,7786 
>   
>   /* We specifically use it before defining it, so that gcc doesn't inline it,
>  otherwise gdb doesn't know how to properly put a breakpoint on it.  */
> ! static void x_error_quitter P_ ((Display *, XErrorEvent *)) NO_RETURN;
>   
>   /* This is the first-level handler for X protocol errors.
>  It calls x_error_quitter or x_error_catcher.  */
> --- 7780,7786 
>   
>   /* We specifically use it before defining it, so that gcc doesn't inline it,
>  otherwise gdb doesn't know how to properly put a breakpoint on it.  */
> ! static void x_error_quitter P_ ((Display *, XErrorEvent *));
>   
>   /* This is the first-level handler for X protocol errors.
>  It calls x_error_quitter or x_error_catcher.  */
> ***
> *** 7825,7830 
> --- 7825,7836 
>   {
> char buf[256], buf1[356];
>   
> +   /* Ignore BadName errors.  They can happen because of fonts
> +  or colors that are not defined.  */
> + 
> +   if (error->error_code == BadName)
> + return;
> + 
> /* Note that there is no real way portable across R3/R4 to get the
>original error handler.  */
>   


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Reverting locate buffers.

2006-09-05 Thread Matt Hodges
In GNU Emacs 22.0.50.93 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2006-09-01 on escpc40
X server distributor `The X.Org Foundation', version 11.0.7000
configured using `configure '--with-gtk''

Reverting Locate mode buffers (via locate-update) currently ignores
filters from locate-with-filter.  It also doesn't work with uniquely
renamed buffers, or when locate has been called non-interactively
(e.g., from eshell/locate) and locate-history-list and
locate-grep-history-list aren't modified.

The attached patch has suggested changes to address these issues.  If
suitable, a ChangeLog entry is:

2006-09-05  Matt Hodges  <[EMAIL PROTECTED]>

* locate.el (locate-current-search): New variable.
(locate): Set buffer local value.  Use current buffer if it is
in Locate mode.
(locate-mode): Disable undo here.
(locate-do-setup): Use locate-current-filter from buffer to be
killed. 
(locate-update): Use locate-current-search and
locate-current-filter.

Thanks,

Matt

--- locate.el	04 Jul 2006 11:11:38 +0100	1.37
+++ locate.el	05 Sep 2006 13:15:31 +0100	
@@ -114,6 +114,7 @@
 
 ;; Variables
 
+(defvar locate-current-search nil)
 (defvar locate-current-filter nil)
 
 (defgroup locate nil
@@ -289,29 +290,36 @@
 	 (run-locate-command
 	  (or (and current-prefix-arg (not locate-prompt-for-command))
 	  (and (not current-prefix-arg) locate-prompt-for-command)))
+ locate-buffer
 	 )
 
 ;; Find the Locate buffer
-(save-window-excursion
-  (set-buffer (get-buffer-create locate-buffer-name))
+(setq locate-buffer (if (eq major-mode 'locate-mode)
+(current-buffer)
+  (get-buffer-create locate-buffer-name)))
+
+(save-excursion
+  (set-buffer locate-buffer)
   (locate-mode)
+
   (let ((inhibit-read-only t)
-	(buffer-undo-list t))
-	(erase-buffer)
+(buffer-undo-list t))
+(erase-buffer)
+
+(set (make-local-variable 'locate-current-search) search-string)
+(set (make-local-variable 'locate-current-filter) filter)
+
+(if run-locate-command
+(shell-command search-string)
+  (apply 'call-process locate-cmd nil t nil locate-cmd-args))
+
+(and filter
+ (locate-filter-output filter))
 
-	(setq locate-current-filter filter)
+(locate-do-setup search-string)))
 
-	(if run-locate-command
-	(shell-command search-string locate-buffer-name)
-	  (apply 'call-process locate-cmd nil t nil locate-cmd-args))
-
-	(and filter
-	 (locate-filter-output filter))
-
-	(locate-do-setup search-string)
-	))
-(and (not (string-equal (buffer-name) locate-buffer-name))
-	(switch-to-buffer-other-window locate-buffer-name))
+(unless (eq (current-buffer) locate-buffer)
+  (switch-to-buffer-other-window locate-buffer))
 
 (run-hooks 'dired-mode-hook)
 (dired-next-line 3)			;move to first matching file.
@@ -461,6 +469,7 @@
 default-directory   "/"
 	buffer-read-onlyt
 	selective-display   t)
+  (buffer-disable-undo)
   (dired-alist-add-1 default-directory (point-min-marker))
   (set (make-local-variable 'dired-directory) "/")
   (set (make-local-variable 'dired-subdir-switches) locate-ls-subdir-switches)
@@ -492,11 +501,12 @@
 ;; Nothing returned from locate command?
 (and (eobp)
 	 (progn
-	   (kill-buffer locate-buffer-name)
-	   (if locate-current-filter
-	   (error "Locate: no match for %s in database using filter %s"
-		  search-string locate-current-filter)
-	 (error "Locate: no match for %s in database" search-string
+   (let ((filter locate-current-filter)) ; local
+ (kill-buffer (current-buffer))
+ (if filter
+ (error "Locate: no match for %s in database using filter %s"
+search-string filter)
+   (error "Locate: no match for %s in database" search-string)
 
 (locate-insert-header search-string)
 
@@ -580,15 +590,14 @@
   "Revert the *Locate* buffer.
 If `locate-update-when-revert' is non-nil, offer to update the
 locate database using the shell command in `locate-update-command'."
-  (let ((str (car locate-history-list)))
-(and locate-update-when-revert
-	 (yes-or-no-p "Update locate database (may take a few seconds)? ")
-	 ;; `expand-file-name' is used in order to autoload Tramp if
-	 ;; necessary.  It cannot be loaded when `default-directory'
-	 ;; is remote.
-	 (let ((default-directory (expand-file-name locate-update-path)))
-	   (shell-command locate-update-command)))
-(locate str)))
+  (and locate-update-when-revert
+   (yes-or-no-p "Update locate database (may take a few seconds)? ")
+   ;; `expand-file-name' is used in order to autoload Tramp if
+   ;; necessary.  It cannot be loaded when `default-directory'
+   ;; is remote.
+   (let ((default-directory (expand-file-name locate-update-path)))
+ (shell-command lo

Re: silent PC vs. emacs

2006-09-05 Thread Richard Stallman
  > Could someone try this experiment?  Does the laptop burn power faster
  > when Emacs is running and blinking the cursor?

I am not sure how easy it is to do such an experiment.

You could let your laptop run without AC power, with Emacs running
and without it, and ask acpi what the power drain rate is.

Given that so many applications wake up so often, what emacs does
might not be measurable at this point, but it might make a difference
in the future.

You could try also killing other X apps, and try killing X too.

I just tried some experiments.  Having Emacs running under X does not
increase my power drain rate.  However, having X running (with GNOME)
makes a big increase -- about 50%.



___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug


Re: Emacs crashes when displaying the Euro character

2006-09-05 Thread Richard Stallman
How about making X protocol errors fatal only when glyph debugging is
on?  When it is off, we can print the error message to stderr.

I don't think that printing on stderr is very useful.  People won't
see it.  After the release we should make these errors display as
warnings in a buffer.

This ought to cause the BadName error to be ignored.  Does it work?

*** xterm.c 25 Aug 2006 03:47:19 -0400  1.924
--- xterm.c 04 Sep 2006 14:55:40 -0400  
***
*** 7501,7507 
  static struct x_error_message_stack *x_error_message;
  
  /* An X error handler which stores the error message in
!x_error_message_string.  This is called from x_error_handler if
 x_catch_errors is in effect.  */
  
  static void
--- 7501,7507 
  static struct x_error_message_stack *x_error_message;
  
  /* An X error handler which stores the error message in
!*x_error_message.  This is called from x_error_handler if
 x_catch_errors is in effect.  */
  
  static void
***
*** 7520,7526 
  
 After calling this function, X protocol errors no longer cause
 Emacs to exit; instead, they are recorded in the string
!stored in x_error_message_string.
  
 Calling x_check_errors signals an Emacs error if an X error has
 occurred since the last call to x_catch_errors or x_check_errors.
--- 7520,7526 
  
 After calling this function, X protocol errors no longer cause
 Emacs to exit; instead, they are recorded in the string
!stored in *x_error_message.
  
 Calling x_check_errors signals an Emacs error if an X error has
 occurred since the last call to x_catch_errors or x_check_errors.
***
*** 7780,7786 
  
  /* We specifically use it before defining it, so that gcc doesn't inline it,
 otherwise gdb doesn't know how to properly put a breakpoint on it.  */
! static void x_error_quitter P_ ((Display *, XErrorEvent *)) NO_RETURN;
  
  /* This is the first-level handler for X protocol errors.
 It calls x_error_quitter or x_error_catcher.  */
--- 7780,7786 
  
  /* We specifically use it before defining it, so that gcc doesn't inline it,
 otherwise gdb doesn't know how to properly put a breakpoint on it.  */
! static void x_error_quitter P_ ((Display *, XErrorEvent *));
  
  /* This is the first-level handler for X protocol errors.
 It calls x_error_quitter or x_error_catcher.  */
***
*** 7825,7830 
--- 7825,7836 
  {
char buf[256], buf1[356];
  
+   /* Ignore BadName errors.  They can happen because of fonts
+  or colors that are not defined.  */
+ 
+   if (error->error_code == BadName)
+ return;
+ 
/* Note that there is no real way portable across R3/R4 to get the
   original error handler.  */
  


___
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug