Apress is having a 40% sale on the eBook versions of Edi Weitz’s Common Lisp Recipes. If you’re a Lisper, you’ll definitely want this book. I just bought my copy so I haven’t had a chance to peruse it yet.
The Sale ends February 1.
Most of you know how I love reading “workflow” articles, especially if they involve Emacs and Org. Brandon van Beekum has a nice post on how he uses Org mode to take notes and then export them to share with others. For his example, he demonstrates how he might take notes on a computer science paper but even if you’re interested in creative writing and have no interest in scientific matters, you will still find his write-up instructive.
Van Beekum starts with a title and the outline headings Summary and Links. He adds some text to the Summary section that describes what he’s trying to accomplish by reading this paper and adds various links to supporting documents in the Links section.
As he goes along, he adds a Notes section that he uses to capture interesting points from the paper including, in his case, a bit of code that he puts in a code block for proper formatting. He even demonstrates generating a graph with Babel and Dot.
For export, van Beekum uses his ox-twbs package which is much like ox-html but with some extra formatting and an interactive table of contents off to the side. It produces very nice output and is worth considering if you produce a lot of HTML documents to share with colleagues and friends.
If you’re interested in using Org mode to take notes—whether or not you want to export them later—van Beekum’s post is worth a read. It uses very simple Org functionality so it’s a good way of starting with Org mode.
Artur Malabarba has another excellent bit of Elisp for us to improve our workflow. This time it’s a quick and easy way to search for the symbol at point. He binds his code to 【Ctrl+u Ctrl+s】 but remarks that that sequence is already used for isearch-forward-regexp. He doesn’t care about that because he’s never used isearch-forward-regexp. There is, though, no need to worry about 【Ctrl+u Ctrl+s】 because 【Ctrl+Meta+s】 is also bound to isearch-forward-regexp and easier to remember because it’s like the 【Ctrl+Meta+%】 that query-replace-regexp uses.
More to the point, isearch-forward-symbol-at-point is bound to 【Meta+s .】, which I find just as easy to type as 【Ctrl+u Ctrl+s】 so unless you, like Malabarba, find the latter easier to type and remember than the former you may not need to add his code to your configuration.
On the other hand, Emacs is all about having it your way and Malabarba’s code shows how easy it is to adjust its behavior to be more how you like it. In my case, I don’t use isearch-forward-symbol-at-point often enough to bother giving it a special key sequence. Of course, 【Meta+s .】 is unintuitive and hard to remember. Since I don’t use it often, it’s not worth building a hydra for it; instead I use the excellent guide-key package to remind me of the proper sequence. Again, Emacs letting me have it my way. Instead of forcing Malabarba and me to use the same work flow, Emacs lets us each optimize it to suit our own way of working.
save-excursion Semantics Marcin Borkowski (mbork) has a useful heads up for Elisp programmers. Starting with Emacs 25.1, save-excursion will no longer save the mark state. If you want to save the mark, you should use save-mark-and-excursion instead.
While reading mbork’s post, I remembered that when I first started learning Elisp, there was an issue with saving the mark and you had to take additional action to make things work correctly. I checked the source code and the problem was that save-excursion didn’t save deactivate-mark. From what I can tell1, the new code fixes that. I’m not sure why they chose to implement the macro save-mark-and-excursion instead of just fixing things up in save-excursion (the semantics changed regardless). The NEWS file and Elisp manual don’t say but I’m sure one of you will let me know.
As mbork points out, programmers mostly didn’t depend on save-excursion saving the mark anyway so this won’t be a huge issue for most code. Just be aware that if you depend on the mark being the same after your protected code runs, you should use save-mark-and-excursion rather than save-excursion.
I really need to figure out the C macros that Emacs uses so that I can read the C code better.
I’ve written before about the horror that is adtech. Advertisers send us megabytes of Javascript for 500 words of content so that they can track us and build profiles of our habits and preferences. When users finally tired of this and started using ad blockers, the advertisers reacted with outrage and indignation. It’s immoral, it’s stealing they said. Some even said it’s illegal. The irony was thick on the ground.
Some advertisers went further. They added scripts to detect when ad blockers were in use and refused to serve content when they were. One such company is Forbes. When readers with ad blockers tried to read their 30 under 30 list, they were asked to turn it off and the content was withheld until they did. Any unfortunate reader who did disable the ad blocker was immediately served malware. Remember, this is not some pr0n site in the seedier corners of the Internet; it’s Forbes.
The Engadget piece linked above says that “[The ad networks are] practically the most popular malware delivery systems on Earth, and they’re making the websites they do business with into the same poisonous monster.” The content providers who use these systems have lost the moral high ground. It’s easy to have sympathy for their position that they depend on advertising and without it they can’t provide content but it’s too great a stretch to ask users to have their privacy violated and it’s certainly not reasonable to ask readers to deal with the malware that these websites serve them.
It’s up to the content providers to hold the ad networks’ feet to the fire and insist that they clean up their act. If that doesn’t happen, it’s not hard to imagine a lot of companies going out of business. The final irony is that the annoying ads are not cost effective.
After Sacha’s chat with John Wiegley that explored how Wiegley uses Gnus to manage his Emacs maintainer workflow, there’s been a bit of renewed interest from Emacsers in using it for their email client. Unfortunately, Gnus is a large and complex system that is difficult to set up and use. Back in 2014, I wrote about Chen Bin’s Gnus Guide.
The guide takes the pragmatic approach of covering the basic 5% of Gnus that a new user needs to get started. Now, just in time for the renewed Gnus interest, Chen Bin has has updated his guide. He also provides his configuration so you have a go-by if you want to set up your own instance.
The guide is oriented towards using Gmail as the server but it should be pretty easy to adapt to other providers. If you’ve been wanting to try Gnus but were put off by the difficulty of getting it set up, Chen Bin’s guide may be just what you need.
#StopTPP Retweet this. Then retweet it again. We need this all over the Internet now. pic.twitter.com/x8rS8KfAoi https://t.co/7mOyNfoiIQ
— Ruth E. Kastner (@rekastner) January 13, 2016
M. J. Wall has an interesting post entitled How I Use Emacs. Wall’s workflow is a bit unusual—by which I mean different from mine—in that he spends a lot of time in the terminal even though he’s running GUI desktops in Linux and OS X. Sometimes he just wants to edit a file and then return to the terminal. Other times he wants to pop up an Emacs buffer and return to the terminal immediately.
To facilitate that workflow, he has two scripts. One starts Emacs in the terminal window and waits for Emacs to finish before returning to the shell. The other pops up a new Emacs frame and returns to the terminal immediately. An interesting trick that both these scripts use is to call emacsclient with the -a “” option. That says that if the Emacs server is not already running, start it and then reattach emacsclient to it.
As I mentioned, my workflow is different. I always have Emacs running and have a shortcut key to change focus to it so if I’m in a terminal and need Emacs I just press【F6】 to pop into Emacs and do what needs doing. Nonetheless, there is one case where Wall’s technique is useful to me. Usually if I want to edit a file on another machine, I just use tramp but if I’m sshed into that machine already it’s convenient to just bring up emacsclient on the remote machine. Wall’s et script is perfect for that. Even if the remote machine doesn’t have a copy of the et script installed, it’s simple to call emacsclient directly
emacsclient -a "" -t file-to-edit
If you use Emacs and ever ssh into remote machines, this is a technique worth knowing.
Ben Maughan has another great post in his Org mode series. This time, he augments his simple TODO list with schedules and deadlines. Org mode is famously flexible and that can make it hard to settle on a strategy for handling and displaying your tasks and agenda. Maughan shows us how he does it and provides some excellent ideas.
The real benefit of his post, I think, are the configuration items he uses to get his desired behavior. He explains each one in the comments so you can see what they’re supposed to do and look at the results in the accompanying screen shots. You can pick and choose from his list of configuration items to get a behavior that works for you.
It’s important, though, to remember Carsten’s advice for setting up your task management: don’t try to create a final strategy from the beginning. Start small and simple and let your strategy grow organically as you discover what works best for you. That means you shouldn’t blindly adopt someone else’s configuration. Rather, use interesting configurations like Maughan’s to discover what’s possible and steal the pieces that fit in with your workflow.
As I’ve said before, Maughan’s posts are useful and interesting so you should definitely put Pragmatic Emacs in your feed. The posts are usually short and pithy so you won’t have to spend a lot of time with them. A definite win for a small investment.
Here’s a very useful tip
super useful when you open a file that needs sudo perms to edit/save: https://t.co/7Kis1RXa1o i have that bound to C-x C-v #emacs
— Sriram Thaiyar (@s_thai) January 6, 2016
especially if you administer your own machine and often need to edit root-owned files.
If you’re like me, you forget to open the file with SUDO. Fortunately, Emacs protects you from making a lot of changes that you can’t save by marking the buffer read only but you still have to back out of the file and reopen it with SUDO. With Thaiyar’s tiny Elisp function, you can just push a button and automatically re-open the file with SUDO.
Even if you don’t want to install the code in your config file or you find yourself on someone else’s machine, you can do the same trick manually1.
Although to be fair, it’s not clear that that would be much easier than just starting over.