Refactoring with counsel-ag

Back in January of 2015, I wrote about an excellent post from abo-abo on his refactoring workflow. If you haven’t read his post be sure to take a few minutes to read it. The basic idea was that he wanted to change all occurrences of an identifier in all files in a given directory. He does that by finding each occurrence with rgrep, making the rgrep result buffer writable with wgrep, then using iedit to change all occurrences at once.

Samuel Barreto has a similar workflow that uses counsel-ag. He uses the evil substitution command rather than iedit to make his change but that’s a detail. Take a look at his post for the details. If you’re using ag or looking for a reason to install it, his workflow is very appealing. I wouldn’t be surprised if abo-abo is using it himself now. If you often find yourself making this sort of global change, you really need to check out these workflows.

Posted in General | Tagged | Leave a comment

Put imenu Output in a Buffer

Grant over at Wisdom and Wonder has a short post that points us to imenu-list. That’s a minor mode that puts the output of imenu into a separate buffer where you may find it easier to work with. If you follow the link to imenu-list‘s GitHub page you can see a screen shot of it in action.

Somehow, I’ve never warmed up to imenu but perhaps this will help. You can think of imenu-list as being sort of like occur and use it in a similar way. If you find yourself jumping around a program buffer a lot, you may want to give imenu-list a try.

Posted in General | Tagged | 1 Comment

Calling eww from Dired

If you have files that you read in eww, here’s a suggestion that might make your workflow a bit easier:

Posted in General | Tagged | Leave a comment

Learn Elisp with Xah

Xah Lee is running a one month long Elisp tutorial. Everyday he points you to one of his Elisp pages and then gives a quiz or assignment to test your knowledge of the material. The course has been going on since the end of August but it’s not too late to join in on the fun.

If you’ve been meaning to learn Elisp, here’s an easy way to do it in small chunks of about 20 minutes per day. Lee is available for help if you get stuck so this is an excellent chance to hone your Elisp skills. If you’re an Emacs user, your enjoyment and mastery of Emacs will go up if you learn a bit of Elisp.

Posted in General | Tagged , | Leave a comment

Emacs Configurations for LaTeX

There’s been a lot of tweets and posts on Reddit lately asking about Emacs configurations to support writing \(\TeX\) and \(\LaTeX\). Here’s an example from anasrchid. He asks the typical question: how should I configure Emacs and what packages should I install to give me a pleasant \(\TeX\) environment?

What’s nice about this discussions is that he gets lots of good suggestions and adds an edit that lists a very nice final configuration. Basically, it’s to install

  • AUCTeX
  • RefTeX
  • PDF Tools
  • SyncTeX
  • magic-latex-buffer

If you follow the link to nasseralkmim’s animated gif, you can see this setup in action. It looks pretty nice. You get the power of AUCTeX, nice formatting of symbols in the source buffer, an automatically generated output PDF that reflects your changes as you make them, and easy navigation between the PDF and source buffer. Take a look, I think you’ll be impressed.

Of course, you need to do a bit of configuration as well, but there’s also a link to nasseralkmim’s configuration. It’s an Org file so it’s easy to follow and navigate in. Look at the configuration sections for the above tools to see how he’s got things set up.

If you only occasionally use the full power of \(\LaTeX\), it may be easier to do everything from Org mode but if you write a lot of scientific papers, the suggestions in this post are excellent. Be sure to read the comments too.

Posted in General | Tagged , | 1 Comment

SBCL 1.3.9 Released

Steel Bank Common Lisp’s newest version, 1.3.9, is ready for download at the usual place. This month’s release is a small one that fixes a bug, optimizes some operations with complex numbers, and adds an enhancement that helps with garbage collection. See the NEWS page for details.

After compilation, I ran the regressions tests and everything looked fine except that the test script itself exited with a bad status. The test summary showed the expected results though. In any event, everything installed correctly and is working.

Once again, SBCL is an outstanding Lisp environment that’s open source, comes with complete source and documentation, and has an industrial strength compiler. If you’d like to try out Lisp or move to better environment than you have, try SBCL.

Posted in General | Tagged , | Leave a comment

Wisdom From Wilfred Hughes

Some wisdom from Wilfred Hughes. I think this is right.

Posted in Programming | Tagged | Leave a comment

Rewriting Git History with Rebase in Magit

Charl Botha has a useful video on rewriting Git history with Magit. Botha gives three examples:

  1. Changing the commit message on any old commit
  2. Squashing two or more commits into one
  3. Splitting a commit into two or more separate commits

These are all accomplished by rebasing. In all of these, you bring up the rebase menu from the Magit status buffer by pressing 【r】.

For example, to rewrite an old commit message you bring up the log with 【l l】 and move the cursor to the commit you wish to reword. The you call up the rebase menu and choose 【w】 to rewrite the commit message.

The other cases are a bit more complex but follow the same general procedure. Take a look at Botha’s post for the details. The video is a few seconds over 15 minutes so you can probably fit it into a coffee break. It’s a useful adjunct to Howard Abrams’ Magit Introduction and Demonstration video, which covers some of the same material.

Posted in General | Tagged , | Leave a comment

Cool Fact of the Day

Matthew Anderson is right: I didn’t know I knew this but I do

Hat tip to Karl Voit.

Posted in General | Leave a comment

Zamansky on Keyboard Macros

Mike Zamansky has another video up in his Using Emacs Series. This time it’s about keyboard macros. I’m always inclined to think that everyone knows all about them but I keep reading tweets about people discovering their power and being amazed so Zamansky’s video is apt to be useful for many people.

If you aren’t using keyboard macros, you’re almost certainly working too hard. Zamansky gives a couple of examples that show how macros can make quick work of repetitive tasks. Often you can accomplish these tasks with something like multiple-cursors but keyboard macros are built in and always available. Zamansky compares them to a Leatherman but I like the Swiss Army Knife analogy better. In either case, the point is that macros are a flexible and powerful tool to quickly get things done. As Zamansky says, there might be a better tool for a particular task but macros are almost always good enough.

Take a look at the video to see a few more tricks like counters and saving macros. The only thing I would add is that the ability to repeat the macro a fixed number of times or until the end of the buffer is often useful. On the other hand, as Zamansky says, usually it’s just as easy to manually repeat the macro the required number of times.

As usual, the video is short—11:31 (min:sec)—so it should be easy to find time to watch it.

Posted in General | Tagged | Leave a comment