From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?=C3=93scar_Fuentes?= Newsgroups: gmane.emacs.devel Subject: Re: Please help me test this on MS-Windows Date: Sun, 07 Mar 2021 17:37:57 +0100 Message-ID: <87a6reor6i.fsf@telefonica.net> References: <871rcrndyg.fsf@mdeb> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3280"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Matt Armstrong To: emacs-devel@gnu.org Cancel-Lock: sha1:6eO14ZfWF0ZraABBWcjMYfkOZ8I= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Mar 07 17:38:39 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lIwQQ-0000ky-Qi for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Mar 2021 17:38:38 +0100 Original-Received: from localhost ([::1]:33038 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lIwQP-0005Zb-SZ for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Mar 2021 11:38:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48962) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIwPu-000598-AB for emacs-devel@gnu.org; Sun, 07 Mar 2021 11:38:06 -0500 Original-Received: from ciao.gmane.io ([116.202.254.214]:35760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lIwPs-0004oW-Cq for emacs-devel@gnu.org; Sun, 07 Mar 2021 11:38:06 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1lIwPp-00008n-SK for emacs-devel@gnu.org; Sun, 07 Mar 2021 17:38:01 +0100 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:266133 Archived-At: Matt Armstrong writes: > Can somebody with access to an MS-Windows machine help me test the code > below? > > Evaling this in *scratch* suffices. `unlock-buffer' should signal an > error. It does on POSIX-like systems. I'm 99% sure it will on > MS-Windows too, but I'd like to confirm, as well as see the specific > error thrown. Emacs 27 or 28 is fine. > > (let* ((dir (file-name-as-directory > (make-temp-file "unlock-test" t))) > (name (concat dir "a")) > (lockname-as-directory (file-name-as-directory (concat dir ".#a"))) > (spoiler-name (concat lockname-as-directory "spoiler"))) > (unwind-protect > (progn > ;; Create a file named DIR/.#a/spoiler, then attempt to unlock a > ;; buffer named DIR/a. `unlock-buffer' should signal a file-error. > (make-directory lockname-as-directory) > (with-temp-file spoiler-name > (insert "Hello, World!")) > (with-temp-buffer > (set-buffer-modified-p t) > (let ((buffer-file-name name) > (buffer-file-truename name)) > (unlock-buffer)))) > (delete-directory dir t nil))) emacs -Q GNU Emacs 27.1 (build 1, i686-w64-mingw32) of 2020-11-19 Debugger entered--Lisp error: (file-error "Unlocking file" #("Permission denied" 0 17 (charset windows-1252)) "c:/Users/Oscar/AppData/Local/Temp/unlock-testxeeb8...") unlock-buffer() (let ((buffer-file-name name) (buffer-file-truename name)) (unlock-buffer)) (progn (set-buffer-modified-p t) (let ((buffer-file-name name) (buffer-file-truename name)) (unlock-buffer))) (unwind-protect (progn (set-buffer-modified-p t) (let ((buffer-file-name name) (buffer-file-truename name)) (unlock-buffer))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (set-buffer-modified-p t) (let ((buffer-file-name name) (buffer-file-truename name)) (unlock-buffer))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (set-buffer-modified-p t) (let ((buffer-file-name name) (buffer-file-truename name)) (unlock-buffer))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))) (progn (make-directory lockname-as-directory) (let ((temp-file spoiler-name) (temp-buffer (generate-new-buffer " *temp file*"))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert "Hello, World!")) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (set-buffer-modified-p t) (let ((buffer-file-name name) (buffer-file-truename name)) (unlock-buffer))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))) (unwind-protect (progn (make-directory lockname-as-directory) (let ((temp-file spoiler-name) (temp-buffer (generate-new-buffer " *temp file*"))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert "Hello, World!")) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (set-buffer-modified-p t) (let (... ...) (unlock-buffer))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))) (delete-directory dir t nil)) (let* ((dir (file-name-as-directory (make-temp-file "unlock-test" t))) (name (concat dir "a")) (lockname-as-directory (file-name-as-directory (concat dir ".#a"))) (spoiler-name (concat lockname-as-directory "spoiler"))) (unwind-protect (progn (make-directory lockname-as-directory) (let ((temp-file spoiler-name) (temp-buffer (generate-new-buffer " *temp file*"))) (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (insert "Hello, World!")) (save-current-buffer (set-buffer temp-buffer) (write-region nil nil temp-file nil 0))) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (set-buffer-modified-p t) (let ... ...)) (and (buffer-name temp-buffe r) (kill-buffer temp-buffer)))))) (delete-directory dir t nil))) (progn (let* ((dir (file-name-as-directory (make-temp-file "unlock-test" t))) (name (concat dir "a")) (lockname-as-directory (file-name-as-directory (concat dir ".#a"))) (spoiler-name (concat lockname-as-directory "spoiler"))) (unwind-protect (progn (make-directory lockname-as-directory) (let ((temp-file spoiler-name) (temp-buffer (generate-new-buffer " *temp file*"))) (unwind-protect (prog1 (save-current-buffer ... ...) (save-current-buffer ... ...)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))) (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ... ...) (and ... ...))))) (delete-directory dir t nil)))) eval((progn (let* ((dir (file-name-as-directory (make-temp-file "unlock-test" t))) (name (concat dir "a")) (lockname-as-directory (file-name-as-directory (concat dir ".#a"))) (spoiler-name (concat lockname-as-directory "spoiler"))) (unwind-protect (progn (make-directory lockname-as-directory) (let ((temp-file spoiler-name) (temp-buffer ...)) (unwind-protect (prog1 ... ...) (and ... ...))) (let ((temp-buffer ...)) (save-current-buffer (set-buffer temp-buffer) (unwind-protect ... ...)))) (delete-directory dir t nil)))) t) elisp--eval-last-sexp(nil) eval-last-sexp(nil) funcall-interactively(eval-last-sexp nil) call-interactively(eval-last-sexp nil nil) command-execute(eval-last-sexp)