Handmade Hero»Forums»Code
51 posts
Questions about Casey's Emacs
Edited by vexe on
Greetings!

So I started using Emacs recently because I found for me that it's a lot more convenient to use if you have a custom build environment.

0- So when I'm watching the stream, Casey opens up the find-file in the mini-buffer to search and open a file in the current directory. I notice he has this nice auto-completion feature that gives you like a 'ghost' display of what the file you might be looking for is. When I hit 'tab' in the find-file buffer, I get abbreviation completion. So if I have a file called Win32Platform.cpp, I type 'Win' it would auto-complete to 'Window' since that happens to be a variable I have somewhere. If I keep hitting tab it says "Find file: scanning for dabbrevs... done". Can someone please tell me how to get proper file auto-completion like Casey has? I looked at his .emacs but couldn't find anything out of the ordinary

1- I'm using Emacs 24 and if I load Casey's .emacs Emacs just flat out crashes! Any idea what could be causing that to happen?

2- Running Casey's grep (M-x grep) with "findstr -s -n -i -l" yields no results found for pretty much anything I search for. Any idea what could be wrong?

3- Not related to Casey's .emacs, but does anyone know of any good functions/light-weight-plugins to use for some basic C refactoring? All I'm looking for is 'goto definition' and 'rename variable'

Thanks!
vexe/elxenoanizd
Mārtiņš Možeiko
2559 posts / 2 projects
Questions about Casey's Emacs
C/C++ refactoring in text editors is unsolved problem :)
This looks like it can do variable renaming: https://tuhdo.github.io/c-ide.html
29 posts
I enabled the dark theme.
Questions about Casey's Emacs
mmozeiko
C/C++ refactoring in text editors is unsolved problem :)


Truth :P

For navigating to symbols in a project at least, the builtin Etags feature works pretty well. Run ctags (it needs some special flag to format it the way Emacs likes) as part of your build script to generate a tags file that emacs can use to search and jump around by symbol name.

The file fuzzy search tool he's using is called Ido which ships with recent versions of Emacs. You can call [tt](setq ido-everywhere 1)[/tt] to enable it in any situation where you could do autocompletion in the minibuffer.

I use a similar plugin called Helm (mentioned in mmozeiko's link). It's a bit fancier and displays things vertically in a temporary buffer by default instead of inline and linewrapped in the minibuffer by default.
51 posts
Questions about Casey's Emacs
Yeah it's both sad and hilarious that still up to this point there's no straight-forward way to integrate these basic features into your editors...

I've found ido yeah it's nice!

@drjeats Could you elaborate a bit more on etags? I tried it yesterday (Windows) and it says etags wasn't found. Using Emacs 25, isn't it supposed to be 'builtin'? or do I need ctags in either case?
51 posts
Questions about Casey's Emacs
Ummm, basic Emacs question. How do you use these devadvice things?

I have this thing from SO that's supposed to wrap incremental search

[Code]
(defadvice isearch-repeat (after isearch-no-fail activate)
(unless isearch-success
(ad-disable-advice 'isearch-repeat 'after 'isearch-no-fail)
(ad-activate 'isearch-repeat)
(isearch-repeat (if isearch-forward 'forward))
(ad-enable-advice 'isearch-repeat 'after 'isearch-no-fail)
(ad-activate 'isearch-repeat)))
[/Code]

I tried mapping it with (global-set-key (kbd "C-/") 'isearch-no-fail) but it didn't work, I get "Wrong type argument" when trying it...
51 posts
Questions about Casey's Emacs
Answering my 'grep' question. I should have specified which files I want to search in. So 'M-x grep' then 'something *.cpp' will search for 'something' in all cpp files.