[macemacsjp-english 418] smart-dnd / insert text at drop-point

Back to archive index

David Reitter david****@gmail*****
Sun Dec 18 22:32:00 JST 2005


Hi Seiji and all:

the new smart-dnd package is very useful and it'll be available in  
the next Aquamacs version, too.
I've added a little code (see patch below) to insert the correct text  
at the position where it has been dropped, not where the point  
happens to be at the time.

Cheers
David

PS.: I hope this is the right mailing list - sorry for any convenience!


Index: smart-dnd.el
===================================================================
RCS file: /cvsroot/aquamacs/aquamacs/src/site-lisp/smart-dnd.el,v
retrieving revision 1.1
diff -c -r1.1 smart-dnd.el
*** smart-dnd.el        18 Dec 2005 10:04:47 -0000      1.1
--- smart-dnd.el        18 Dec 2005 13:29:02 -0000
***************
*** 123,152 ****
         (error "Remote files not supported"))))

   (defun smart-dnd-execute (f)
!   "Document forthcoming..."
     (interactive "f")
!   (let( (alist smart-dnd-string-alist)
!         (case-fold-search nil)
!         (my-string nil)
!         (succeed nil) )
!     (while alist
!       (when (string-match (caar alist) f)
!         (setq my-string (cdar alist))
!         (when (stringp my-string)
!           (insert (smart-dnd-string my-string f))
!           (setq alist nil)
!           (setq succeed t)
!           )
!         (when (not (stringp my-string))
!           (eval (cdar alist))
!           (setq alist nil)
!           (setq succeed t)
!           )
!         )
!       (setq alist (cdr alist))
!       )
!     succeed
!     ))

   (defun smart-dnd-setup (alist)
     "Install smart-dnd feature to the local buffer."
--- 123,154 ----
         (error "Remote files not supported"))))

   (defun smart-dnd-execute (f)
!   "Execute a Drag'n'Drop action with URL f depending on `smart-dnd- 
string-alist'."
     (interactive "f")
!   (save-excursion
!     (if (eq (car-safe last-nonmenu-event) 'drag-n-drop)
!       (goto-char (posn-point (car (cdr-safe last-nonmenu-event)))))
!     (let( (alist smart-dnd-string-alist)
!         (case-fold-search nil)
!         (my-string nil)
!         (succeed nil) )
!       (while alist
!       (when (string-match (caar alist) f)
!         (setq my-string (cdar alist))
!         (when (stringp my-string)
!           (insert (smart-dnd-string my-string f))
!           (setq alist nil)
!           (setq succeed t)
!           )
!         (when (not (stringp my-string))
!           (eval (cdar alist))
!           (setq alist nil)
!           (setq succeed t)
!           )
!         )
!       (setq alist (cdr alist))
!       )
!       succeed)))

   (defun smart-dnd-setup (alist)
     "Install smart-dnd feature to the local buffer."



More information about the macemacsjp-english mailing list
Back to archive index