Displaying The Active Clock

Over at Ray on Emacs, Raymond Zeitler has an interesting post on displaying the Org clocked in status. The default is to display it in the mode line but Zeitler wanted to display it in the title bar too. It turns out you can turn it off, display it in the mode line, display it in the title bar, or display it in both the mode line and title bar. These choices are controlled by the org-clock-clocked-in-display variable.

If you regularly clock in your tasks, having flexibility in where the status is displayed could be useful. The problem is I couldn’t find any reference to this variable in the help system or in timeclock.el, which handles the seemingly related timeclock-mode-line-display.

I updated my packages to make sure I had the latest Org Mode (I’m on Org 9.8.8) but I got the same results. I’m guessing that Zeitler is using one of the Emacs 31 prereleases, which implements this. If you’re interested in this feature and are on Emacs 31Try it on your system and see what happens. If it works for you, leave a comment.

Posted in General | Tagged | Leave a comment

Another Reason To Use An Ad Blocker

Long term Irreal readers know that I’ve always been ambivalent about ad blockers. On the one hand, many Web sites that provide content need to make money to survive and the only generally effective way of doing that is through advertisements. That does not mean, though, that Irreal or any of you are therefore consenting to abuse. Sites that use tracking techniques to follow you and record your online actions are not ethical and should be illegal.

So the other hand is that users have to protect themselves and unfortunately those—probably few—ethical advertisers suffer. I’ve always said that I’d turn off my ad blocker if the advertisers turned off their trackers. I doubt the makers of ad blockers have much to worry about.

Now there’s another reason to use an blocker. The abusers have themselves been abused. The TL;DR is that the digital advertiser service, Adform, was hacked and started serving malware that stole crypto currency from the infected users. Since Adform serves about 1.5 billion ads a day, that’s potentially a lot of infected computers.

Adform, of course, had nothing to do with the malware other than that their (hacked) servers were used to distribute it. That’s the point. Even if Adform delivered only ethical ads with no tracking, you’d still want to block them to avoid malware. This fact in conjunction with the ad industry’s intransigence means that it would be foolish for anyone to forego the safety of an ad blocker.

Posted in General | Tagged | Leave a comment

I 🩷 RSS

I don’t use social media. Why would I? Who wants some algorithm telling you what to read and filtering your own content? What I do like is RSS. You see messages about all the content from all the sites you’re interested in. As I’ve said before [1, 2], I really like RSS and I’m sad that Google and others pushing social media did everything they could to kill it. But, after all, it wasn’t monetizable.

Fortunately, despite what the pundits will tell you, RSS has survived and is prospering among those who haven’t been lobotomized by social media. Among those people is Andrew Shell who has a site where people who feel similary can list their webpage and agreement.

If you have a Web site and agree, send your site’s URL to Shell and get your site on his list of sites that love RSS.

Posted in General | Tagged | Leave a comment

The Em Dash And Emacs

Irreal, as you all know, is an em-dash friendly site. Irreal has always liked them and now we like them even more because it puts a thumb in the eye of those mentally challenged folks who claim, erroneously, that “real people” don’t use em-dashes and their presence in a document is a sure sign of AI generated text.

It turns out that JTR over at The Art Of Not Asking Why is also an em-dash aficionado and has been struggling with how to enter them, especially when using Emacs. His final solution involves expand-abbrev but seems to me overly complicated. He types --- then immediately calls expand-abbrev by typing Ctrl+x `.

We here at Irreal have the same problem, of course, but solved it in what seems to me a much simpler way:

(defun jcs-insert-em-dash ()
  "Insert an em-dash at point"
  (interactive)
  (insert 8212))

and

(global-set-key (kbd "H--") #'jcs-insert-em-dash)

I have Hyper bound to the right ⌘ Cmd key so it’s really easy to invoke it: thumb on Hyper and index finger on - and it inserts an em-dash directly into the source exactly as JTR wanted.

I don’t claim my solution is better than JTR’s, only that it suits me better. It’s just another example of Emacs letting you have it your way.

Posted in General | Tagged | Leave a comment

Lisp Dialects Compared

Elia Scotto has an excellent post on the major Lisp dialects. There are, of course, several Lisp flavors and while they share many features—including, more or less, syntax—there are nevertheless differences that make the choice of which one to use nontrivial.

That’s where Scotto’s post comes in. He compares Common Lisp, Clojure, Racket (Scheme), and Elisp. He describes each dialect, its strengths, and its weaknesses. The TL;DR is:

Common Lisp
The oldest most complete Lisp, it had libraries and functions for almost everything. It’s premier implementation, SBCL, operates on a large range of hardware and compiles to native code. Its generated code rivals that of C.
Clojure
A modern dialect with some syntactical oddities, this Lisp runs on the JVM, which makes it perfect for large business apps running on Java. Scotto recommends Clojure as a first choice for a beginner looking for a practical and elegant Lisp.
Racket
Racket is a Scheme derived Lisp that’s particularly strong for designing and implementing new languages. Unlike the other Lisps, Racket lets you specify a syntax for your new language even if it’s not a Lisp-like syntax.
Emacs Lisp
Irreal readers probably need no introduction to Elisp. Scotto describes it as an older, limited extension language for Emacs but it is, of course, much more. I—and many others—use it for building tools and one-off internal apps.

There’s a lot more detail in Scotto’s post so be sure to a look at it.

Posted in General | Tagged | Leave a comment

Apple Advertising

This week, I came across a couple of posts feeding my new hobby horse: Apple’s descent into advertising. Like almost everyone else, I HATE, HATE, HATE having ads pop up when I’m trying to do something else. It’s bad enough on Web sites where at least they have the excuse of having to make money some how but it rises to intolerable when they put them up on a device I’ve already paid for.

The annoyance is reason enough to dislike Apple’s ads but for me the worst thing is that they’re corrupting and inevitably lead to the user being replaced by the advertiser as the customer. I’ve said all this before and now John Gruber at Daring Fireball is making much the same argument. He says ads in software are like stickers on your laptop. Apple has always considered the stickers an abomination and refused to put them on their hardware. Gruber reminds us what Steve Jobs had to say about those stickers:

You know, we put ourselves in the customers’ shoes and we say, what do we want stuck on our product when we take it out of the box? And the answer is, nothing.

The same principal applies, I submit, to advertisements in software. We’re not talking about freeware here but to software that we purchased as part of the price of our Apple products.

Meanwhile, Jason Snell over at Six Colors makes the analogy of checking into an expensive but good hotel. You expect things to be perfect: the soap smells nice, the refrigerator is maintained, and the pool is clean. The hotel, of course, can save money by scrimping on those things but if they do they become a lousy but expensive hotel.

It’s the same with Apple. We’re willing to pay more for their products because they’re excellent and give good value. If Apple starts sullying those products, suddenly that extra cost doesn’t seem as worthwhile.

I hope Apple abandons this misadventure. It’s not like they need the extra cash.

Posted in General | Tagged | Leave a comment

🥩 Red Meat Friday: The Scourge Of Dickovers

Over at Pluralistic, Cory Doctorow has a righteous diatribe about dickovers. If you’re not familiar with the term, dickover was coined by John Gruber to describe those super annoying popups that cover the text you’re trying to read. They’re bad enough for those of us in the U.S. but Doctorow says they’re even worse in the UK and EU where they’re used as a sort of malicious compliance with the GDPR.

The thing is, those popups asking if we consent to the use of cookies are completely unnecessary. The law says that sites must presume that users do not want to be spied on and the popups are simply a way of tricking users into giving that consent. It appears to work. According to the Kill The Cookie Banner site, 90% of people agree to the spying by simply clicking through so they can get on with reading whatever they came to see.

A lot of Doctorow’s post describes ways of dealing dickovers but the salient point for me is the “Global Privacy Control” (GPC) signal. That’s an indication that browsers can send to websites saying that the user does not give permission for their spying. The surveillance industry hates this, of course, and largely ignores it. There are efforts in the EU to make compliance mandatory and a couple of states in the U.S. have already done so. The advertisers are, naturally, against this and have pulled out all stops to scuttle the legislation.

It’s fine to deploy stopgap measures—such as those recommended by Doctorow—to fight surveillance advertising but the real solution is to make the advertisers follow the law and stop offering specious reasons why they can’t or won’t obey it. A good first step is to make honoring the GPC mandatory.

Posted in General | Tagged | Leave a comment

Turning Two Spaces Into A New Sentence

In the Apple ecosphere—especially in iOS—a convenient short cut is to type two spaces to end the current sentence and start a new one. Specifically, two spaces will delete the spaces, insert a period and a space, and capitalize the next letter. There’s probably something similar in the Android world; it seems like a natural thing to do.

Over at Bicycle For Your Mind, macosxguru has a post that describes three of the recent changes he’s made to his Emacs environment. Two of them—showing tabs and newlines explicitly, and fiddling with his mode line probably won’t interest most Irreal readers. The third is importing the two space shortcut into Emacs.

Emacs, of course, doesn’t have that capability but macosxguru added it with a bit of Elisp which he binds to the Space key with the text-mode hook. It looks for two consecutive spaces and repaces them with a period and space. The tricky part is capitalizing the next letter. He does that by reading the next character explicitly and capitalizing it if it’s a letter. He also checks for some special keys (like an arrow key) and “unreads” them so that Emacs can treat them normally. All the code is in the post so see it for the details if you’re interested.

I’m ambivalent about this change. On the one hand, I use it all the time on my iPhone and iPad but that’s because typing is such a pain on virtual keyboards. On a regular keyboard, I’m pretty sure that I could type the period, space, and next letter just as fast. The shift for the next letter might slow things down a bit but not by much. I haven’t decided yet whether I will adopt it but inertia will probably cause me not to.

Posted in General | Tagged | Leave a comment

Folding In Non-Org Buffers

Marcin Borkowski (mbork) really likes being able to cycle folding in Org buffers. Of course, then he wanted to be able to do the same thing in any buffer. In particular, he wanted to be able to fold and unfold groups of functions as a set. He experimented with all sorts of solutions including the builtin outline minor mode.

None of them were quite what he wanted. Then he found outli. It was perfect for his needs. It’s a third party package but appears to be well maintained and is less than 400 lines of code. What he really likes, though, is the keybindings. Most important to him is that Tab cycles the folding just like in Org mode.

Although I like and use headline folding in Org mode, I’ve never been able warm up to code folding. On those rare occasions when I want to narrow focus to a single function—usually to delimit searches—I simply narrow to the function or region in question. Of course, others, like mbork, disagree and those folks may want to check out mbork’s post to get the details of his solution.

Posted in General | Tagged | Leave a comment

A Quick EWW Hack

I’ve been writing a bit lately about my growing use of EWW [1, 2, 3, 4]. I was always a little skeptical of those who said they made significant use of EWW for their browsing but then I realized that I had started doing the same thing. It certainly hasn’t replaced Safari but I am using it more and more.

It started fairly innocently. I use elfeed-webkit to render the web pages from my RSS feed. That has the significant disadvantage that my ad and tracking blocker doesn’t work for them. That, in turn, means that I get all sorts of junk displayed. It’s usually a dickover but sometimes there’s a seemingly never ending train of popup ads. Fortunately, elfeed (and elfeed-webkit) have a hot key to display the page in EWW and avoid all that. Now as soon as a dickover covers up the text or a avalanche of ads starting popping up, I simply switch over to EWW and read in peace. It’s surprising how little I need JavaScript.

As I said, I find myself using EWW more and more. It’s easy to call it from Embark when the point is on a URL and often I’ll just use it instead of invoking Safari. Of course, that brings up question. Can I switch from Safari to EWW when I need to? I couldn’t find any builtin way but I realized I already had everything I needed to do it. The first part is to retrieve the URL of the current Safari Web page. I’ve had a function to do this for a long time and use it all the time to capture links to the current Web page into Org. It’s pretty simple but restricted to macOS. Here it is.

(defun jcs-retrieve-url ()
  "Retrieve the URL of the current Safari page as a string."
  ;; (org-trim (shell-command-to-string
  ;;   "osascript -e 'tell application \"Safari\" to return URL of document 1'")))
  (do-applescript "tell application \"Safari\" to return URL of document 1"))

The way to do this varies by browser and OS but is usually straightforward.

The second part is doing the actual switch. Again, it’s simple:

(defun jcs-switch-to-eww ()
  "Invoke EWW for the current Safari web page"
  (interactive)
  (eww (jcs-retrieve-url)))

I put this in iCanHazShortcut and bound it to Ctrl+F7. It works fine except I haven’t yet figured out how to switch to Emacs from Safari so I have to press F6 for that. That’s a small price to play until I figure out the rest of the magic spell.

EWW, of course, has a way to switch to the default browser so it’s easy to pop back and forth as needed. It’s a small thing but makes my workflow easier.

Posted in General | Tagged , | Leave a comment