Fork me on GitHub
#emacs
<
2018-06-13
>
vemv01:06:51

Say I (ido-read-directory-name ()), and am presented with a choice. How to open that choice directly, instead of having to press RET RET? (one RET for the choice, another for the .)

solf14:06:40

Actually, pressing RET once does it for me

vemv14:06:23

and how do you do it if the directory contains more directories? (genuinely curious - we might have different configurations)

solf14:06:02

Ah I see what you mean. Then C-j is probably what you're looking for

solf14:06:26

Let's say you're in $HOME and want to go to $HOME/folderA, who itself has other directories

solf14:06:37

You open ido, then type folderA, then do C-j

solf14:06:06

or you open ido, type 'fol', use TAB to autocomplete to 'folderA', then do C-j

solf14:06:47

basically RET or C-m tells ido to continue doing his autocomplete thingy (in this case showing you the subdirectories), C-j instead is a "use what I typed" command, you could type 'folderB' (which doesn't exist), do C-j and ido will use it anyway

vemv14:06:18

That's pretty close to what I'm seeking! But instead of TAB I'd rather take the first already-selected option i.e.: I want a new shortcut (like S-RET) to mean "with this half-typed input, choose the first option, and open it directly instead of showing me its subdirectoties"

solf14:06:55

I'm not sure how to do it. I figured

(defun ido-complete-and-select-text ()
  (interactive)
  (ido-complete)
  (ido-select-text)
  )
was enough, since those are the commands called by TAB and C-j, but for some reason it doesn't work

vemv14:06:32

in any case TAB can sometimes ask you for a choice (`possible completions are: ...`), so it's not equivalent to picking the first displayed option

vemv14:06:09

sometimes (call-interactively 'ido-complete) does the trick for when stuff doesn't work

solf14:06:12

C-j is for another use-case, where you don't want to use ido autocomplete but just submit whatever you typed in the minibuffer

andrea.crotti14:06:41

hello fellow Emacsers, should I be able to do M-n/ M-p in Clojure when completing with company-mode?

andrea.crotti14:06:05

because I was never able to do but now a colleague mentioned she can do it in the REPL but not in the actual .clj buffer

kliph15:06:00

Hi @U0524T275 Try C-h k followed by M-n or M-p in each of those buffers to see which functions are run

kliph15:06:31

You may need to have the company-mode selection open to see which function is run in that particular state

andrea.crotti15:06:26

yeah doesn't let me do that once I'm in company mode expansion time already

mpenet16:06:23

It can do it, but requires some elisp hackery I think

mpenet16:06:02

I have those lines in my conf: https://github.com/mpenet/emax/blob/master/elisp/modes.el prolly cause of that

andrea.crotti14:06:24

so I wonder if it should just work and I have something enabled that breaks it