X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/3e93bafb95608467e438ba7f725fd1f020669f8c..e4adb6cdf30706f28dada8aafd347549c84105ac:/lisp/dnd.el diff --git a/lisp/dnd.el b/lisp/dnd.el index 73b531dfd1..b715eecad9 100644 --- a/lisp/dnd.el +++ b/lisp/dnd.el @@ -1,6 +1,6 @@ -;;; dnd.el --- drag and drop support. -*- coding: utf-8 -*- +;;; dnd.el --- drag and drop support -;; Copyright (C) 2005-2014 Free Software Foundation, Inc. +;; Copyright (C) 2005-2016 Free Software Foundation, Inc. ;; Author: Jan Djärv ;; Maintainer: emacs-devel@gnu.org @@ -122,17 +122,18 @@ Return nil if URI is not a local file." ;; The hostname may be our hostname, in that case, convert to a local ;; file. Otherwise return nil. TODO: How about an IP-address as hostname? - (let ((hostname (when (string-match "^file://\\([^/]*\\)" uri) + (let ((sysname (system-name))) + (let ((hostname (when (string-match "^file://\\([^/]*\\)" uri) (downcase (match-string 1 uri)))) - (system-name-no-dot - (downcase (if (string-match "^[^\\.]+" system-name) - (match-string 0 system-name) - system-name)))) - (when (and hostname - (or (string-equal "localhost" hostname) - (string-equal (downcase system-name) hostname) - (string-equal system-name-no-dot hostname))) - (concat "file://" (substring uri (+ 7 (length hostname))))))) + (sysname-no-dot + (downcase (if (string-match "^[^\\.]+" sysname) + (match-string 0 sysname) + sysname)))) + (when (and hostname + (or (string-equal "localhost" hostname) + (string-equal (downcase sysname) hostname) + (string-equal sysname-no-dot hostname))) + (concat "file://" (substring uri (+ 7 (length hostname)))))))) (defsubst dnd-unescape-uri (uri) (replace-regexp-in-string