background preloader

EMACS

Facebook Twitter

Jaor/geiser.

Emacs Themes

Emacs Stack Exchange. New MELPA URL. What's New In Emacs 24.4 : programming. Emacs Less-known Tips. Nothing Buy Xah Emacs Tutorial. Master emacs benefits for life. This page shows some less known emacs tips. Before continuing, here are 4 commands every serious emacs users have memorized by heart. To find the command name of a keybinding, call command describe-key 【F1 k】.To find the keybinding of a command, call describe-function 【F1 f】. This also gives the inline documentation of the command.If you forgot the name of a command, call apropos-command 【F1 a】. Editing Related Interactive Search How to search the last searched string?

Type 【Ctrl+s Ctrl+s】 to search the same word searched last time. How to search the string under cursor without typing it? Type 【Ctrl+s Ctrl+w】 to search the word under the cursor. 〔➤ Emacs: Search & Highlight Words〕 Grep Lines How to sort lines? Select a region first, then call sort-lines. To sort lines by a specific column, use sort-fields or sort-numeric-fields. For example: Type 【Ctrl+u】, then 2, then 【Alt+x sort-numeric-fields】. Other Misc Many ways. Display. Emacs Stack Exchange. Xah Emacs Tutorial. Nothing This emacs tutorial is designed for programers & scientists who wish to learn emacs to get things done quickly, without spending a lot time on Emacs's special terminologies & methods. For programers, knowing emacs benefits you for life. Use the search box at top to find things. For new articles, subscribe: Xah Emacs Blog. Quick Tips Working with Files the church of emacs filling, of chars lispy and binding, buffers insert yank, meta sexp add-hook, Eight M-bites And C.

Find & Replace Tab, Indentation, Whitespace Editing Tricks Common Tasks Using shell #! Working with HTML Emacs Keys ⌨ Productivity Editing Convenience Setting Up Emacs Init Customization Settings Build Emacs, New Features Useful Packages Misc Emacs Lisp Tutorial Keybinding, Keyboard, Emacs Pinky Emacs Modernization Emacs Related Essays Emacs Images Thumbnails Index Buy Xah Emacs & Emacs Lisp Tutorial About the author, Acknowledgement.

Clojure and Emacs without Cider. I've been hacking Clojure for many years now, and I've been happy to rekindle my love for Emacs. The Clojure/Emacs tool-chain has come a long way during this time, swank-clojure, nREPL, nrepl.el and now Cider. The feature list is ever growing, and every-time you look there are some new awesome shortcut that will 'make your day'. However, the last couple of months have been rough for the Cider project. I've experienced lots of instability, crashes and hanged UIs. Cider has become very complex and is starting to feel bloated. I went from Visual Studio to the simpler & snappier Emacs for a reason, and there is a part of me that feel concerned that Cider is 're-inventing' an IDE inside Emacs.

In this post I'll describe a simpler Emacs/Clojure setup that I've been using for the last couple of weeks. It's based on Emacs standard way to talk to Lisp REPLs, inferior-lisp-mode. The setup consists of the following emacs modes (all available on Melpa); init.el A repl session with this setup. Emacs Keymap for Launching External Applications and Websites. 05 Oct 2014, by Artur Malabarba. The launcher-map wouldn’t be half of what it is if not for the run macro.

With it, we can easily turn Emacs into a quick ’n dirty app launcher. (defmacro run (exec) "Return a function that runs the executable EXEC. " (let ((func-name (intern (concat "endless/run-" exec)))) `(progn (defun ,func-name () ,(format "Run the %s executable. " exec) (interactive) (start-process "" nil ,exec)) ',func-name))) (define-key launcher-map "m" (run "Mathematica"))(define-key launcher-map "k" (run "keepass"))(define-key launcher-map "v" (run "steam")) We could use a lambda instead of the macro, but the macro defines a nicely documented function.

While we’re at it, let’s do something similar for websites. (defmacro browse (url) "Return a function that calls `browse-url' on URL. " Emacs Less-known Tips. Site Map. SLIME for Emacs Live | (null '()) => T. Emacs Live is a frakkin’ epic compilation of customizations and packages, streamlined for the ultimate hacking experience. As I mentioned in my last post, Adventures in Clojure, it’s under development by the same team as the Clojure bridge to SuperCollider, Overtone. The one downside? It was designed for hacking Clojure, so it doesn’t include SLIME and Common Lisp support out of the box, and of course, it completely replaces your ~/.emacs.d/ directory and ~/.emacs config file, so you lose your existing SLIME setup (and all your other customizations) when you install Emacs Live. Don’t panic, the Emacs Live installer is smart enough to move your existing ~/.emacs.d/ folder and ~/.emacs config file to a safe place.

To get the full Emacs Live experience for Common Lisp, however, you also need another package, AC-SLIME. It provides the auto-completion and pop-up documentation for Common Lisp, both in file buffers and the REPL. (live-append-packs '(~/.live-packs/slime-pack)) Like this: Thephoeron/slime-pack · GitHub. Start Using Emacs | Clojure for the Brave and True. On your journey to Clojure mastery, your editor will be your closest ally. You can, of course, use any editor you want. Some get pretty close to Emacs's Clojure functionality. The reason I recommend Emacs, however, is that it offers tight integration with a Clojure REPL.

This allows you to instantly try out your code as you write. That kind of tight feedback loop will be useful both when learning Clojure and, later, when writing real Clojure programs. Emacs is also great for working with any Lisp dialect; Emacs itself is written in a Lisp dialect called Emacs Lisp. If you don't follow the thorough Emacs instructions in this chapter, then it's still worthwhile to invest time in setting up your editor to work with a REPL. By the end of this chapter, your Emacs setup will look something like this: To get there, we'll do the following: Install Emacs Install a new-person-friendly Emacs configuration After we're done installing and setting up Emacs, we'll cover: In the next chapter, we'll cover: 1. Global key bindings in Emacs (Shallow Thoughts) Global key bindings in emacs. What's hard about that, right? Just something simple like (global-set-key "\C-m" 'newline-and-indent) and you're all set.

Well, no. global-set-key gives you a nice key binding that works ... until the next time you load a mode that wants to redefine that key binding out from under you. For many years I've had a huge collection of mode hooks that run when specific modes load. (defun reset-revert-buffer () (define-key python-mode-map "\C-c\C-r" 'revert-buffer) ) (setq python-mode-hook 'reset-revert-buffer) That worked fine -- but you have to do it for every mode that overrides key bindings and every binding that gets overridden. A web search quickly led me to the StackOverflow discussion Globally override key bindings. It took a lot of help from the kind folks on #emacs, but after an hour or so they finally found the key: emulation-mode-map-alists. Okay, here's what it means. Now define a minor mode that will use that keymap. There's one final step.

Whew! Emacs Customization for Clojure. Synopsis: I talk about the value of paredit in Emacs and show a trick which allows you to insert the result of any given Clojure expression directly underneath that expression. As I said in the first post, a good set of tools can make a big difference in productivity and enjoyment while working in any language, and Clojure is certainly no exception. The most important tool in your toolbox, regardless of language, is your editor. Editing Lisp code in particular is much more natural with the right editor setup. I have been using Emacs since the 1990s, though I still consider myself a novice (Emacs is that way). While I’ll give a few Emacs configuration tips below, I don’t give a complete recipe for customizing Emacs here.

Paredit Though it takes a little getting used to, I started using paredit mode exclusively a year or so and it has made a huge difference, not only for my productivity with the language, but also in my enjoyment and appreciation of Lisp in general. Cider.