5 ms·
The thing is, I'm a programmer. I want to extend my tools with code, not configuration. The power of the command line is not so much that it's a command line
by mikekchar 11y ago
The thing is, I'm a programmer. I want to extend my tools with code, not configuration. The power of the command line is not so much that it's a command line -- the power is that it is a programmable environment. I'm not limited to configuring what the tools are doing on my behalf. I'm writing my own tools.
I think this is the biggest draw for Emacs. It's a fully featured lisp development environment. If you want to change it, you just write lisp. If your IDE is free software, you can do the same thing, but they aren't always that easy to extend. Emacs, shell script, and the various tools are a set of APIs that you can code against. Most IDEs are geared towards giving you a UI interface to the functionality, not a programming API.
And that's fair, but not really what I'm after most of the time.
- ZenoArrow 11y ago> "I want to extend my tools with code, not configuration." You can do that with Visual Studio too with Visual Studio Extensions. You can also manage extensions (including those from other users) with a built-in package manager, just like in Emacs. Here's a Visual Studio Extensions tutorial if you're interested: https://channel9.msdn.com/Shows/Visual-Studio-Toolbox/Building-Extensions-Part-1 https://channel9.msdn.com/Shows/Visual-Studio-Toolbox/Buildi...
- wtetzner 11y agoYes, but writing a Visual Studio extension (or Eclipse, etc.) is much higher friction than Emacs. In emacs, I can just open a buffer in emacs-lisp-mode, write a quick function, immediately eval it and start using it. The instant feedback means that quick, small customizations are very low cost. It's like the difference between writing a code generator for Java vs using macros in Lisp.
- ZenoArrow 11y agoI see. Can you give me an example of a function you wrote in that way?
- TeMPOraL 11y agoNot OP, but a very quick and simple example of something I put in my .emacs very long time ago: (defconst trc-comment-keywords "\\<\\(FIXME\\|TODO\\|BUG\\|HACK\\|NOTE\\|WARNING\\|ERROR\\)") ;; Install the word coloring (defun add-comment-keywords () (font-lock-add-keywords nil `((,trc-comment-keywords 1 font-lock-warning-face t)))) (add-hook 'find-file-hooks 'add-comment-keywords t) (set-face-underline 'font-lock-warning-face "yellow") ; Just make sure we'll see it This defines a function #'add-comment-keywords and adds it as a hook to the "open file" operation. The function highlights all matches to the regexp in trc-comment-keywords so that they're highlighted in the source code using a modified font-lock-warning-face. This is an example of something you could just type in and evaluate right there, in your buffer. Later, you can save it in your init file to have it always enabled. A more complicated example of related code I wrote with some help from the Internet and the Emacs documentation: (defun list-comment-notes () "List all TODO/FIXME/HACK, itp. in a new buffer for reference." (interactive) (save-excursion (goto-char (point-min)) (let ((collected-lines '())) (while (re-search-forward trc-comment-keywords nil t) ;; collect lines (setq collected-lines (cons (format "%d: %s" (line-number-at-pos) (grab-current-line)) collected-lines))) ;; generate a new buffer (let ((notes-buffer (generate-new-buffer (concat (buffer-name) "-comment-notes")))) (set-buffer notes-buffer) ;; dump collected stuff to here. (dolist (a-line collected-lines) (insert a-line) (insert "\n")))))) What it does is it scans the current buffer for all occurrences of the keywords and lists them in a new buffer (with "-comment-notes" appended to the name). It's a crude function that could use some improvements, but it works well enough and is now just a M-x list-comment-notes away. Or, with the way M-x works, just M-x l-c-n away. Or I could bind it to a key. The great thing about Emacs is that all you need to extend it is to type the source somewhere. No need for creating projects, build scripts, rebooting your editor, etc. You can evalute and reevaluate the code until it does what you want. Lisp interactivity, which Emacs inherits, is addicting and still unparalleled in other programming languages / environments.
- to3m 11y agoHere are three of mine: (defun tom/insert-sterling-symbol () (interactive) (insert "£")) (defun tom/set-buffer-modified () (interactive) (set-buffer-modified-p 't)) (defun tom/unix () "Set buffer to unix line endings" (interactive) (set-buffer-file-coding-system 'unix)) The last one exists only because I could never remember the right command to select Unix-style line endings. So rather than train myself to learn it, I just wrote a small wrapper with an obvious (to me...) name, because it's so easy to do that. I've written some Visual Studio addins as well... the experience is not really comparable. (Visual Studio VBA macros, when it supported that, were painful too.) emacs makes it a lot easier.
- criddell 11y agoVisual Studio had a pretty nice macro record and playback system that was great for ephemeral, low friction scripts. They removed it because they said nobody used it. I switched to AutoHotKey and now I have a macro system that works everywhere.
- ska 11y ago"just like in Emacs." There are many thing you can do, but it really, really isn't just like emacs.
- ZenoArrow 11y ago> "There are many thing you can do, but it really, really isn't just like emacs." "a built-in package manager, just like in Emacs." They both have built-in package managers for extensions. I don't think this is a controversial statement.
- ska 11y agoThat is fair - I mis-read "just like emacs" in your original. Apologies. The extension mechanism really isn't like emacs at all. Package management is a bit more similar (although can you easily add new repositories for nuget?)
- ZenoArrow 11y ago> "although can you easily add new repositories for nuget?" Yes. Here's a guide showing how to create a local Nuget repository: http://codurance.com/2015/05/04/creating-a-local-nuget-repository/ http://codurance.com/2015/05/04/creating-a-local-nuget-repos... In the guide you can see this screenshot: http://codurance.com/assets/img/custom/blog/2015-05-01-creating-a-local-nuget-repository/package-manager.png http://codurance.com/assets/img/custom/blog/2015-05-01-creat... Which shows you one way to set up the package source. Also worth mentioning Paket, which is a Nuget replacement. In addition to working with the standard Nuget library, Paket can pull dependencies directly from Git repos. https://fsprojects.github.io/Paket/ https://fsprojects.github.io/Paket/
- ska 11y agocool, thanks.