Subject: bug#1161: 23.0.60; Text being added to wrong buffer

From: jpff <[email-masked]>
Date: Tue, 14 Oct 2008 07:32:49 +0100

For a long time now I have been using a popup frame for diary
reminders
(defvar appt-used-frame nil
  "Frame used for displaying last appointment.")

(defun appt-disp-frame (min-to-app new-time appt-msg)
  "Display appointments in a frame"
  (if (get-buffer "*Appointments*") (kill-buffer "*Appointments*"))
  (get-buffer-create "*Appointments*")
  (set-buffer "*Appointments*")
  (save-excursion
    (let ((pos (mouse-pixel-position)))
      (if (not (frame-live-p appt-used-frame))
	  (setq appt-used-frame
		(make-frame '((name . "Appointments")
			      (menu-bar-lines . 1)	(minibuffer . nil) 
			      (modeline . nil)
			      (height . 5)		(width . 80)
			      (top . -2)		(left . 1)
			      (scroll-bar-width . 15)
			      (unsplittable . t)
			      (visibility . nil)
			      (border-width . 2)))))
;;      (menu-bar-mode -1)
      (and (eq 'icon (frame-visible-p appt-used-frame))
	   (make-frame-visible appt-used-frame))
      (set-frame-position appt-used-frame 1 -2)
      (select-frame appt-used-frame)
      (set-window-buffer (frame-first-window appt-used-frame)
			 (get-buffer-create "*Appointments*"))
      (goto-char (point-max))
      (make-frame-visible)
      (if (string-lessp emacs-version "22")
          (progn
            (insert "--- Appointment in " min-to-app " minutes ---\n\n")
            (insert appt-msg "\n"))
        (insert "--- Appointment in " min-to-app " minutes ---\n\n")
        (insert appt-msg "\n"))
      (toggle-read-only 1)
      (set-buffer-modified-p nil)
      (if appt-audible (beep 1))
      (select-frame (car pos))
      (set-mouse-pixel-position (car pos) (car (cdr pos)) (cdr (cdr pos))))))

For the last few days sometimes i get a blank popup frame and the text
of the appointment appears in another buffer I have open -- and that
buffer is changed to read-only.  It has actually just happened again
as I typed this message.

(defun appt-delete-frame ()
  "Remove the appointment frame and buffer"
  (if (frame-live-p appt-used-frame)
      (progn
	(make-frame-invisible appt-used-frame t)
	(delete-frame appt-used-frame)
	(setq appt-used-frame nil)))
  (delete-buffer "*Appointments*")
  (if appt-audible (beep 1)) )
      
(setq appt-disp-window-function 'appt-disp-frame)
(setq appt-delete-window-function 'appt-delete-frame)

This could be a compatability change but I am worried about text
appearing in other buffers.

In GNU Emacs 23.0.60.2 (i686-pc-linux-gnu, GTK+ Version 2.12.0)
 of 2008-10-14 on cardew
Windowing system distributor `The X.Org Foundation', version 11.0.70200000
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_GB.UTF-8
  value of $XMODIFIERS: @im=local
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Mail

Minor modes in effect:
  auto-image-file-mode: t
  show-paren-mode: t
  display-time-mode: t
  tooltip-mode: t
  mouse-wheel-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:
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> d d d d SPC 
d d d d d d d d SPC d d d d d d d d d d d SPC d SPC 
d d SPC d d d d d d d d d d d d d d d d d d d d SPC 
d SPC d SPC d d SPC SPC d SPC SPC SPC d d d d t f <help-echo> 
<down-mouse-1> <mouse-1> C-l C-k C-k C-e <return> C-x 
i . d i r <tab> <return> <help-echo> <down-mouse-1> 
<mouse-1> C-v <down-mouse-1> <mouse-movement> <mouse-movement> 
<drag-mouse-1> <help-echo> <down-mouse-1> <mouse-1> 
<escape> < <down-mouse-2> <mouse-2> <down-mouse-1> 
<mouse-1> , C-d C-d C-d C-v C-v C-v C-v <escape> > 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<prior> <prior> <prior> <prior> <prior> <prior> C-c 
C-c x <return> o <return> C-o <return> C-x C-f S P 
A <tab> <return> <backspace> 6 C-x C-s C-x o t <help-echo> 
<down-mouse-1> <mouse-movement> <mouse-movement> <drag-mouse-1> 
d SPC SPC SPC SPC SPC SPC d SPC d d d SPC d d s y <help-echo> 
d s y <switch-frame> <switch-frame> C-x o C-x k <return> 
C-_ M-x t o g g <tab> r e <tab> <return> C-_ <tab> 
<tab> C-x C-s C-x C-f m y e <tab> <return> <help-echo> 
C-s f r a n e <backspace> <backspace> m e <help-echo> 
<down-mouse-1> <mouse-1> C-x b * m <tab> <backspace> 
<backspace> <backspace> <backspace> <backspace> M e 
<tab> <return> M-v C-v C-x o <down-mouse-1> <mouse-1> 
M-m e m <backspace> <backspace> C-g M-x r e p <tab> 
o <tab> r <tab> <return>

Recent messages:
Saving file /home/jpff/RMAIL...
Wrote /home/jpff/RMAIL
Buffer is read-only: #<buffer SPAM_record>
Undo!
Saving file /home/jpff/SPAM_record...
Wrote /home/jpff/SPAM_record
Mark saved where search started
Auto save file for draft message exists; consider M-x mail-recover
Quit
Making completion list... [2 times]

==John ffitch