unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* RE: patch is received?
       [not found] <BAY121-DAV73ED6DDCDAB11014BA9E6E2E10@phx.gbl>
@ 2008-04-21 16:19 ` Drew Adams
  2008-04-21 16:29   ` Toru TSUNEYOSHI
       [not found] ` <480CC2D7.3030302@gmail.com>
  1 sibling, 1 reply; 4+ messages in thread
From: Drew Adams @ 2008-04-21 16:19 UTC (permalink / raw)
  To: 'Toru TSUNEYOSHI'; +Cc: emacs-devel

> I made a patch for src/{w32.c,emacs.c} (in emacs 22.2) about 
> moving file
> (or directory) to the Recycle Bin on Windows NT series.
> 
> I have a question.
> The patch is received?
> If yes, where I shoud send it to?

Mailing list emacs-devel@gnu.org is probably the right list for this question.
Moving this there





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: patch is received?
  2008-04-21 16:19 ` patch is received? Drew Adams
@ 2008-04-21 16:29   ` Toru TSUNEYOSHI
  0 siblings, 0 replies; 4+ messages in thread
From: Toru TSUNEYOSHI @ 2008-04-21 16:29 UTC (permalink / raw)
  To: Drew Adams; +Cc: emacs-devel

Thank you.

I'll send to emacs-devel@gnu.org right now.

----- Original Message ----- 
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Toru TSUNEYOSHI'" <t_tuneyosi@hotmail.com>
Cc: <emacs-devel@gnu.org>
Sent: Tuesday, April 22, 2008 1:19 AM
Subject: RE: patch is received?


> > I made a patch for src/{w32.c,emacs.c} (in emacs 22.2) about 
> > moving file
> > (or directory) to the Recycle Bin on Windows NT series.
> > 
> > I have a question.
> > The patch is received?
> > If yes, where I shoud send it to?
> 
> Mailing list emacs-devel@gnu.org is probably the right list for this question.
> Moving this there
> 
> 




^ permalink raw reply	[flat|nested] 4+ messages in thread

* patch is received?
@ 2008-04-21 16:34 Toru TSUNEYOSHI
  0 siblings, 0 replies; 4+ messages in thread
From: Toru TSUNEYOSHI @ 2008-04-21 16:34 UTC (permalink / raw)
  To: emacs-devel

I made a patch for src/{w32.c,emacs.c} (in emacs 22.2) about moving file
(or directory) to the Recycle Bin on Windows NT series.

I have a question.
The patch is received?
If yes, where I should send it to?





^ permalink raw reply	[flat|nested] 4+ messages in thread

* patch about moving file (or directory) to the Recycle Bin on Windows NT series
       [not found] ` <480CC2D7.3030302@gmail.com>
@ 2008-04-21 17:07   ` Toru TSUNEYOSHI
  0 siblings, 0 replies; 4+ messages in thread
From: Toru TSUNEYOSHI @ 2008-04-21 17:07 UTC (permalink / raw)
  To: emacs-devel; +Cc: Lennart Borgman (gmail)

[-- Attachment #1: Type: text/plain, Size: 170 bytes --]

I made a patch for src/{w32.c,emacs.c} (in emacs 22.2) about moving file
(or directory) to the Recycle Bin on Windows NT series.

If possible, please patch emacs source.

[-- Attachment #2: w32.c_and_emacs.c.diff --]
[-- Type: application/octet-stream, Size: 3356 bytes --]

--- w32.c.original	2008-02-23 22:49:09.000000000 +0900
+++ w32.c	2008-04-21 22:08:48.248179300 +0900
@@ -75,6 +75,10 @@
 #include <windows.h>
 #include <shlobj.h>
 
+#ifdef MYDEF
+#include <shellapi.h>
+#endif	/* MYDEF */
+
 #ifdef HAVE_SOCKETS	/* TCP connection support, if kernel can do it */
 #include <sys/socket.h>
 #undef socket
@@ -111,6 +115,10 @@
 extern Lisp_Object Vw32_get_true_file_attributes;
 extern int w32_num_mouse_buttons;
 
+#ifdef MYDEF
+int w32_sys_unlink_use_shellapi;
+#endif	/* MYDEF */
+
 \f
 /*
   Initialization states
@@ -2240,6 +2248,71 @@
   return result;
 }
 
+#ifdef MYDEF
+
+int
+sys_rmdir (const char * path)
+{
+  if (w32_sys_unlink_use_shellapi)
+    return (sys_unlink ((const char *)path));
+  else
+    return _rmdir (map_w32_filename (path, NULL));
+}
+
+int
+sys_unlink (const char * path)
+{
+  if (w32_sys_unlink_use_shellapi)
+    {
+      /* Each file name must be terminated by a single NULL
+	 character. An additional NULL character must be appended to the
+	 end of the final name to indicate the end of pFrom. */
+      TCHAR tmp_path[MAX_PATH + 1 + 1];
+      SHFILEOPSTRUCT stFileOp;
+
+      path = map_w32_filename (path, NULL);
+
+      /* On Unix, unlink works without write permission. */
+      _chmod (path, 0666);
+
+#if 0
+      *(tmp_path + lstrlen(tmp_path) + 1) = '\0';
+#else
+      ZeroMemory(tmp_path, sizeof(tmp_path));
+#endif
+      lstrcpy(tmp_path, path);
+
+      ZeroMemory(&stFileOp, sizeof(SHFILEOPSTRUCT));
+      stFileOp.hwnd = HWND_DESKTOP;
+      stFileOp.wFunc = FO_DELETE;
+      stFileOp.pFrom = tmp_path;
+      stFileOp.pTo = NULL;
+      stFileOp.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_SILENT;
+      stFileOp.fAnyOperationsAborted = FALSE;
+      stFileOp.hNameMappings = NULL;
+      stFileOp.lpszProgressTitle = NULL;
+
+#if 0
+      SHFileOperation(&stFileOp);
+
+      return (stFileOp.fAnyOperationsAborted);
+#else
+      /* value returned by SHFileOperation() must match value returned by _unlink() */
+      return (SHFileOperation(&stFileOp) == 0 ? 0 : -1);
+#endif
+    }
+  else
+    {
+      path = map_w32_filename (path, NULL);
+
+      /* On Unix, unlink works without write permission. */
+      _chmod (path, 0666);
+      return _unlink (path);
+    }
+}
+
+#else	/* MYDEF */
+
 int
 sys_rmdir (const char * path)
 {
@@ -2256,6 +2329,8 @@
   return _unlink (path);
 }
 
+#endif	/* MYDEF */
+
 static FILETIME utc_base_ft;
 static long double utc_base;
 static int init = 0;
@@ -4160,6 +4235,18 @@
   SetConsoleCtrlHandler(shutdown_handler, TRUE);
 }
 
+#ifdef MYDEF
+
+void
+syms_of_w32 ()
+{
+  DEFVAR_BOOL ("w32-sys-unlink-use-shellapi", &w32_sys_unlink_use_shellapi,
+	       "Non-nil means using shellapi for sys_unlink(), sys_rmdir().");
+  w32_sys_unlink_use_shellapi = 0;
+}
+
+#endif	/* MYDEF */
+
 /* end of w32.c */
 
 /* arch-tag: 90442dd3-37be-482b-b272-ac752e3049f1
--- emacs.c.original	2008-01-10 21:16:14.000000000 +0900
+++ emacs.c	2008-04-21 22:14:55.457184200 +0900
@@ -1588,6 +1588,9 @@
       syms_of_vmsproc ();
 #endif /* VMS */
 #ifdef WINDOWSNT
+#ifdef MYDEF
+      syms_of_w32 ();
+#endif	/* MYDEF */
       syms_of_ntproc ();
 #endif /* WINDOWSNT */
       syms_of_window ();

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-21 17:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <BAY121-DAV73ED6DDCDAB11014BA9E6E2E10@phx.gbl>
2008-04-21 16:19 ` patch is received? Drew Adams
2008-04-21 16:29   ` Toru TSUNEYOSHI
     [not found] ` <480CC2D7.3030302@gmail.com>
2008-04-21 17:07   ` patch about moving file (or directory) to the Recycle Bin on Windows NT series Toru TSUNEYOSHI
2008-04-21 16:34 patch is received? Toru TSUNEYOSHI

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).