comparison lisp/prim/frame.el @ 179:9ad43877534d r20-3b16

Import from CVS: tag r20-3b16
author cvs
date Mon, 13 Aug 2007 09:52:19 +0200
parents 0132846995bd
children e121b013d1f0
comparison
equal deleted inserted replaced
178:e703507b8a00 179:9ad43877534d
815 (add-hook 'select-frame-hook 'default-select-frame-hook)) 815 (add-hook 'select-frame-hook 'default-select-frame-hook))
816 816
817 (or deselect-frame-hook 817 (or deselect-frame-hook
818 (add-hook 'deselect-frame-hook 'default-deselect-frame-hook)) 818 (add-hook 'deselect-frame-hook 'default-deselect-frame-hook))
819 819
820 (defun default-drag-and-drop-functions (frame filepath &optional data) 820 (defun default-drag-and-drop-functions (frame filepath &optional data type)
821 "Implements the `drag-and-drop-functions' variable. 821 "Implements the `drag-and-drop-functions' variable.
822 For use as the value of `drag-and-drop-functions'. 822 For use as the value of `drag-and-drop-functions'.
823 This default simply pops up the file in the selected frame or, 823 A file is popped up in a new buffer, some data without
824 if the dragged object is a buffer, inserts it at point." 824 is inserted at point, and data with a type is handled
825 (if data 825 for it's type (NOTE: type is only set for OffiX DnD)."
826 (insert data) 826 (cond (type
827 (let ((x pop-up-windows)) 827 (cond ((or (< type 2) (> type 9)) ;; this is raw data or unknown stuff
828 (setq pop-up-windows nil) 828 (let ((buf (generate-new-buffer "DndRawData")))
829 (pop-to-buffer (find-file-noselect filepath) nil frame) 829 (set-buffer buf)
830 (make-frame-visible frame) 830 (pop-to-buffer buf nil frame)
831 (setq pop-up-windows x)))) 831 (insert data)
832 (hexlify-buffer)
833 (make-frame-visible frame)))
834 ((= type 5) (dired data))
835 ((= type 8) (funcall browse-url-browser-function data))
836 ((= type 9)
837 (let ((buf (generate-new-buffer "DndMIME")))
838 (set-buffer buf)
839 (pop-to-buffer buf nil frame)
840 (insert data)
841 (make-frame-visible frame)))
842 (t (ding))))
843 (data (insert data))
844 (t
845 (let ((x pop-up-windows))
846 (setq pop-up-windows nil)
847 (pop-to-buffer (find-file-noselect filepath) nil frame)
848 (make-frame-visible frame)
849 (setq pop-up-windows x)))))
832 850
833 (and (boundp 'drag-and-drop-functions) 851 (and (boundp 'drag-and-drop-functions)
834 (or drag-and-drop-functions 852 (or drag-and-drop-functions
835 (add-hook 'drag-and-drop-functions 'default-drag-and-drop-functions))) 853 (add-hook 'drag-and-drop-functions 'default-drag-and-drop-functions)))
836 854