Artawower / blamer.el

A git blame plugin for emacs inspired by VS Code's GitLens plugin
GNU General Public License v3.0
426 stars 15 forks source link

Getting warning message after evaluating the default config #5

Open tmythicator opened 2 years ago

tmythicator commented 2 years ago

Config used:

(use-package blamer
  :quelpa (blamer :fetcher github :repo "artawower/blamer.el")
  (blamer-idle-time 0.3)
  (blamer-min-offset 70)
  :custom-face
  (blamer-face ((t :foreground "#7a88cf"
                    :background nil
                    :height 140
                    :italic t)))
  :config
  (global-blamer-mode 1))

Environment: Emacs 27.2 OS: Linux Warning message: Error (use-package): blamer/:config: Setting current directory: No such file or directory, /build/emacs/src/emacs-27.2/

Artawower commented 2 years ago

Unable to reproduce. But I noticed a small typo in the config, try this

(use-package blamer
  :quelpa (blamer :fetcher github :repo "artawower/blamer.el")
  :custom
  (blamer-idle-time 0.3)
  (blamer-min-offset 70)
  :custom-face
  (blamer-face ((t :foreground "#7a88cf"
                    :background nil
                    :height 140
                    :italic t)))
  :config
  (global-blamer-mode 1))

Tried to reproduce it on pure emacs (ubuntu 20.04) GNU Emacs 27.2.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20) of 2021-10-26

If the first fix doesn't help, try temporarily using these settings to see if there is a warning

Full config ```elisp (require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) ; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities` ;; and `package-pinned-packages`. Most users will not need or want to do this. ;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t) (package-initialize) (unless (package-installed-p 'quelpa) (with-temp-buffer (url-insert-file-contents "https://raw.githubusercontent.com/quelpa/quelpa/master/quelpa.el") (eval-buffer) (quelpa-self-upgrade))) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(package-selected-packages '(evil-collection evil blamer quelpa-use-package quelpa))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(blamer-face ((t :foreground "#7a88cf" :background nil :height 140 :italic t)))) (unless (package-installed-p 'use-package) (package-refresh-contents) (package-install 'use-package)) (eval-when-compile (require 'use-package)) (put 'use-package 'lisp-indent-function 1) (use-package use-package-core :custom ;; (use-package-verbose t) ;; (use-package-minimum-reported-time 0.005) (use-package-enable-imenu-support t)) (quelpa '(quelpa-use-package :fetcher git :url "https://github.com/quelpa/quelpa-use-package.git")) (require 'quelpa-use-package) (use-package blamer :quelpa (blamer :fetcher github :repo "artawower/blamer.el") :custom-face (blamer-face ((t :foreground "#7a88cf" :background nil :height 140 :italic t))) :custom (blamer-idle-time 0.3) (blamer-min-offset 70) :config (global-blamer-mode 1)) ```
evolify commented 2 years ago

The same error in dashboard

tmythicator commented 2 years ago

I have tried first and second suggested config as well, still getting this error. Further findings: This config doesn't produce the error:

(use-package blamer
  :quelpa (blamer :fetcher github :repo "artawower/blamer.el"))

This config on the other hand produces the error:

(use-package blamer
  :quelpa (blamer :fetcher github :repo "artawower/blamer.el")
  :config
  (global-blamer-mode 1))

Unable to reproduce. But I noticed a small typo in the config, try this

(use-package blamer
  :quelpa (blamer :fetcher github :repo "artawower/blamer.el")
  :custom
  (blamer-idle-time 0.3)
  (blamer-min-offset 70)
  :custom-face
  (blamer-face ((t :foreground "#7a88cf"
                    :background nil
                    :height 140
                    :italic t)))
  :config
  (global-blamer-mode 1))

Tried to reproduce it on pure emacs (ubuntu 20.04) GNU Emacs 27.2.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20) of 2021-10-26

If the first fix doesn't help, try temporarily using these settings to see if there is a warning Full config

tmythicator commented 2 years ago

I narrowed down the problem. It happens whenever I execute global-blamer-mode. Stacktrace:

Debugger entered--Lisp error: (file-missing "Setting current directory" "No such file or directory" "/build/emacs/src/emacs-27.2/")
  call-process("/bin/bash" nil t nil "-c" "git rev-parse --is-inside-work-tree")
  call-process-shell-command("git rev-parse --is-inside-work-tree" nil t)
  shell-command("git rev-parse --is-inside-work-tree" t)
  shell-command-to-string("git rev-parse --is-inside-work-tree")
  blamer--git-exist-p()
  blamer-mode()
  global-blamer-mode(toggle)
  funcall-interactively(global-blamer-mode toggle)
  call-interactively(global-blamer-mode record nil)
Artawower commented 2 years ago

Its look like emacs is trying to execute shell comand inside directory that doesn't exist..

Could you check the output from M-: (or M-x eval-expression) (shell-command "pwd") ? (You can copy result from Message buffer) And what happens if you execute git rev-parse --is-inside-work-tree in directory from pwd command in terminal?

And one more question, did this happen inside your project? (where the .git exists), or does this only happen when starting emacs and buffers without the project?

tmythicator commented 2 years ago

Could you check the output from M-: (or M-x eval-expression) (shell-command "pwd") ? (You can copy result from Message buffer)

(shell-command "pwd") evaluates as 0 And I got 0 (#o0, #x0, ?\C-@)Invalid face attribute :background nil in Message buffer.

And what happens if you execute git rev-parse --is-inside-work-tree in directory from pwd command in terminal?

fatal: not a git repository. But that is expected, because I don't have one in my home folder

And one more question, did this happen inside your project? (where the .git exists), or does this only happen when starting emacs and buffers without the project?

It happened when starting emacs or calling global-blamer-mode anywhere, whether there is a .git folder or not.

Artawower commented 2 years ago

I apologize for such a long reply. A few days ago I encountered a very similar problem, it happened when I tried to make a new yasnippet inside a folder that did not yet exist on my machine. I tried to fix this behavior in the last commit, can anyone check this?