Fork me on GitHub
#emacs
<
2017-05-26
>
norman14:05:27

When I C-c C-f in cider (cider-pprint-eval-defun-at-point) It opens a popup buffer without selecting it.

norman14:05:51

If I’m only editing a clojure file, the popup buffer appears to the side and I can just C-x 1 to make my edit buffer on top

norman14:05:41

However, if I have a clojure file and (for example) a repl open and my emacs is very big then the clojure window will split in two leaving me with three emacs sections

norman14:05:26

editor and popup buffer on top, repl on bottom. To close the popup buffer, I have to C-x o and then q

norman14:05:00

That strikes me as the kind of thing I should be able to do more easily. Any ideas?

norman14:05:08

Obviously I can trivially macro that and bind it to a key, but I’m wondering if there’s a more emacs way to say “close to the most recently opened thing, even if it’s not selected”

dpsutton14:05:22

so i don't think that there is anything for this, but i think we could easily make it

dpsutton14:05:35

digging through that call stack, it eventually hits cider-make-popup-buffer

dpsutton14:05:47

and marks it with this: (cider-popup-buffer-mode 1)

dpsutton14:05:01

so it looks like something along the lines of

dpsutton14:05:43

(mapc #'kill-buffer (seq-filter #(lambda (b) (derived-mode b 'cider-popup-buffer-mode)) (buffer-list))

dpsutton14:05:11

obviously this syntax is wrong but that's the general idea. loop over all buffers and kill the ones which have cider-popup-buffer-mode

norman14:05:47

Thanks - I’ll look at that later when I’m back on on the big monitor and it hits me again

norman14:05:13

I guess maybe I could also see if cider could just make sure that buffer is selected so I could just exit with “q”

dpsutton14:05:14

sounds good. feel free to ping me if you have any questions

dpsutton14:05:46

you could possibly add a defcustom to do that

dpsutton14:05:01

(defun cider-popup-buffer (name &optional select mode ancillary)
  "Create new popup buffer called NAME.
If SELECT is non-nil, select the newly created window.
If major MODE is non-nil, enable it for the popup buffer.
If ANCILLARY is non-nil, the buffer is added to `cider-ancillary-buffers'
and automatically removed when killed."
  (thread-first (cider-make-popup-buffer name mode ancillary)
    (cider-popup-buffer-display select)))

dpsutton14:05:16

that's what calls things. notice that select is set to nil or not in other places

dpsutton14:05:53

but you could change (cider-popup-buffer-display select) to (cider-popup-buffer-display (or select cider-always-focus-popup-buffers))

jcromartie17:05:11

In clojure-mode, the indentation under extend-protocol is all messed up

jcromartie17:05:51

I just updated from package-list-packages

jcromartie17:05:05

it must have been fixed since whenever I set this up first 🙂