From: "Óscar Fuentes" <ofv@wanadoo.es>
To: emacs-devel@gnu.org
Cc: Matt Armstrong <matt@rfc20.org>
Subject: Re: Please help me test this on MS-Windows
Date: Sun, 07 Mar 2021 17:37:57 +0100 [thread overview]
Message-ID: <87a6reor6i.fsf@telefonica.net> (raw)
In-Reply-To: 871rcrndyg.fsf@mdeb
Matt Armstrong <matt@rfc20.org> 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)
next prev parent reply other threads:[~2021-03-07 16:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-07 16:08 Please help me test this on MS-Windows Matt Armstrong
2021-03-07 16:37 ` Óscar Fuentes [this message]
2021-03-07 16:56 ` Eli Zaretskii
2021-03-07 19:53 ` Matt Armstrong
2021-03-07 18:30 ` Óscar Fuentes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a6reor6i.fsf@telefonica.net \
--to=ofv@wanadoo.es \
--cc=emacs-devel@gnu.org \
--cc=matt@rfc20.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.