]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/x-dnd.el (x-dnd-do-direct-save): Remove redundant stmts.
authorPo Lu <luangruo@yahoo.com>
Fri, 14 Feb 2025 09:56:22 +0000 (17:56 +0800)
committerEshel Yaron <me@eshelyaron.com>
Fri, 14 Feb 2025 11:44:32 +0000 (12:44 +0100)
(cherry picked from commit 4d6f40dfc9075d64275da97dc35a2becc9eca4a2)

lisp/x-dnd.el

index 760dd0a42bf4f30738e14961f489b2721961f7e9..13fe3842f18fb58de9f75a06ba37f2db53251d93 100644 (file)
@@ -1544,41 +1544,39 @@ was taken, or the direct save failed."
         (x-dnd-use-offix-drop nil)
         (x-dnd-use-unsupported-drop nil)
         (prop-deleted nil)
-        (action nil)
         encoded-name)
     (unwind-protect
-        (setq action
-              (progn
-                (when (file-remote-p file)
-                  (setq file-name (file-local-copy file))
-                  (setq dnd-last-dragged-remote-file file-name)
-                  (add-hook 'kill-emacs-hook
-                            #'dnd-remove-last-dragged-remote-file))
-                (setq encoded-name
-                      (encode-coding-string name
-                                            (or file-name-coding-system
-                                                default-file-name-coding-system)))
-                (setq x-dnd-xds-current-file file-name)
-                (x-change-window-property "XdndDirectSave0" encoded-name
-                                          frame "text/plain" 8 nil)
-                (gui-set-selection 'XdndSelection (concat "file://" file-name))
-                ;; FIXME: this does not work with GTK file managers,
-                ;; since they always reach for `text/uri-list' first,
-                ;; contrary to the spec.
-                (let ((action (x-begin-drag '("XdndDirectSave0" "text/uri-list"
-                                              "application/octet-stream")
-                                            'XdndActionDirectSave
-                                            frame nil allow-same-frame)))
-                  (if (not x-dnd-xds-performed)
-                      action
-                    (let ((property (x-window-property "XdndDirectSave0" frame
-                                                       "AnyPropertyType" nil t)))
-                      (setq prop-deleted t)
-                      ;; "System-G" deletes the property upon success.
-                      (and (or (null property)
-                               (and (stringp property)
-                                    (not (equal property ""))))
-                           action))))))
+        (progn
+          (when (file-remote-p file)
+            (setq file-name (file-local-copy file))
+            (setq dnd-last-dragged-remote-file file-name)
+            (add-hook 'kill-emacs-hook
+                      #'dnd-remove-last-dragged-remote-file))
+          (setq encoded-name
+                (encode-coding-string name
+                                      (or file-name-coding-system
+                                          default-file-name-coding-system)))
+          (setq x-dnd-xds-current-file file-name)
+          (x-change-window-property "XdndDirectSave0" encoded-name
+                                    frame "text/plain" 8 nil)
+          (gui-set-selection 'XdndSelection (concat "file://" file-name))
+          ;; FIXME: this does not work with GTK file managers,
+          ;; since they always reach for `text/uri-list' first,
+          ;; contrary to the spec.
+          (let ((action (x-begin-drag '("XdndDirectSave0" "text/uri-list"
+                                        "application/octet-stream")
+                                      'XdndActionDirectSave
+                                      frame nil allow-same-frame)))
+            (if (not x-dnd-xds-performed)
+                action
+              (let ((property (x-window-property "XdndDirectSave0" frame
+                                                 "AnyPropertyType" nil t)))
+                (setq prop-deleted t)
+                ;; "System-G" deletes the property upon success.
+                (and (or (null property)
+                         (and (stringp property)
+                              (not (equal property ""))))
+                     action)))))
       (unless prop-deleted
         (x-delete-window-property "XdndDirectSave0" frame))
       ;; Delete any remote copy that was made.