unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "牟 桐" <mou.tong@outlook.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "61289-done@debbugs.gnu.org" <61289-done@debbugs.gnu.org>
Subject: bug#61289: 回复: 回复: bug#61289: 30.0.50; Cannot reinstall language grammar after running `treesit-ready-p'
Date: Sun, 5 Feb 2023 11:26:42 +0000	[thread overview]
Message-ID: <SJ0P220MB0675CBF6FBB66FF1F77341FF97D59@SJ0P220MB0675.NAMP220.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <83cz6os93l.fsf@gnu.org>

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

> Thanks.  I installed the change on the emacs-29 branch, and I'm
> closing this bug.

I compiled a new Emacs based on emacs-29 branch, it works fine, thanks
for your patience. Hope it will be merged to master soon 😊

> It cannot be deleted as long as the Emacs session which uses it is up
> and running.  Windows doesn't let us delete a DLL that is being used,
> that's why the patch renames it instead.

I get it, thanks for the explanation.

> This was considered, but we decided not to do that, for several good
> reasons.  One reason is that Emacs itself changes the value, which is
> not appropriate with defcustoms.

Oh, it seems that I think too little.

---

发件人: Eli Zaretskii<mailto:eliz@gnu.org>
发送时间: 2023年2月5日 18:24
收件人: 牟 桐<mailto:mou.tong@outlook.com>
抄送: 61289-done@debbugs.gnu.org<mailto:61289-done@debbugs.gnu.org>
主题: Re: 回复: bug#61289: 30.0.50; Cannot reinstall language grammar after running `treesit-ready-p'

> From: 牟 桐 <mou.tong@outlook.com>
> CC: "61289@debbugs.gnu.org" <61289@debbugs.gnu.org>
> Date: Sun, 5 Feb 2023 09:58:49 +0000
>
> Yes, after applying your patch, I believe this problem has been solved.

Thanks.  I installed the change on the emacs-29 branch, and I'm
closing this bug.

> But I noticed the `libtree-sitter-xxx.dll.old` in the tree-sitter dir
> hadn't been delelted.

It cannot be deleted as long as the Emacs session which uses it is up
and running.  Windows doesn't let us delete a DLL that is being used,
that's why the patch renames it instead.

The next time you install a new version of the same DLL, the .old file
will be deleted, if it still exists.  Or you can delete it by hand.

> If I remove the `ignore-errors` function in your patch, which seems like
> this (sorry, I'm not a programmer and don't know how to use diff):
>
> -          (copy-file lib-name (file-name-as-directory out-dir) t t)
> +          (let* ((library-fname (expand-file-name lib-name out-dir))
> +                 (old-fname (concat library-fname ".old")))
> +            ;; Rename the existing shared library, if any, then
> +            ;; install the new one, and try deleting the old one.
> +            ;; This is for Windows systems, where we cannot simply
> +            ;; overwrite a DLL that is being used.
> +            (if (file-exists-p library-fname)
> +                (rename-file library-fname old-fname t))
> +            (copy-file lib-name (file-name-as-directory out-dir) t t)
> +            ;; Ignore errors, in case the old version is still used.
> +            (delete-file old-fname))
>
>              ^
>              I deleted the outside `ignore-errors` to know why the `xxx.old` hadn’t been deleted.
>
> After applying the change, I got the same error as I mentioned before:
>
> ```
> ⛔ Warning (treesit): Error encountered when installing language grammar: (permission-denied Removing old name Permission denied c:/Users/redacted/.emacs.d/tree-sitter/libtree-sitter-c.dll.old)
> ```

Of course: that's why the patch uses ignore-errors in the first
place.  The DLL cannot be deleted as long as it is used.

> Btw, can we make the variable ` treesit-language-source-alist`
> customizable? (Use `defcustom` instead of `defvar`.) I'm using
> `use-package` to manage my config. When I'm configuring treesit, I'd
> like to use `:custom` instead of `:init` or `:config` since it can let
> me set variable's value without writing `setq`.

This was considered, but we decided not to do that, for several good
reasons.  One reason is that Emacs itself changes the value, which is
not appropriate with defcustoms.


[-- Attachment #2: Type: text/html, Size: 9018 bytes --]

      reply	other threads:[~2023-02-05 11:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-04 12:59 bug#61289: 30.0.50; Cannot reinstall language grammar after running `treesit-ready-p' 牟 桐
2023-02-05  9:13 ` Eli Zaretskii
2023-02-05  9:58   ` bug#61289: 回复: " 牟 桐
2023-02-05 10:24     ` Eli Zaretskii
2023-02-05 11:26       ` 牟 桐 [this message]

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0P220MB0675CBF6FBB66FF1F77341FF97D59@SJ0P220MB0675.NAMP220.PROD.OUTLOOK.COM \
    --to=mou.tong@outlook.com \
    --cc=61289-done@debbugs.gnu.org \
    --cc=eliz@gnu.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 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).