11 ms·
'Using Emacs' Series
- sigjuice 9y agoI have never understood the rampant practice of using ~/.emacs.d/ for one's personal Elisp files. Most of what is in this directory appears to be machine generated files from various packages. To me, it seems much cleaner to have a separate directory for my own files, instead of maintaining ~/.emacs.d in Git and having to constantly update my .gitignore as I install and use new packages. EDIT: Also, C-h v user-emacs-directory RET says programs in Emacs store information in this directory.
- rafiei 9y ago1. You shouldn't be updating your `.gitignore` continuously. You need to ignore everything and explicitly define exceptions e.g. * !.gitignore !init.el 2. The reason I prefer ~/.emacs.d/ is that I have it in a git repo and on every system, I'll just clone the repo and soft link it in the home directory. This way, I have only one directory inside home about emacs within which my files are explicitly separated and tracked. P.S. I've recently tried to move from Spacemacs to Emacs and by no means a pro, so the process I've described may not be optimal.
- sigjuice 9y ago1. I still need to grow my .gitignore file as I add more .el files of my own. 2. A similar scheme would be to maintain a directory called ~/elisp in git and make ~/.emacs a symlink to ~/elisp/emacs. And pretend that ~/.emacs.d/ does not exist.
- rafiei 9y ago1. Perhaps make a new directory `.emacs.d/elisp`, append it to your path and add your files in it and have .gitignore not ignore the directory? 2. You could!
- TeMPOraL 9y agoI solve this issue by using my own config directory; this way I soft-link two things from my dotfiles repo: - .emacs - which defines my config dir and loads everything in there - my own config dir (called .emacs.conf), in which I have lots of .el files with specific configurations Emacs packages still write by default to .emacs.d, and this way I don't have to care about any of that when moving between machines, because my configuration and Emacs's ongoing state are separate. To be honest, though, I'll probably be migrating into a single-file literate solution soon, which will render my own config directory unnecessary.
- geokon 9y agoSo each time you launch emacs you have to point it to your init file?
- TeMPOraL 9y agoNo. My .emacs has a code snippet that points Emacs to another directory for my own configs. I softlink both .emacs and the config directory.
- smnscu 9y agoI do this as well! I have this repo [0] at ~/cfg, then I symlink what I need [1] as an init script. My end goal is to be able to run a single script and get everything [2] set up on a new machine (I change machines somewhat frequently and I got the manual process to under 45 minutes, so there's room for improvement). More on setting up Macs [3]. There is also GNU Stow [4] that does something similar, and probably better. 0: https://github.com/andreis/cfg https://github.com/andreis/cfg 1: https://github.com/andreis/cfg/blob/master/init.sh#L64-L69 https://github.com/andreis/cfg/blob/master/init.sh#L64-L69 2: brew and brew cask, dotfiles ofc, and a _lot_ of system settings on mac os can be changed via the CLI, see 3: https://github.com/iCHAIT/awesome-macOS#setup https://github.com/iCHAIT/awesome-macOS#setup 4: http://brandon.invergo.net/news/2012-05-26-using-gnu-stow-to-manage-your-dotfiles.html http://brandon.invergo.net/news/2012-05-26-using-gnu-stow-to...
- frumiousirc 9y agoI used to do it that way. I've switched to `vcsh` to let me keep various files directly in my ~/ directory in various different git repos without needing a ~/.git/ marking the whole thing as a working directory.
- db48x 9y agoUsing ~/.emacs.d this way came about well before git was invented. :)
- sigjuice 9y agoReally? C-h v user-emacs-directory RET says programs in Emacs store information in this directory. To me, this says ~/.emacs.d/ is not intended for humans. user-emacs-directory is a variable defined in ‘subr.el’. Its value is "~/.emacs.d/" This variable may be risky if used as a file-local variable. Documentation: Directory beneath which additional per-user Emacs-specific files are placed. Various programs in Emacs store information in this directory. Note that this should end with a directory separator. See also ‘locate-user-emacs-file’.
- omaranto 9y agoPrograms and humans can peacefully coexist. Emacs looks for your init.el in that directory so it is most definitely also meant for people to use. I put my own libraries in ~/.emacs.d/my-lisp (and I put this directory on the load path). I've had zero trouble with this setup.
- db48x 9y agoIt happened in 2002, and git was started in 2005. See commit a04d5983: commit a04d59830e46664faa4d534366a6b07e3b7c12f2 Author: Richard M. Stallman <rms@gnu.org> Date: Sat Oct 26 22:41:33 2002 +0000 (command-line): Look for .emacs under ~/.emacs.d after looking in ~. Interestingly it was changed to look for ~/.emacs.d/init.el in 2005, six months after git got started. See also chapter 51.4 of the Emacs manual (which is often preferred over the documentation of variables simply because it can be more explanatory): 51.4 The Emacs Initialization File ================================== When Emacs is started, it normally tries to load a Lisp program from an “initialization file”, or “init file” for short. This file, if it exists, specifies how to initialize Emacs for you. Emacs looks for your init file using the filenames ‘~/.emacs’, ‘~/.emacs.el’, or ‘~/.emacs.d/init.el’; you can choose to use any one of these three names (*note Find Init::). Here, ‘~/’ stands for your home directory. So yes, it's long been used for things like the list of recently opened files, and configuration changes you made with Custom, and the UIDVALIDITY of your IMAP folders and so on, but it's also been a place to put your init file for quite a long time as well. Once you get a longish init.el file, it's a pretty short step to making several .el files that you load from init.el, and from there you can get as fancy as you like.
- justinhj 9y agoI don't think there is a right and wrong way to customize emacs, whatever works is good. What I do is have a .emacs and my custom elisp files in a Dropbox folder. Then I have a simple ~/.emacs file that loads the Dropbox one. If I didn't use Dropbox for various other purposes I think I'd use git as well.
- gumby 9y agoI am a little concerned you start with package repository and then org mode. Emacs is at heart a simple, modeless editor. With c-[fbpns] and c-x c-[fa] you can immediately, if laboriously, do anything. Every new thing you learn incrementally speeds you up.
- S4M 9y ago> c-x c-[fa] You mean c-x c-[fs], right? I'm by no mean an emacs expert although I've been using it for 6 years now, and when I read your comment I thought "Wow, c-x c-a is a functionality? How comes I have never used that?", so I tried that in emacs but it's not mapped to anything. Apart from that, I fully agree with your comment.
- hellofunk 9y agoI had the same reaction when I read this. I was looking forward to getting to my computer later today so I can see what that key map does!
- gumby 9y agoYes, it's a typo (but I can't edit my post anymore). c-x c-f and c-x c-s
- omaranto 9y agoIf you want a suggestion for what to bind C-x C-a to, I use this function: (defun align-all-matches (start end regexp) "Align all matches of the given regular expression." (interactive "r\nsAlign regexp: ") (align-regexp start end (concat "\\(\\s-*\\)" regexp) 1 1 t)) It inserts space in each line of the region so that all matches a given regexp are vertically aligned. I find this to be my most common use for the powerful but complicated align-regexp. (If you call align-regexp interactively without a prefix argument it does something much like this function but only aligning the first ocurrence on each line, and if you call it with the prefix argument it prompts for all parameters of align-regexp.)
- omaranto 9y agoI don't think Emacs has been modeless in many, many years. I read that already in 1978 Emacs buffers could be used to edit files, of course, but also read email, run a shell, show a list of compilation errors linked to source locations, etc. Each of those is a completely different mode of operation with different keybindings (and different meaning for keybindings that happened to be shared).
- mycat 9y agoWhat is the best way to reduce pain from using ctrl with pinky finger? (emacs pinky?)
- duncan_bayne 9y agoIn my experience - buy a good mechanical keyboard, and remap Control and Caps Lock.
- lottin 9y agoI don't understand how remapping Caps Lock to Control is supposed to improve things, considering that there's already a Control key in the vicinity of Caps Lock. For me the bigger problem is the right control key.
- TeMPOraL 9y agoTry it and you'll see. Control is usually two keys lower than Caps Lock, forcing you to bend your pinky in a weird way. As for Right Control - I don't think I ever pressed that key in my life...
- hellofunk 9y agoAt least on MacBook Pros, there is not a control key anywhere in the same pinky area as the caps lock key. A solid inch or two is quite a big deal.
- alyandon 9y agoI used to basically think it was insane that people would recommend changing the layout of my keyboard in order to accommodate the inefficient default key bindings of Emacs. However, even though I long ago stopped using Emacs, to this day I still swap Caps Lock with Ctrl because it's a much more natural position for the control key once you get used to it.
- duncan_bayne 9y agoThe difference between "in the vicinity of" and "on the same row as the home keys" proved immense for me. YMMV I guess, depending on your typing habits.
- azangru 9y agoHey, has any of you guys been using emacs for modern front-end development? I’ve been looking for video tutorials (or at least for demos) on this subject, but could not find anything useful and practical. How is emacs’ support of JSX? Of typescript and TSX? Of flow? Of CSS in JS? Of eslint? Does it keep up with the crazy speed frontend development is changing, or has it remained far behind (being used mostly for the basic tasks that are shown in the video on web-mode in the 'Using Emacs' series)? What's your experience?
- wlkr 9y agoI'm not a professional front end developer but recently completed some projects in TypeScript. I found it very painless to get set up on Emacs with Tide [0] and it was a pleasure to use. I also use web-mode [1] for templates which adds some bonus features over the existing HMTL editing mode. [0]: https://github.com/ananthakumaran/tide https://github.com/ananthakumaran/tide [1]: https://github.com/fxbois/web-mode https://github.com/fxbois/web-mode
- ruraljuror 9y agoI have done some work in angular2 (and rails, fwiw) using emacs. There are modes for javascript (yegge's js2-mode is one of the more feature rich modes I have seen for any language), angular, and typescript. I have not tried eslint but a quick search for emacs eslint turned up some packages. What in particular would you be looking for in terms of front-end development? One issue I run into is problems with poor (auto)indentation when I am editing a file which contains html formatted as a string. For example an html template in an angular module. Anybody have/fix this issue?
- _asummers 9y agoI've found web-mode to be superior for JSX and ES6 stuff, though I tried to use Yegge's for a while. Though I don't do much JS development anymore, this is my current config for web-mode, though I had Flycheck and Flow types working at one point, as well. https://gist.github.com/asummers/b8304b8ea78fc331b8177ff35d002046 https://gist.github.com/asummers/b8304b8ea78fc331b8177ff35d0...
- 9y ago
- free_everybody 9y ago>Inspired by Mattias Petter Johansson, or MPJ who make a weekly video, I decided to try to create a series of YouTube videos and matching blog posts. I find this pretty funny since MPJ is editor-agnostic and thinks it's a huge waste of time to learn command shortcuts, config files, etc. He promotes using a clean Atom install with no plugins to his viewers.
- ammij_tomar 9y agoShaq Just Dropped a Fiery LaVar Ball Diss Track | http://blog.goo.ne.jp/kalachosma/e/a56d4a305fafa30ffe3761286c9f0117 http://blog.goo.ne.jp/kalachosma/e/a56d4a305fafa30ffe3761286...
- Accacin 9y agoI'm a Vim user that did try to get into Emacs with evil-mode. However, I got annoyed when dired wouldn't let me user the Vim movement keys and went back to Vim.
- wyuenho 9y agoHave you tried neotree? It's a port of vim's nerdtree.
- brandoncordell 9y agoYou need to check out Spacemacs[1]. It's set up so that as soon as it's installed you can use it efficiently using your vim keys. It's got a ton of great defaults and I'm considering changing over full-time. I've been using it quite a bit lately and love it so far. [1]https://spacemacs.org https://spacemacs.org
- everybodyknows 9y agoMulti-occur has kept me with emacs. Exactly what's wanted when making coordinated edits to multiple file formats, e.g. a project that involves JS, Go, Markdown. After some setup hassle, 'M-x mo <regexp>' or similar searches all open buffers, and presents matches in a new temporary buffer. Typing 'e' in that buffer makes it writable. The usual editing commands then simultaneously modify both the temporary multi-occur buffer, and the originals.