Closed ghowoo closed 3 years ago
Please include the output of straight-version
.
This cause Emacs to hang on r processing and gives ESSR loading error: (use-package ess :straight t :init (require 'ess-site) )
Please include the error stack trace.
Unable to reproduce with the following test:
(straight-bug-report
:user-dir "ess.straight"
:interactive t
:post-bootstrap
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
(use-package ess
:defer t
:init (require 'ess-site)))
If you can, please include the simplest way to reproduce the error you are seeing as well.
With the following in init.el:
(use-package ess
:straight t
:init (require 'ess-site))
When I start an R process, it sends a message saying ESSR loading error, but the actual R process starts.
If I type print(1:3)
in the iESS buffer (or in ESS buffer), Emacs hangs on pri for a while. The *ESS* buffer says:
current-prefix-arg=nil
(inferior-ess: waiting for process to start (before hook)
(inferior-ess 3): waiting for process after hookDisabling output delimiter because CMD failed to parse (ess-search-list ... )
Disabling output delimiter because CMD failed to parse (ess-search-list ... )
Disabling output delimiter because CMD failed to parseDisabling output delimiter because CMD failed to parse
And the *Messages* buffer says:
Messages while loading ESSR: + + + Error in .ess.ESSR.load("/home/username/.emacs.d/elpa/ess-20200522.920/etc/ESSR/R") :
could not find function ".ess.ESSR.load"
ess-command: Timeout during background ESS command options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient', show.error.locations=TRUE)
Error running timer ac-update-greedy : (error "Timeout during background ESS command search() ") [2 times]
Error running timer ac-update-greedy : (error "Timeout during background ESS command local({ r <- .ess_get_completions(\"1:\", 2, \" = \"); r[r != '...='] }) ")
"/home/username/.emacs.d/elpa/ess-20200522.920/etc/ESSR/R"
This path indicates that you are installing via package.el. Ensure that you have followed the directions here:
https://github.com/raxod502/straight.el/tree/develop#getting-started
And here if you are using use-package:
https://github.com/raxod502/straight.el/tree/develop#integration-with-use-package
Thanks progfolio for help. I think my straight setting is right:
;; use straight to manage packages
(setq package-enable-at-startup nil)
(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))
;; use straight to install use-package
(straight-use-package 'use-package)
And I have also set:
;; ensure automatically install pacakges once declared
;; (require 'use-package-ensure)
;; (setq use-package-always-ensure t)
By commenting the above two lines doesn't solve the problem.
I am not sure if the following setting may change anything:
;; automatically update package if needed
(use-package auto-package-update
:straight t
:config
(setq auto-package-update-delete-old-versions t)
(auto-package-update-maybe))
;;Update Emacs's GPG keyring for GNU ELPA
(use-package gnu-elpa-keyring-update
:straight t)
(use-package auto-package-update
This package was designed with package.el in mind. It will not work with straight.el in its current form.
You can update all packages using M-x straight-pull-all
followed by M-x straight-rebuild-all
.
(use-package gnu-elpa-keyring-update
Likewise this is not designed to be used with straight.el. I haven't vetted the source, but you should not need it if you are using straight.el for package management.
I have commented auto-package-update
and gnu-elpa-keyring-update
, and done M-x straight-pull-all
and M-x straight-rebuild-all
. But it doesn't solve the problem. So, I have to use the use-package to make it work.
(use-package ess
:defer t
:init
(require 'ess-r-mode))
Is this the current init file you are using?:
https://github.com/ghowoo/dot-emacs
If not, can you link to it?
Currently I set my init private. There are some settings relating to my work. Also, it is messy and I am trying to reorganize it. This is init.el:
;; use straight to manage packages
(setq package-enable-at-startup nil)
(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))
;; use straight to install use-package
(straight-use-package 'use-package)
(org-babel-load-file
(expand-file-name
(concat (pcase system-type
('windows-nt "windows")
((or 'gnu/linux 'darwin) "linux")
(_ (error "Uknown system-type: %s" system-type)))
"_init.org")
user-emacs-directory))
(org-babel-load-file (expand-file-name "myinit.org" user-emacs-directory))
And this is linux_init.org
:
(use-package doom-themes
:straight t
:config
;; Global settings (defaults)
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled
doom-themes-enable-italic t) ; if nil, italics is universally disabled
(load-theme 'doom-vibrant t)
;; Enable flashing mode-line on errors
(doom-themes-visual-bell-config)
;; Enable custom neotree theme (all-the-icons must be installed!)
(doom-themes-neotree-config)
;; or for treemacs users
(setq doom-themes-treemacs-theme "doom-colors") ; use the colorful treemacs theme
(doom-themes-treemacs-config)
;; Corrects (and improves) org-mode's native fontification.
(doom-themes-org-config))
(use-package all-the-icons :straight t)
;;; setup appearance
(set-frame-font "Ubuntu Mono 16")
;; projectile: project interaction
(use-package projectile
:straight t)
(projectile-mode +1)
(define-key projectile-mode-map (kbd "C-x p") 'projectile-command-map)
;; make yes/no prompts to y/n
(defalias 'yes-or-no-p 'y-or-n-p)
;; rewrite expand-regin with use-package
;; highlighted text being selected
(use-package expand-region
:straight t
:bind (("C-=" . 'er/expand-region)
("C--" . 'er/contract-region)))
;; replace selected words while editing, not work on iedit
(delete-selection-mode 1)
;; multiple selecting/editing
(use-package iedit :straight t)
;; popup kill ring
(use-package popup-kill-ring
:straight t
:bind ("M-y" . popup-kill-ring))
;; undo tree
(use-package undo-tree
:straight t
:init
(global-undo-tree-mode))
;;movetext
(use-package move-text :straight t)
(move-text-default-bindings)
;; set up convenient way to resize window
(global-set-key (kbd "S-C-<left>") 'shrink-window-horizontally)
(global-set-key (kbd "S-C-<right>") 'enlarge-window-horizontally)
(global-set-key (kbd "S-C-<down>") 'shrink-window)
(global-set-key (kbd "S-C-<up>") 'enlarge-window)
(use-package ivy
:straight t
:demand
:config
(setq ivy-use-virtual-buffers t
ivy-count-format "%d/%d "))
;; use swiper instead of default i-search
(use-package swiper
:straight t)
(global-set-key "\C-s" 'swiper)
;; enable ag
(use-package ag
:straight t)
;; hide trailing dots of header
(setq org-hide-emphasis-markers t)
;; Replace headline markers with unicode bullets
(use-package org-bullets
:straight t
:config
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))
;;make org-bullets not hang on (on Windows)
(setq inhibit-compacting-font-caches t)
(use-package org-ref
:straight t)
;; see org-ref for use of these variables
(setq org-ref-bibliography-notes "~/Dropbox/bibliography/notes.org"
org-ref-default-bibliography '("~/Dropbox/bibliography/references.bib")
org-ref-pdf-directory "~/Dropbox/bibliography/bibtex-pdfs/")
;;to enlarge the image of latex formula
(setq org-format-latex-options (plist-put org-format-latex-options :scale 2.0))
;; org babel;
(org-babel-do-load-languages
'org-babel-load-languages
'((R . t)))
(use-package ob-async
:straight t)
(add-hook 'org-babel-after-execute-hook 'org-display-inline-images)
(add-hook 'org-mode-hook 'org-display-inline-images)
(use-package ess
:defer t
:init
(require 'ess-r-mode))
;;Poly mode and Poly-markdown
(use-package poly-R
:straight t)
(use-package poly-markdown
:straight t)
(use-package poly-noweb
:straight t)
(use-package polymode
:straight t
:after (poly-markdown poly-noweb poly-R)
:init
(require 'polymode-core)
:mode
("\\.Rmd" . poly-markdown+r-mode)
("\\.rmd" . poly-markdown+r-mode)
("\\.md" . poly-markdown-mode)
("\\.Snw" . poly-noweb+r-mode)
("\\.Rnw" . poly-noweb+r-mode))
;;; ess view data.frame
(use-package ess-view
:straight t
:diminish)
;; set up some functions to stop ESS
(defun ess-abort ()
(interactive)
(interrupt-process (ess-get-process)))
(define-key ess-mode-map (kbd "C-c C-a") 'ess-abort)
(define-key inferior-ess-mode-map (kbd "C-c C-a") 'ess-abort)
(straight-use-package 'ein)
(use-package elpy
:straight t
:init
(elpy-enable)
)
(setq elpy-rpc-python-command "python3")
(setenv "IPY_TEST_SIMPLE_PROMPT" "1")
(setq python-shell-interpreter "ipython3"
python-shell-interpreter-args "-i")
(elpy-enable)
(dolist (hook '(text-mode-hook))
(add-hook hook (lambda () (flyspell-mode 1))))
(dolist (hook '(prog-mode-hook))
(add-hook hook (lambda () (flyspell-prog-mode 1))))
(use-package flyspell-correct
:straight t
:after flyspell
:bind (:map flyspell-mode-map ("C-M-;" . flyspell-correct-wrapper)))
(use-package flyspell-correct-ivy
:straight t
:after flyspell-correct)
(use-package auto-complete
:straight t);; set autocompletion
(global-auto-complete-mode t)
(ac-config-default)
(setq ac-use-quick-help nil);; disable open R help in browser
(setq ess-use-company nil);; disable company mode
;; Type the shortcut and press TAB to complete
;; Or M-/ to autoseggest a snippet
(use-package yasnippet
:straight t
:diminish yas-minor-mode
:config
(add-to-list 'yas-snippet-dirs "~/.emacs.d/snippets")
(yas-global-mode)
(global-set-key (kbd "M-/") 'company-yasnippet)
)
;; Set snippet with intended indents, otherwise being flat
(setq yas/indent-line 'fixed)
;; password for Tramp plink
(use-package tramp
:straight t)
(setq tramp-default-method "plink")
(setq password-cache-expiry nil)
(with-eval-after-load 'tramp-sh
(add-to-list 'tramp-remote-path 'tramp-own-remote-path))
(add-hook 'after-init-hook
'(lambda ()
(if (member "." load-path)
(delete "." load-path))))
;; add magit key
(straight-use-package 'magit)
(global-set-key (kbd "C-x g") 'magit-status)
(setq
backup-by-copying t ; don't clobber symlinks
kept-new-versions 10 ; keep 10 latest versions
kept-old-versions 0 ; don't bother with old versions
delete-old-versions t ; don't ask about deleting old versions
version-control t ; number backups
vc-make-backup-files t) ; backup version controlled files
(defvar backup-location (expand-file-name "~/emacs-backups")
"Base directory for backup files.")
(setq backup-directory-alist
`(("" . ,(expand-file-name "per-save" backup-location))))
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq TeX-save-query nil)
(setq TeX-PDF-mode t)
(use-package imenu-list
:straight t
:bind (("C-'" . imenu-list-smart-toggle))
:config
(setq imenu-list-focus-after-activation t
imenu-list-auto-resize nil))
(defun clear-shell ()
(interactive)
(let ((old-max comint-buffer-maximum-size))
(setq comint-buffer-maximum-size 0)
(comint-truncate-buffer)
(setq comint-buffer-maximum-size old-max)))
(global-set-key (kbd "\C-x l") 'clear-shell)
and this is myinit: (I follow progfolio to make the format suitable to github)
(use-package diminish
:straight t
:defer 5
:config
(diminish 'global-visual-line-mode)
)
(setq display-time-24hr-format t)
(display-time-mode +1)
;; Disable the splash screen (to enable it again, replace the t with 0)
(setq inhibit-splash-screen t)
;; hide toolbar and scrollbar
(tool-bar-mode 0)
(scroll-bar-mode 0)
;; setup highlight current line
(global-hl-line-mode +1)
;; word wrap: each long logical line is divided into two or more screen lines
;; at word boundaries near the right window edge
(global-visual-line-mode t)
;;; show line numbers
(global-linum-mode t)
;; show x-position (ie column number) for point in buffer
(column-number-mode 1)
;; show percentage of file size on the line;
(size-indication-mode t)
which key mode, after input C-x, after 1 second, the mini-buffer show all possible commands
(use-package which-key
:straight t
:init
(which-key-mode)
(which-key-setup-minibuffer))
;;map C-k to kill-line, it was remapped to kill-visual-line
(global-set-key (kbd "C-k") 'kill-line)
(show-paren-mode 1) ; turn on paren match highlighting
(setq show-paren-style 'expression) ; highlight entire bracket expression
;; use smartparens, deminish is to not show mode on mode-line
(use-package smartparens
:straight t
:diminish
:config
(add-hook 'prog-mode-hook 'smartparens-mode)
)
;; make color names such as "#FF0000" colorful
(use-package rainbow-mode
:straight t
:diminish
:init
(rainbow-mode t))
;; make parentheses colorful
(use-package rainbow-delimiters
:straight t
:diminish
:init
(rainbow-delimiters-mode t)
)
(add-hook 'prog-mode-hook 'rainbow-mode)
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
;; add space around operators
(use-package electric-operator
:straight t
:init
(electric-operator-mode t)
)
(add-hook 'ess-r-mode-hook 'electric-operator-mode)
;; specify some special operators
;; (electric-operator-add-rules-for-mode 'ess-r-mode
;; (cons "->" " -> ")
;; (cons "=>" " => ")
;; (cons "=>" " => ")
;; (cons "=<==" " <= ")
;; (cons "<" " < ")
;; (cons "<-" " <- ")
;; (cons ":=" " := ")
;; (cons "=" " = ")
;; (cons "%notin%" " %notin% ")
;; )
;; direct-narrow, filter within dired, key "/", then input filter
(use-package dired-narrow
:straight t
:bind (:map dired-mode-map
("/" . dired-narrow)))
;; recent directory
;;C-x C-d to select a previously visited directory to open
(use-package dired-recent
:straight t
:config
(dired-recent-mode 1)
)
;; dired sub-tree, key tab on a folder to show subfolders and files
(use-package dired-subtree
:straight t
:diminish
:after dired
:config
(bind-key "<tab>" #'dired-subtree-toggle dired-mode-map)
)
;; treemacs, a treelike window shows directory
(use-package s
:straight t)
(use-package treemacs
:straight t
:bind
(:map global-map
([f8] . treemacs)))
Emacs to automatically update a buffer if a file changes on disk and auto refresh dired when file changes.
(global-auto-revert-mode 1)
(add-hook 'dired-mode-hook 'auto-revert-mode)
(setq save-place-mode nil)
(setq save-place-local_mode nil)
(use-package restart-emacs
:straight t)
;;; show recent files and set up shortcut
(use-package recentf
:straight t
:diminish)
(recentf-mode 1)
(setq recentf-max-saved-items 50)
(setq recentf-max-menu-items 50)
;;; set save list every 10 minutes
(run-at-time nil (* 10 60) 'recentf-save-list)
(global-set-key "\C-x\ \C-r" 'recentf-open-files)
;; provent files from elpa folder showing
;;(add-to-list 'recentf-exclude (format "%s/([^\s]+)\/\\.emacs\\.d/elpa/.*" (getenv "HOME")))
;;(setq recentf-exclude '("c:/\\.emacs/\\.emacs\\.d/elpa/"));; M-x recentf-cleanup to remove excluded files
(setq recentf-exclude '("c:/([^\s]+)/\\.emacs\\.d/elpa/"));; M-x recentf-cleanup to remove excluded files
;;(setq recentf-exclude '("\/home\/([^\s]+)\/\.emacs\.d\/documents\/brain\/"
;; "^\/home\/([^\s]+)\/\.emacs\.d\/documents\/brain\/" ))
;; startup with recent file buffer
(use-package init-open-recentf
:straight t
:diminish
:config
(init-open-recentf))
let ivy use posframe to show its candidate menu
;; (use-package ivy-posframe
;; :ensure t
;; :diminish
;; )
;; (setq ivy-posframe-height-alist '((swiper . 20)
;; (t . 20)))
;; (setq ivy-posframe-display-functions-alist
;; '((swiper . ivy-display-function-fallback)
;; (complete-symbol . ivy-posframe-display-at-point)
;; (counsel-M-x . ivy-posframe-display-at-window-bottom-left)
;; (t . ivy-posframe-display)))
;; (ivy-posframe-mode nil)
(use-package eldoc
:straight t
:delight
:hook (emacs-lisp-mode . eldoc-mode)
)
(use-package css-mode
:custom (css-indent-offset 2))
(use-package csv-mode)
I've edited your comments to make them a little more readable. In the future please either use markdown or, better yet, link to a file sharing host such as https://gist.github.com/ or pastebin for whole files.
What I would do is remove the folder at /home/username/.emacs.d/elpa/
and restart Emacs.
Straight should install missing packages if you have it configured correctly.
If the elpa
folder reappears, you are still using package.el.
If it doesn't and you hit another error, it's likely that you have misconfigured your packages in your init.el.
Unfortunately, I do not have much time to comb through your init, but if you hit a specific error after trying the above you can copy the entire backtrace for that error here and someone may be able to help you in the future.
Thanks Progolio. I removed the elpa folder, restarted Emacs, and this time worked. It is very interesting.
(use-package ess
:straight t
:init (require 'ess-site))
Yeah. If you're using Emacs 27 or later, you'll need to put (setq package-enable-at-startup nil)
into ~/.emacs.d/early-init.el
, or else your package.el
packages will already be loaded by time the normal init-file is loaded. The alternative is simply deleting all your package.el
packages (in ~/.emacs.d/elpa
), so that loading them has no effect.
I tried to use straight for all packages including ESS. However, it has problems with ESS. I am not sure what is wrong with my setting or with ESS or with straight.
This works: (use-package ess :defer t :init (require 'ess-r-mode) )
This cause Emacs to hang on r processing and gives ESSR loading error: (use-package ess :straight t :init (require 'ess-site) )
Thanks.