X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/362b9d483c714a8fd87966ddbd8686850f870e34..b8657d829a50110930decf87545ca2a19ff991c1:/lisp/dnd.el diff --git a/lisp/dnd.el b/lisp/dnd.el index 4f70048097..73b531dfd1 100644 --- a/lisp/dnd.el +++ b/lisp/dnd.el @@ -1,10 +1,9 @@ ;;; dnd.el --- drag and drop support. -*- coding: utf-8 -*- -;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 -;; Free Software Foundation, Inc. +;; Copyright (C) 2005-2014 Free Software Foundation, Inc. ;; Author: Jan Djärv -;; Maintainer: FSF +;; Maintainer: emacs-devel@gnu.org ;; Keywords: window, drag, drop ;; Package: emacs @@ -153,15 +152,18 @@ Return nil if URI is not a local file." (let ((f (cond ((string-match "^file:///" uri) ; XDND format. (substring uri (1- (match-end 0)))) ((string-match "^file:" uri) ; Old KDE, Motif, Sun - (substring uri (match-end 0)))))) - (and f (setq f (decode-coding-string (dnd-unescape-uri f) - (or file-name-coding-system - default-file-name-coding-system)))) + (substring uri (match-end 0))))) + (coding (if (equal system-type 'windows-nt) + ;; W32 pretends that file names are UTF-8 encoded. + 'utf-8 + (or file-name-coding-system + default-file-name-coding-system)))) + (and f (setq f (decode-coding-string (dnd-unescape-uri f) coding))) (when (and f must-exist (not (file-readable-p f))) (setq f nil)) f)) -(defun dnd-open-local-file (uri action) +(defun dnd-open-local-file (uri _action) "Open a local file. The file is opened in the current window, or a new window if `dnd-open-file-other-window' is set. URI is the url for the file, @@ -181,7 +183,7 @@ An alternative for systems that do not support unc file names is 'private) (error "Can not read %s" uri)))) -(defun dnd-open-remote-url (uri action) +(defun dnd-open-remote-url (uri _action) "Open a remote file with `find-file' and `url-handler-mode'. Turns `url-handler-mode' on if not on before. The file is opened in the current window, or a new window if `dnd-open-file-other-window' is set. @@ -227,5 +229,4 @@ TEXT is the text as a string, WINDOW is the window where the drop happened." (provide 'dnd) -;; arch-tag: 0472f6a5-2e8f-4304-9e44-1a0877c771b7 ;;; dnd.el ends here