0

I have Emacs installed with brew install emacs-mac --HEAD --with-cocoa --with-gnutls --with-librsvg --with-imagemagick. I have the final .app binary in the OS X Dock.

If I drag a file onto the Dock icon, the default behavior opens it in the last-activated frame, even if it is on a different desktop. I'd like files to open in a new frame in the current desktop when drag-and-dropped onto the icon. Is this behavior possible? Yes, because this is emacs. Can anyone suggest a place to begin implementing this?

  • 1
    I don't use the Brew or dropping stuff in Dock icons, but I have looked into altering ns-find-file so that files opened from the Finder.app get displayed in certain select frames (using a custom function and let-binding the display-buffer-alist). Why not try adding a message to ns-find-file and drop your file on the Dock and see if the message gets displayed? If it does, then "Bingo!". If not, then "Go Fish!". Here is a link to a modified version of ns-find-file: stackoverflow.com/questions/18346785/… – lawlist Jul 7 '16 at 16:39
0

Until someone suggest a better implementation, I over-write dnd-open-local-file to open in a new frame instead of a new window:

(setq dnd-open-file-other-frame t)    
(defun dnd-open-local-file (uri _action)
  (let* ((f (dnd-get-local-file-name uri t)))
    (if (and f (file-readable-p f))
    (progn
      (if dnd-open-file-other-frame
          (find-file-other-frame f)
        (find-file f))
      'private)
      (error "Can not read %s" uri))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.