Fork me on GitHub
#emacs
<
2016-12-09
>
thegeez13:12:17

Hi, when I do C-u C-x C-e the result is put into the buffer next to what I just evaluated. If I do C-x C-e the result is in the mini-buffer and will disappear from the buffer on the next action. Is there a key combo to insert the result into the buffer after doing C-x C-e?

hlolli13:12:58

wow, don't have the answer but thanks for sharing this C-u C-x C-e trick

dpsutton14:12:23

M-x eval-print-last-sexp

thegeez14:12:36

@dpsutton using that lands me in a debugger backtrace buffer

dpsutton14:12:07

are you evaluating clojure or emacs lisp code

thegeez14:12:17

it works for (+ 3 4) but not for (or (println "evalling") :xyz)

dpsutton14:12:25

because the former is valid elisp

dpsutton14:12:30

its an elisp evaluation

dpsutton14:12:40

i saw emacs channel i thought you wanted to eval emacs lisp

thegeez14:12:36

Ah yes, I meant for clojure code. Although if there is a common way to refer to the last output in the minibuffer then that might work for both

dpsutton14:12:28

cider-eval-last-sexp-to-repl (C-c M-e)

dpsutton14:12:35

does that meet your needs?

dpsutton14:12:18

cider-eval-defun-to-comment C-c M-;

dpsutton14:12:22

looks handy as well

thegeez14:12:45

those are helpful, but both seem to do the evaluation again. My use case is more for "crap, I lost the output of that long running operation"

dpsutton15:12:36

oh i think i misunderstood your original intent

dpsutton15:12:39

what are you looking to do?

thegeez15:12:08

Oh I see that the results are also in the Messages buffer, that is helpful too

thegeez15:12:56

Well sometimes I do C-x C-e when I wanted to do C-u C-x C-e, so I want to be able to have the output somewhere after running something

dpsutton15:12:03

so you want to save the output of code?

dpsutton15:12:17

maybe bind the print to repl one to a convenient shortcut?

dpsutton15:12:23

and always stick it out to the repl?

thegeez15:12:52

For me it works to use C-u C-x C-e and if I do C-x C-e instead I now know that I can lookup and paste the result from the Messages buffer. That works for me

thegeez15:12:55

I use this when adding a (comment ..) section in a clojure file and trying out some things in there to see how code works.

christianromney23:12:10

can someone answer a really stupid question for me please? 🙂 is there a standard elisp package / lib providing the function “first” that I ought to know about? I know I can just use “car” or define my own. but a couple of packages I have seem almost to expect that it be there. tia

christianromney23:12:32

something like dash.el but which contains things like first, last, butlast, etc

dpsutton23:12:59

/usr/local/share/emacs/26.0.50/lisp/emacs-lisp/cl.elc (defalias first) /usr/local/share/emacs/26.0.50/lisp/emacs-lisp/cl-lib.el (defun cl-first)

dpsutton23:12:11

looks like the cl and cl-lib are what you're looking for

dpsutton23:12:17

not sure how to ensure they are imported

christianromney23:12:04

i didn’t really know how to formulate the question for google “elisp first function” gets misinterpreted

dpsutton23:12:28

luckily i had that package in my environment, so i just went to its definition

dpsutton23:12:32

and it had those two options

dpsutton23:12:34

the alias and defun

christianromney23:12:34

pretty sure now that you mention it that i’ve seen (require ‘cl) before

dpsutton23:12:44

there's weird stuff like require on compile

dpsutton23:12:46

and some other weird stuff

dpsutton23:12:54

and the emacs crew don't like cl, even though everyone uses it

dpsutton23:12:58

i'm not really sure

christianromney23:12:22

man, really thanks, lol. this was really irritating me 🙂

christianromney23:12:38

you’ve contributed to the net happiness in the universe

dpsutton23:12:31

well, i didn't hold the door open for someone coming into the coffee shop so this just makes the universe net even again

christianromney23:12:58

well, you have restored balance to the force

christianromney23:12:42

@dpsutton don’t suppose you have function* ?

christianromney23:12:47

i’m trying to run 4clojure mode and getting errors for a bunch of missing defs

dpsutton23:12:55

function* ?

dpsutton23:12:36

they should bring in their own dependencies

dpsutton23:12:45

cl-macs.el is the file you are looking for it seems

christianromney23:12:14

thanks again. yeah, 4clojure mode depends explicitly on json and request but apparently assumes cl and cl-macs

christianromney23:12:34

i may file an issue after i ascertain that i’m not the bozo