[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Emacs-21.1 won't yield `drag' modifier as older versions

From: Seiichi NAMBA
Subject: Emacs-21.1 won't yield `drag' modifier as older versions
Date: Wed, 31 Oct 2001 22:29:33 +0900

Emacs-21.1 does not generate `drag' modifier anymore when

 (1) the mouse is dragged in the region where is no text
     (eg. in a window showing buffer-size-0 buffer), and

 (2) the mouse-drag is started in the mode-line and the mouse-button
     is released within the mode-line.

All of the behaviours are incompatible to the older versions (19.28,
19.34, 20.7).

Where is the merit of daring to take these changes ?

Someone might insist that these are all `features', but I believe the
changes are wrong, because Emacs-21.1 generates `click' modifier in
situations (1) and (2) and it is totally against the user's feeling
(who believes he/she made a drag indeed).

Or these changes might (at least) be against the trend of emacs which
is now capable of displaying images, and future programmers may want
to write more `graphical' applications in elisp.

I noticed the changes because I wrote

 (A) dired-dd (http://www.asahi-net.or.jp/~pi9s-nnb/dired-dd-home.html)

 (B) MonK (http://www.asahi-net.or.jp/~pi9s-nnb/monk/)

(A) is a drag-and-drop I/F for dired/dired-x, and,
(B) is a multimedia player to play mp3, cdaudio, mpeg video etc.,
and uses mode-line as a draggable shuttle-search-bar (sort-of).

In (A), you should always start drag within the region containing
texts to copy or move file(s).  In (B), you should always release
mouse button off the mode-line (eg.) when you create a loop by
[mode-line C-drag-mouse-2].

emacs-version => "21.1.1", and
the things seem to have changed around emacs-21.0.100.

I am not subscribing the list so please cc: any comment on this.

I put a brief test code at the bottom (you can test it with
[down-mouse-3] and [mode-line down-mouse-3] in any buffer).

NAMBA Seiichi <address@hidden>

$ cat ~/monk/mode-line-drag-can't-be-detected.el

;; This can't raise `drag' modifier.
(local-set-key [down-mouse-3] 'Tmonk-mode-line-down-mouse)

;; Can't rase `drag' modifier if button is released within the mode-line.
(local-set-key [mode-line down-mouse-3] 'Tmonk-mode-line-down-mouse)

;; Eg., Tmonk-mode-line-down-mouse() issues a message (even if that
;; was a drag):
;; (click):(mouse-3 (#<window 3 on mode-line-drag-can't-be-detected.el> 
mode-line (510 . 667) -97512528 (#("-%-" 0 3 (help-echo "mouse-1: select 
window, mouse-2: delete others, mouse-3: delete ...")) . 2)))

(defun Tmonk-mode-line-down-mouse (event &optional arg)
  "Hook mouse-down event, and take final fixed event via \
finally settled mouse event in `down' buffer."
  (interactive "e\nP")
  (mouse-minibuffer-check event)
  ;; mode-line prefix is not included in `event' here, so `fun' is useless.
  (let* ( ;; fun
         (click-count (event-click-count event)))
    (setq event (monk-track-mouse-read-event nil)
          ;; fun (key-binding (vector (car event)))
          modifiers (event-modifiers event))
    (message"%S:%S" modifiers event) (sit-for 3)

    ;; NO use for BUG report hereunder...

(defun monk-track-mouse-read-event (&optional debug)
  "Read mouse events till mouse button-up event.
Mouse movement, or switching frame event does not stop reading event.
Finally fixed mouse event status is returned."
  (let (event)
      (while (progn
               (setq event (read-event))
               (if debug (message "%d:%s:%s"
                                  (event-click-count event)
                                  (key-binding (vector (car event)))))
               (or (mouse-movement-p event)
                   (eq (car-safe event) 'switch-frame)))

(defvar monk-mode-map
  (let ((monk-mode-map (make-sparse-keymap)))
    (define-key monk-mode-map
      [mode-line down-mouse-2] 'monk-mode-line-down-mouse)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]