Add new user option `mouse-drag-mode-line-buffer'
* etc/NEWS: Announce new option. Also add missing entries for an earlier change. * lisp/mouse.el (mouse-drag-mode-line-buffer): New user option. (mouse-drag-mode-line): Implement that option.
This commit is contained in:
parent
e65647a70e
commit
4f56ca6376
2 changed files with 36 additions and 4 deletions
10
etc/NEWS
10
etc/NEWS
|
@ -305,6 +305,10 @@ the current Emacs process at the end, it starts a new Emacs process
|
|||
optional parameters to restart instead of just killing the current
|
||||
process.
|
||||
|
||||
** New user option 'mouse-drag-mode-line-buffer'.
|
||||
If non-nil, dragging on the buffer name part of the mode-line will
|
||||
drag the buffer's associated file to other programs.
|
||||
|
||||
+++
|
||||
** New user option 'mouse-drag-and-drop-region-cross-program'.
|
||||
If non-nil, this option allows dragging text in the region from Emacs
|
||||
|
@ -2083,9 +2087,9 @@ list in reported motion events if there is no frame underneath the
|
|||
mouse pointer.
|
||||
|
||||
+++
|
||||
** New function 'x-begin-drag'.
|
||||
This function initiates a drag-and-drop request with the contents of
|
||||
the selection 'XdndSelection', and returns when a drop occurs.
|
||||
** New functions 'x-begin-drag', 'dnd-begin-text-drag' and 'dnd-begin-file-drag'.
|
||||
These functions allow dragging contents (such as files and text) from
|
||||
Emacs to other programs.
|
||||
|
||||
---
|
||||
** New function 'ietf-drums-parse-date-string'.
|
||||
|
|
|
@ -108,6 +108,13 @@ down and up respectively."
|
|||
(integer :tag "This many lines from window top or bottom"))
|
||||
:version "29.1")
|
||||
|
||||
(defcustom mouse-drag-mode-line-buffer nil
|
||||
"If non-nil, allow dragging files from the mode line.
|
||||
When the buffer has an associated file, it can be dragged from
|
||||
the buffer name portion of its mode line to other programs."
|
||||
:type 'boolean
|
||||
:version "29.1")
|
||||
|
||||
(defvar mouse--last-down nil)
|
||||
|
||||
(defun mouse--down-1-maybe-follows-link (&optional _prompt)
|
||||
|
@ -854,8 +861,29 @@ frame instead."
|
|||
(interactive "e")
|
||||
(let* ((start (event-start start-event))
|
||||
(window (posn-window start))
|
||||
(frame (window-frame window)))
|
||||
(frame (window-frame window))
|
||||
(skip-tracking nil)
|
||||
filename)
|
||||
;; FIXME: is there a better way of determining if the event
|
||||
;; started on a buffer name?
|
||||
(when (and mouse-drag-mode-line-buffer
|
||||
(eq (car (posn-string start))
|
||||
(car (with-selected-window window
|
||||
(setq filename (buffer-file-name))
|
||||
mode-line-buffer-identification)))
|
||||
filename
|
||||
(file-exists-p filename))
|
||||
(let ((mouse-fine-grained-tracking nil))
|
||||
(track-mouse
|
||||
(setq track-mouse 'drag-source)
|
||||
(let ((event (read-event)))
|
||||
(if (not (eq (event-basic-type event)
|
||||
'mouse-movement))
|
||||
(push event unread-command-events)
|
||||
(dnd-begin-file-drag filename frame 'copy t)
|
||||
(setq skip-tracking t))))))
|
||||
(cond
|
||||
(skip-tracking t)
|
||||
((not (window-live-p window)))
|
||||
((or (not (window-at-side-p window 'bottom))
|
||||
;; Allow resizing the minibuffer window if it's on the
|
||||
|
|
Loading…
Add table
Reference in a new issue