I have a :dev profile set up in my leiningen project file. This defines an :init and :init-ns setting for my repl session. If I launch nrepl in emacs (M-x nrepl-jack-in) with the cursor over the :dev keyword in my project.clj, the repl launches and the :init and :init-ns settings are used. If I have my cursor elsewhere, the initial namespace is different (a test ns, not user), and :init hasn't been evaluated.
I'm guessing it's a feature of some sort, (I'm more inclined to think it's random buggy behaviour now) but can anyone explain it or point me at the docs that do so? Also, is there any way to change the profile once the repl's been launched?
Thanks
Contrary to what commenter #user7610 said, there is no cider-jack-in-with-profile function in cider. Cider pull-request #544 was a bit misleading in that regard.
If you want cider to load your own special-snowflake profile do this in emacs:
M-x set-variable cider-lein-parameters to e.g. with-profile +my-special-snowflake repl :headless
or to set the variable interactively (so you can see it's current value before changing it):
C-h, v cider-lein-parameters and then click or hit enter on "customize" and set it there to e.g. with-profile +my-special-snowflake repl :headless and apply it
That'll cause your next cider-jack-in to load the my-special-snowflake profile in addition to the base profile (which is needed in order to run the nrepl and hence cider).
Try this:
(defun start-cider-repl-with-profile ()
(interactive)
(letrec ((profile (read-string "Enter profile name: "))
(lein-params (concat "with-profile +" profile " repl :headless")))
(message "lein-params set to: %s" lein-params)
(set-variable 'cider-lein-parameters lein-params)
(cider-jack-in)))
Test on CIDER 0.16.0 (Riga)
I'm just searching the same feature and found this open issue in clojure-emacs/nrepl.el "Add argument to nrepl-jack-in to allow specification of profiles" https://github.com/clojure-emacs/nrepl.el/issues/327
it is still open
I try the function author by Jiacai Liu in my computer(GNU Emacs 26.2 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109)) of 2019-04-13) . I get a error is:
eval-region: Wrong number of arguments: (1 . 1), 0
And then, I try to elisp function as:
(defun start-cider-repl-with-profile ()
(interactive)
(letrec ((profile (read-string "Enter profile name: "))
(lein-params (concat "with-profile +" profile " repl :headless")))
(message "lein-params set to: %s" lein-params)
(set-variable 'cider-lein-parameters lein-params)
(cider-jack-in '())))
Now it work. Thanks for Jiacai Liu!
Related
I use undo-tree 0.6.5 (from Elpa), and it works quite well most of the time. However, if I have not yet called C-x-u on a buffer, then from this buffer I can't open a new frame. If I do C-x-5-2, Emacs opens the `Backtrace buffer with this:
Debugger entered--Lisp error: (wrong-type-argument undo-tree nil)
signal(wrong-type-argument (undo-tree nil))
undo-tree-current(nil)
(undo-tree-node-previous (undo-tree-current buffer-undo-tree))
(and undo-tree-mode (not buffer-read-only) (not (eq t buffer-undo-list)) (undo-tree-node-previous (undo-tree-current buffer-undo-tree)))
x-create-frame(((visibility) (vertical-scroll-bars . left) (reverse . t)))
x-create-frame-with-faces(((vertical-scroll-bars . left) (reverse . t)))
#f(compiled-function (params) #<bytecode 0x1fdd4b1bc7bf>)(((vertical-scroll-bars . left) (reverse . t)))
apply(#f(compiled-function (params) #<bytecode 0x1fdd4b1bc7bf>) ((vertical-scroll-bars . left) (reverse . t)))
frame-creation-function(((vertical-scroll-bars . left) (reverse . t)))
make-frame()
make-frame-command()
funcall-interactively(make-frame-command)
call-interactively(make-frame-command nil nil)
command-execute(make-frame-command)
Then, I do C-x-u so the undo-tree buffer related to that buffer is created, and from then on I can create other frames.
Is there a workaround for this?
edit: it also prevents the use of menus. When I try to click on any menu item, the same message shows up.
edit: opening Emacs with this minimalistic startup file gives the same error:
(add-to-list 'load-path
"~/.emacs.d/elpa/undo-tree-0.6.5")
(require 'undo-tree)
(global-undo-tree-mode)
(setq debug-on-error t)
Okay, so I got it working. I was using the ELPA version of undo-tree, which is version 0.6.5. So a couple of days ago I noticed that the developer has a new version in his git repository, 0.6.6. I installed it locally and the problem was gone!
First, get a copy of the git repository:
$ cd ~/.emacs.d
$ git clone http://www.dr-qubit.org/git/undo-tree.git
Then add this to your Emacs config:
(load "~/.emacs.d/undo-tree/undo-tree.el")
(require 'undo-tree)
(global-undo-tree-mode)
When I try to edit an Arduino Sketch (*.ino file), I get this error:
Eval error in the ‘c-lang-defconst’ for ‘c-constant-kwds’ in arduino-mode:
Eval error in the ‘c-lang-defconst’ for ‘c-basic-matchers-before’ in arduino-mode:
Eval error in the ‘c-lang-defconst’ for ‘c-matchers-2’ in arduino-mode:
File mode specification error: (invalid-function (append (quote (HIGH LOW INPUT OUTPUT INPUT_PULLUP LED_BUILTIN true false)) (c-get-lang-constant (quote c-constant-kwds) (quote (cc-langs)))))
This happens even on the stock examples->basic->Blink.ino file.
My .emacs.d/init.el file contains these lines:
(setq auto-mode-alist (cons '("\\.\\(pde\\|ino\\)$" . arduino-mode) auto-mode-alist))
(autoload 'arduino-mode "arduino-mode" "Arduino editing mode." t)
I can't find a 'c-matchers-2' file.
This is Emacs 26.1.
Can anyone point me in a direction to fix this error?
Thanks in advance for your help and advice.
-Kevin
#nega, you were right, it was a version issue. When I used M-x list-packages, I saw I had installed version 20151017.2335, and the most current was 20180509.36 by stardivirer. arduino-mode packages are in the melpa repository.
Thanks so much for your help in pointing me in the right direction.
-Kevin
Using the following use-package syntax, Org-journal doesn't recognize the org-journal-dir setting--instead, attempts to create a different directory with query Journal directory ~/Documents/journal not found. Create one?:
(use-package org-journal
:ensure t
:custom
(setq org-journal-dir "~/Dropbox/logs/journal/")
(setq org-journal-file-format "%m.%d.%Y.org"))
I see no error messages--it just seems to ignore the directory setting. Is this a simple syntax error? I'm new to the package and to Org mode.
[Update]: Sometimes, I get the following error message on Emacs start:
Error (use-package): org-journal/:catch: Symbol’s value as variable is void: org-journal-dir
The syntax for :custom is wrong. See https://github.com/jwiegley/use-package#customizing-variables. It should be something like:
:custom
(org-journal-dir "~/Dropbox/logs/journal/")
(org-journal-file-format "%m.%d.%Y.org")
Either that, or use :config (or maybe :init, but probably not) with setq:
:config
(setq org-journal-dir "~/Dropbox/logs/journal/")
(setq org-journal-file-format "%m.%d.%Y.org")
I've added this code snippet to my stumpwmrc file:
(defun load-swank ()
"Load a swank server"
(ql:quickload 'swank)
(require 'swank)
(setq swank:*use-dedicated-output-stream* nil)
(setq slime-net-coding-system 'utf-8-unix)
(swank:create-server :port 4006))
(load-swank)
I am expecting to open a socket server, accepting the "swank" protocol. Thus I could connect to it with emacs (thanks to Slime).
But when I login and and stumpwm is reading its configuration file, here is the error message I get:
15:00:34 Outputting a message:
^B^1*Error loading ^b/home/ybaumes/.stumpwmrc^B: ^nThe name "SWANK" does not designate any package.
How can I fix that? I invoke 'require, or even 'quickload functions. What's the issue here?
A typical error is this:
You load the file and the reader sees the code:
SWANK is not loaded
(defun load-swank ()
"Load a swank server"
SWANK is not loaded
(ql:quickload 'swank)
SWANK is not loaded - remember, we are still reading the form.
(require 'swank)
SWANK is not loaded - remember, we are still reading the form.
Now use us a symbol in package which is not existing... the reader complains:
(setq swank:*use-dedicated-output-stream* nil) ; the package SWANK does not exist yet.
(setq slime-net-coding-system 'utf-8-unix)
(swank:create-server :port 4006))
Now you want to load SWANK:
(load-swank)
You can't use a symbol from a package which does not exist.
For example what works is this inside the function:
(setf (symbol-value (read-from-string "swank:*use-dedicated-output-stream*")) nil)
and so on.
You need to find the symbol at runtime of that function. Use (find-symbol "FOO" "SWANK") (remember Common Lisp is upcase internally) or (read-from-string "SWANK::FOO").
I'm trying to use emacs with preview-latex (C-c C-p C-b) to view my document. First a minimal example of my document:
\documentclass {article}
\usepackage{minted}
\begin{document}
\begin{listing}[H]
\begin{minted}{sql}
Select * from FOOBAR;
\end{minted}
\caption{Test Query}
\label{code:query}
\end{listing}
\end{document}
I already tried using Using minted (source code LaTeX package) with emacs/auctex the following answer but it does not seem to work with preview-latex.
I get the following error message:
! Package minted Error: You must invoke LaTeX with the -shell-escape flag.
So I changed my latex-mode-hook to the following:
(defun kungi/latex-mode-hook ()
(turn-on-flyspell)
(auto-complete-mode 1)
(turn-on-reftex)
(turn-on-auto-fill-mode)
(push
'("Latexmk" "latexmk -pdf %s" TeX-run-TeX nil t
:help "Run Latexmk on file")
TeX-command-list)
(eval-after-load "tex"
'(setcdr (assoc "LaTeX" TeX-command-list)
'("xelatex -shell-escape %t"
TeX-run-TeX nil (latex-mode doctex-mode) :help "Run LaTeX")))
(add-hook 'LaTeX-mode-hook
'kungi/latex-mode-hook)
Can you please tell me what I am doing wrong? Is it possible to use minted with preview latex?
I am using VIM with the LaTeX_Box plugin and I ran into a similar issue getting the very same error message. I could solve it by simply putting a file with the following contents to ~/.latexmkrc
$latex = 'latex --shell-escape';
$pdflatex = 'pdflatex --shell-escape';