Closed cwcartmell closed 3 years ago
SPC m
works in a .r
file on the Spacemacs develop
branch.
The issue on the master
branch seems to be that the key bindings are defined under:
https://github.com/syl20bnr/spacemacs/blob/26b8fe0c317915b622825877eb5e5bdae88fb2b2/layers/%2Blang/ess/packages.el#L64
On the develop
branch the key bindings are defined under:
https://github.com/syl20bnr/spacemacs/blob/fdd38eec9b7bcb5ed92404d3c30401791808e968/layers/%2Blang/ess/packages.el#L62
and then they are called with: https://github.com/syl20bnr/spacemacs/blob/fdd38eec9b7bcb5ed92404d3c30401791808e968/layers/%2Blang/ess/packages.el#L137-L138
This workaround might work:
When the snippet below (from the develop
branch) is copied and pasted to the dotspacemacs/user-config
section of .spacemacs
, with Spacemacs on the master
branch.
;; R --------------------------------------------------------------------------
(setq spacemacs/ess-config
'(progn
;; Follow Hadley Wickham's R style guide
(setq ess-first-continued-statement-offset 2
ess-continued-statement-offset 0
ess-expression-offset 2
ess-nuke-trailing-whitespace-p t
ess-default-style 'DEFAULT)
(define-key ess-doc-map "h" 'ess-display-help-on-object)
(define-key ess-doc-map "p" 'ess-R-dv-pprint)
(define-key ess-doc-map "t" 'ess-R-dv-ctable)
(dolist (mode '(ess-julia-mode ess-r-mode))
(spacemacs/declare-prefix-for-mode mode "ms" "repl")
(spacemacs/declare-prefix-for-mode mode "mh" "help")
(spacemacs/declare-prefix-for-mode mode "mr" "extra")
(spacemacs/declare-prefix-for-mode mode "mw" "pkg")
(spacemacs/declare-prefix-for-mode mode "md" "dev")
(spacemacs/declare-prefix-for-mode mode "mc" "noweb")
(spacemacs/set-leader-keys-for-major-mode
mode
"," 'ess-eval-region-or-function-or-paragraph-and-step
"'" 'spacemacs/ess-start-repl
"si" 'spacemacs/ess-start-repl
"ss" 'ess-switch-to-inferior-or-script-buffer
"sS" 'ess-switch-process
;; REPL
"sB" 'ess-eval-buffer-and-go
"sb" 'ess-eval-buffer
"sd" 'ess-eval-region-or-line-and-step
"sD" 'ess-eval-function-or-paragraph-and-step
"sL" 'ess-eval-line-and-go
"sl" 'ess-eval-line
"sR" 'ess-eval-region-and-go
"sr" 'ess-eval-region
"sF" 'ess-eval-function-and-go
"sf" 'ess-eval-function
;; predefined keymaps
"h" 'ess-doc-map
"r" 'ess-extra-map
"w" 'ess-r-package-dev-map
"d" 'ess-dev-map
;; noweb
"cC" 'ess-eval-chunk-and-go
"cc" 'ess-eval-chunk
"cd" 'ess-eval-chunk-and-step
"cm" 'ess-noweb-mark-chunk
"cN" 'ess-noweb-previous-chunk
"cn" 'ess-noweb-next-chunk))
(dolist (mode '(inferior-ess-mode))
(spacemacs/declare-prefix-for-mode mode "ms" "repl")
(spacemacs/declare-prefix-for-mode mode "me" "eval")
(spacemacs/declare-prefix-for-mode mode "mg" "xref")
(spacemacs/declare-prefix-for-mode mode "mh" "help")
(spacemacs/declare-prefix-for-mode mode "mr" "extra")
(spacemacs/declare-prefix-for-mode mode "mw" "pkg")
(spacemacs/declare-prefix-for-mode mode "md" "dev")
(spacemacs/set-leader-keys-for-major-mode
mode
"," 'ess-smart-comma
"ss" 'ess-switch-to-inferior-or-script-buffer
;; predefined keymaps
"h" 'ess-doc-map
"r" 'ess-extra-map
"w" 'ess-r-package-dev-map
"d" 'ess-dev-map))
(define-key ess-mode-map (kbd "<s-return>") 'ess-eval-line)
(define-key inferior-ess-mode-map (kbd "C-j") 'comint-next-input)
(define-key inferior-ess-mode-map (kbd "C-k") 'comint-previous-input)))
(eval-after-load "ess-r-mode" spacemacs/ess-config)
(eval-after-load "ess-julia" spacemacs/ess-config)
And Spacemacs is restarted. Then SPC m
works in a .r
file.
The snippet is almost the same as on the develop branch. The following section was just removed:
(when ess-assign-key
(define-key ess-r-mode-map ess-assign-key #'ess-insert-assign)
(define-key inferior-ess-r-mode-map ess-assign-key #'ess-insert-assign))
Because Spacemacs said that it couldn't find ess-assign-key
.
By copying the snipet under user-config does not work for me. It throws this error:
File mode specification error: (wrong-type-argument integer-or-marker-p ess-eval-buffer)
It still works for me on the master
branch with updated packages.
After adding the:
;; R -------------------------------------------------------------------------- (setq spacemacs/ess-config '(progn ;; Follow Hadley Wickham's R style guide (setq ess-first-continued-statement-offset 2 ess-continued-statement-offset 0 ess-expression-offset 2 ess-nuke-trailing-whitespace-p t ess-default-style 'DEFAULT) (define-key ess-doc-map "h" 'ess-display-help-on-object) (define-key ess-doc-map "p" 'ess-R-dv-pprint) (define-key ess-doc-map "t" 'ess-R-dv-ctable) (dolist (mode '(ess-julia-mode ess-r-mode)) (spacemacs/declare-prefix-for-mode mode "ms" "repl") (spacemacs/declare-prefix-for-mode mode "mh" "help") (spacemacs/declare-prefix-for-mode mode "mr" "extra") (spacemacs/declare-prefix-for-mode mode "mw" "pkg") (spacemacs/declare-prefix-for-mode mode "md" "dev") (spacemacs/declare-prefix-for-mode mode "mc" "noweb") (spacemacs/set-leader-keys-for-major-mode mode "," 'ess-eval-region-or-function-or-paragraph-and-step "'" 'spacemacs/ess-start-repl "si" 'spacemacs/ess-start-repl "ss" 'ess-switch-to-inferior-or-script-buffer "sS" 'ess-switch-process ;; REPL "sB" 'ess-eval-buffer-and-go "sb" 'ess-eval-buffer "sd" 'ess-eval-region-or-line-and-step "sD" 'ess-eval-function-or-paragraph-and-step "sL" 'ess-eval-line-and-go "sl" 'ess-eval-line "sR" 'ess-eval-region-and-go "sr" 'ess-eval-region "sF" 'ess-eval-function-and-go "sf" 'ess-eval-function ;; predefined keymaps "h" 'ess-doc-map "r" 'ess-extra-map "w" 'ess-r-package-dev-map "d" 'ess-dev-map ;; noweb "cC" 'ess-eval-chunk-and-go "cc" 'ess-eval-chunk "cd" 'ess-eval-chunk-and-step "cm" 'ess-noweb-mark-chunk "cN" 'ess-noweb-previous-chunk "cn" 'ess-noweb-next-chunk)) (dolist (mode '(inferior-ess-mode)) (spacemacs/declare-prefix-for-mode mode "ms" "repl") (spacemacs/declare-prefix-for-mode mode "me" "eval") (spacemacs/declare-prefix-for-mode mode "mg" "xref") (spacemacs/declare-prefix-for-mode mode "mh" "help") (spacemacs/declare-prefix-for-mode mode "mr" "extra") (spacemacs/declare-prefix-for-mode mode "mw" "pkg") (spacemacs/declare-prefix-for-mode mode "md" "dev") (spacemacs/set-leader-keys-for-major-mode mode "," 'ess-smart-comma "ss" 'ess-switch-to-inferior-or-script-buffer ;; predefined keymaps "h" 'ess-doc-map "r" 'ess-extra-map "w" 'ess-r-package-dev-map "d" 'ess-dev-map)) (define-key ess-mode-map (kbd "") 'ess-eval-line) (define-key inferior-ess-mode-map (kbd "C-j") 'comint-next-input) (define-key inferior-ess-mode-map (kbd "C-k") 'comint-previous-input))) (eval-after-load "ess-r-mode" spacemacs/ess-config) (eval-after-load "ess-julia" spacemacs/ess-config)
to the dotspacemacs/user-config
section and restarting Spacemacs.
When I open this file: r-example.r
a <- 42
A <- a * 2 # R is case sensitive
print(a)
cat(A, "\n") # "84" is concatenated with "\n"
if(A>a) # true, 84 > 42
{
cat(A, ">", a, "\n")
}
Then SPC m
shows the key bindings.
#### System Info :computer: - OS: windows-nt - Emacs: 26.3 - Spacemacs: 0.200.13 - Spacemacs branch: master (rev. 26b8fe0c3) - Graphic display: t - Distribution: spacemacs - Editing style: vim - Completion: helm - Layers: ```elisp (autohotkey command-log emacs-lisp ess git helm imenu-list javascript (markdown :variables markdown-live-preview-engine 'vmd markdown-command "vmd") multiple-cursors org pdf python (shell :variables shell-default-shell 'shell shell-default-height 30 shell-default-position 'bottom) spell-checking syntax-checking treemacs version-control) ``` - System configuration features: XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS THREADS LCMS2
It might be best to switch to the develop
branch, it's the recommended branch until the next version is released.
Here's the develop branch changelog: https://github.com/syl20bnr/spacemacs/blob/develop/CHANGELOG.develop
develop
branch:Backup your current setup and make sure that there isn't a .emacs.d
directory or a .spacemacs
file in your home directory. Then navigate to your home directory in a terminal (or command prompt) and clone directly to the develop
branch with:
git clone -b develop https://github.com/syl20bnr/spacemacs .emacs.d
I'm getting this and I'm on develop.
There is no spacemacs/ess-config
in running emacs, or in .emacs.d
Update: reinstalling ESS layer brought back major mode keybindings, but not ess-assign-key
Update II: you may need to use the vector representation of a hotkey for ess-assign-key
.
In my case I want to use C-'
, so I did:
(setq ess-assign-key [?\C-'])
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!
Description :octocat:
ESS major mode keybindings are missing. I've found other similar issues, but none that solve the problem for me. https://github.com/syl20bnr/spacemacs/issues/11831 https://github.com/syl20bnr/spacemacs/issues/11371 . It looks like this has been fixed in the past but has become broken again.
Reproduction guide :beetle:
Observed behaviour: :eyes: :broken_heart: "SPC m is undefined"
Expected behaviour: :heart: :smile: The ESS major mode keybindings appear.
System Info :computer:
Backtrace :paw_prints: