unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* mouse-show-mark bug
@ 2004-10-28 11:57 David PONCE
  2004-10-28 12:17 ` David Kastrup
  0 siblings, 1 reply; 2+ messages in thread
From: David PONCE @ 2004-10-28 11:57 UTC (permalink / raw)


Hi,

Since this change:

2004-10-27  Richard M. Stallman  <rms@gnu.org>

	* mouse.el (mouse-show-mark): Do most processing the same
	regardless of transient-mark-mode.

Each time I try to delete a selected region with transient-mark-mode
enabled I get this error:

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  delete-region(nil nil)
  (if (member key mouse-region-delete-keys) (delete-region
  (overlay-start mouse-drag-overlay) (overlay-end mouse-drag-overlay))
  (setq unread-command-events (nconc events unread-command-events)))
  (if ignore nil (if (member key mouse-region-delete-keys)
  (delete-region ... ...) (setq unread-command-events ...)))
  (let ((inhibit-quit t) (echo-keystrokes 0) event events key ignore
  (x-lost-selection-hooks ...)) (add-hook (quote
  x-lost-selection-hooks) (lambda ... ...)) (if transient-mark-mode
  (delete-overlay mouse-drag-overlay) (move-overlay mouse-drag-overlay
  ... ...)) (catch (quote mouse-show-mark) (while ... ...)) (if ignore
  nil (if ... ... ...)) (setq quit-flag nil) (unless
  transient-mark-mode (delete-overlay mouse-drag-overlay)))
  mouse-show-mark()
  mouse-drag-region-1((double-down-mouse-1 (#<window 22 on *shell*>
  127 (215 . 61) 21028920 nil 127 (26 . 2) nil (7 . 9) (8 . 16)) 2))
  mouse-drag-region((double-down-mouse-1 (#<window 22 on *shell*> 127
  (215 . 61) 21028920 nil 127 (26 . 2) nil (7 . 9) (8 . 16)) 2))
  call-interactively(mouse-drag-region)

This is because at this point mouse-drag-overlay has been deleted.

This patch seems to fix the bug for me. Please could someone review
it?

Regards
David

Index: mouse.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/mouse.el,v
retrieving revision 1.252
diff -c -r1.252 mouse.el
*** mouse.el	27 Oct 2004 17:44:59 -0000	1.252
--- mouse.el	28 Oct 2004 11:50:55 -0000
***************
*** 1066,1072 ****
      (if ignore
  	nil
        ;; For certain special keys, delete the region.
!       (if (member key mouse-region-delete-keys)
  	  (delete-region (overlay-start mouse-drag-overlay)
  			 (overlay-end mouse-drag-overlay))
  	;; Otherwise, unread the key so it gets executed normally.
--- 1066,1073 ----
      (if ignore
  	nil
        ;; For certain special keys, delete the region.
!       (if (and (not transient-mark-mode)
!                (member key mouse-region-delete-keys))
  	  (delete-region (overlay-start mouse-drag-overlay)
  			 (overlay-end mouse-drag-overlay))
  	;; Otherwise, unread the key so it gets executed normally.

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

* Re: mouse-show-mark bug
  2004-10-28 11:57 mouse-show-mark bug David PONCE
@ 2004-10-28 12:17 ` David Kastrup
  0 siblings, 0 replies; 2+ messages in thread
From: David Kastrup @ 2004-10-28 12:17 UTC (permalink / raw)
  Cc: emacs-devel

David PONCE <david.ponce@wanadoo.fr> writes:

> Since this change:
>
> 2004-10-27  Richard M. Stallman  <rms@gnu.org>
>
> 	* mouse.el (mouse-show-mark): Do most processing the same
> 	regardless of transient-mark-mode.
>
> Each time I try to delete a selected region with transient-mark-mode
> enabled I get this error:
>
> Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
>   delete-region(nil nil)
>   (if (member key mouse-region-delete-keys) (delete-region
>   (overlay-start mouse-drag-overlay) (overlay-end mouse-drag-overlay))
>   (setq unread-command-events (nconc events unread-command-events)))
>   (if ignore nil (if (member key mouse-region-delete-keys)
>   (delete-region ... ...) (setq unread-command-events ...)))
>   (let ((inhibit-quit t) (echo-keystrokes 0) event events key ignore
>   (x-lost-selection-hooks ...)) (add-hook (quote
>   x-lost-selection-hooks) (lambda ... ...)) (if transient-mark-mode
>   (delete-overlay mouse-drag-overlay) (move-overlay mouse-drag-overlay
>   ... ...)) (catch (quote mouse-show-mark) (while ... ...)) (if ignore
>   nil (if ... ... ...)) (setq quit-flag nil) (unless
>   transient-mark-mode (delete-overlay mouse-drag-overlay)))
>   mouse-show-mark()
>   mouse-drag-region-1((double-down-mouse-1 (#<window 22 on *shell*>
>   127 (215 . 61) 21028920 nil 127 (26 . 2) nil (7 . 9) (8 . 16)) 2))
>   mouse-drag-region((double-down-mouse-1 (#<window 22 on *shell*> 127
>   (215 . 61) 21028920 nil 127 (26 . 2) nil (7 . 9) (8 . 16)) 2))
>   call-interactively(mouse-drag-region)
>
> This is because at this point mouse-drag-overlay has been deleted.
>
> This patch seems to fix the bug for me. Please could someone review
> it?
>
> Regards
> David
>
> Index: mouse.el
> ===================================================================
> RCS file: /cvsroot/emacs/emacs/lisp/mouse.el,v
> retrieving revision 1.252
> diff -c -r1.252 mouse.el
> *** mouse.el	27 Oct 2004 17:44:59 -0000	1.252
> --- mouse.el	28 Oct 2004 11:50:55 -0000
> ***************
> *** 1066,1072 ****
>       (if ignore
>   	nil
>         ;; For certain special keys, delete the region.
> !       (if (member key mouse-region-delete-keys)
>   	  (delete-region (overlay-start mouse-drag-overlay)
>   			 (overlay-end mouse-drag-overlay))
>   	;; Otherwise, unread the key so it gets executed normally.
> --- 1066,1073 ----
>       (if ignore
>   	nil
>         ;; For certain special keys, delete the region.
> !       (if (and (not transient-mark-mode)
> !                (member key mouse-region-delete-keys))
>   	  (delete-region (overlay-start mouse-drag-overlay)
>   			 (overlay-end mouse-drag-overlay))
>   	;; Otherwise, unread the key so it gets executed normally.

Looks dangerous to me.  Why not simply use as a check that
mouse-drag-overlay is not detached?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

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

end of thread, other threads:[~2004-10-28 12:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-28 11:57 mouse-show-mark bug David PONCE
2004-10-28 12:17 ` David Kastrup

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