Subject: bug#1898: 23.0.60; choosing coding system

From: Richard M Stallman <[email-masked]>
Date: Tue, 13 Jan 2009 16:41:57 -0500

When I visit the file losing.mbox in Pmail using C-u M-x pmail RET
losing.mbox RET, then run M-x lynx (see code below), it asks me to
specify the coding system.  When I type RET to choose the default,
raw-text, it gives me this error:

   select-safe-coding-system: Cancelled because the buffer was modified

This only fails the first time.  If you type M-x lynx again, it works.
However, if you type the . command which makes Pmail display the
message, the next M-x lynx will fail again.  I did not report this
before, because the problem was very inconvenient to reproduce in
Rmail.  Reproducing it with Pmail is much easier because you can re-arm
the bug with the . command.

I tried to investigate a previous case of this, and found that the
buffer was indeed marked as modified during the function that read the
coding system name.  That was inside coding.c, which I do not
understand, so I did not try to track it down.

(The buffer text is not in fact changed.  I have no easy way
to see if any text properties were changed.  But maybe this
does not matter.)

(defun lynx ()
  (interactive)
  (unless (re-search-backward "^From [email-masked]" nil t)
    (goto-char (point-min)))
  (save-excursion
    (search-forward "/bin/sh")
    (forward-line 3)
    (let ((start (point)))
      (search-forward "!EOF!")
      (beginning-of-line)
      (write-region start (point) "~/foo.html"))))

Here's the mailbox, uuencoded.

In GNU Emacs 23.0.60.16 (mipsel-unknown-linux-gnu, GTK+ Version 2.12.11)
 of 2009-01-03 on lemote-yeeloong
configured using `configure  'CFLAGS=-O0 -g -Wno-pointer-sign' 'mipsel-unknown-linux-gnu' 'build_alias=mipsel-unknown-linux-gnu' 'host_alias=mipsel-unknown-linux-gnu' 'target_alias=mipsel-unknown-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
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Mail

Minor modes in effect:
  shell-dirtrack-mode: t
  gpm-mouse-mode: t
  tooltip-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Recent input:
d ESC d ESC d ESC q C-x C-s C-n C-a ESC f ESC f ESC 
DEL i t C-x C-s ESC f ESC f C-k . RET C-x C-s C-x b 
RET C-p C-o ESC C-v C-p C-o C-p C-o C-x o C-n C-n C-n 
C-n C-o b c c : SPC r e s p 3 d DEL DEL 2 DEL 3 d C-x 
C-s C-x o g ~ x y e s RET C-x b P TAB RET ESC x c l 
e a n u p RET C-x 1 t C-x h ESC w C-x b f o o f RET 
C-u C-y C-x b RET t ESC x l y n x RET RET n p C-x h 
ESC w C-x b f o o f RET ESC x e r a s e SPC b u f RET 
ESC x i n s SPC b u f RET RET C-x b RET ESC x l y n 
x RET RET ESC x c o m C-g C-x 4 b RET C-x o ESC x c 
o m p a r e SPC w i n RET o ESC DEL l o s i n g . m 
b o x RET y e s RET i ESC p RET ESC x l y n x RET RET 
ESC x s h e l l RET u u e n c o d e SPC l o s i ESC 
/ . TAB ESC DEL ESC DEL C-y C-y > SPC l o s i n g . 
c o d e RET C-x m ESC x r e p o r t SPC e m a c v s 
SPC b u g DEL DEL DEL DEL DEL s SPC b u g RET

Recent messages:
select-safe-coding-system: Cancelled because the buffer was modified
Quit
Mark set
Added to /home/rms/losing.mbox
Counting messages...done
select-safe-coding-system: Cancelled because the buffer was modified
Scanning for dabbrevs...100%
Expansion found in 'free-system-distribution-guidelines.html'
Completed
Mark set [2 times]