radian-software / straight.el

🍀 Next-generation, purely functional package manager for the Emacs hacker.
MIT License
2.72k stars 150 forks source link

undo-tree installation #880

Closed dotemacs closed 2 years ago

dotemacs commented 2 years ago

Hello

I'm trying to install undo-tree package from source, but when I do specify it, it errors with:

Error (use-package): Cannot load undo-treе

My whole .init.el:

(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(setq package-enable-at-startup nil)

(straight-use-package 'use-package)
(setq straight-use-package-by-default t)

(use-package undo-treе
  :straight (undo-tree :type git
               :host gitlab
               :repo "tsc25/undo-tree")
  :config
  (global-undo-tree-mode))

straight-process buffer:

$ cd /Users/alex/.emacs.d/
$ find /dev/null -newermt 2018-01-01\ 12\:00\:00

/dev/null

[Return code: 0]

$ cd /Users/alex/.emacs.d/straight/repos/
$ find /Users/alex/.emacs.d/straight/repos/queue/ /Users/alex/.emacs.d/straight/repos/use-package/ /Users/alex/.emacs.d/straight/repos/straight.el/ /Users/alex/.emacs.d/straight/repos/emacsmirror-mirror/ /Users/alex/.emacs.d/straight/repos/el-get/ /Users/alex/.emacs.d/straight/repos/gnu-elpa-mirror/ /Users/alex/.emacs.d/straight/repos/melpa/ -name .git -prune -o -path /Users/alex/.emacs.d/straight/repos/queue/\* -newermt 2021-11-15\ 09\:22\:19 -print -o -path /Users/alex/.emacs.d/straight/repos/use-package/\* -newermt 2021-11-15\ 09\:22\:19 -print -o -path /Users/alex/.emacs.d/straight/repos/straight.el/\* -newermt 2021-11-15\ 09\:22\:19 -print -o -path /Users/alex/.emacs.d/straight/repos/emacsmirror-mirror/\* -newermt 2021-11-15\ 09\:22\:19 -print -o -path /Users/alex/.emacs.d/straight/repos/el-get/\* -newermt 2021-11-15\ 09\:22\:19 -print -o -path /Users/alex/.emacs.d/straight/repos/gnu-elpa-mirror/\* -newermt 2021-11-15\ 09\:22\:19 -print -o -path /Users/alex/.emacs.d/straight/repos/melpa/\* -newermt 2021-11-15\ 09\:22\:19 -print

[Return code: 0]

$ cd /Users/alex/.emacs.d/straight/repos/
$ git clone --origin origin --no-checkout https\://gitlab.com//tsc25/undo-tree.git /Users/alex/.emacs.d/straight/repos/undo-tree/

Cloning into '/Users/alex/.emacs.d/straight/repos/undo-tree'...
warning: redirecting to https://gitlab.com/tsc25/undo-tree.git/

[Return code: 0]

$ cd /Users/alex/.emacs.d/straight/repos/undo-tree/
$ git branch -r

  origin/HEAD -> origin/master
  origin/master

[Return code: 0]

$ cd /Users/alex/.emacs.d/straight/repos/undo-tree/
$ git checkout -B master origin/master

Reset branch 'master'
Branch 'master' set up to track remote branch 'master' from 'origin'.
Your branch is up to date with 'origin/master'.

[Return code: 0]

$ cd /Users/alex/.emacs.d/straight/repos/undo-tree/
$ git submodule update --init --recursive

[Return code: 0]

$ cd /Users/alex/.emacs.d/straight/repos/undo-tree/
$ find . -name .git -prune -o -newermt 2021-11-15\ 09\:22\:19 -print

.
./.gitignore
./undo-tree.el

[Return code: 0]

Now if I remove from the above init.el

:config
  (global-undo-tree-mode)

and put this line outside of the use-package declaration:

(global-undo-tree-mode)

I still get the above error, but this time I can use undo-tree and ignore the error.

What do I need to do in order to suppress this error and have the package loaded as expected?

Thanks

dotemacs commented 2 years ago

Putting this in instead:

(use-package undo-treе-mode
  :straight (undo-tree :type git
               :host gitlab
               :repo "tsc25/undo-tree"))

Still produces the error, but at least undo-tree mode works.

progfolio commented 2 years ago

I'm unable to reproduce with the following:

Yodel Report (2021-11-15 10:59:07):

(yodel
  :formatter yodel-format-as-github-markdown
  :packages*
  use-package
  :post*
  (setq straight-use-package-by-default t)
  (use-package undo-tree
    :straight
    (undo-tree
     :host gitlab
     :repo "tsc25/undo-tree")
    :config
    (global-undo-tree-mode)))
STDOUT: ```emacs-lisp Loading /tmp/yodel-DzlbNb/straight-bootstrap-snippet.el (source)... Bootstrapping straight.el... Bootstrapping straight.el...done Rebuilding all packages due to build cache schema change Looking for gnu-elpa-mirror recipe -> Cloning melpa... Looking for gnu-elpa-mirror recipe -> Cloning melpa...done Looking for emacsmirror-mirror recipe -> Cloning gnu-elpa-mirror... Looking for emacsmirror-mirror recipe -> Cloning gnu-elpa-mirror...done Looking for emacsmirror-mirror recipe -> Cloning el-get... Looking for emacsmirror-mirror recipe -> Cloning el-get...done Looking for straight recipe -> Cloning emacsmirror-mirror... Looking for straight recipe -> Cloning emacsmirror-mirror...done Building straight... Building straight...done Cloning use-package... Cloning use-package...done Building use-package... Building use-package -> Building bind-key... Building use-package -> Building bind-key...done Building use-package... Building use-package...done Cloning undo-tree... Cloning undo-tree...done Building undo-tree... Building undo-tree -> Cloning queue... Building undo-tree -> Cloning queue...done Building undo-tree -> Building queue... Building undo-tree -> Building queue...done Building undo-tree... Building undo-tree...done ```
Environment - **emacs version**: GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.17.4, Xaw3d scroll bars) of 2021-11-03 - **system type**: gnu/linux
Packages | Name | Branch | Commit | Date | Source | |--------------------------------------------------------|--------|----------------------------------------------------------------------------------------------------|------------|-----------------| | [use-package](https://github.com/jwiegley/use-package) | master | https://github.com/jwiegley/use-package/commit/a7422fb8ab1baee19adb2717b5b47b9c3812a84c | 2021-02-10 | melpa | | [bind-key](https://github.com/jwiegley/use-package) | master | https://github.com/jwiegley/use-package/commit/a7422fb8ab1baee19adb2717b5b47b9c3812a84c | 2021-02-10 | melpa | | [undo-tree](https://gitlab.com/tsc25/undo-tree) | master | [2bf5e230f1](https://gitlab.com/tsc25/undo-tree/-/commit/2bf5e230f1d11df7bbd9d8c722749e34482bc458) | 2021-03-24 | gnu-elpa-mirror | | [queue](https://github.com/emacs-straight/queue) | master | https://github.com/emacs-straight/queue/commit/130c2d656cd5d7376552272fab9e50a7c37d0c4a | 2021-03-07 | gnu-elpa-mirror |

Are you able to reproduce the error via straight-bug-report? e.g.

Test Case ```emacs-lisp (straight-bug-report :pre-bootstrap (setq straight-repository-branch "develop" straight-use-package-by-default t) :post-bootstrap (straight-use-package 'use-package) (use-package undo-tree :straight (undo-tree :host gitlab :repo "tsc25/undo-tree") :config (global-undo-tree-mode))) ```
Output ```emacs-lisp Bootstrapping straight.el... Bootstrapping straight.el...done Rebuilding all packages due to build cache schema change Looking for gnu-elpa-mirror recipe -> Cloning melpa... Looking for gnu-elpa-mirror recipe -> Cloning melpa...done Looking for emacsmirror-mirror recipe -> Cloning gnu-elpa-mirror... Looking for emacsmirror-mirror recipe -> Cloning gnu-elpa-mirror...done Looking for emacsmirror-mirror recipe -> Cloning el-get... Looking for emacsmirror-mirror recipe -> Cloning el-get...done Looking for straight recipe -> Cloning emacsmirror-mirror... Looking for straight recipe -> Cloning emacsmirror-mirror...done Building straight... Building straight...done Test run with version: prerelease (HEAD -> develop, origin/develop) 7262ebc 2021-11-05 Cloning use-package... Cloning use-package...done Building use-package... Building use-package -> Building bind-key... Building use-package -> Building bind-key...done Building use-package... Building use-package...done Cloning undo-tree... Cloning undo-tree...done Building undo-tree... Building undo-tree -> Cloning queue... Building undo-tree -> Cloning queue...done Building undo-tree -> Building queue... Building undo-tree -> Building queue...done Building undo-tree... Building undo-tree...done Packages: "org-elpa" n/a n/a "melpa" n/a master db77988a 2021-11-15 "gnu-elpa-mirror" n/a master 870aae4 2021-11-12 "el-get" melpa master 960f3fb9 2021-10-31 "emacsmirror-mirror" n/a master 5bcbacb 2021-11-12 "straight" n/a develop 7262ebc 2021-11-05 "use-package" melpa master a7422fb 2021-02-10 "bind-key" melpa master a7422fb 2021-02-10 "undo-tree" gnu-elpa-mirror master 2bf5e23 2021-03-24 "queue" gnu-elpa-mirror master 130c2d6 2021-03-07 ```
progfolio commented 2 years ago

I would also recommend moving (setq package-enable-at-startup nil) to the early-init file:

https://www.gnu.org/software/emacs/manual/html_node/emacs/Early-Init-File.html

dotemacs commented 2 years ago

I would also recommend moving (setq package-enable-at-startup nil) to the early-init file:

Did that, with the config as per my original comment above, no change.

I'll try the other approaches you've outlined above. Thanks

dotemacs commented 2 years ago

My full config for undo-tree is this:

(use-package undo-treе-mode
  :straight (undo-tree :type git
               :host gitlab
               :repo "tsc25/undo-tree")
  :init
  (global-undo-tree-mode t)
  (setq undo-tree-visualizer-timestamps t)
  (setq undo-tree-enable-undo-in-region t))

The thing that fixes this issue is that the first argument to use-package is undo-tree-mode and the package is fetched with the name undo-tree (note the omitted -mode).

I still get the warning but the package does initialise and works, which is something I can live with, since I seldom restart Emacs.

I'll close the issue, thanks

progfolio commented 2 years ago

I still get the warning but the package does initialise and works, which is something I can live with, since I seldom restart Emacs.

Why not just change the first argument from undo-tree-mode to undo-tree? That should prevent the warning.

dotemacs commented 2 years ago

I still get the warning but the package does initialise and works, which is something I can live with, since I seldom restart Emacs.

Why not just change the first argument from undo-tree-mode to undo-tree? That should prevent the warning.

That seems like a great suggestion, just tried it and with this:

(use-package undo-treе
  :straight (undo-tree :type git
               :host gitlab
               :repo "tsc25/undo-tree")
  :init
  (global-undo-tree-mode t)
  (setq undo-tree-visualizer-timestamps t)
  (setq undo-tree-enable-undo-in-region t))

I still get the warning:

Error (use-package): Cannot load undo-treе