The Placement of Quotation Marks

I’m pretty much a strict constructionist when it come to grammar issues but there are exceptions. I’m not above starting a sentence with “And” or “But” and my comma usage is driven by what I see as logical and making my meaning as clear as possible even if my 8th grade teacher, Miss Frump, wouldn’t approve.

One place where I do follow the (American) convention is the relative placement of quotation marks and other punctuation. Thus, I always place the period before the quotation mark even though it often doesn’t make sense to do it that way.

The English do this correctly but American usage insists on the illogical. It wouldn’t matter all that much except for when it does:

  • To exit the application, type “quit.”
  • To exit the application, type “quit”.

If you’re a user trying to exit an application (that uses “quit” to exit), which would you prefer the documentation to say?

Erich Grunewald has a nice post that argues that the American convention is an abomination and we should all be doing what the English do. It’s hard to argue with him. Over the years, I’ve read many explanations for why the American convention is the way it is. They mainly cite some ancient typography technical issue. Here’s what the MLA has to say about it. I’ve read other, similar explanations. Regardless, it’s time to stop the nonsense and adopt the more logical English convention.

Posted in General | Leave a comment

Time Tracking With Org-mode

I’m Bmax has a post about his journey to find the perfect way to track his time. Like almost everyone else, he started with a spreadsheet but if you’ve ever done that you know what a pain it is and how hard it is to keep it up. He tried a few other solutions before settling on Emacs and Org-mode.

The thing that makes tracking your time with Org-mode so easy is that you just put the point on a task and clock in. When you’re finished or clock into another task, Org records the start and end time so that the time spent on a task is easily available. It doesn’t end there, of course. Org can produce reports on the total time spent on various task with a single key sequence.

I’m Bmax seems happy with his Org solution. It’s just a matter of clocking in and out of the task Org entries he needs in any event. In my experience, the time tracking comes later. You start with recording tasks or some other item and then realize that you can easily track how much time you spend on them with a simple key sequence.

Lots of people use Org mode to track their time for billing purposes and even produce their bills from the Org data. The nice thing about using Org is that you can simply record the times or use it to produce reports or bills on the time you spent on various tasks.

Posted in General | Tagged , | Leave a comment

Another Emacs Configuration

As you all know—at least if you’ve been around Irreal for a while—I like reading through other peoples Emacs configurations. It’s not just a matter of voyeurism; I almost always learn something from seeing how others use Emacs. The latest example is this post from Supratim Samanta.

It’s in the form of an Org file so there’s a bit of explanation included. Samanta has all the usual use cases

  • Coding
  • Documentation with Org-mode
  • Elfeed
  • Magit
  • Evil for the Vim experience

It’s a fairly extensive configuration so there may be ideas lurking in it that you’ll find useful. Take a look and see.

Posted in General | Tagged | Leave a comment

Two Mini Tutorials

Here are a couple of mini-tutorials on using two Emacs packages. They’re both pretty short so I’ve combined them into a single post. In the first, Yuri Tricys presents some configurations and packages to customize Olivetti-mode. He shows how to adjust the margins, toggle the fringe on and off, and configure wrap and fill columns, He also shows using the highlight-numbers and the stripes packages.

Unfortunately, Tricys doesn’t provide any examples of the output but most of his configurations are self explanatory. If you’re a writer who uses or is considering using Olivetti-mode, take a quick look at Tricys’ post.

The second tutorial is by Franco Pasut and considers using expand-region with LaTeX. Many Irreal readers are probably familiar with expand-region from using it with their programming buffers but it’s also useful for dealing with LaTeX source. Pasut has a series of animated GIFs that show it in action. Judging from the GIFs, expand-region has some shortcomings when used with LaTeX as compared to other languages. For example, I’d expect the highlighting to go from word to sentence and then to paragraph.

Of course, Magnar anticipated that people would want to add capabilities and made that easy. If you’re really interested in using expand-region with LaTeX, you should look into adding the features you need.

Posted in General | Tagged | Leave a comment

Quitting Safari

Today’s post is specific to those Irreal readers who use the Safari browser. As I’ve written many times, almost all my tube time is spent in either Emacs or Safari. A typical workflow occurs when I’m reading my RSS feed in Emacs with Elfeed. If I see a post that looks interesting, I have Elfeed launch the site in the browser. After I finish with the website, I delete the tab with ⌘ Cmd+w. This same process also happens in many other situations.

The problem is I often type the neighboring key ⌘ Cmd+q instead, which quits Safari and all the open tabs I was working on. That’s not too bad because Safari has an option to reload all the tabs from the previous session so I don’t really lose those tabs.

But there is a problem. When I quit Safari like that, I lose the mapping from F6 to Emacs and can only get it back by rebooting macOS. That’s a real problem because I’m constantly using F6 and F7 to switch between Emacs and Safari.

The last time it happened, I’d had enough and decided something had to be done. Surely, I thought, there must be a way to get Safari to query you before quitting. That’s what happens when you spend all your time in Emacs: you expect everything to be configurable. But Safari is not Emacs and there isn’t an option for asking for confirmation before quitting. I asked Duck Duck Go and found this post from John Gruber, who had similar problems. Gruber provides a bit of Apple Script to provide the confirmation dialogue but he mentions that if all you want to do it avoid confusing ⌘ Cmd+q with ⌘ Cmd+w, you can simply change (or remove) the shortcut for quitting Safari. That’s really easy to do: see Gruber’s post for the details.

Now I’m having the reaction I always have when I trivially solve some longstanding problem: why didn’t I do this earlier? I will, it appears, never learn.

Posted in General | Tagged , | Leave a comment

Prot on Bookmarks

Protesilaos Stavrou has a new video out on the Emacs bookmarks system. If you don’t use bookmarks, you should give them a try. They’re really handy for files you use often but don’t want to keep loaded all the time. Where they really shine for me is hard-to-find nodes in the info system. For example, I always have a hard time finding the Emacs syntax class information so I set a bookmark to pop me right into the info page.

If you use bookmark+ you can even use bookmarks to call a function or load a page in your browser. I have a bookmark to load Irreal, which is useful when writing and posting to the site. I’ve been using bookmark+ for a long time so I’m no longer sure what functionality is also in the default bookmark package.

If you want to integrate bookmarks into your workflow, I can’t recommend stealing abo-abo’s workflow enough. He uses a hydra and his headlong package to make opening a bookmark every efficient. Here’s the hydra entry I use for opening bookmarks

("m" headlong-bookmark-jump "bmk")

I’ll let you read the details at the above link but the TL;DR is that you can specify a bookmark with a single key in most cases. Thus, to open the aforementioned syntax node, I simply type Hyper+w m s and the page opens. The Hyper+w invokes a hydra that I use for window and buffer related operations. The m says to jump to a bookmark and the s specifies the syntax class info node.

The video is 24 minutes, 20 seconds long so plan accordingly. As always with Prot’s videos, it’s worth spending a few minutes on.

Posted in General | Tagged | Leave a comment

Enabling Multiple Minor Modes

Timo Geusch has a nice quickie post on setting multiple minor modes for a buffer. Often it’s convenient to have several minor modes associated with a buffer. For example, when I’m writing blog or prose text I like to have

  1. visual-line-mode
  2. wc-mode
  3. flyspell-mode

turned on and auto-fill-mode turned of. That’s enough modes that it’s inconvenient to set them by hand. The normal solution is to turn them on in the local variables list at the top or bottom of the file.

# -*- eval: (visual-line-mode 1); eval: (auto-fill-mode -1); eval: (wc-mode 1); eval: (flyspell-mode 1;) -*-

That works well and is what I do for non-blog writing but you have to take some sort of action to get it into each buffer such as including it or copying it by hand.

Geusch has another solution. He wrote a simple function to turn on the minor modes he needs and then runs that function in a hook for the type of buffer he’s interested in. That’s really easy if you use the use-package macro to configure your packages because you can use its :hook keyword to cause the function to be called. See Geusch’s post for the details and sample code.

It’s a simple idea and easy to implement but it can make your workflow a bit easier. Definitely worth taking a look at.

Posted in General | Tagged | Leave a comment

Embedding Images in Text Files

Yuan Fu likes to take notes in which he can embed images. You can do that with Org, of course, but Fu doesn’t like that Org’s solution boils down to a link to a file. That means you have to keep the file paths in sync. He wanted a solution that embedded the image in the file and made it easy to resize the image on the fly.

To a first approximation, his solution is simple: Embed the image as a Base64 string at the bottom of the buffer and put an internal link to it at the point to where it is to appear. Of course, there are complications. First, there’s handling the resizing. That’s not too hard but there are also display issues such as having reasonable scrolling. Fu has some animated screenshots that show this in action. It appears to work well.

The code does not appear to be in Melpa and Fu doesn’t say whether he plans to submit it but it’s a single file and should be easy to load and try out. If you have a need to permanently embed images in a file and don’t want to have to worry about keeping file paths in sync, this is a good solution.

Posted in General | Tagged | Leave a comment

The Technical Problems with Apple’s CSAM Scanning

I’ve written several posts (1, 2, 3, 4, 5, 6, 7) about Apple’s planned CSAM scanning project but those posts have always focused on how Apple was betraying their long held promise to protect our privacy and not allow random snooping through our iPhones. To me, that’s the most important aspect of the controversy: it’s really important—at least to me—to feel secure that your smartphone is not collecting information about you and reporting it to the government or anyone else.

This post is a quick look at the other reasons to be against Apple’s plan. I’ve collected them under the rubric of “Technical problems” but, strictly speaking, they aren’t all “technical.”

The first issue is that the matching is based on hashing CSAM images and comparing the hash against images on the phone. The problem is collisions. Hashing is a way of reducing any sequence of bits, say \(n\) long, to a sequence of \(m ≪ n\) bits. That necessarily means that more than one sequence of bits will reduce to the same \(m\) bit value. In terms of Apple’s system, that means that more than 1 image will have the same hash value.

Hashing algorithms generally deal with these collisions by comparing the two values that were hashed to make sure they’re a match but that’s not possible here because it’s illegal a have a copy of the actual CSAM image, let alone to download it to billions of iPhones. To a first order of approximation, Apple treats identical hash values as a match. It protects against ambiguity by two means:

  1. The number of matches have to exceed a threshold (\(≈30\)) before Apple even looks at the results.
  2. Even when the threshold is exceeded a human being looks at the potentially matching images to make sure they really are child porn.

Apple’s protocol is more robust than I’ve recounted here (see this technical summary and this paper detailing the theoretical details). Among other things it’s resistant against hackers generating false matches or pedophiles discovering offending hashes so they can bypass them. In addition, Apple is prevented by technical means from seeing any of the potential matches until the threshold is exceeded. Despite some folks generating images that hash to the same value (1, 2), Apple’s protocol seems to me to be pretty robust against such attacks.

That’s bad news for Apple’s hope of refining and reintroducing their plan. It’s hard to see how anything like the current plan could be more secure so any changes are likely to be eyewash.

But the real danger with Apple’s plan is something out of their control: that the machinery for CSAM scanning will be repurposed for other, less savory purposes. Apple. of course, says that they will refuse to let it happen but that claim is empty. When presented with a court order or law demanding that they scan for, say, terrorist images or content, they will have no choice but to comply. And that doesn’t begin to address what they will do when China and others bring economic pressure to bear. Apples CSAM scanning machinery is easy to adapt for other types of content monitoring. It’s really not something you want on your phone.

This isn’t just paranoid ravings. The developers of the algorithm that Apple uses have written a WAPO op-ed in which they say that they concluded the algorithm was too dangerous to be used precisely because of its potential for abuse. If you read none of the other links from this post, you should read that one.

The takeaway from all this is that Apple should, once and for all, abandon this project. The dangers are manifest and the benefits few. Those dealing with CSAM images can easily work around Apple’s scanning and the rest of us will be paying with our privacy for nothing. Part of problem is that Apple’s protocol is clever and a nice piece of engineering. Those involved with its development are doubtless in love with the result and will hate to throw it away but that’s the right thing to do.

Posted in General | Tagged , , | Leave a comment

Apropos Library

Recently a post by jao, who’s written a whole bunch of excellent software, popped up in my feed inbox. It’s just a very short (15 words) mention of apropos-library, a function that lists all the variables and functions in a library. It can also be configured to show the keybindings for the functions.

Apparently it’s been around since Emacs 23 but neither jao nor I were aware of it. It seems like a useful facility. Even though you won’t need it often, it’s easy to see how it could be really useful in certain circumstances. It’s already installed so give it a try to see how it works.

Posted in General | Tagged | Leave a comment