reddit / emacs

Not able to run .rkt file in emacs with racket-mode, getting an error

TheCarlosTovias · 2022-04-09 00:17
I'm a first time emacs user, literally just downloaded it today via [https://emacsformacosx.com](https://emacsformacosx.com). Anyways, I am trying to create and run racket files with the editor and racket-mode. I've done everything from these two links below: [https://www.racket-mode.com](https://www.racket-mode.com) [https://www.linw1995.com/en/blog/Write-Racket-With-Emacs/](https://www.linw1995.com/en/blog/Write-Racket-With-Emacs/) ​ The problem that I am getting is that when I m-x and "racket-run", I get the following error: "Wrong type argument: string, nil". ​ Here is my ".emacs" config file that I created: (require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) ;;; Package manager ;; Bootstrapping straight.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)) ;; Integration with use-package (straight-use-package 'use-package) ;;; Theme Config (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-one-light 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)) ;;; Dashboard (use-package dashboard :straight t :config (dashboard-setup-startup-hook)) (use-package racket-mode :straight t :hook (racket-mode . racket-xp-mode)) ;;; GUI Config (when (eq system-type 'darwin) ;; Make the title bar and toolbar to be transparent. (add-to-list 'default-frame-alist '(ns-transparent-titlebar . t)) (add-to-list 'default-frame-alist '(ns-appearance . dark)) ;; Change the opacity of the frame. (add-to-list 'default-frame-alist '(alpha . (80 . 75)))) ;; Disable dialog box (setq use-file-dialog nil use-dialog-box nil) ;; Hide toolbar (when (fboundp 'tool-bar-mode) (tool-bar-mode -1)) ;; Hide scrollbar (when (fboundp 'set-scroll-bar-mode) (set-scroll-bar-mode nil)) (setq racket-program (executable-find "Racket")) ;;; Shell Configure ;; Ensure environment variables inside Emacs ;; look the same as in the user's shell. (use-package exec-path-from-shell :straight t :if (memq window-system '(mac ns)) :config (exec-path-from-shell-initialize))
bhrgunatha · 2022-04-09 08:54
[Pretty sure the mac version of racket uses lower case for the executable](https://www.reddit.com/r/Racket/comments/tzh6l3/not_able_to_run_rkt_file_in_emacs_with_racketmode/i3zx7pr/) Try this instead: (use-package racket-mode :straight t :hook (racket-mode . racket-xp-mode) :config (setq racket-program (executable-find "racket"))) If that doesn't work (e.g. if you've installed racket somewhere emacs can't find it) then you need to find the path directly from your OS.
TheCarlosTovias · 2022-04-09 13:36
THANK YOU SO MUCH. It seemed moving my setting of racket-program and changing it to lower case solved it! Much appreciated.