Charles Choi: Announcing Casual (Redux) and Reorganization

A recent effort to try to publish the Casual packages on ELPA resulted in push-back: There are too many of them. After a bit of contemplation and external input, I made the decision to consolidate the Casual packages as follows:

  1. A new base package named casual would be created to contain all user interfaces for the built-in Emacs modes it supported. The following packages would be superseded by casual:

    • casual-agenda
    • casual-bookmarks
    • casual-calc
    • casual-dired
    • casual-editkit
    • casual-ibuffer
    • casual-info
    • casual-isearch
    • casual-lib
    • casual-re-builder
  2. Casual packages reliant on a third-party package would still be distributed as a separate package. Two such packages exist in this category:

    • casual-avy
    • casual-symbol-overlay
  3. The package casual-suite would still serve as an umbrella package, in this case installing the following packages as dependencies:

    • casual
    • casual-avy
    • casual-symbol-overlay

I’m happy to announce that today that consolidation work is largely complete and available to the public. The consolidated package casual is now available on MELPA and that the related packages casual-avy, casual-symbol-overlay and casual-suite have all been updated to reflect said changes. To help distinguish these aforementioned packages from the past organization, all of them have been bumped to a major version of 2.

The packages superseded by casual will eventually have their distribution on MELPA removed, likely within a week or two of this post’s date. They have been recently updated to issue a warning to upgrade to casual.

Configuration Changes

If you have an installation of a Casual package prior to 2.x, your configuration for the Casual user interfaces should require no changes, particularly if you do not use use-package.

On the other hand, users who have configured Casual with use-package will likely need to take into account the consolidated package casual, particularly if it is used to download/update the package.

While we are on the topic of use-package, I have also made the decision to not provide guidance on using it to configure Casual user interfaces. This is largely due to the fact that I do not regularly use use-package so my knowledge about it is poor as well as my ability to verify its behavior. Rather than give bad guidance on use-package, I have chosen to not offer it. That said, I encourage knowledgeable use-package users to provide support for it in the Discussions section of the casual repository.

Closing Thoughts

For everyone who has been along with me in this journey of using Casual, I thank you and also appreciate your patience with these changes. Hopefully they will improve your user experience with Casual once all the dust settles.

If this is all new to you, then welcome! I invite you to try Casual out.

I am always open to feedback on Casual; please share your thoughts on it at its discussions section.

References

-1:-- Announcing Casual (Redux) and Reorganization (Post Charles Choi)--L0--C0--October 22, 2024 03:20 AM

Alvaro Ramirez: Hide another detail

21 October 2024 Hide another detail

It's been 5 years since I talked about showing/hiding Emacs dired details in style, a short post showcasing hide-details-mode (built-in) and diredfl (third-party).

While my dired usage increased over the years, my dired config remained largely unchanged. Today, I'll show a new dired tweak.

As you likely suspect by now, I'm a big fan of hide-details-mode. It gives me super clean and minimalistic view of my files.

before.png

If I need more details, it's one toggle away using my trusty C-( binding.

toggle-before.gif

Now this is a super minor thing, but for a little while, I wished I could also hide the current directory's absolute path as part of hide-details-mode's toggling. In the same spirit as other hidden dired details, I rarely need to see the absolute path. And if I did, it'd only be a toggle away.

With that in mind, I set out to bend dired my way. I looked at the dired-hide-details-mode built-in code (dired.el) and came across invisibility specs, which I hadn't used before. Dired uses add-to-invisibility-spec and remove-from-invisibility-spec to show and hide details using the invisible property set to dired-hide-details-information.

Now that we know what property to set, we need to find the text to apply it to. Dired offers that via dired-subdir-regexp. All we need to do is match the regular expression and apply our invisible property to the relevant bounds.

(defun  hide-dired-details-include-all-subdir-paths ()
  (save-excursion
    (goto-char (point-min))
    (while (re-search-forward dired-subdir-regexp nil t)
      (let* ((match-bounds (cons (match-beginning 1) (match-end 1)))
             (path (file-name-directory (buffer-substring (car match-bounds)
                                                          (cdr match-bounds))))
             (path-start (car match-bounds))
             (path-end (+ (car match-bounds) (length path)))
             (inhibit-read-only t))
        (put-text-property path-start path-end
                           'invisible 'dired-hide-details-information)))))

All that's left is for us to add our new function to a hook, and we're good to go.

(use-package dired
   :hook ((dired-mode . dired-hide-details-mode)
         (dired-after-readin . hide-dired-details-include-all-subdir-paths)))

My Dired window is even cleaner now. The current directory's absolute path is now hidden.

after.png

There may be times we need to peek at the absolute path. We can now toggle hiding this detail just like the others.

toggle-after.gif

My first Emacs patch

While this is a rather small change, I figured I could use it to get my toes dipped as a first Emacs contribution. I've since reworked the patch to fit into dired.el's code and submitted for review.

I'm happy to report the tiny feature's now merged to master as of a couple of days ago. Yay! 🎉

It'll be sometime until the feature makes it to a release, but if you're living on the Emacs master edge, it should be available there. While the feature is disabled by default, it can enabled with:

(setq dired-hide-details-hide-absolute-location t)

Happy hiding!

Enjoying this content? Using one of my Emacs packages?

Help make the work sustainable. Consider sponsoring. I'm also building lmno.lol. A platform to drag and drop your blog to the web.

-1:-- Hide another detail (Post)--L0--C0--October 21, 2024 07:40 PM

Irreal: Adding Org Image Links From Dired

Over at DyerDwelling there’s another great example of using a bit of Elisp to sand down the friction of a recurring task. The task in question is generating an Org link with attributes for an image file in Dired to be inserted into a blog post.

Capturing a file link from Dired is easy, of course, but the goal of this hack was to add some size attributes along with the link. If you know a little Elisp, it’s easy to imagine the necessary code. In any event, the code is there in the post.

It’s just another example of how Emacs makes it easy to automate a lot of routine tasks. One could, of course, simply add the attributes manually or even use something like yasnippet to insert them but a little bit of Elisp make the problem disappear.

If you’re a blogger and sometimes want to add images to your posts, take a look at the DyerDwelling post. Even if it’s not exactly what you want, it should be easy to adapt to your needs.

-1:-- Adding Org Image Links From Dired (Post jcs)--L0--C0--October 21, 2024 02:33 PM

Sacha Chua: 2024-10-21 Emacs news

Links from reddit.com/r/emacs, r/orgmode, r/spacemacs, r/planetemacs, Mastodon #emacs, Hacker News, lobste.rs, programming.dev, lemmy.world, lemmy.ml, communick.news, planet.emacslife.com, YouTube, the Emacs NEWS file, Emacs Calendar, and emacs-devel. Thanks to Andrés Ramírez for emacs-devel links. Do you have an Emacs-related link or announcement? Please e-mail me at sacha@sachachua.com. Thank you!

View org source for this post
-1:-- 2024-10-21 Emacs news (Post Sacha Chua)--L0--C0--October 21, 2024 12:15 PM

TheMKat: My life isn’t going anywhere - wishing my life had meaning

Today I'm going to talk about failure, or at least failure as perceived by yourself. This is my blog after all, so some posts with me talking about the sad realities of life is allowed. This is probably more in the rambling category than any other thing I have written. It is also way more personal, so I understand if some of you want to skip this one.
-1:-- My life isn’t going anywhere - wishing my life had meaning (Post)--L0--C0--October 21, 2024 12:00 AM

Arne Bahlo: Jujutsu in practice

This post is not about the Japanese martial arts Jiu-jitsu, it’s about a new VCS, or version control system. There are some great tutorials and introductions for Jujutsu, short jj, so I want to give some insight in how I use it day to day for this website.

Initialize a repository

You can initialize jj in an existing git repository like this:

$ jj git init --git-repo .

This will create a .jj directory next to .git. You can now use both git and jj, although I wouldn’t recommend it. There’s a work-in-progress native storage backend, but since all my projects are git repositories anyway, this works great for me.

Note that this is non-destructive; if you want to go back to git, all it takes is a rm -r .jj.

Get an overview

Running jj log in the repository for this very website gives this output:

$ jj log
@  qzsvtxpv hey@arne.me 2024-10-21 09:58:06 e18f7532
  Add blog/jj-in-practice
 ○  yoxxsupn hey@arne.me 2024-10-20 22:55:03 ae5d9109
├─╯  Add library/calibans-war
 ○  tvkvwslw hey@arne.me 2024-10-20 22:49:54 5e4dee1f
├─╯  Add library/the-posthumous-memoirs-of-bras-cubas
 ○  pywmtrys hey@arne.me 2024-10-20 21:20:11 7bda14b7
 │  Add atoms/1
 ○  xnlzypwn hey@arne.me 2024-10-20 21:20:10 8a004404
├─╯  Add atoms functionality
  wxxtrmqk hey@arne.me 2024-10-20 16:18:15 main HEAD@git 1eb46c81
  Add weekly/166
~

This already shows one of the biggest differences, compared to git: There’s no branches, other than main. You can create branches, which are called bookmarks in jj, but you don’t need to. Instead, you work mostly with changes1.

The terminal above shows the change w (you can use the first letter to reference changes, on your terminal it’ll be highlighted as well) as a parent to x, t, y and q. All these child-revisions don’t have a branch/bookmark, but they don’t need one. You can see what’s in-flight at this repository better than with any git repo, especially if branches haven’t been cleaned up in a while.

Create a revision

My usual flow with git, is to leave chages in the staging area until I’m ready to commit. Sometimes, if I have to switch branches or want to save my work, I’ll stash or create a WIP commit.

In jj, there is no staging area—everything is a revision. Let’s create a new revision on top of my revisions where I add atoms functionality:

$ jj new -r p

Running git log again:

$ jj log
@  kxqvnxnw hey@arne.me 2024-10-21 10:03:20 22c020cf
  (empty) (no description set)
  pywmtrys hey@arne.me 2024-10-20 21:20:11 HEAD@git 7bda14b7
  Add atoms/1
  xnlzypwn hey@arne.me 2024-10-20 21:20:10 8a004404
  Add atoms functionality
 ○  qzsvtxpv hey@arne.me 2024-10-21 10:03:18 27229dca
├─╯  Add blog/jj-in-practice
 ○  yoxxsupn hey@arne.me 2024-10-20 22:55:03 ae5d9109
├─╯  Add library/calibans-war
 ○  tvkvwslw hey@arne.me 2024-10-20 22:49:54 5e4dee1f
├─╯  Add library/the-posthumous-memoirs-of-bras-cubas
  wxxtrmqk hey@arne.me 2024-10-20 16:18:15 main 1eb46c81
  Add weekly/166
~

You’ll notice that our active revisions are now left-aligned, and the one to add this very blog post has moved to the right. There’s no hirarchy, they’re all descendants of Add weekly/166.

After doing some work, e.g. addings a new atom, I can describe that revision with jj describe. This is comparable to git commit, but it doesn’t actually create a commit or a revision, it only describes the current one.

Sometimes I want to update a previous revision, in this case Add atoms/1. I can run jj squash to merge the current one with its parent.

Push and pull

To fetch new revisions, I run jj git fetch, to push branches/bookmarks, I run jj git push. This uses the same git server it was using before.

Before pushing, I need to move my bookmark to the revision I want to push. I push the main branch to deploy my website, so if I wanted to publish my atoms functionality (should I?), I would run jj bookmark set main -r p before pushing.

Rebase and split

Sometimes I need to rebase. Fortunately that’s a lot simpler than it is in git: I can run jj rebase -s <source> -d <destination> to move revisions around. If I wanted support for atoms for this blog post, I would run jj rebase -s q -d p and it would move the revision for this blog post on top of “Add atoms/1”.

jj also does automatic rebasing, e.g. if you squash changes into a revision that has descendants.

And if I have a revision that I’d like to be two, I run jj split and interactively select what belongs to which revision.

Undo

Undoing an (interactive) rebase in git is not fun. jj undo undoes the last jj operation, doesn’t matter if it’s abandoning (deleting) a revision or doing a rebase. This is a life saver! You can also run jj op log to display your last jj operations.

Things I stumble upon

I’ve been using git for a long, long time. My brain assumes that after a commit, I’m working on the next one. It also assumes that jj describe does the same as git commit (it’s not). I often describe a revision and continue editing files, which then erroneously get added to the current revision. I’m not saying this is wrong, it makes sense in the jj world, but I keep tripping over that and have to run jj split to pull changes out again.
alterae on Lobste.rs pointed out that you can describe and immediatly create a new revision on top of it with jj commit. Thanks!

One other thing is that you cannot check out a revision directly (or maybe I just don’t know how to), so when I’ve moved to a different revision and want to move back, I run jj new <revision>, which creates an empty revision on top of it. This means that if I’m not done with the revision, I have to keep running jj squash to move changes into it.
gecko on Lobste.rs pointed out that you can check out a revision directly with jj edit <revision>. Thanks!

Why it works for me

A week ago, I removed jj from my website’s repository, to see if I’d miss it. I added it back the same day. Jujutsu feels lighter than git, while at the same time giving you a full overview of what’s in-flight right now2. Having no staging area means I only need to worry about revisions (see caveat above).

If trying new things sounds fun to you, give Jujutsu a spin!

Further reading

  1. What’s cool about a jj change, is that updating it doesn’t change it’s ID.

  2. If you work in large projects with many contributors, you can tune your jj log to only your revisions.

-1:-- Jujutsu in practice (Post Arne Bahlo)--L0--C0--October 21, 2024 12:00 AM

Sacha Chua: Shuffling my Org Mode unscheduled tasks

I enjoyed listening to Podcast #1,029: Treat Your To-Do List Like a River, and Other Mindset Shifts for Making Better Use of Your Time | The Art of Manliness (thanks @ctietze@mastodon.social for the recommendation) and checking out the Autofocus method (main website with translations) for reviewing your TODO list without worrying too much about prioritization. I also had an opportunity to reflect on similar topics in a conversation with John Wiegley and Adam Porter about personal information management (which I'll be blogging about once John has a chance to review the draft).

This nudged me to experiment with randomizing my unscheduled task list. I'm not trying to finish everything on my list, I'm just mixing it up so that I enjoy keeping things on my radar and picking something to do. org-ql lets me create randomly-sorted views, so I wrote some code to show me a shuffled list of my unscheduled TODO tasks and SOMEDAY tasks.

(defun my-org-ql-shuffle-todo ()
  (interactive)
  (org-ql-search (org-agenda-files)
    '(and
      (todo "TODO" "STARTED")
      (not (done))
      (not (scheduled))
      (not (deadline))
      (not (ts-active))
      (not (tags "cooking")))
    :sort 'random))

(defun my-org-ql-shuffle-someday ()
  (interactive)
  (org-ql-search (org-agenda-files)
    '(and
      (todo "SOMEDAY")
      (not (done))
      (not (scheduled))
      (not (deadline))
      (not (ts-active))
      (not (tags "cooking")))
    :sort 'random))

I can't make it part of my org-agenda-custom-commands yet because of an open issue, but having separate commands is a starting point. It's surprisingly fun. I used org-agenda-follow-mode to quickly flip through the tasks while looking at the agenda. I've already noticed some tasks to cancel and picked some tasks to do. Could be neat!

This is part of my Emacs configuration.
View org source for this post
-1:-- Shuffling my Org Mode unscheduled tasks (Post Sacha Chua)--L0--C0--October 20, 2024 11:00 PM

Irreal: Substitute Command Keys

Marcin Borkowski (mbork) has a nice post on the Emacs substitute-command-keys command. The TL;DR is that it’s a way of mapping a command name to its keybinding. I’ve long been familiar with it but only in the context of Emacs Doc strings. For example, here’s the Doc string from one of my custom macros:

  "Convenience macro to generate a key sequence map entry
for \\[prettify-key-sequence]."

the \\[prettify-key-sequence] is mapped to whatever the current binding for prettify-key-sequence is. It’s nice because I can change the binding without having to worry about updating the documentation.

Mbork’s post tells us that my use above is really just a special case of a more general facility: substitute-command-keys. You can programmatically convert a function name to its binding by calling substitute-command-keys.

I’m not sure where you’d want to use this other than in a Doc string (or maybe an Org doc) but I’m ready to be educated on the matter. I can’t remember where I learned about using \\[...] in the Doc string. It was probably from seeing it in some function in Emacs core. One thing for sure, it’s not easy to discover without looking for it explicitly or stumbling across it like I probably did.

In any event, this is a useful thing to know. It’s a great example of how Emacs is self documenting.

-1:-- Substitute Command Keys (Post jcs)--L0--C0--October 20, 2024 02:59 PM

Protesilaos Stavrou: Emacs: the Modus themes have a new ‘rotate’ command

I just added a new command to rotate across a list of Modus themes: modus-themes-rotate. In interactive use, it uses the value of the new user option modus-themes-to-rotate. When called from Lisp, it accepts any list that consists of Modus themes.

The way I implemented this feature, we get the following behaviour:

  • Check which is the current Modus theme and find its position in the list of the themes that are in rotation.
  • Move to the next item on the list, reading from left to right.
  • If the next item is the current theme, move to the one after.

This is a nice little command that complements the existing modus-themes-toggle (switch between two themes, per modus-themes-to-toggle) and modus-themes-select (choose a theme from the entire family using minibuffer completion).

The new functionality will be available to all users as part of Modus themes 4.6.0. If you do try it before then, let me know if something is amiss.

-1:-- Emacs: the Modus themes have a new ‘rotate’ command (Post)--L0--C0--October 20, 2024 12:00 AM

Eric MacAdie: 2024-10 Austin Emacs Meetup

There was another meeting a couple of weeks ago of EmacsATX, the Austin Emacs Meetup group. For this month we had no predetermined topic. However, as always, there were mentions of many modes, packages, technologies and websites, some of which I had never heard of before, and some of this may be of interest to ... Read more
-1:-- 2024-10 Austin Emacs Meetup (Post Eric MacAdie)--L0--C0--October 19, 2024 07:12 PM

Marcin Borkowski: substitute-command-keys

Today I have a short tip for everyone that codes Elisp (for other people or even only for themselves), inspired by something I wrote recently (and will blog about soon, too). If you want to tell the user things like “press C-c C-c to finish what you are doing”, don’t hardcode the keybindings in the message string. You may bind the command to finish whatever the user is doing to C-c C-c, true, but the user could rebind it to or even M-s s-a or whatever key they like, or even unbind it completely. Instead, use the following syntax
-1:-- substitute-command-keys (Post)--L0--C0--October 19, 2024 04:49 PM

Irreal: Emacs Drawing Tools

Over at the Emacs subreddit, ismbks asks about drawing tools for Emacs. If you’re like me, the only thing that comes to mind is artist-mode with possible export through ditaa. That combination has always met my needs but it is pretty rudimentary and mostly confined to block diagrams.

The comments have some other solutions. On really nice example is AKIYAMA Kouhei’s Emacs Easy Draw. It’s very interactive and has nice line drawing capabilities. Take a look at the demo on its GitHub page to get an idea of what it can do.

Another commenter recommends PlantUML, which is good for flow diagrams and fancy block diagrams. It’s a markup application rather than interactive if you prefer that way of working.

Of course, all these applications are meant for engineers needing to draw engineering diagrams and not for artists who want to do serious digital art. Emacs is probably never going to support that sort of thing and why should it? After all, there are applications specialized for that and it’s hard to imagine a need for doing it from within Emacs.

-1:-- Emacs Drawing Tools (Post jcs)--L0--C0--October 19, 2024 03:41 PM

Protesilaos Stavrou: Iosevka Comfy version 2.1.0

Iosevka Comfy is a customised build of the Iosevka typeface, with a consistent rounded style and overrides for almost all individual glyphs in both roman (upright) and italic (slanted) variants. Many font families are available, covering a broad range of typographic weights. The README file in the git repository covers all the technicalities.

Below are the release notes.


Update to Iosevka Comfy version 2.1.0 (on top of Iosevka 31.9.1)

This is a small release that fixes a detail in the m character of all the “motion” variants. It now has a tail at the bottom right corner in addition to the top left serif. This is the same design used wherever relevant, such as in the n and u glyphs.

Other than that, the rebuild is an attempt to fix the broken files that appear on NixOS, as reported by Damien Cassou in issue 17: https://github.com/protesilaos/iosevka-comfy/issues/17. I do not know if this fixes the problem, but I cannot think of a better approach. This is not reproducible on my end (Debian stable).

All the variants

A quick reminder of all the Iosevka Comfy variants:

| Family                          | Shapes | Spacing | Style      | Ligatures |
|---------------------------------+--------+---------+------------+-----------|
| Iosevka Comfy                   | Sans   | Compact | Monospaced | Yes       |
| Iosevka Comfy Duo               | Sans   | Compact | Duospaced  | Yes       |
| Iosevka Comfy Fixed             | Sans   | Compact | Monospaced | No        |
|---------------------------------+--------+---------+------------+-----------|
| Iosevka Comfy Motion            | Slab   | Compact | Monospaced | Yes       |
| Iosevka Comfy Motion Duo        | Slab   | Compact | Duospaced  | Yes       |
| Iosevka Comfy Motion Fixed      | Slab   | Compact | Monospaced | No        |
|---------------------------------+--------+---------+------------+-----------|
| Iosevka Comfy Wide              | Sans   | Wide    | Monospaced | Yes       |
| Iosevka Comfy Wide Duo          | Sans   | Wide    | Duospaced  | Yes       |
| Iosevka Comfy Wide Fixed        | Sans   | Wide    | Monospaced | No        |
|---------------------------------+--------+---------+------------+-----------|
| Iosevka Comfy Wide Motion       | Slab   | Wide    | Monospaced | Yes       |
| Iosevka Comfy Wide Motion Duo   | Slab   | Wide    | Duospaced  | Yes       |
| Iosevka Comfy Wide Motion Fixed | Slab   | Wide    | Monospaced | No        |

Below are the updated screenshots (click to enlarge).

iosevka-comfy

iosevka-comfy duo

iosevka-comfy fixed

iosevka-comfy-motion

iosevka-comfy-motion-duo

iosevka-comfy-wide

iosevka-comfy-wide duo

iosevka-comfy-wide fixed

iosevka-comfy-wide-motion

iosevka-comfy-wide-motion-duo

iosevka-comfy-wide-motion-fixed

-1:-- Iosevka Comfy version 2.1.0 (Post)--L0--C0--October 19, 2024 12:00 AM

Alex Popescu: An Intro to Emacs packages Vertico, Consult, Marginalia, Orderless, Embark by Protesilaos Stavrou

This video from Protesilaos Stavrou provides a good overview of the Emacs packages: Vertico, Marginalia, Consult, Orderless, Embark. The post also provides the basic configuration for these packages.
-1:-- An Intro to Emacs packages Vertico, Consult, Marginalia, Orderless, Embark by Protesilaos Stavrou (Post)--L0--C0--October 18, 2024 07:59 PM

Alex Schroeder: 2024-09-18 Emacs Wiki and China

2024-09-18 Emacs Wiki and China

2024-09-14. I’m somewhere in the Italian-speaking parts of Switzerland with my wife. There is a lot of running, hiking, hugging, kissing, eating and drinking involved. 🥰

2024-09-15. Still on the trip but late at night I spent more than an hour trying to figure out why my server had a load of nearly 40. 💻

All I discovered is that load went down when I shut down Emacs Wiki. See also 2024-09-16 on Emacs Wiki.

Well, I needed to sleep and I’ve got plans for the next few days so I shut it down while I slept hoping that the misconfigured spider is fixed or the inept programmer discovers their mistake. Just another day in the Butlerian Jihad. Some misguided soul probably wanted to download it all and wrote a broken web crawler and when that got blocked they bought some nice scaling infrastructure from Amazon, Hetzner, OHV or Alibaba Cloud or whatever they are called, allowing them to use a gazillion different IP numbers that will eventually lead me to implement some sort of cloud service provider block.

Load shoots up to nearly 40 around midnight. The graph is for an entire week so the peaks are not shown. It just goes up to 30 multiple times.

2024-09-16. Switched Emacs Wiki back on after a few hours of sleep and it did fine. But then it restarted again… at 18:00, 19:00, 21:00, 22:00… and so I switched Emacs Wiki off again. Time to ban some networks!

Anybody interested in my banning of IP ranges and possibly interested in me reverting any of these, take a look at ban-cidr … from a network that isn’t banned, I guess. 😏

2024-09-17. This continues to keep me busy and angry every evening. Too bad I don’t have a real fast network-lookup to firewall ban pipeline. I’m using this script instead of carefully checking IP numbers and networks. I’m also sick and tired of the same networks popping up again and again.

I added over a hundred Chinese networks to the firewall rules and I’m seriously considering blocking the whole country for a week. It seems that most of the offenders are networks run by China Telecoms and China Mobile.

2024-09-18. So far, so good. Load stays below two.

Here’s example usage for network-lookup, filtering for Emacs Wiki and a URL parameter used when requesting recent changes or a RSS feed for a single page only. That would count as suspicious misbehaving crawler behaviour in my book.

Made 16 DNS requests.
4 cache hits.
Range Hits Org
34.32.128.0/17 3 Google LLC / GOOGL-2
113.0.0.0/13 3 UNICOM-HL / CNC Group CHINA169 Heilongjiang Province Network
14.208.0.0/12 1 CHINANET-GD / China Telecom
39.64.0.0/11 1 China Unicom Shandong Province Network / UNICOM-SD
111.36.192.0/20 1 China Mobile communications corporation / China Mobile / CMNET / ORG-CM1-AP
223.167.0.0/16 1 UNICOM-SH / China Unicom Shanghai Province Network
39.184.0.0/18 1 Internet Service Provider in China / CMNET / ORG-CM1-AP / China Mobile
111.18.128.0/20 1 China Mobile / ORG-CM1-AP / CMNET / China Mobile communications corporation
27.38.200.0/24 1 UNICOM-GDSZ / China Unicom
112.47.128.0/18 1 China Mobile communications corporation / China Mobile Communications Corporation / ORG-CMCC1-AP / CMNET
218.71.0.0/16 1 CHINANET-ZJ-WZ / Zhejiang Telecom
39.130.48.0/20 1 CMNET / ORG-CM1-AP / China Mobile / Internet Service Provider in China
222.90.0.0/16 1 CHINANET-SN / Beijing 100088
223.81.240.0/20 1 ORG-CM1-AP / CMNET / China Mobile / China Mobile communications corporation
218.107.192.0/19 1 CNCGROUP-FJ-XIAMEN-MAN / CNCGroup CHINA169 FuJian province network
219.128.0.0/13 1 CHINANET-GD / China Telecom
34.32.128.0/17 Google LLC / GOOGL-2
34.32.172.122 34.32.172.122 34.32.172.122
34.32.128.0/17 | 34.32.172.122 | 18/Sep/2024:18:02:12 +0200 | GET /cgi-bin/emacs?action=rss;rcidonly=RssExclude;days=1;all=1;showedit=1;full=1 HTTP/1.1 | Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
34.32.128.0/17 | 34.32.172.122 | 18/Sep/2024:18:02:12 +0200 | GET /cgi-bin/emacs?action=rss;rcidonly=RssExclude;days=1;all=1;showedit=1;full=1 HTTP/1.1 | Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
34.32.128.0/17 | 34.32.172.122 | 18/Sep/2024:18:02:12 +0200 | GET /emacs?action=rss;rcidonly=RssExclude;days=1;all=1;showedit=1;full=1 HTTP/1.1 | Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
ipset add banlist 34.32.128.0/17

113.0.0.0/13 UNICOM-HL / CNC Group CHINA169 Heilongjiang Province Network
113.2.156.201 113.2.184.52 113.1.92.78
113.0.0.0/13 | 113.2.156.201 | 18/Sep/2024:18:02:11 +0200 | GET /emacs?action=rc&all=1&days=14&rcidonly=tzhelp.el&showedit=0 HTTP/1.1 | Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 ADG/11.0.2566 AOLBUILD/11.0.2566 Safari/537.36
113.0.0.0/13 | 113.2.184.52 | 18/Sep/2024:18:02:16 +0200 | GET /emacs?action=rc&all=1&days=7&rcidonly=WriteRoom&showedit=1 HTTP/1.1 | Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Brave Chrome/88.0.4324.152 Safari/537.36
113.0.0.0/13 | 113.1.92.78 | 18/Sep/2024:18:02:21 +0200 | GET /emacs?action=rc&all=1&from=1&rcidonly=screen-term.el&showedit=1 HTTP/1.1 | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.63 Safari/537.36
ipset add banlist 113.0.0.0/13

14.208.0.0/12 CHINANET-GD / China Telecom
14.216.128.162
14.208.0.0/12 | 14.216.128.162 | 18/Sep/2024:18:02:27 +0200 | GET /emacs?action=rc&all=1&from=1&rcidonly=SyncBBDB&showedit=1 HTTP/1.1 | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36
ipset add banlist 14.208.0.0/12

39.64.0.0/11 China Unicom Shandong Province Network / UNICOM-SD
39.76.103.29
39.64.0.0/11 | 39.76.103.29 | 18/Sep/2024:18:02:17 +0200 | GET /emacs?action=rc&all=1&days=1&rcidonly=FinderMode&showedit=1 HTTP/1.1 | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
ipset add banlist 39.64.0.0/11

111.36.192.0/20 China Mobile communications corporation / China Mobile / CMNET / ORG-CM1-AP
111.36.200.78
111.36.192.0/20 | 111.36.200.78 | 18/Sep/2024:18:01:50 +0200 | GET /emacs?action=rc&all=1&days=28&rcidonly=DiredPlusMarkMenu&showedit=1 HTTP/1.1 | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36
ipset add banlist 111.36.192.0/20

223.167.0.0/16 UNICOM-SH / China Unicom Shanghai Province Network
223.167.74.168
223.167.0.0/16 | 223.167.74.168 | 18/Sep/2024:18:01:39 +0200 | GET /emacs?action=rc&all=1&from=1726266329&rcidonly=etagsselect&showedit=1 HTTP/1.1 | Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
ipset add banlist 223.167.0.0/16

39.184.0.0/18 Internet Service Provider in China / CMNET / ORG-CM1-AP / China Mobile
39.184.45.222
39.184.0.0/18 | 39.184.45.222 | 18/Sep/2024:18:02:28 +0200 | GET /emacs?action=rss&all=1&days=14&rcidonly=BufferMenuPlus&showedit=1 HTTP/1.1 | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Brave Chrome/81.0.4044.122 Safari/537.36
ipset add banlist 39.184.0.0/18

111.18.128.0/20 China Mobile / ORG-CM1-AP / CMNET / China Mobile communications corporation
111.18.142.15
111.18.128.0/20 | 111.18.142.15 | 18/Sep/2024:18:02:00 +0200 | GET /emacs?action=rc&all=1&from=1&rcidonly=orgfold-separate-file.el&showedit=1 HTTP/1.1 | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36
ipset add banlist 111.18.128.0/20

27.38.200.0/24 UNICOM-GDSZ / China Unicom
27.38.200.210
27.38.200.0/24 | 27.38.200.210 | 18/Sep/2024:18:01:57 +0200 | GET /emacs?action=rc&all=1&from=1723764629&rcidonly=AnselmHelbig&showedit=1&upto=1724974229 HTTP/1.1 | Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36
ipset add banlist 27.38.200.0/24

112.47.128.0/18 China Mobile communications corporation / China Mobile Communications Corporation / ORG-CMCC1-AP / CMNET
112.47.136.104
112.47.128.0/18 | 112.47.136.104 | 18/Sep/2024:18:01:28 +0200 | GET /emacs?action=rc&all=0&days=14&rcidonly=RubyEvalRegion&showedit=1 HTTP/1.1 | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.89 Safari/537.36
ipset add banlist 112.47.128.0/18

218.71.0.0/16 CHINANET-ZJ-WZ / Zhejiang Telecom
218.71.59.116
218.71.0.0/16 | 218.71.59.116 | 18/Sep/2024:18:01:55 +0200 | GET /emacs?action=rc&all=1&from=1726412272&rcidonly=AnilTappetla&showedit=1 HTTP/1.1 | Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36
ipset add banlist 218.71.0.0/16

39.130.48.0/20 CMNET / ORG-CM1-AP / China Mobile / Internet Service Provider in China
39.130.50.65
39.130.48.0/20 | 39.130.50.65 | 18/Sep/2024:18:02:28 +0200 | GET /emacs?action=rc&all=1&days=7&rcidonly=CarlMikkelsen&showedit=1 HTTP/1.1 | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36
ipset add banlist 39.130.48.0/20

222.90.0.0/16 CHINANET-SN / Beijing 100088
222.90.194.237
222.90.0.0/16 | 222.90.194.237 | 18/Sep/2024:18:01:57 +0200 | GET /emacs?action=rc&all=1&from=1&rcidonly=AnIntroductionToTheEmacsEditor&showedit=1 HTTP/1.1 | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.146 Safari/537.36
ipset add banlist 222.90.0.0/16

223.81.240.0/20 ORG-CM1-AP / CMNET / China Mobile / China Mobile communications corporation
223.81.249.112
223.81.240.0/20 | 223.81.249.112 | 18/Sep/2024:18:01:43 +0200 | GET /emacs?action=rc&all=1&from=1726333566&rcidonly=iclects_-_search_search_commands,_overview&showedit=1 HTTP/1.1 | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.9999.0 Safari/537.36
ipset add banlist 223.81.240.0/20

218.107.192.0/19 CNCGROUP-FJ-XIAMEN-MAN / CNCGroup CHINA169 FuJian province network
218.107.204.27
218.107.192.0/19 | 218.107.204.27 | 18/Sep/2024:18:01:57 +0200 | GET /emacs?action=rc&all=1&from=1&rcidonly=DiredPlusPopupRegionRemoveRectMenu&showedit=1 HTTP/1.1 | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Brave Chrome/88.0.4324.152 Safari/537.36
ipset add banlist 218.107.192.0/19

219.128.0.0/13 CHINANET-GD / China Telecom
219.133.249.75
219.128.0.0/13 | 219.133.249.75 | 18/Sep/2024:18:02:11 +0200 | GET /emacs?action=rc&all=1&days=1&rcidonly=Categor%C3%ADaHerramientasOnline&showedit=1 HTTP/1.1 | Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.93 Safari/537.36
ipset add banlist 219.128.0.0/13

As far as I am concerned, all deserve to be banned. Over-banning? Maybe. What do you think?

For demonstration purposes, this is what I ran:

ssh sibirocobombus.root grep '"^www.emacswiki.org.*rcidonly"' /var/log
/apache2/access.log \
| tail -n 20 \
| ssh sibirocobombus.root bin/admin/network-lookup \
| wl-copy

So now I’m ready to ban them all:

wl-paste | grep ipset

#Emacs #Butlerian Jihad #Administration

2024-10-01. Today I came back to the server with load at 40. Again! Here’s me filtering the log for requests that got a server error status code (500–509).

root@sibirocobombus ~# tail -n 20000 /var/log/apache2/access.log \
| grep -v ^social \
| grep " 50[0-9] " \
| tail -n 50 \
| bin/admin/network-lookup
Made 44 DNS requests.
6 cache hits.

I think the only one I didn’t ban was the unknown one, Gwene and Bing (Microsoft).

Range Hits Org
1.56.0.0/13 3 UNICOM-HL / China Unicom Heilongjiang Province Network
221.208.0.0/14 3 UNICOM-HL / CNC Group CHINA169 Heilongjiang Province Network
112.224.0.0/11 2 China Unicom CHINA169 Shandong Province Network / UNICOM-SD
39.184.104.0/21 2 China Mobile / CMNET / Internet Service Provider in China / ORG-CM1-AP
unknown 2 ?
36.132.172.0/22 1 China Mobile Communications Corporation / China Mobile Communications Corporation / CMNET / ORG-CMCC1-AP
113.248.0.0/14 1 China Telecom / CHINANET-CQ
221.5.0.0/17 1 CNC Group CHINA169 Guangdong Province Network / UNICOM-GD
111.36.240.0/20 1 China Mobile / China Mobile communications corporation / CMNET / ORG-CM1-AP
223.88.64.0/19 1 CMNET / China Mobile communications corporation / ORG-CM1-AP / China Mobile
111.16.32.0/20 1 China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
111.34.144.0/20 1 China Mobile / ORG-CM1-AP / CMNET / China Mobile communications corporation
182.32.0.0/12 1 CHINANET-SD / Beijing 100032
183.92.0.0/14 1 UNICOM-HB / China Unicom Hubei Province Network
60.218.0.0/15 1 CNC Group CHINA169 Heilongjiang Province Network / UNICOM-HL
114.216.20.0/23 1 CHINANET-JS / Beijing 100032
139.227.0.0/16 1 China Unicom / UNICOM-SH
119.176.0.0/12 1 UNICOM-SD / CNC Group CHINA169 Shandong Province Network
119.96.0.0/13 1 China Telecom / CHINANET-HB
115.48.0.0/12 1 UNICOM-HA / CNC Group CHINA169 Henan Province Network
42.100.0.0/15 1 CHINANET-HL / NO.178 Zhongshan Road,Haerbin,Heilongjiang 150040
60.255.0.0/16 1 SCN / China Unicom China169 Network
157.55.0.0/16 1 Microsoft Corporation / MSFT-GFS
116.202.0.0/16 1 Transferred to the RIPE region on 2018-08-28T00:42:30Z. / STUB-116-202SLASH15
111.37.176.0/20 1 CMNET / China Mobile communications corporation / ORG-CM1-AP / China Mobile
117.179.28.0/22 1 China Mobile / China Mobile communications corporation / CMNET / ORG-CM1-AP
58.21.0.0/16 1 CNC Group CHINA169 Jilin Province Network / UNICOM-JL
27.8.0.0/13 1 UNICOM-CQ / China Unicom Chongqing Province Network
65.19.128.0/18 1 Hurricane Electric LLC / HURRICANE-4
223.94.208.0/20 1 China Mobile / China Mobile communications corporation / CMNET / ORG-CM1-AP
111.37.224.0/19 1 ORG-CM1-AP / China Mobile communications corporation / CMNET / China Mobile
183.64.0.0/13 1 CHINANET-CQ / China Telecom
1.188.0.0/14 1 UNICOM-HL / China Unicom Heilongjiang Province Network
112.36.80.0/20 1 China Mobile Communications Corporation / CMNET / China Mobile communications corporation / ORG-CMCC1-AP
163.125.191.0/24 1 UNICOM-GD / China Unicom Guangdong Province Network
36.143.23.0/24 1 China Mobile Communications Corporation / ORG-CMCC1-AP / China Mobile Communications Corporation / CMNET
61.162.0.0/16 1 CNC Group CHINA169 Shandong Province Network / UNICOM-SD
27.152.0.0/13 1 Fujian Province / QZCABID-QZ-FJ
222.136.0.0/13 1 UNICOM-HA / CNC Group CHINA169 Henan Province Network
36.132.191.0/24 1 China Mobile Communications Corporation / CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation
58.19.0.0/16 1 UNICOM-HB / CNCGroup HuBei province network
139.226.0.0/16 1 China Unicom / UNICOM-SH
118.86.0.0/16 1 JCOM-NET / Jupiter Telecommunications Co., Ltd.

Load is now at around 31.

2024-10-01. Getting lazier… Pick a suspicious pattern and check for China…

root@sibirocobombus ~# tail -n 500 /var/log/apache2/access.log \
 | grep -v ^social \
 | grep "action=browse&id=" \
 | tail -n 50 \
 | bin/admin/network-lookup > result.log
root@sibirocobombus ~# grep ipset result.log 
ipset add banlist 27.16.0.0/12 # CHINANET-HB / China Telecom
ipset add banlist 219.145.0.0/16 # CHINANET-SN / Beijing 100032
ipset add banlist 116.179.0.0/16 # UNICOM / China Unicom CHINA169 Network
ipset add banlist 221.219.0.0/18 # China Unicom Beijing Province Network / UNICOM-BJ
ipset add banlist 119.128.0.0/12 # China Telecom / CHINANET-GD
ipset add banlist 124.234.0.0/15 # CHINANET-JL / China Telecom
ipset add banlist 101.80.0.0/13 # Beijing 100032 / CHINANET-SH
ipset add banlist 111.41.128.0/17 # China Mobile communications corporation / CMNET / China Mobile / ORG-CM1-AP
ipset add banlist 111.14.0.0/20 # ORG-CM1-AP / China Mobile / CMNET / China Mobile communications corporation
ipset add banlist 110.176.0.0/13 # shanxi telecom linfen branch ip node links to customer ip address / sxlfbas
ipset add banlist 221.232.0.0/14 # Beijing 100088 / CHINANET-HB
ipset add banlist 116.4.0.0/14 # Beijing 100032 / CHINANET-GD
ipset add banlist 111.41.16.0/22 # ORG-CM1-AP / China Mobile / China Mobile communications corporation / CMNET
ipset add banlist 36.44.0.0/15 # CHINANET-SN / Beijing 100032
ipset add banlist 112.10.192.0/18 # China Mobile communications corporation / CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation
ipset add banlist 117.154.240.0/20 # China Mobile / ORG-CM1-AP / CMNET / China Mobile communications corporation
ipset add banlist 111.43.58.0/23 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 111.19.0.0/17 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 183.229.0.0/16 # ORG-CMCC1-AP / China Mobile Communications Corporation / CMNET / China Mobile communications corporation
ipset add banlist 223.89.128.0/18 # CMNET / China Mobile communications corporation / ORG-CM1-AP / China Mobile
ipset add banlist 42.184.0.0/16 # NO.178 Zhongshan Road,Haerbin,Heilongjiang 150040 / CHINANET-HL
ipset add banlist 60.162.0.0/15 # CHINANET-ZJ-TZ / Zhejiang Telecom
ipset add banlist 112.8.32.0/19 # China Mobile communications corporation / CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation
ipset add banlist 39.129.248.0/21 # Internet Service Provider in China / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 36.46.0.0/16 # CHINANET-SN / Beijing 100032
ipset add banlist 125.76.128.0/17 # From Shanxi(CHINANET-SN) Network of ChinaTelecom / CHINANET-SN
ipset add banlist 123.121.128.0/18 # China Unicom Beijing Province Network / UNICOM-BJ
ipset add banlist 140.75.0.0/16 # CHINANET-SD / Beijing 100032
ipset add banlist 112.88.0.0/13 # UNICOM-GD / China Unicom CHINA169 Guangdong Province Network
ipset add banlist 112.49.192.0/18 # ORG-CMCC1-AP / China Mobile Communications Corporation / CMNET / China Mobile communications corporation
ipset add banlist 113.204.0.0/14 # UNICOM-CQ / CNC Group CHINA169 Chongqing Province Network
ipset add banlist 123.149.0.0/16 # CHINANET-HA / Beijing 100032
ipset add banlist 60.14.0.0/15 # CNC Group CHINA169 Heilongjiang Province Network / UNICOM-HL
ipset add banlist 114.92.0.0/17 # Beijing 100032 / CHINANET-SH
ipset add banlist 1.56.0.0/13 # China Unicom Heilongjiang Province Network / UNICOM-HL
ipset add banlist 111.14.64.0/21 # ORG-CM1-AP / China Mobile / CMNET / China Mobile communications corporation
ipset add banlist 123.128.0.0/13 # CNC Group CHINA169 Shandong Province Network / UNICOM-SD
ipset add banlist 119.120.0.0/13 # China Telecom / CHINANET-GD
ipset add banlist 222.68.0.0/16 # CHINANET-SH / Beijing 100032
ipset add banlist 36.248.0.0/14 # UNICOM-FJ-QUANZHOU-MAN / China Unicom Fujian Province Network
ipset add banlist 221.0.0.0/15 # UNICOM-SD / CNC Group CHINA169 Shandong Province Network
ipset add banlist 113.56.0.0/15 # CNC Group CHINA169 Hubei Province Network / UNICOM-HB
ipset add banlist 223.78.192.0/18 # China Mobile / China Mobile communications corporation / CMNET / ORG-CM1-AP
ipset add banlist 112.2.128.0/19 # ORG-CMCC1-AP / CMNET / China Mobile communications corporation / China Mobile Communications Corporation
ipset add banlist 183.227.0.0/16 # CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation / China Mobile communications corporation
ipset add banlist 106.46.0.0/16 # CHINANET henan province network / CHINANET-HA
ipset add banlist 123.8.0.0/13 # CNC Group CHINA169 Henan Province Network / UNICOM-HA
ipset add banlist 219.136.0.0/15 # CHINANET-GD / China Telecom
ipset add banlist 111.172.0.0/14 # CHINANET-HB / Beijing 100032
ipset add banlist 118.112.0.0/13 # Beijing 100088 / CHINANET-SC
ipset add banlist 27.148.0.0/14 # Beijing 100032 / CHINANET-FJ
ipset add banlist 153.101.0.0/16 # UNICOM-JS / China Unicom Jiangsu Province Network
ipset add banlist 221.237.0.0/16 # CHINANET-SC / Beijing 100088
ipset add banlist 121.28.0.0/15 # UNICOM-HE / CNC Group CHINA169 Hebei Province Network
ipset add banlist 61.241.192.0/19 # UNICOM / Beijing 100140 ,P.R.China
ipset add banlist 114.86.128.0/17 # CHINANET-SH / Beijing 100032
ipset add banlist 223.67.32.0/19 # CMNET / ORG-CM1-AP / China Mobile / China Mobile communications corporation
ipset add banlist 122.136.0.0/13 # UNICOM-JL / CNC Group CHINA169 Jilin Province Network
ipset add banlist 27.36.0.0/14 # China Unicom Guangdong Province Network / UNICOM-GDDG
ipset add banlist 117.147.0.0/17 # China Mobile / China Mobile communications corporation / ORG-CM1-AP / CMNET
ipset add banlist 153.3.0.0/16 # UNICOM-JS / China Unicom Jiangsu Province Network
ipset add banlist 14.112.0.0/12 # China Telecom / CHINANET-GD
ipset add banlist 183.253.0.0/19 # China Mobile Communications Corporation / China Mobile Communications Corporation / ORG-CMCC1-AP / CMNET
ipset add banlist 183.228.0.0/16 # China Mobile communications corporation / China Mobile Communications Corporation / ORG-CMCC1-AP / CMNET
ipset add banlist 221.196.0.0/15 # UNICOM-TJ / CNC Group CHINA169 Tianjin Province Network
ipset add banlist 111.196.192.0/18 # UNICOM-BJ / China Unicom Beijing Province Network
ipset add banlist 14.107.172.0/22 # CHINANET-CQ / China Telecom
ipset add banlist 114.216.66.0/23 # Beijing 100032 / CHINANET-JS
ipset add banlist 112.1.32.0/19 # China Mobile communications corporation / China Mobile Communications Corporation / CMNET / ORG-CMCC1-AP
ipset add banlist 221.182.0.0/18 # China Mobile communications corporation / China Mobile / CMNET / ORG-CM1-AP
ipset add banlist 118.72.0.0/13 # CNC Group CHINA169 Shanxi Province Network / sxyc-yongji-BAS
ipset add banlist 58.59.0.0/17 # No.999,Shunhua road,Jinan,Shandong / CHINANET-SD
ipset add banlist 111.1.96.0/20 # China Mobile / China Mobile communications corporation / ORG-CM1-AP / CMNET
ipset add banlist 36.104.0.0/16 # China Telecom / CHINANET-ZJ
ipset add banlist 117.151.16.0/20 # China Mobile / China Mobile communications corporation / CMNET / ORG-CM1-AP
ipset add banlist 119.34.128.0/17 # GZPRBNET / GuangDong, China 510010
ipset add banlist 112.0.192.0/19 # China Mobile Communications Corporation / China Mobile communications corporation / ORG-CMCC1-AP / CMNET
ipset add banlist 111.1.192.0/19 # CMNET / ORG-CM1-AP / China Mobile / China Mobile communications corporation
ipset add banlist 183.225.0.0/19 # CMNET / ORG-CMCC1-AP / China Mobile communications corporation / China Mobile Communications Corporation
ipset add banlist 58.60.0.0/14 # Beijing 100032 / CHINANET-GD
ipset add banlist 117.24.0.0/13 # CHINANET-FJ / 7,East Street ,Fuzhou ,Fujian ,PRC
ipset add banlist 112.24.224.0/19 # CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation / China Mobile communications corporation
ipset add banlist 39.130.64.0/19 # Internet Service Provider in China / China Mobile / CMNET / ORG-CM1-AP
ipset add banlist 119.164.0.0/14 # UNICOM-SD / CNC Group CHINA169 Shandong Province Network
ipset add banlist 39.190.96.0/21 # China Mobile / Internet Service Provider in China / CMNET / ORG-CM1-AP
ipset add banlist 111.224.0.0/14 # Beijing 100032 / CHINANET-HE
ipset add banlist 112.0.128.0/19 # China Mobile Communications Corporation / China Mobile communications corporation / CMNET / ORG-CMCC1-AP
ipset add banlist 211.103.72.0/21 # China Mobile / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 1.202.0.0/17 # CHINANET-BJ / CHINANET Beijing Province Network
ipset add banlist 39.149.80.0/20 # CMNET / Internet Service Provider in China / ORG-CM1-AP / China Mobile
ipset add banlist 218.10.0.0/16 # UNICOM-HL / CNC Group CHINA169 Heilongjiang Province Network
ipset add banlist 36.143.46.0/23 # CMNET / China Mobile Communications Corporation / ORG-CMCC1-AP / China Mobile Communications Corporation
ipset add banlist 223.97.160.0/19 # ORG-CM1-AP / CMNET / China Mobile communications corporation / China Mobile
ipset add banlist 111.14.96.0/19 # China Mobile / ORG-CM1-AP / CMNET / China Mobile communications corporation
ipset add banlist 122.240.0.0/13 # CHINANET-ZJ-WZ / Zhejiang Telecom
ipset add banlist 120.80.0.0/13 # UNICOM-GD / CNC Group CHINA169 Guangdong Province Network
ipset add banlist 120.85.182.0/23 # China Unicom / GuangZhou-unicom
ipset add banlist 171.43.0.0/16 # China Telecom / CHINANET-HB
ipset add banlist 117.144.0.0/16 # CMNET-shanghai / China Mobile communications corporation
ipset add banlist 117.179.107.0/24 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 117.179.122.0/23 # CMNET / China Mobile communications corporation / ORG-CM1-AP / China Mobile
ipset add banlist 112.20.224.0/19 # CMNET / China Mobile communications corporation / ORG-CMCC1-AP / China Mobile Communications Corporation
ipset add banlist 111.35.224.0/20 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 223.106.128.0/18 # CMNET / China Mobile communications corporation / ORG-CM1-AP / China Mobile
ipset add banlist 61.156.0.0/16 # UNICOM-CN / CNC Group CHINA169 Shandong Province Network
ipset add banlist 111.48.77.0/24 # China Mobile / CMNET / China Mobile communications corporation / ORG-CM1-AP
ipset add banlist 36.40.0.0/14 # CHINANET-SN / Beijing 100032

2024-10-02. The situation is under control again, but since I’m vindictive, I’ll block some more.

tail -n 500 /var/log/apache2/access.log \
 | grep -v ^social \
 | grep "rcidonly=" \
 | tail -n 50 \
 | bin/admin/network-lookup > result.log
grep ipset result.log
ipset add banlist 101.16.0.0/12 # CNCGROUP-HE / China Unicom Hebei Province Network
ipset add banlist 111.18.32.0/20 # China Mobile / CMNET / China Mobile communications corporation / ORG-CM1-AP
ipset add banlist 36.16.0.0/12 # CHINANET-ZJ-TZ / Zhejiang Telecom
ipset add banlist 112.20.96.0/19 # CMNET / China Mobile communications corporation / ORG-CMCC1-AP / China Mobile Communications Corporation
ipset add banlist 223.67.224.0/19 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 36.132.168.0/22 # China Mobile Communications Corporation / CMNET / China Mobile Communications Corporation / ORG-CMCC1-AP
ipset add banlist 123.120.0.0/18 # China Unicom Beijing Province Network / UNICOM-BJ
ipset add banlist 111.43.144.0/24 # ORG-CM1-AP / CMNET / China Mobile communications corporation / China Mobile
ipset add banlist 116.231.0.0/16 # Beijing 100032 / CHINANET-SH
ipset add banlist 39.149.0.0/20 # ORG-CM1-AP / CMNET / Internet Service Provider in China / China Mobile
ipset add banlist 223.73.84.0/22 # ORG-CM1-AP / CMNET / China Mobile communications corporation / China Mobile
ipset add banlist 218.8.0.0/15 # UNICOM-HL / CNC Group CHINA169 Heilongjiang Province Network
ipset add banlist 36.132.166.0/23 # China Mobile Communications Corporation / ORG-CMCC1-AP / China Mobile Communications Corporation / CMNET
ipset add banlist 58.22.0.0/15 # CNCGROUP-FJ-XIAMEN-MAN / CNCGroup FuJian province network
ipset add banlist 117.143.52.0/22 # China Mobile communications corporation / CMNET-shanghai
ipset add banlist 111.41.34.0/24 # ORG-CM1-AP / China Mobile communications corporation / CMNET / China Mobile
ipset add banlist 125.40.0.0/13 # UNICOM-HA / CNC Group CHINA169 Henan Province Network
ipset add banlist 171.40.0.0/15 # China Telecom / CHINANET-HB
ipset add banlist 112.64.0.0/17 # Addresses from APNIC / UNICOM-SH
ipset add banlist 117.179.181.0/24 # ORG-CM1-AP / CMNET / China Mobile communications corporation / China Mobile
ipset add banlist 223.66.192.0/19 # China Mobile / ORG-CM1-AP / CMNET / China Mobile communications corporation
ipset add banlist 111.33.0.0/17 # China Mobile / CMNET / China Mobile communications corporation / ORG-CM1-AP
ipset add banlist 101.44.160.0/20 # Huawei-Cloud-SG / HUAWEI INTERNATIONAL PTE. LTD.
ipset add banlist 36.106.148.0/23 # CHINANET TIANJIN PROVINCE NETWORK / CHINANET-TJ
ipset add banlist 117.179.33.0/24 # ORG-CM1-AP / CMNET / China Mobile communications corporation / China Mobile
ipset add banlist 124.114.0.0/16 # Beijing 100088 / CHINANET-SN
ipset add banlist 223.89.192.0/18 # ORG-CM1-AP / China Mobile communications corporation / CMNET / China Mobile
ipset add banlist 118.248.0.0/13 # Beijing 100032 / CHINANET-HN
ipset add banlist 223.81.128.0/19 # China Mobile / ORG-CM1-AP / CMNET / China Mobile communications corporation
ipset add banlist 223.74.216.0/22 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 111.41.14.0/23 # ORG-CM1-AP / CMNET / China Mobile communications corporation / China Mobile
ipset add banlist 223.74.103.0/24 # China Mobile / ORG-CM1-AP / CMNET / China Mobile communications corporation
ipset add banlist 223.74.72.0/21 # CMNET / China Mobile communications corporation / ORG-CM1-AP / China Mobile
ipset add banlist 39.130.96.0/19 # China Mobile / CMNET / Internet Service Provider in China / ORG-CM1-AP
ipset add banlist 221.228.192.0/20 # CHINANET-JS / Beijing 100088
ipset add banlist 180.175.0.0/16 # CHINANET-SH / Beijing 100032
ipset add banlist 112.100.0.0/14 # NO.178 Zhongshan Road,Haerbin,Heilongjiang 150040 / CHINANET-HL
ipset add banlist 223.95.192.0/19 # China Mobile / China Mobile communications corporation / CMNET / ORG-CM1-AP
ipset add banlist 111.34.192.0/20 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 111.36.160.0/20 # ORG-CM1-AP / CMNET / China Mobile communications corporation / China Mobile
ipset add banlist 111.17.64.0/19 # ORG-CM1-AP / China Mobile communications corporation / CMNET / China Mobile
ipset add banlist 101.69.0.0/16 # UNICOM-ZJ / China Unicom Zhejiang Province Network
ipset add banlist 112.116.0.0/15 # CHINANET-YN / Beijing 100032
ipset add banlist 111.14.144.0/20 # China Mobile / ORG-CM1-AP / China Mobile communications corporation / CMNET
ipset add banlist 111.18.0.0/16 # China Mobile / ORG-CM1-AP / CMNET / China Mobile communications corporation
ipset add banlist 220.192.0.0/18 # China Unicom Network / UNICOM
ipset add banlist 123.118.0.0/18 # China Unicom Beijing Province Network / UNICOM-BJ

2024-10-10. Load is at 30 again. Another round!

ipset add banlist 14.208.0.0/12 # CHINANET-GD / China Telecom
ipset add banlist 113.0.0.0/13 # CNC Group CHINA169 Heilongjiang Province Network / UNICOM-HL
ipset add banlist 223.81.240.0/20 # China Mobile communications corporation / ORG-CM1-AP / China Mobile / CMNET
ipset add banlist 112.38.0.0/16 # ORG-CMCC1-AP / China Mobile communications corporation / CMNET / China Mobile Communications Corporation
ipset add banlist 222.129.0.0/18 # UNICOM-BJ / China Unicom Beijing Province Network
ipset add banlist 117.176.208.0/21 # CMNET / China Mobile / China Mobile communications corporation / ORG-CM1-AP
ipset add banlist 153.34.0.0/15 # UNICOM-JS / China Unicom Jiangsu Province Network
ipset add banlist 116.149.128.0/17 # China Unicom CHINA169 Network / UNICOM
ipset add banlist 182.112.0.0/12 # China Unicom Henan Province Network / UNICOM-HA
ipset add banlist 112.51.16.0/20 # China Mobile communications corporation / ORG-CMCC1-AP / China Mobile Communications Corporation / CMNET
ipset add banlist 39.190.112.0/21 # China Mobile / CMNET / Internet Service Provider in China / ORG-CM1-AP
ipset add banlist 112.65.0.0/17 # UNICOM-SH / Addresses from APNIC
ipset add banlist 223.88.192.0/18 # China Mobile / CMNET / China Mobile communications corporation / ORG-CM1-AP
ipset add banlist 111.33.192.0/18 # CMNET / China Mobile / ORG-CM1-AP / China Mobile communications corporation
ipset add banlist 114.88.0.0/17 # CHINANET-SH / Beijing 100032
ipset add banlist 36.32.0.0/14 # UNICOM-AH / China Unicom Anhui Province Network
ipset add banlist 61.174.0.0/15 # YINXIAN-MINGHUI-LTD / Ningbo Minghui International Trade Co.,Ltd
ipset add banlist 112.98.0.0/15 # NO.178 Zhongshan Road,Haerbin,Heilongjiang 150040 / CHINANET-HL
ipset add banlist 39.163.64.0/20 # China Mobile / CMNET / ORG-CM1-AP / Internet Service Provider in China
ipset add banlist 117.179.8.0/21 # ORG-CM1-AP / China Mobile communications corporation / China Mobile / CMNET
ipset add banlist 117.179.249.0/24 # ORG-CM1-AP / China Mobile communications corporation / China Mobile / CMNET
ipset add banlist 42.185.0.0/16 # CHINANET-HL / NO.178 Zhongshan Road,Haerbin,Heilongjiang 150040
ipset add banlist 218.58.0.0/15 # CNC Group CHINA169 Shandong Province Network / UNICOM-SD
ipset add banlist 211.143.180.0/22 # CMNET-fujian / China Mobile communications corporation
ipset add banlist 223.167.0.0/16 # China Unicom Shanghai Province Network / UNICOM-SH
ipset add banlist 112.49.128.0/17 # China Mobile communications corporation / ORG-CMCC1-AP / China Mobile Communications Corporation / CMNET
ipset add banlist 223.96.128.0/20 # China Mobile / CMNET / ORG-CM1-AP / China Mobile communications corporation
ipset add banlist 117.152.240.0/20 # China Mobile communications corporation / ORG-CM1-AP / CMNET / China Mobile
ipset add banlist 117.179.38.0/23 # China Mobile / CMNET / ORG-CM1-AP / China Mobile communications corporation
ipset add banlist 39.148.48.0/20 # China Mobile / CMNET / ORG-CM1-AP / Internet Service Provider in China
ipset add banlist 223.80.192.0/18 # ORG-CM1-AP / China Mobile communications corporation / CMNET / China Mobile
ipset add banlist 112.20.64.0/19 # CMNET / China Mobile Communications Corporation / China Mobile communications corporation / ORG-CMCC1-AP
ipset add banlist 144.52.0.0/16 # Beijing 100032 / CHINANET-SD
ipset add banlist 36.100.96.0/22 # China Telecom / CHINANET-ZJ
ipset add banlist 60.168.0.0/13 # CHINANET-AH / Beijing 100088
ipset add banlist 61.159.192.0/18 # CHINANET Yunnan province network / CHINANET-YN
ipset add banlist 125.36.0.0/14 # CNC Group CHINA169 Tianjin Province Network / UNICOM-TJ
ipset add banlist 124.236.0.0/14 # CHINANET-HE / Beijing 100032
ipset add banlist 183.226.0.0/16 # China Mobile communications corporation / ORG-CMCC1-AP / CMNET / China Mobile Communications Corporation
ipset add banlist 223.166.0.0/16 # UNICOM-SH / China Unicom Shanghai Province Network
ipset add banlist 218.93.0.0/16 # CHANGZHOU-Xinhua-bookshop-CORP / Jiangsu Province
ipset add banlist 39.183.128.0/19 # China Mobile / CMNET / Internet Service Provider in China / ORG-CM1-AP
ipset add banlist 180.160.0.0/13 # CHINANET-SH / Beijing 100032
ipset add banlist 223.73.56.0/21 # China Mobile communications corporation / ORG-CM1-AP / CMNET / China Mobile

Munin showing system load. Another surge started at 6 in the morning.

2024-10-14. Here we go again.

Load going up to 30 and more.

Same procedure as every week.

tail -n 500 /var/log/apache2/access.log \
 | grep -v ^social \
 | grep "rcidonly" \
 | tail -n 100 \
 | bin/admin/network-lookup > result.log

Then look at the list, append it to ban-cidr, pipe it to the shell, and post it here for all to see.

ipset add banlist 106.114.0.0/16 # Beijing 100032 / CHINANET-HE
ipset add banlist 111.41.0.0/19 # CMNET / China Mobile / ORG-CM1-AP / China Mobile communications corporation
ipset add banlist 223.102.96.0/19 # CMNET / ORG-CM1-AP / China Mobile / China Mobile communications corporation
ipset add banlist 119.248.0.0/14 # China Unicom China169 Network / UNICOM-HE
ipset add banlist 223.74.89.0/24 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 180.137.96.0/19 # Beijing 100032 / CHINANET-GX
ipset add banlist 112.22.192.0/19 # China Mobile communications corporation / CMNET / China Mobile Communications Corporation / ORG-CMCC1-AP
ipset add banlist 36.143.24.0/22 # CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation / China Mobile Communications Corporation
ipset add banlist 223.96.96.0/20 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 123.115.128.0/18 # China Unicom Beijing Province Network / UNICOM-BJ
ipset add banlist 106.117.0.0/16 # CHINANET-HE / Beijing 100032
ipset add banlist 110.52.0.0/15 # UNICOM-HN / China Unicom CHINA169 Hunan Province Network
ipset add banlist 39.171.128.0/18 # Internet Service Provider in China / CMNET / China Mobile / ORG-CM1-AP
ipset add banlist 112.32.224.0/19 # China Mobile Communications Corporation / ORG-CMCC1-AP / CMNET / China Mobile communications corporation
ipset add banlist 125.211.0.0/16 # CNC Group CHINA169 Heilongjiang Province Network / UNICOM-HL
ipset add banlist 223.96.208.0/20 # China Mobile communications corporation / ORG-CM1-AP / China Mobile / CMNET
ipset add banlist 61.49.64.0/18 # UNICOM-BJ / China Unicom Beijing Province Network
ipset add banlist 183.253.64.0/20 # ORG-CMCC1-AP / China Mobile Communications Corporation / CMNET / China Mobile Communications Corporation
ipset add banlist 36.97.0.0/16 # CHINANET-ZJ / China Telecom
ipset add banlist 36.155.64.0/18 # CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation / China Mobile Communications Corporation
ipset add banlist 223.91.0.0/18 # ORG-CM1-AP / China Mobile / CMNET / China Mobile communications corporation
ipset add banlist 117.151.96.0/20 # ORG-CM1-AP / China Mobile / CMNET / China Mobile communications corporation
ipset add banlist 117.185.156.0/22 # China Mobile communications corporation / CMNET / China Mobile / ORG-CM1-AP
ipset add banlist 61.163.0.0/16 # UNICOM-HA / CNC Group CHINA169 Henan Province Network
ipset add banlist 117.153.0.0/16 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 111.201.0.0/18 # China Unicom Beijing Province Network / UNICOM-BJ
ipset add banlist 221.224.0.0/13 # CHINANET-JS / Beijing 100088
ipset add banlist 106.86.0.0/15 # CHINANET-CQ / China Telecom
ipset add banlist 1.203.0.0/16 # CHINANET-BJ / CHINANET Beijing Province Network
ipset add banlist 112.23.128.0/19 # CMNET / China Mobile Communications Corporation / ORG-CMCC1-AP / China Mobile communications corporation
ipset add banlist 163.204.0.0/16 # UNICOM-GD / China Unicom Guangdong Province Network
ipset add banlist 124.72.0.0/16 # CHINANET-FJ / 7,East Street ,Fuzhou ,Fujian ,PRC
ipset add banlist 117.135.88.0/22 # China Mobile communications corporation / CMNET-shanghai
ipset add banlist 39.155.32.0/19 # Internet Service Provider in China / CMNET / China Mobile / ORG-CM1-AP
ipset add banlist 36.132.144.0/21 # China Mobile Communications Corporation / China Mobile Communications Corporation / ORG-CMCC1-AP / CMNET
ipset add banlist 39.149.208.0/20 # CMNET / ORG-CM1-AP / China Mobile / Internet Service Provider in China
ipset add banlist 123.119.192.0/18 # UNICOM-BJ / China Unicom Beijing Province Network
ipset add banlist 163.125.124.0/24 # UNICOM-GD / China Unicom Guangdong Province Network
ipset add banlist 121.16.0.0/13 # UNICOM-HE / CNC Group CHINA169 Hebei Province Network
ipset add banlist 114.245.64.0/18 # UNICOM-BJ / China Unicom Beijing Province Network
ipset add banlist 119.13.96.0/20 # Huawei-Cloud-Singapore / HUAWEI INTERNATIONAL PTE. LTD.
ipset add banlist 114.93.0.0/17 # CHINANET-SH / Beijing 100032
ipset add banlist 106.9.0.0/16 # CHINANET-HE / Beijing 100032
ipset add banlist 106.35.0.0/16 # Beijing 100032 / CHINANET-HN
ipset add banlist 117.132.80.0/21 # China Mobile communications corporation / China Mobile / ORG-CM1-AP / CMNET
ipset add banlist 117.179.114.0/23 # China Mobile communications corporation / China Mobile / ORG-CM1-AP / CMNET
ipset add banlist 112.13.48.0/21 # China Mobile communications corporation / CMNET / China Mobile Communications Corporation / ORG-CMCC1-AP
ipset add banlist 119.162.0.0/15 # CNC Group CHINA169 Shandong Province Network / UNICOM-SD
ipset add banlist 61.158.0.0/17 # BY-TEL-BUREAU / CNC Group CHINA169 Heilongjiang Province Network
ipset add banlist 223.106.0.0/18 # China Mobile communications corporation / CMNET / China Mobile / ORG-CM1-AP
ipset add banlist 36.4.0.0/14 # China Telecom / CHINANET-AH
ipset add banlist 113.112.0.0/13 # CHINANET-GD / China Telecom
ipset add banlist 39.162.128.0/19 # Internet Service Provider in China / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 27.40.0.0/13 # China Unicom Guangdong Province Network / UNICOM-GD
ipset add banlist 112.41.0.0/17 # ORG-CMCC1-AP / China Mobile Communications Corporation / CMNET / China Mobile communications corporation
ipset add banlist 222.130.192.0/18 # China Unicom Beijing Province Network / UNICOM-BJ
ipset add banlist 39.189.8.0/21 # CMNET / China Mobile / ORG-CM1-AP / Internet Service Provider in China
ipset add banlist 175.146.0.0/15 # UNICOM-LN / China Unicom Liaoning Province Network
ipset add banlist 114.247.64.0/18 # UNICOM-BJ / China Unicom Beijing Province Network
ipset add banlist 112.7.136.0/22 # China Mobile communications corporation / CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation
ipset add banlist 119.112.0.0/13 # UNICOM-LN / CNC Group CHINA169 Liaoning Province Network
ipset add banlist 223.101.96.0/19 # China Mobile communications corporation / China Mobile / ORG-CM1-AP / CMNET
ipset add banlist 117.152.32.0/19 # China Mobile communications corporation / China Mobile / ORG-CM1-AP / CMNET
ipset add banlist 111.27.18.0/24 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 221.14.0.0/15 # CNC Group CHINA169 Henan Province Network / UNICOM-HA
ipset add banlist 101.32.240.0/20 # ACEVILLEPTELTD-SG / ACEVILLE PTE.LTD.
ipset add banlist 114.93.128.0/17 # Beijing 100032 / CHINANET-SH
ipset add banlist 111.31.128.0/18 # China Mobile communications corporation / CMNET / China Mobile / ORG-CM1-AP
ipset add banlist 112.36.40.0/21 # China Mobile Communications Corporation / ORG-CMCC1-AP / CMNET / China Mobile communications corporation
ipset add banlist 114.86.0.0/17 # Beijing 100032 / CHINANET-SH
ipset add banlist 39.184.0.0/18 # Internet Service Provider in China / China Mobile / ORG-CM1-AP / CMNET
ipset add banlist 36.148.128.0/17 # China Mobile Communications Corporation / CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation
ipset add banlist 125.104.0.0/13 # CHINANET-ZJ-WZ / China Telecom
ipset add banlist 112.47.192.0/20 # CMNET / China Mobile Communications Corporation / ORG-CMCC1-AP / China Mobile communications corporation
ipset add banlist 59.42.0.0/16 # Beijing 100032 / CHINANET-GD
ipset add banlist 36.142.32.0/19 # China Mobile Communications Corporation / CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation
ipset add banlist 223.81.160.0/19 # CMNET / China Mobile / ORG-CM1-AP / China Mobile communications corporation
ipset add banlist 112.112.0.0/14 # Beijing 100032 / CHINANET-YN
ipset add banlist 106.42.0.0/16 # CHINANET-HA / CHINANET henan province network
ipset add banlist 36.132.176.0/22 # CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation / China Mobile Communications Corporation
ipset add banlist 112.32.0.0/16 # ORG-CMCC1-AP / China Mobile Communications Corporation / CMNET / China Mobile communications corporation
ipset add banlist 222.184.0.0/13 # Beijing 100088 / CHINANET-JS
ipset add banlist 112.21.192.0/19 # China Mobile communications corporation / CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation
ipset add banlist 58.56.0.0/15 # CHINANET-SD / No.999,Shunhua road,Jinan,Shandong
ipset add banlist 121.24.0.0/14 # CNC Group CHINA169 Hebei Province Network / UNICOM-HE
ipset add banlist 101.88.0.0/13 # CHINANET-SH / Beijing 100032
ipset add banlist 61.52.0.0/15 # CNC Group CHINA169 Henan Province Network / UNICOM-HA

And again. Oops, and Google got caught up in it. They are probably following all the per-page RSS feeds again. Oh well.

ipset add banlist 34.90.160.0/20 # GOOGL-2 / Google LLC
ipset add banlist 39.185.192.0/19 # Internet Service Provider in China / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 223.240.0.0/13 # China Telecom / CHINANET-AH
ipset add banlist 219.144.0.0/16 # Beijing 100032 / CHINANET-SN
ipset add banlist 113.240.0.0/13 # CHINANET-HN / Beijing 100032
ipset add banlist 223.72.0.0/17 # China Mobile / China Mobile communications corporation / CMNET / ORG-CM1-AP
ipset add banlist 39.187.88.0/21 # China Mobile / CMNET / ORG-CM1-AP / Internet Service Provider in China
ipset add banlist 223.67.0.0/19 # China Mobile communications corporation / ORG-CM1-AP / CMNET / China Mobile
ipset add banlist 122.96.0.0/15 # CNC Group CHINA169 Jiangsu Province Network / UNICOM-JS
ipset add banlist 36.132.152.0/22 # China Mobile Communications Corporation / CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation
ipset add banlist 117.135.20.0/22 # CMNET-shanghai / China Mobile communications corporation
ipset add banlist 42.94.0.0/16 # Beijing 100032 / CHINANET-GS
ipset add banlist 42.247.0.0/19 # CERNET / NJR-CERNET
ipset add banlist 218.24.0.0/16 # UNICOM-LN / CNC Group CHINA169 Liaoning Province Network
ipset add banlist 223.96.32.0/20 # China Mobile / China Mobile communications corporation / ORG-CM1-AP / CMNET
ipset add banlist 223.73.12.0/22 # China Mobile / China Mobile communications corporation / CMNET / ORG-CM1-AP
ipset add banlist 106.115.0.0/16 # CHINANET-HE / Beijing 100032
ipset add banlist 123.121.64.0/18 # China Unicom Beijing Province Network / UNICOM-BJ
ipset add banlist 111.17.0.0/18 # China Mobile / ORG-CM1-AP / CMNET / China Mobile communications corporation
ipset add banlist 112.25.136.0/22 # China Mobile Communications Corporation / China Mobile communications corporation / ORG-CMCC1-AP / CMNET
ipset add banlist 117.151.128.0/18 # ORG-CM1-AP / CMNET / China Mobile communications corporation / China Mobile
ipset add banlist 116.248.0.0/15 # Beijing 100032 / CHINANET-YN
ipset add banlist 210.73.0.0/18 # CNIC-CAS / Route origin from CSTNET / ORG-CA107-AP / CSTNET-CN
ipset add banlist 124.126.0.0/16 # No.1 Gaojiayuan,Xicheng District,Beijing,China / RITELE
ipset add banlist 116.130.0.0/16 # China Unicom CHINA169 Network / UNICOM
ipset add banlist 112.48.32.0/19 # CMNET / ORG-CMCC1-AP / China Mobile communications corporation / China Mobile Communications Corporation
ipset add banlist 111.197.64.0/18 # UNICOM-BJ / China Unicom Beijing Province Network
ipset add banlist 223.74.4.0/23 # ORG-CM1-AP / CMNET / China Mobile communications corporation / China Mobile
ipset add banlist 42.48.0.0/15 # UNICOM-HN / China Unicom Hunan Province Network
ipset add banlist 123.144.0.0/14 # CNC Group CHINA169 Chongqing Province Network / UNICOM-CQ
ipset add banlist 117.170.64.0/20 # ORG-CM1-AP / CMNET / China Mobile communications corporation / China Mobile
ipset add banlist 175.0.0.0/12 # Beijing 100032 / CHINANET-HN
ipset add banlist 42.4.0.0/14 # China Unicom Liaoning Province Network / UNICOM-LN
ipset add banlist 125.64.0.0/13 # CHINANET-SC / Beijing 100088
ipset add banlist 124.64.192.0/18 # UNICOM-BJ / China Unicom Beijing Province Network
ipset add banlist 106.119.0.0/16 # CHINANET-HE / Beijing 100032
ipset add banlist 211.92.244.0/22 # China United Telecommunications Corporation / UNICOM
ipset add banlist 223.66.224.0/19 # CMNET / ORG-CM1-AP / China Mobile communications corporation / China Mobile
ipset add banlist 183.252.208.0/20 # China Mobile Communications Corporation / ORG-CMCC1-AP / CMNET / China Mobile Communications Corporation
ipset add banlist 223.101.160.0/20 # China Mobile / CMNET / ORG-CM1-AP / China Mobile communications corporation
ipset add banlist 180.168.0.0/13 # CHINANET-SH / Beijing 100032
ipset add banlist 123.168.0.0/14 # No.999,Shunhua road,Jinan,Shandong / CHINANET-SD
ipset add banlist 58.244.0.0/15 # CNC Group CHINA169 Jilin Province Network / UNICOM-JL
ipset add banlist 112.0.96.0/19 # China Mobile Communications Corporation / China Mobile communications corporation / CMNET / ORG-CMCC1-AP
ipset add banlist 202.96.96.0/20 # NULL / HANGZHOU-LIFE-INSURANCE-CORPORATION
ipset add banlist 36.157.73.0/24 # CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation / China Mobile Communications Corporation
ipset add banlist 125.78.0.0/15 # 7,East Street ,Fuzhou ,Fujian ,PRC / CHINANET-FJ
ipset add banlist 117.150.0.0/16 # China Mobile / CMNET / ORG-CM1-AP / China Mobile communications corporation
ipset add banlist 218.203.52.0/24 # CMNET-heilongjiang / China Mobile communications corporation
ipset add banlist 222.208.0.0/13 # CHINANET-SC / Beijing 100088
ipset add banlist 39.128.0.0/19 # Internet Service Provider in China / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 223.65.160.0/19 # China Mobile / China Mobile communications corporation / CMNET / ORG-CM1-AP
ipset add banlist 106.7.0.0/16 # CHINANET-JX / Beijing 100032
ipset add banlist 118.88.32.0/19 # FAW / Addresses from APNIC(FAW)
ipset add banlist 112.22.96.0/19 # China Mobile Communications Corporation / China Mobile communications corporation / CMNET / ORG-CMCC1-AP
ipset add banlist 117.163.224.0/20 # ORG-CM1-AP / CMNET / China Mobile communications corporation / China Mobile
ipset add banlist 117.143.148.0/22 # CMNET-shanghai / China Mobile communications corporation
ipset add banlist 223.90.192.0/18 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 221.216.64.0/18 # UNICOM-BJ / China Unicom Beijing Province Network
ipset add banlist 113.224.0.0/12 # CNC Group CHINA169 Liaoning Province Network / UNICOM-LN
ipset add banlist 223.97.192.0/19 # China Mobile / China Mobile communications corporation / CMNET / ORG-CM1-AP
ipset add banlist 119.8.160.0/19 # HUAWEI INTERNATIONAL PTE. LTD. / Huawei-SG-Cloud
ipset add banlist 112.0.32.0/19 # China Mobile Communications Corporation / China Mobile communications corporation / ORG-CMCC1-AP / CMNET
ipset add banlist 112.3.32.0/19 # CMNET / ORG-CMCC1-AP / China Mobile communications corporation / China Mobile Communications Corporation
ipset add banlist 223.87.196.0/22 # China Mobile / China Mobile communications corporation / ORG-CM1-AP / CMNET
ipset add banlist 14.16.0.0/12 # CHINANET-GD / China Telecom
ipset add banlist 123.113.64.0/18 # UNICOM-BJ / China Unicom Beijing Province Network
ipset add banlist 111.201.128.0/18 # UNICOM-BJ / China Unicom Beijing Province Network
ipset add banlist 114.250.192.0/18 # China Unicom Beijing Province Network / UNICOM-BJ
ipset add banlist 36.143.108.0/22 # China Mobile Communications Corporation / China Mobile Communications Corporation / CMNET / ORG-CMCC1-AP
ipset add banlist 219.159.64.0/18 # CHINANET-GX / Beijing 100032
ipset add banlist 39.188.192.0/22 # China Mobile / ORG-CM1-AP / CMNET / Internet Service Provider in China
ipset add banlist 112.3.192.0/19 # China Mobile communications corporation / CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation
ipset add banlist 61.173.128.0/17 # CHINANET-SH / China Telecom
ipset add banlist 122.224.0.0/12 # CHINANET-ZJ-WZ / Zhejiang Telecom
ipset add banlist 222.65.0.0/16 # Chinanet shanghai boardband adsl 081 / CHINANET-SH-BBAD-081
ipset add banlist 223.65.32.0/19 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 114.249.192.0/18 # UNICOM-BJ / China Unicom Beijing Province Network
ipset add banlist 117.174.240.0/20 # CMNET / ORG-CM1-AP / China Mobile communications corporation / China Mobile
ipset add banlist 60.12.0.0/16 # NingBoZhongJiQiCheMaoYiYouXian / CNC Group CHINA169 Zhejiang Province Network
ipset add banlist 218.84.0.0/16 # CHINANET-XJ / Beijing 100088
ipset add banlist 110.240.0.0/12 # UNICOM-HE / China Unicom Hebei Province Network

Load remains between 30 and 35.

And more…

ipset add banlist 223.67.192.0/19 # ORG-CM1-AP / China Mobile / China Mobile communications corporation / CMNET
ipset add banlist 37.59.0.0/16 # Paris, France / SD-GRA-GRA3-SDAGG33-FAT-MAGGIE-2-2 / ORG-OS3-RIPE / OVH SAS
ipset add banlist 115.171.0.0/18 # China Telecom / CHINANET-CDMA
ipset add banlist 112.3.128.0/20 # ORG-CMCC1-AP / China Mobile Communications Corporation / CMNET / China Mobile communications corporation
ipset add banlist 114.84.0.0/17 # Beijing 100032 / CHINANET-SH
ipset add banlist 36.132.128.0/17 # China Mobile Communications Corporation / ORG-CMCC1-AP / CMNET / China Mobile Communications Corporation
ipset add banlist 171.116.0.0/14 # UNICOM-SX / China Unicom shanxi Province Network
ipset add banlist 111.2.152.0/22 # China Mobile communications corporation / CMNET / China Mobile / ORG-CM1-AP
ipset add banlist 123.118.64.0/18 # UNICOM-BJ / China Unicom Beijing Province Network
ipset add banlist 39.148.144.0/20 # China Mobile / ORG-CM1-AP / Internet Service Provider in China / CMNET
ipset add banlist 119.36.0.0/16 # UNICOM-HB / CNC Group CHINA169 Hubei Province Network
ipset add banlist 223.65.64.0/19 # China Mobile communications corporation / CMNET / China Mobile / ORG-CM1-AP
ipset add banlist 116.1.0.0/16 # CHINANET-GX / China Telecom
ipset add banlist 223.73.210.0/24 # CMNET / China Mobile communications corporation / ORG-CM1-AP / China Mobile
ipset add banlist 218.1.0.0/16 # CHINANET-SH / China Telecom
ipset add banlist 223.101.224.0/19 # CMNET / China Mobile communications corporation / ORG-CM1-AP / China Mobile
ipset add banlist 221.214.0.0/15 # CNC Group CHINA169 Shandong Province Network / JNTIB-IBAR
ipset add banlist 111.85.0.0/16 # China Unicom Guizhou Province Network / UNICOM-GZ
ipset add banlist 222.74.0.0/16 # Beijing 100032 / CHINANET-NM
ipset add banlist 39.154.96.0/19 # CMNET / Internet Service Provider in China / ORG-CM1-AP / China Mobile
ipset add banlist 58.240.0.0/15 # UNICOM-JS / CNC Group Jiangsu province network
ipset add banlist 111.25.56.0/23 # CMNET / China Mobile communications corporation / ORG-CM1-AP / China Mobile
ipset add banlist 219.140.0.0/16 # CHINANET-HB-WH / Chinanet network in Wuhan city Hubei province
ipset add banlist 39.148.32.0/20 # Internet Service Provider in China / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 36.105.0.0/16 # China Telecom / CHINANET-ZJ
ipset add banlist 218.71.0.0/16 # CHINANET-ZJ-NB / Zhejiang Telecom
ipset add banlist 36.143.68.0/22 # China Mobile Communications Corporation / ORG-CMCC1-AP / CMNET / China Mobile Communications Corporation
ipset add banlist 101.66.0.0/16 # China Unicom Zhejiang Province Network / UNICOM-ZJ
ipset add banlist 112.132.0.0/16 # IPPOOL / China Unicom CHINA169 Anhui Province Network
ipset add banlist 223.74.201.0/24 # ORG-CM1-AP / China Mobile / China Mobile communications corporation / CMNET
ipset add banlist 36.143.208.0/22 # China Mobile Communications Corporation / ORG-CMCC1-AP / CMNET / China Mobile Communications Corporation
ipset add banlist 113.12.0.0/14 # CHINANET-GX / Beijing 100032
ipset add banlist 111.33.0.0/16 # CMNET / China Mobile communications corporation / China Mobile / ORG-CM1-AP
ipset add banlist 112.10.176.0/20 # ORG-CMCC1-AP / China Mobile Communications Corporation / CMNET / China Mobile communications corporation
ipset add banlist 39.187.112.0/20 # Internet Service Provider in China / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 59.40.0.0/15 # Beijing 100032 / CHINANET-GD
ipset add banlist 117.174.24.0/21 # China Mobile / ORG-CM1-AP / CMNET / China Mobile communications corporation
ipset add banlist 183.240.0.0/16 # China Mobile Communications Corporation / ORG-CMCC1-AP / CMNET / China Mobile communications corporation
ipset add banlist 117.179.100.0/22 # China Mobile communications corporation / CMNET / China Mobile / ORG-CM1-AP
ipset add banlist 36.142.192.0/19 # China Mobile Communications Corporation / CMNET / China Mobile Communications Corporation / ORG-CMCC1-AP
ipset add banlist 58.247.0.0/16 # UNICOM-SH / CNC Group CHINA169 Shanghai Province Network
ipset add banlist 171.14.0.0/16 # 97 # Zhongyuan Street, Zhengzhou,henan,China / CHINANET-HA
ipset add banlist 39.162.240.0/20 # China Mobile / ORG-CM1-AP / CMNET / Internet Service Provider in China
ipset add banlist 39.154.160.0/19 # CMNET / Internet Service Provider in China / China Mobile / ORG-CM1-AP
ipset add banlist 223.73.28.0/22 # ORG-CM1-AP / China Mobile / CMNET / China Mobile communications corporation
ipset add banlist 223.73.207.0/24 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 111.60.0.0/16 # ORG-CM1-AP / China Mobile / China Mobile communications corporation / CMNET
ipset add banlist 223.73.200.0/23 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 113.220.0.0/14 # CHINANET-HN / Beijing 100032
ipset add banlist 222.76.0.0/14 # CHINANET-FJ / Beijing 100032
ipset add banlist 116.138.0.0/15 # UNICOM / China Unicom CHINA169 Network
ipset add banlist 112.22.224.0/19 # ORG-CMCC1-AP / China Mobile Communications Corporation / CMNET / China Mobile communications corporation
ipset add banlist 119.0.0.0/15 # CHINANET-GZ / GuiZhou
ipset add banlist 36.129.0.0/18 # ORG-CMCC1-AP / China Mobile Communications Corporation / China Mobile Communications Corporation / CMNET
ipset add banlist 106.8.0.0/16 # CHINANET-HE / Beijing 100032
ipset add banlist 117.173.0.0/16 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 1.204.0.0/14 # CHINANET-GZ / Beijing 100032
ipset add banlist 114.246.64.0/18 # China Unicom Beijing Province Network / UNICOM-BJ
ipset add banlist 58.37.0.0/16 # CHINANET-SH / Shanghai Telecom
ipset add banlist 112.39.208.0/20 # CMNET / China Mobile communications corporation / ORG-CMCC1-AP / China Mobile Communications Corporation
ipset add banlist 222.88.0.0/15 # CHINANET-HA / Beijing 100032
ipset add banlist 111.48.159.0/24 # CMNET / China Mobile communications corporation / China Mobile / ORG-CM1-AP
ipset add banlist 117.181.72.0/24 # ORG-CM1-AP / China Mobile / CMNET / China Mobile communications corporation
ipset add banlist 39.148.224.0/19 # CMNET / Internet Service Provider in China / ORG-CM1-AP / China Mobile
ipset add banlist 112.8.96.0/19 # China Mobile communications corporation / CMNET / China Mobile Communications Corporation / ORG-CMCC1-AP
ipset add banlist 112.23.96.0/19 # ORG-CMCC1-AP / China Mobile Communications Corporation / CMNET / China Mobile communications corporation
ipset add banlist 223.74.68.0/23 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 183.184.0.0/13 # sxyc-209ju-BAS / China Unicom Shanxi Province Network
ipset add banlist 223.96.240.0/20 # ORG-CM1-AP / China Mobile / China Mobile communications corporation / CMNET
ipset add banlist 110.184.0.0/13 # CHINANET-SC / China Telecom
ipset add banlist 60.11.0.0/16 # CNC Group CHINA169 Heilongjiang Province Network / UNICOM-HL
ipset add banlist 61.137.128.0/17 # UNICOM-LN / CNC Group CHINA169 Liaoning Province Network
ipset add banlist 116.78.0.0/16 # No.21 Financial Street,Xicheng District, Beijing 100140 ,P.R.China / UNICOM
ipset add banlist 223.98.208.0/20 # China Mobile communications corporation / CMNET / China Mobile / ORG-CM1-AP
ipset add banlist 114.82.0.0/16 # Beijing 100032 / CHINANET-SH
ipset add banlist 61.178.0.0/16 # Beijing 100088 / CHINANET-GS
ipset add banlist 111.25.16.0/21 # ORG-CM1-AP / China Mobile / China Mobile communications corporation / CMNET
ipset add banlist 117.135.12.0/22 # CMNET-shanghai / China Mobile communications corporation
ipset add banlist 42.248.0.0/15 # Beijing 100032 / CHINANET-LN
ipset add banlist 111.60.200.0/21 # CMNET / China Mobile communications corporation / China Mobile / ORG-CM1-AP
ipset add banlist 180.212.68.0/23 # CHINANET-TJ / NO.11 LIUJING ROAD,HEDONG DISTRICT,TIANJIN
ipset add banlist 115.171.64.0/18 # China Telecom / CHINANET-CDMA
ipset add banlist 223.90.128.0/18 # China Mobile / ORG-CM1-AP / China Mobile communications corporation / CMNET
ipset add banlist 27.152.0.0/13 # Fujian Province / BNTCFD-FZ-FJ
ipset add banlist 221.182.75.0/24 # ORG-CM1-AP / China Mobile / CMNET / China Mobile communications corporation
ipset add banlist 36.148.0.0/17 # China Mobile Communications Corporation / ORG-CMCC1-AP / CMNET / China Mobile Communications Corporation
ipset add banlist 101.71.0.0/16 # UNICOM-ZJ / China Unicom Zhejiang Province Network
ipset add banlist 223.74.0.0/16 # CMNET / China Mobile communications corporation / China Mobile / ORG-CM1-AP
ipset add banlist 112.7.156.0/23 # CMNET / China Mobile communications corporation / ORG-CMCC1-AP / China Mobile Communications Corporation
ipset add banlist 58.248.0.0/13 # UNICOM-GD / CNC Group CHINA169 Guangdong Province Network

2024-10-18. And they are at it again.

Load going up to 40. Again.

And I keep adding to the ban hammer.

ipset add banlist 111.43.204.0/23 # China Mobile communications corporation / China Mobile / CMNET / ORG-CM1-AP
ipset add banlist 39.148.160.0/20 # ORG-CM1-AP / CMNET / China Mobile / Internet Service Provider in China
ipset add banlist 112.9.0.0/19 # China Mobile Communications Corporation / China Mobile communications corporation / CMNET / ORG-CMCC1-AP
ipset add banlist 111.32.0.0/16 # China Mobile / China Mobile communications corporation / CMNET / ORG-CM1-AP
ipset add banlist 175.160.0.0/12 # China Unicom Liaoning Province Network / UNICOM-LN
ipset add banlist 39.185.96.0/19 # CMNET / ORG-CM1-AP / Internet Service Provider in China / China Mobile
ipset add banlist 58.35.0.0/17 # CHINANET-SH / Shanghai Telecom
ipset add banlist 218.66.0.0/16 # Beijing 100088 / CHINANET-FJ
ipset add banlist 39.130.0.0/20 # ORG-CM1-AP / CMNET / Internet Service Provider in China / China Mobile
ipset add banlist 111.124.0.0/16 # Beijing 100032 / CHINANET-GZ
ipset add banlist 218.85.0.0/16 # CHINANET-FJ / China Telecom
ipset add banlist 117.189.200.0/22 # China Mobile / China Mobile communications corporation / ORG-CM1-AP / CMNET
ipset add banlist 223.86.176.0/20 # China Mobile communications corporation / China Mobile / ORG-CM1-AP / CMNET
ipset add banlist 222.174.0.0/15 # Jinan-langshan-Bar / Jinan-langshan-Bar,Jinan city,Shandong province
ipset add banlist 112.9.32.0/20 # CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation / China Mobile communications corporation
ipset add banlist 182.144.0.0/13 # CHINANET-SC / China Telecom
ipset add banlist 223.73.221.0/24 # ORG-CM1-AP / CMNET / China Mobile / China Mobile communications corporation
ipset add banlist 36.142.64.0/18 # China Mobile Communications Corporation / China Mobile Communications Corporation / CMNET / ORG-CMCC1-AP
ipset add banlist 112.37.208.0/20 # ORG-CMCC1-AP / CMNET / China Mobile Communications Corporation / China Mobile communications corporation
ipset add banlist 218.203.0.0/22 # CMNET-heilongjiang / China Mobile communications corporation
ipset add banlist 223.107.192.0/19 # China Mobile communications corporation / China Mobile / CMNET / ORG-CM1-AP
ipset add banlist 223.64.128.0/18 # China Mobile communications corporation / China Mobile / CMNET / ORG-CM1-AP
ipset add banlist 42.56.0.0/14 # UNICOM-LN / China Unicom Liaoning Province Network
ipset add banlist 42.102.0.0/16 # CHINANET-HL / NO.178 Zhongshan Road,Haerbin,Heilongjiang 150040
ipset add banlist 111.16.144.0/20 # China Mobile / China Mobile communications corporation / ORG-CM1-AP / CMNET
ipset add banlist 112.12.100.0/22 # China Mobile Communications Corporation / China Mobile communications corporation / ORG-CMCC1-AP / CMNET
ipset add banlist 220.249.128.0/18 # CNCGroup CHINA169 FuJian province network / CNC-FJ-NINGDE-MAN
ipset add banlist 42.122.40.0/22 # CHINANET-TJ / NO.11 LIUJING ROAD,HEDONG DISTRICT,TIANJIN
ipset add banlist 180.159.0.0/16 # CHINANET-SH / Beijing 100032
ipset add banlist 123.4.0.0/14 # CNC Group CHINA169 Henan Province Network / UNICOM-HA
ipset add banlist 223.102.128.0/19 # China Mobile communications corporation / China Mobile / ORG-CM1-AP / CMNET
ipset add banlist 171.12.0.0/16 # CHINANET-HA / 97 # Zhongyuan Street, Zhengzhou,henan,China
ipset add banlist 39.189.16.0/20 # CMNET / ORG-CM1-AP / China Mobile / Internet Service Provider in China
ipset add banlist 222.168.0.0/15 # CHINANET-JL / No.2136,Dong-Nan-Hu Road,Changchun,130000,Jilin
ipset add banlist 39.158.32.0/19 # ORG-CM1-AP / CMNET / China Mobile / Internet Service Provider in China
ipset add banlist 116.234.0.0/16 # Beijing 100032 / CHINANET-SH
ipset add banlist 223.87.40.0/22 # China Mobile communications corporation / China Mobile / ORG-CM1-AP / CMNET
ipset add banlist 124.90.0.0/15 # CNC Group CHINA169 Zhejiang Province Network / UNICOM-ZJ
ipset add banlist 42.122.64.0/18 # NO.11 LIUJING ROAD,HEDONG DISTRICT,TIANJIN / CHINANET-TJ
ipset add banlist 119.39.0.0/16 # CNC Group CHINA169 Hunan Province Network / UNICOM-HN
ipset add banlist 220.163.0.0/16 # Beijing 100088 / CHINANET-YN
ipset add banlist 222.85.0.0/17 # CHINANET-HA / Beijing 100032
ipset add banlist 111.42.128.0/19 # China Mobile / China Mobile communications corporation / ORG-CM1-AP / CMNET
ipset add banlist 117.143.160.0/22 # China Mobile communications corporation / CMNET-shanghai
ipset add banlist 123.117.192.0/18 # China Unicom Beijing Province Network / UNICOM-BJ
ipset add banlist 222.67.0.0/16 # CHINANET-SH / Beijing 100032
ipset add banlist 223.79.192.0/18 # China Mobile communications corporation / China Mobile / ORG-CM1-AP / CMNET
ipset add banlist 211.93.32.0/19 # China United Telecommunications Corporation / UNICOM
ipset add banlist 117.132.48.0/20 # CMNET / ORG-CM1-AP / China Mobile / China Mobile communications corporation
ipset add banlist 112.20.192.0/19 # ORG-CMCC1-AP / CMNET / China Mobile communications corporation / China Mobile Communications Corporation
ipset add banlist 27.224.0.0/14 # Beijing 100032 / CHINANET-GS
ipset add banlist 111.0.232.0/21 # China Mobile / China Mobile communications corporation / CMNET / ORG-CM1-AP
ipset add banlist 111.37.32.0/19 # China Mobile communications corporation / China Mobile / ORG-CM1-AP / CMNET
ipset add banlist 221.223.64.0/18 # UNICOM-BJ / China Unicom Beijing Province Network
ipset add banlist 223.64.64.0/18 # ORG-CM1-AP / CMNET / China Mobile / China Mobile communications corporation
ipset add banlist 112.47.0.0/16 # China Mobile Communications Corporation / China Mobile communications corporation / CMNET / ORG-CMCC1-AP
ipset add banlist 117.154.96.0/21 # ORG-CM1-AP / CMNET / China Mobile communications corporation / China Mobile
ipset add banlist 112.37.96.0/21 # China Mobile communications corporation / China Mobile Communications Corporation / CMNET / ORG-CMCC1-AP
ipset add banlist 36.142.128.0/18 # ORG-CMCC1-AP / CMNET / China Mobile Communications Corporation / China Mobile Communications Corporation
ipset add banlist 39.128.112.0/20 # ORG-CM1-AP / CMNET / China Mobile / Internet Service Provider in China
ipset add banlist 223.73.216.0/22 # China Mobile communications corporation / China Mobile / ORG-CM1-AP / CMNET
ipset add banlist 117.169.224.0/20 # China Mobile / China Mobile communications corporation / ORG-CM1-AP / CMNET
ipset add banlist 117.179.78.0/23 # China Mobile communications corporation / China Mobile / ORG-CM1-AP / CMNET
ipset add banlist 42.242.0.0/15 # Beijing 100032 / CHINANET-YN
ipset add banlist 218.56.0.0/15 # JISB-GOV / CNC Group CHINA169 Shandong Province Network
ipset add banlist 182.240.0.0/13 # Beijing 100032 / CHINANET-YN
ipset add banlist 112.48.80.0/21 # CMNET / ORG-CMCC1-AP / China Mobile communications corporation / China Mobile Communications Corporation
ipset add banlist 110.156.0.0/15 # China Telecom / CHINANET-XJ
ipset add banlist 123.174.0.0/15 # CHINANET-SX / shanxi telecom yuncheng branch ip node links to customer ip address
ipset add banlist 111.52.64.0/19 # CMNET / ORG-CM1-AP / China Mobile / China Mobile communications corporation
ipset add banlist 182.128.0.0/12 # China Telecom / CHINANET-SC
ipset add banlist 116.237.0.0/16 # CHINANET-SH / Beijing 100032
ipset add banlist 36.159.224.0/21 # ORG-CMCC1-AP / CMNET / China Mobile Communications Corporation / China Mobile Communications Corporation
ipset add banlist 112.7.96.0/19 # CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation / China Mobile communications corporation
ipset add banlist 112.3.160.0/19 # CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation / China Mobile communications corporation
ipset add banlist 123.60.0.0/17 # Shenzhen,Guangdong Province, 518129 P.R.China / HWCSNET
ipset add banlist 112.24.128.0/19 # ORG-CMCC1-AP / CMNET / China Mobile Communications Corporation / China Mobile communications corporation
ipset add banlist 1.24.0.0/13 # UNICOM-NM / China Unicom Neimeng Province Network
ipset add banlist 111.34.120.0/21 # ORG-CM1-AP / CMNET / China Mobile communications corporation / China Mobile
ipset add banlist 117.135.92.0/22 # CMNET-shanghai / China Mobile communications corporation
ipset add banlist 39.162.160.0/19 # China Mobile / Internet Service Provider in China / ORG-CM1-AP / CMNET
ipset add banlist 222.84.0.0/16 # CHINANET-GX / Beijing 100032
ipset add banlist 183.225.192.0/20 # China Mobile communications corporation / China Mobile Communications Corporation / CMNET / ORG-CMCC1-AP
ipset add banlist 36.152.24.0/21 # ORG-CMCC1-AP / CMNET / China Mobile Communications Corporation / China Mobile Communications Corporation
ipset add banlist 123.180.0.0/14 # Beijing 100032 / CHINANET-HE
ipset add banlist 39.184.68.0/22 # China Mobile / Internet Service Provider in China / ORG-CM1-AP / CMNET
ipset add banlist 222.240.0.0/13 # CHINANET-HN / Beijing 100032
ipset add banlist 223.80.0.0/18 # ORG-CM1-AP / CMNET / China Mobile / China Mobile communications corporation
ipset add banlist 112.3.0.0/20 # CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation / China Mobile communications corporation
ipset add banlist 39.187.98.0/23 # CMNET / ORG-CM1-AP / Internet Service Provider in China / China Mobile
ipset add banlist 163.125.125.0/24 # China Unicom Guangdong Province Network / UNICOM-GD
ipset add banlist 117.179.0.0/22 # China Mobile / China Mobile communications corporation / ORG-CM1-AP / CMNET
ipset add banlist 111.36.176.0/20 # China Mobile communications corporation / China Mobile / CMNET / ORG-CM1-AP
ipset add banlist 180.212.28.0/22 # NO.11 LIUJING ROAD,HEDONG DISTRICT,TIANJIN / CHINANET-TJ

A few hours later and I’m still feeling vindictive. Let’s ban some more even though load is back at around 2.5.

ipset add banlist 144.0.0.0/16 # CHINANET-SD / Beijing 100032
ipset add banlist 112.21.0.0/19 # CMNET / China Mobile Communications Corporation / ORG-CMCC1-AP / China Mobile communications corporation
ipset add banlist 111.37.96.0/20 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 61.134.128.0/18 # CNC Group CHINA169 Hebei Province Network / UNICOM-HE
ipset add banlist 223.93.112.0/20 # China Mobile communications corporation / ORG-CM1-AP / China Mobile / CMNET
ipset add banlist 114.252.64.0/18 # China Unicom Beijing Province Network / UNICOM-BJ
ipset add banlist 223.96.176.0/21 # China Mobile communications corporation / ORG-CM1-AP / China Mobile / CMNET
ipset add banlist 222.172.128.0/17 # CHINANET-YN / Beijing 100088
ipset add banlist 220.160.0.0/15 # China Telecom / CHINANET-FJ
ipset add banlist 117.154.0.0/16 # CMNET / China Mobile / ORG-CM1-AP / China Mobile communications corporation
ipset add banlist 117.151.0.0/16 # CMNET / China Mobile / ORG-CM1-AP / China Mobile communications corporation
ipset add banlist 117.143.128.0/22 # CMNET-shanghai / China Mobile communications corporation
ipset add banlist 222.132.0.0/14 # CNC Group CHINA169 Shandong Province Network / WFYHHJ-COM
ipset add banlist 171.44.0.0/16 # China Telecom / CHINANET-HB
ipset add banlist 106.47.28.0/22 # CHINANET-TJ / CHINANET TIANJIN PROVINCE NETWORK
ipset add banlist 180.136.0.0/13 # Beijing 100032 / CHINANET-GX
ipset add banlist 36.143.124.0/22 # China Mobile Communications Corporation / ORG-CMCC1-AP / China Mobile Communications Corporation / CMNET
ipset add banlist 123.96.0.0/15 # Zhejiang Telecom / CHINANET-ZJ-TZ
ipset add banlist 163.125.188.0/24 # China Unicom Guangdong Province Network / UNICOM-GD
ipset add banlist 114.243.192.0/18 # UNICOM-BJ / China Unicom Beijing Province Network
ipset add banlist 221.8.0.0/15 # UNICOM-JL / CNC Group CHINA169 Jilin Province Network
ipset add banlist 111.2.0.0/19 # China Mobile / ORG-CM1-AP / CMNET / China Mobile communications corporation
ipset add banlist 222.80.0.0/15 # CHINANET-XJ / Beijing 100032
ipset add banlist 61.134.192.0/18 # UNICOM-CN / CNC Group CHINA169 Shanxi Province Network
ipset add banlist 223.73.52.0/22 # China Mobile communications corporation / China Mobile / ORG-CM1-AP / CMNET
ipset add banlist 112.7.208.0/21 # China Mobile Communications Corporation / ORG-CMCC1-AP / CMNET / China Mobile communications corporation
ipset add banlist 39.146.96.0/21 # China Mobile / ORG-CM1-AP / CMNET / Internet Service Provider in China
ipset add banlist 163.142.0.0/16 # UNICOM-GD / China Unicom Guangdong Province Network
ipset add banlist 117.179.97.0/24 # ORG-CM1-AP / China Mobile / CMNET / China Mobile communications corporation
ipset add banlist 112.22.0.0/19 # ORG-CMCC1-AP / China Mobile Communications Corporation / CMNET / China Mobile communications corporation
ipset add banlist 39.188.208.0/20 # Internet Service Provider in China / ORG-CM1-AP / China Mobile / CMNET
ipset add banlist 221.221.0.0/18 # UNICOM-BJ / China Unicom Beijing Province Network
ipset add banlist 220.203.224.0/19 # UNICOM / China Unicom Network
ipset add banlist 123.114.0.0/18 # China Unicom Beijing Province Network / UNICOM-BJ
ipset add banlist 216.246.66.0/24 # NET-216-246-66-0-23 / IPXO LLC
ipset add banlist 122.90.0.0/16 # CMNET / Internet Service Provider in China
ipset add banlist 117.183.128.0/21 # ORG-CM1-AP / China Mobile / CMNET / China Mobile communications corporation
ipset add banlist 36.143.32.0/23 # China Mobile Communications Corporation / ORG-CMCC1-AP / CMNET / China Mobile Communications Corporation
ipset add banlist 58.16.0.0/16 # UNICOM-GZ / CNC Group CHINA169 Guizhou Province Network
ipset add banlist 112.7.128.0/21 # CMNET / ORG-CMCC1-AP / China Mobile Communications Corporation / China Mobile communications corporation
ipset add banlist 111.25.48.0/21 # ORG-CM1-AP / China Mobile / CMNET / China Mobile communications corporation
ipset add banlist 202.192.80.0/24 # CERNET-CN / Beijing, 100084
ipset add banlist 61.173.0.0/17 # CHINANET-SH / China Telecom
ipset add banlist 36.106.128.0/17 # CHINANET TIANJIN PROVINCE NETWORK / CHINANET-TJ
ipset add banlist 222.160.0.0/15 # China Unicom / UNICOM-JL
ipset add banlist 111.119.208.0/20 # HUAWEI INTERNATIONAL PTE. LTD. / Huawei-Cloud-SG
ipset add banlist 123.185.64.0/20 # CHINANET-LN / Shenyang,110168
ipset add banlist 221.2.0.0/16 # UNICOM-SD / CNC Group CHINA169 Shandong Province Network
ipset add banlist 171.112.0.0/15 # CHINANET-HB / China Telecom
ipset add banlist 58.48.0.0/13 # Beijing 100088 / CHINANET-HB
ipset add banlist 222.218.0.0/16 # Beijing 100032 / CHINANET-GX
ipset add banlist 112.109.128.0/17 # CNCGROUP-FJ-QUANZHOU-MAN / China Unicom CHINA169 Fujian Province Network
ipset add banlist 218.80.64.0/18 # CHINANET-SH / China Telecom
ipset add banlist 122.188.0.0/14 # UNICOM-HB / China Unicom Hubei Province Network
ipset add banlist 121.60.0.0/14 # China Telecom / CHINANET-HB
ipset add banlist 112.2.64.0/19 # China Mobile Communications Corporation / ORG-CMCC1-AP / CMNET / China Mobile communications corporation
ipset add banlist 58.58.0.0/16 # No.999,Shunhua road,Jinan,Shandong / CHINANET-SD
ipset add banlist 111.16.192.0/20 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 117.174.64.0/21 # China Mobile communications corporation / CMNET / China Mobile / ORG-CM1-AP
ipset add banlist 117.179.116.0/22 # CMNET / China Mobile / ORG-CM1-AP / China Mobile communications corporation
ipset add banlist 111.34.176.0/20 # CMNET / China Mobile / ORG-CM1-AP / China Mobile communications corporation
ipset add banlist 112.7.80.0/20 # CMNET / China Mobile Communications Corporation / ORG-CMCC1-AP / China Mobile communications corporation
ipset add banlist 112.40.96.0/19 # China Mobile communications corporation / ORG-CMCC1-AP / China Mobile Communications Corporation / CMNET
ipset add banlist 36.143.192.0/18 # ORG-CMCC1-AP / China Mobile Communications Corporation / CMNET / China Mobile Communications Corporation
ipset add banlist 117.143.100.0/22 # CMNET-shanghai / China Mobile communications corporation
ipset add banlist 36.143.56.0/22 # CMNET / China Mobile Communications Corporation / ORG-CMCC1-AP / China Mobile Communications Corporation
ipset add banlist 36.48.0.0/16 # No.2136,Dong-Nan-Hu Road,Changchun,130000,Jilin / CHINANET-JL
ipset add banlist 117.135.80.0/22 # CMNET-shanghai / China Mobile communications corporation
ipset add banlist 60.8.0.0/15 # UNICOM-HE / CNC Group CHINA169 Hebei Province Network
ipset add banlist 111.14.240.0/20 # CMNET / China Mobile / ORG-CM1-AP / China Mobile communications corporation
ipset add banlist 223.107.224.0/19 # China Mobile communications corporation / CMNET / ORG-CM1-AP / China Mobile
ipset add banlist 223.81.207.0/24 # China Mobile communications corporation / ORG-CM1-AP / China Mobile / CMNET
-1:-- 2024-09-18 Emacs Wiki and China (Post)--L0--C0--October 18, 2024 06:23 PM

Sacha Chua: Yay Emacs 6: Inserting links with consult-omni

I want to quickly look up and add links. consult-omni lets me search within Emacs instead of switching to a web interface. After I set up consult-omni-google with a Google custom search engine and a JSON API key, I can call it with my shortcut: M-g w. Using M-n for future history pulls in the word at point. Then I can select a site and use Embark to insert with C-. i or copy with C-. w.

My config: https://sachachua.com/dotemacs#consult-omni

You can watch this on YouTube, download the video, or download the audio.

View org source for this post
-1:-- Yay Emacs 6: Inserting links with consult-omni (Post Sacha Chua)--L0--C0--October 18, 2024 03:58 PM

James Dyer: Transforming Dired File Paths into Org Links

I am of course using org mode for organizing my tasks, notes and other paraphernalia.

In addition, I generate static web pages from org using hugo, with each org heading representing a single post.

I often find myself needing to refer to files stored in a directory, especially image files that can be org embedded and then passed through to Hugo by the ox-hugo package.

Navigating to the file and manually generating the appropriate org link can be just a little cumbersome - to initially pick up the file name and then insert the relevant org attributes.

dired-copy-filename-as-kill is a function I often use in dired, which copies the filename under point. I can then use something like tempel to insert the attributes. However, while the combination of copying the filename in dired and then remembering the tempel shortcode is quite efficient, I think this could be accomplished more cleanly with some Elisp and a dired-mode mapping.

Here is a typical embedded image form, which restricts the image within the org document to 300 pixels and to 100% width when exported through hugo to my web site.

#+attr_org: :width 300px
#+attr_html: :width 100%
[[file:emacs/20240918111443-emacs--Transforming-Dired-File-Paths-into-Org-Links-with-Emacs-Lisp.jpg]]

Lets walk through a custom function, my/dired-file-to-org-link, which transforms the dired file path under cursor/point into an org link and copies it to the kill ring for easy pasting.

(defun my/dired-file-to-org-link ()
  "Transform the file path under the cursor in Dired to an Org mode
link and copy to kill ring."
  (interactive)
  (let ((file-path (dired-get-file-for-visit)))
    (if file-path
        (let* ((relative-path (file-relative-name file-path
                                                  (project-root (project-current t))))
               (org-link (concat "#+attr_org: :width 300px\n"
                                 "#+attr_html: :width 100%\n"
                                 "file:" relative-path "\n")))
          (kill-new org-link)
          (message "Copied to kill ring: %s" org-link))
      (message "No file under the cursor"))))

When my/dired-file-to-org-link is called in a dired buffer, it gets the file path under the point, transforms it into an Org link with specific attributes, and copies the link to the kill ring. This enables you to quickly paste it into your Org file.

I map this to the letter b in the dired-mode mapping, which for me mnemonically refers to (b)log and the b key is not one I currently use in dired.

Note also the use of project.el with the project functions, as I have a project top level defined for my website content, allowing for an easily generated relative path name.

Therefore for example, 20240918111443-emacs--Transforming-Dired-File-Paths-into-Org-Links-with-Emacs-Lisp.jpg from dired in an emacs directory is transformed into :

#+attr_org: :width 300px
#+attr_html: :width 100%
[[file:emacs/20240918111443-emacs--Transforming-Dired-File-Paths-into-Org-Links-with-Emacs-Lisp.jpg]]
-1:-- Transforming Dired File Paths into Org Links (Post James Dyer)--L0--C0--October 17, 2024 02:36 PM

TheMKat: Write your own Emacs Lisp macros - a short introduction

Have you ever wondered how you can write your own macros in Emacs Lisp? Or what that even mean? Macros are a very powerful tool, and one that has long history in the Lisp family of programming languages. Writing your own syntax seems enticing, and that is indeed what we will look at. We will see simple examples, as well as creating your own syntax for anonymous functions (aka lambdas).
-1:-- Write your own Emacs Lisp macros - a short introduction (Post)--L0--C0--October 17, 2024 12:00 AM

Protesilaos Stavrou: Emacs: remap font size in the minibuffer

Over at the fontaine repository, I was asked by akartha if we could have a font preset for the minibuffer that is smaller than the others. The minibuffer does not have its own face, so we cannot affect it with Fontaine. We can, however, use the face remapping mechanism to change the attributes of the default face locally in the minibuffer. Here is the code for it.

(defvar-local my-minibuffer-font-remap-cookie nil
  "The current face remap of `my-minibuffer-set-font'.")

(defface my-minibuffer-default
  '((t :height 0.8))
  "Face for the minibuffer and the Completions.")

(defun my-minibuffer-set-font ()
  (setq-local my-minibuffer-font-remap-cookie
              (face-remap-add-relative 'default 'my-minibuffer-default)))

(add-hook 'minibuffer-mode-hook #'my-minibuffer-set-font)

[ Yes, I know setq-local is redundant for a defvar-local, but I prefer to be explicit. ]

In this example, the my-minibuffer-default is set to a height that is 0.8 times the height of the default face. As such, if we increase the height of the latter, the former will adapt gracefully. Only the default needs an absolute :height value.

If you are using the generic completion user interface with the *Completions* buffer, then you also need this:

(add-hook 'completion-list-mode-hook #'my-minibuffer-set-font)

Of course, we are not limited to changing the font height. Here is how we can apply some different colours:

(defface my-minibuffer-default
  '((((class color) (min-colors 88) (background dark))
     :background "#181032" :foreground "#a0d0ff")
    (((class color) (min-colors 88) (background light))
     :background "#f2ede0" :foreground "#6f2000")
    ((t :height 0.8)))
  "Face for the minibuffer and the Completions.")

If you are using any of my modus-themes, ef-themes, or standard-themes, then you can also benefit from the macro that exposes the palette of the effective theme. With Modus as an example:

(defun my-modus-themes-custom-faces (&rest _)
  (modus-themes-with-colors
    (custom-set-faces
     `(my-minibuffer-default ((t :background ,bg-magenta-nuanced :foreground ,magenta-cooler))))))

(add-hook 'enable-theme-functions #'my-modus-themes-custom-faces)

[ The palette can be previewed with M-x modus-themes-preview-colors. Check the manual of each of my packages for further details. ]

I can probably patch minibuffer.el to set its own face, but I have not had the chance to look into the details. This “just works”, anyway. Enjoy!

-1:-- Emacs: remap font size in the minibuffer (Post)--L0--C0--October 17, 2024 12:00 AM

Irreal: Moving Among Emacs Windows

Once you discover the utility of having multiple windows in a single Emacs frame, the question of how to switch between those windows arises naturally. Emacs, of course, has you covered. You can use Ctrl+x o to cycle between windows. That’s great if you have only a couple of windows in a frame but it becomes tedious when there are multiple windows. That, of course, happens often once you get used to making maximum use of Emacs.

Marie K. Ekeberg over at TheMKat has a solution. It’s a nice solution in the sense that it’s built into Emacs so you can use it without adding anything extra. That solution is windmove. Ekeberg didn’t like the default bindings but, as she says, it’s easy to change them to whatever is comfortable for you.

I used windmove for a while but I have since moved to ace-window, a wonderful app from abo-abo that, when invoked, labels each visible window with a number that you can use to select that window you want to move to. I’ve bound it to Ctrl+x o so I didn’t have to learn a new binding. The nice thing is that if there are only two windows—my usual situation—ace-window will simply switch to the other without further ado.

When I brought up the ace-window repository while writing this post, I noticed that there are a bunch of possible actions available. I never use any of them except switching but you may find some of them useful.

The TL;DR is that if you routinely have more than two windows in a frame, ace-window is a must have app. I’ve been using it for years and wouldn’t want to live without it.

-1:-- Moving Among Emacs Windows (Post jcs)--L0--C0--October 16, 2024 03:00 PM

Sacha Chua: Thinking about 12 aspects of personal information/knowledge management

Here is a totally rough list of aspects that I came up with to start thinking about how I do personal information/knowledge management and how I want to explore other people's systems.

(text from sketch duplicated as headings below)

Quick reflections on my setup:

Use: What do you want to use it for, and how?

I mostly work on code, so I need to keep things like TODOs and setup instructions.

I also want to organize resources and refer people to them.

It's important to me to get things out of my head because unfinished thoughts in my head are intrusive (Ovsiankina effect). They get in the way of being able to enjoy time with the kiddo. I need to be able to get them out into a system that I can trust, so that I can stop thinking about it until it's time to think about it again. I don't have a lot of computer time, so I want to be able to pick things up quickly when I do.

Capture: How do you get stuff in?

Most of the time, I add quick questions or ideas using Orgzly Revived on my phone because I'm not close to a computer. Sometimes I look up web pages that relate to something, and then I can share that with Orgzly using the Android share menu. If I'm close to a computer, then I can use org-capture.

I also use my Supernote to sketch/write ideas.

I use my phone for audio braindumps.

Challenge: I want to write down more context because I occasionally come across notes that don't make sense to me.

Retrieval: How do you get stuff out?

I usually tend to work on things that I've recently thought about, so I'm working out of my inbox or out of a few active projects. Either the relevant items I've captured are still there in my inbox or in the project's tree, or I can quickly organize them before I dive into my work.

Sometimes I need to retrieve something that's a lot older, such as when I want to recommend something I remember seeing a year or two ago. This is challenging because I often don't remember the exact words that will bring it up. I can help that a little bit by adding my own words when I create the note, but I don't feel like that's a solid solution yet. I think that this is a challenge that's going to get worse as my brain gets fuzzier. Finding things using approximate matches could be interesting. Most of the time, I end up relying on an Internet search, because then I can take advantage of the variety of words used in other people's descriptions of the thing.

Blog posts (and funneling my toots and sketches into blog posts) makes things slightly more findable. I've come across things I've completely forgotten writing about.

Challenge: When I'm trying to move too quickly instead of writing things down, then there's nothing to retrieve years later when I'm picking a project back up again. For example, when I finally dusted off my time-tracking project so that I could upgrade the Rails version, I had to do a lot of figuring out. That tells me I need to write more notes. As I run into things that I didn't write down well enough (or as I bump into things I could've sworn I wrote about but I just can't find my notes), I try to write down what I've figured out, where I looked, and what words I used in order to look for it. Maybe that will make it more findable in the future.

Priorities: How do you get the right stuff out?

I tend to work on a few recent thoughts, so I can generally schedule them for the day that I think I'll be able to work on them. Then I can use my Org Mode agenda to get a short list of the things that I want to work on. When that's done, I can then go through the more general things–still biased towards what's recent, what's in my inbox, what I've been thinking about lately. It takes extra time to context shift back into older things.

My life generally doesn't have a lot of urgent commitments, so it's mostly a matter of thinking: What do I feel like working on? What's the most annoying thing I need to work around? What am I curious about? Then I can go to that project or thought.

Sometimes I'll use the TODO status to distinguish between things that I want to do someday versus things that I could do sooner. Pushing things off to SOMEDAY is especially handy for ideas that are not very fleshed out yet. My newly created tasks default to SOMEDAY so that it takes me an active effort to say, okay, this stuff is on my list of things to focus on.

Sometimes I use the [#A] and [#C] priority marker in Org Mode to move things to the top or bottom of my list.

In general, I don't worry too much about making sure that I'm working on the absolute best thing at the time, because that stuff takes planning, too.

Time: How do you deal with dates/times/conditions?

Scheduling something on a particular day is how I pick a short list of things that I want to do. These things don't always happen. Sometimes I end up procrastinating something for another few weeks out or a month out. If I do that too often, I usually end up cancelling it, because clearly there are other things I want to do.

There are also the things I've got to schedule once in a while that I don't actively think about until the reminder pops up, like renewing my passport. The Org agenda takes care of that.

I like to keep journal entries so that I can look back and see the progress I've made.

Revision: How do you add to or refine things?

I might start off with just a quick question or idea. Depending on what I have time for, I might flush out that idea in an audio braindump or a sketch. I can convert either of those things into text and dump them into my note for editing, or I can sit down and flesh out the idea further by writing it, with the eventual goal of turning it into either a toot or a post. Maybe some of them will get turned into videos. So that's how I gradually refine things.

I would like to get better at this. Maybe I can keep track of which thoughts could benefit from sketching or doing a brain dump, or refining those sketches or brain dumps into posts. Which posts are almost there and just need a little bit more work? Which ones do I want to turn into a video?

Since the sketching and the braindumping can happen in parallel, it's probably more about tags rather than TODO states.

One improvement could be showing me where these ideas are in the pipeline so that if I'm at my computer and I want to get something out the door, I can make a list of posts that are almost there. If I'm heading out for a walk to the store, then I can make a list of the things to think about out loud. Then I can have my system do the transcript and stick it back into the pipeline so I can edit it.

How do I take those fragments of thoughts, put them together, and turn them into a finished chunk?

When it comes to refining sketches, I can just flip open my supernote and I add more stuff to it. It's very easy to pick up and put down again. I like that.

Audio is harder to work with in terms of refining an idea, but maybe I'll figure out the workflow for that someday. The draft for this post came from a sketch and an audio braindump.

There's also this idea of refining a project. When I do my first pass through my inbox, I'm just basically throwing things in the rough direction of where I'm probably going to want them. I'll refile things very roughly into Consulting or EmacsConf or whatever else. Refining in that context would be collecting several resources and putting them under one subtree, or making sense of something, mapping out the resources for a topic, or summarizing.

If I've saved a web page, it becomes a lot easier to learn from and find again if I use my own words to describe what I'm learning from it. That's another area that I could definitely do better in.

Refining is easier to do when I'm on my computer, but when I'm on my computer, I tend to want to make stuff rather than edit stuff. If I'm refining something with the goal of making it a post, that sometimes happens. But if I want to review a page whose link I saved, sometimes that ends up very low on my priority list. I'm throwing all these things into my SOMEDAY list and not actually getting around to them yet. Maybe someday!

Connection: How do you link things together?

Most of the time, I refile things so they're roughly close to where other things I need are. I can just scroll to find connected items.

I don't have many things that need to be in multiple places in my In my outline. When I do, I tend to use links to connect the ideas. I like linking between blog posts and sketches.

I don't have a good facility for backlinks yet. I should make this easier for myself, either by just opening the blog post that I'm referring to so that I can quickly add a link to it going the other way–a manual backlink that lets me provide the context–or maybe adding some backlink support to my static site generator.

Anyhow, at least the forward links are fine. I've got some completion to help me with that. Web searches are helpful just in case my completion doesn't work, as right now my completion only works with title searches. If I am a little fuzzier about what I've called something, then I will search the Internet, grab the URL, and pop in the link.

Most of the linking happens in my blog posts because the blog posts live outside my outline. They are just roughly organized by date and category. So if I want to build on another thought, I've got to link to it. Fortunately, I've got the URL, so it's easy to link to things.

I can link to things within Org Mode. I probably should more often, and it will probably involve getting the hang of Org IDs. It hasn't been as big a need for me for now because I try to push things into blog posts as much as possible.

Sometimes it makes sense to have a URL or a link that works for both the exported version and my own internal notes. I want some things to open up in Emacs instead. Then I might have a custom link type to make that easier.

Externals: How do you refer to things outside your system?

There are a lot of things that I want to think about or refer to that aren't within my Org Mode files. Fortunately, Org Mode makes it super easy to link to the things, so that part is fairly solid.

There are some kinds of things that I don't have an easy way of thinking about or working with yet, like audio.

Work ideas are harder for me to link to now that I can't access the company's WebEx chat on my personal phone, so I just write down a couple of keywords to remind myself what to think about or search for. I also tend to read my e-mail on my phone, so I don't have Org Mode's fancy linking. I write down or copy a few keywords and tag the note with "email" to help me remember where to look. Life would be much easier if I could do all of these things within Emacs so that I could just create a task and it would automatically be annotated with the link to the original stuff, but we've got to work with what we've got.

Sharing: How do you share with others?

I've been gradually refining my workflow for turning my notes ito blog posts. Org Mode is fantastic for this. I can have source blocks, I can export to various formats, it's all good. I'm also exploring the idea of turning some things into richer text–adding diagrams or sketches, or narrating it, or turning it into a video.

My main thing is I want to get thoughts, ideas, and questions from my notes into some kind of public chunk. Toots are nice because I can get smaller thoughts out instead of waiting until I've fleshed them out further. Blog posts are ideal.

I want to experiment with this by using audio braindumps and sketches to explore ideas faster and use non-computer time to help with writing.

Maintenance: How do you tidy or trim?

Part of maintenance is figuring out what's out of date and what I can archive to make it easier for me to just see the current stuff. I periodically go through my inbox and archive things or refile things into projects. I am slowly getting the hang of archiving things instead of deleting things, since disk space is cheap. Once in a while, I'll go through my Org file to archive inactive projects and neaten things up.

On the public side, I could probably do automated things like link-checking, but it's been pretty low priority. Most of the time, I end up updating posts when I look up them up in order to link to them or when people ask me about them. I have a snippet that makes it a little easier to note an update, but I should probably improve it to handle adding an update to a post that's already been updated before.

I don't have a list of recently modified but not newly posted posts, which might be a good idea for exposing that to blog readers.

I also want to create more evergreen pages that organize resources, kind of like my blog outline but more granular. I still want to have the last modified date as text in the page itself, but it doesn't have to be part of the permalink.

Discovery: How do you stumble upon things?

I have a lot in my notes that I've completely forgotten about. One of the benefits of keeping most of my notes online is that when people come across those notes, their links or comments help me find them again.

I've also added a random blog post button on my blog, and I'm trying to shift some doom-scrolling to use that instead.

For my personal notes, I don't bump into things as much because org-refile is very efficient for getting to just the thing I want to look at. For the most part, things get hidden away under their sub-trees until I feel like working on that particular area, so it might be years before I touch something again, if at all.

I could probably add some kind of randomness thing, but I don't really struggle with finding things to work on when I'm on my computer. There's usually something else more pressing that I want to work on, so it hasn't been an issue.

I do want to add a random sketch thing, though. I think it could be fun to cycle my background through the files in my public sketches on my desktop or my phone lockscreen.

Longevity: How do you keep it around?

Using plain text and free and open source software is really important to me because I want it to be easy to back up and I want to be able to trust that it's going to be around. Having seen many things get bought up or taken down… Yeah, I want to have my own notes. I feel reasonably confident, based on other people's experiences, that if I want to keep using my notes in another 20 years or more, it'll probably still be there as long as I don't do anything silly with the data.

For my sketches, I put titles and tags in the filenames. I've been using Google Cloud Vision to do handwriting recognition so that I have some kind of text that presumably I could search, although I haven't built that part yet.

Audio is a bit more ephemeral, but it might still be interesting to hear archived audio.

One of these days, I should make an organized backup of the things that I've shared on YouTube and other places. Videos take much more space.

Another thing that I'm thinking of long-term, once in a while, is how to keep going into this, how to keep it easy for me to access, use, add to, and share as I get older. I hear menopause might really do a number on my brain. People report having a hard time remembering words and thinking thoughts. It would be nice to have approximate search in place by then so that I can still find things, or at least have shared as much as possible.

My long-term plan (in case stuff happens) is to have whatever notes might be helpful be publicly available already so that theoretically someone could use the Internet Archive or a static mirror or to get back to it. Even in the case where I die and my hosting stops being paid for, the core things about it, I think, have been well-demonstrated and can be easily picked up by somebody else if they want to.

Planet Emacslife is a blog aggregator. The idea of Emacs News is fairly straightforward and somebody else could step into it easily. The ideas are not dependent on me, whic his nice.

My posts and code are out there too. They're not immortal, and they don't have to do be. If they're useful in the moment, that's already enough. If somebody comes across them months or years later and finds them useful, that's a bonus. I use them to think through something, so that's already a win.

Wrapping up

I'd love to hear about your personal information/knowledge management systems, whether you want to think about it using these aspects or your own framework. Let's share notes!

View org source for this post
-1:-- Thinking about 12 aspects of personal information/knowledge management (Post Sacha Chua)--L0--C0--October 16, 2024 02:03 PM

Irreal: Organizing A Book In Org Mode

Somehow, I missed this great reference to Ron Galloway’s outline for using Org mode to organize a book. Fortunately, Sacha had me covered with her excellent Emacs News.

If you haven’t written a book before, it may be surprising how necessary Galloway’s template is for the actual mechanics of writing a book. Even if you’re organized and divide your book into a main file and separate files for each chapter, you’ll soon discover that you want some place to put notes, log your progress, track your references, and brainstorm ideas.

Every author solves these problems in different ways with different file structures but Org is especially amenable to providing a useful framework for organizing these things.

I wrote my books before I discovered Org mode—or perhaps before it existed—but my structure was essentially the same. The nice thing about Org is that you can access—and work on—all those files from a single top level file.

If you’re writing or considering writing a book, take a look at Galloway’s outline. It’s an excellent starting point for our own project.

-1:-- Organizing A Book In Org Mode (Post jcs)--L0--C0--October 15, 2024 04:35 PM

Sacha Chua: Change Org Mode TODO keyword color based on the state and the current Modus theme

I use modus-theme-toggle to switch between modus-vivendi-tinted and modus-operandi-tinted depending on whether I want a dark background or a light one. I also customize my org-todo-keyword-faces to visually distinguish TODO, DONE, WAITING, and SOMEDAY. This is how to colour them based on the current Modus theme.

(defun my-org-todo-set-keyword-faces ()
  (setq org-todo-keyword-faces
        `(("TODO" . (:foreground ,(modus-themes-get-color-value 'blue-warmer) :weight bold))
          ("DONE" . (:foreground ,(modus-themes-get-color-value 'green-warmer) :weight bold))
          ("WAITING" . (:foreground ,(modus-themes-get-color-value 'red-warmer) :weight bold))
          ("SOMEDAY" . (:foreground ,(modus-themes-get-color-value 'fg-dim) :weight bold))))
  (when (derived-mode-p 'org-mode)
    (font-lock-fontify-buffer)))
(with-eval-after-load 'modus-themes
  (add-hook 'modus-themes-after-load-theme-hook #'my-org-todo-set-keyword-faces))
2024-10-14-17-21-48.svg
Figure 1: Light background
2024-10-14-17-22-31.svg
Figure 2: Dark background
This is part of my Emacs configuration.
View org source for this post
-1:-- Change Org Mode TODO keyword color based on the state and the current Modus theme (Post Sacha Chua)--L0--C0--October 14, 2024 09:02 PM

Sacha Chua: 2024-10-14 Emacs news

Links from reddit.com/r/emacs, r/orgmode, r/spacemacs, r/planetemacs, Mastodon #emacs, Hacker News, lobste.rs, programming.dev, lemmy.world, lemmy.ml, communick.news, planet.emacslife.com, YouTube, the Emacs NEWS file, Emacs Calendar, and emacs-devel. Thanks to Andrés Ramírez for emacs-devel links. Do you have an Emacs-related link or announcement? Please e-mail me at sacha@sachachua.com. Thank you!

View org source for this post
-1:-- 2024-10-14 Emacs news (Post Sacha Chua)--L0--C0--October 14, 2024 11:58 AM

Marcin Borkowski: mrr-replace-mode

I have to admit that this is a bit embarrassing. A long time ago I announced a future post (and promised to release my code) for performing multiple regex replacements in a buffer, possibly in an interactive way. A few months later I started my first programming job (yay!) and promptly forgot about it…
-1:-- mrr-replace-mode (Post)--L0--C0--October 14, 2024 11:30 AM

TheMKat: Emacs tip: Use windmove to navigate open buffer windows

Do you also move between your Emacs buffer windows in an ineffective way? Always using C-x o to switch between them after opening several? Or maybe you are using the mouse (ugh)? Did you know that you could navigate to a buffer window in the direction you want, instead of just going randomly to the next one?
-1:-- Emacs tip: Use windmove to navigate open buffer windows (Post)--L0--C0--October 14, 2024 12:00 AM

İsmail Efe: My Design Stack

My Design Stack

İsmail Efe Top

2024-10-13

If you are familiar with frontend and backend development, you've likely come across tech stacks. You can think of tech stacks as a list of tools people use to create applications. People can share their stack and others can get inspired or learn about new technologies.

While it is common to find different stacks when working in the programming field. You don't see them utilized in other fields, such as design. Since I picked up a lot of design jobs and create a lot of slides, I wanted to create a design stack and share what I use and how I use them.

I am calling this the PCSG stack. Before I start explaining, I want to go over two things.

  • I am a student on a budget and can't afford multiple subscriptions. I try to unnecessary avoid costs as much as possible, that is why all of my recommendations are free to use.

  • I don't want to steal anyone's hard work. If a recommendation includes user-generated content, it comes with an open commercial license or is public domain.

Photopea

Photopea is a browser-based photo editor. Coming from Adobe Photoshop, I find it easy to work with, as Photopea draws heavily from Photoshop's interface, shortcuts and features.

Since there is a lot of different options when it comes to photo editors, I want to list the things I like about Photopea:

  • Runs locally in your browser. That means you can open it on almost any device and run it offline.
  • Can open PSD files flawlessly, it also supports a bunch of formats.
  • You can use it for free with ads. -$5 gets you an ad-free experience, 5 GB storage, and some AI credits-
  • Houses almost all of the Google Fonts library. -I will talk about Google Fonts in a sec-
  • It has a large community that offers plenty of tutorials and technical support.

Colorhunt

Colorhunt is a website that hosts curated color palettes. I use this website very often; you can search for specific color palettes, sort by popularity, and add palettes to your collection.

Colorhunt comes in handy when I have to quickly select a contrasting color scheme for a slide or when I need inspiration for a project.

SVG Repo

I think I speak for all designers when I say SVGs are awesome! If you don't know what an SVG is, I recommend this video, as it does a great job of explaining.

SVG Repo is a wonderful way to get SVGs. It houses "500.000+ Open-licensed SVG Vector and Icons" and comes in handy A LOT when doing design work.

Most of them have licenses that enable you to use them however you want. I generally make use of SVGs in slides, posters, social media contents, and websites.

Google Fonts

Google Fonts is one of my favorite sites to use. It houses more than a thousand fonts, and all of them have open licenses. All the fonts hosted have unique personalities, and you can easily find one that suits your needs.

For example, my website mainly uses EB Garamond and Gentium Plus, which I found and got from Google Fonts.

Google Fonts also has wonderful articles that teach you how to select fonts, where to use them, and how to use them. These articles are a must-read for any designer.

If you are a webmaster, you can use Google Fonts on your websites without downloading or hosting anything. This can be achieved by getting embed links for the fonts you want to use and importing them with just one line of CSS.

Bonus

Accessibility is something I deeply care about. A lot of my design work comes in the form of web design. For more people to have the ability to view my website comfortably, I need to be operating within the W3 contrast standards. I use 2 sites for checking whether I am following this standard or not.

First is Colour contrast checker, this site lets me check the AA and the AAA value. If my color combination doesn't pass, I proceed to use the second site.

Second is Contrast Finder, this site helps me find a color that both passes the standard and is similar to my original color using an algorithm.

Closing Words

Thanks a lot for reading about my easy to incorporate but horribly named design stack.

I don't do any video, 3D, or professional vector work. That's why my flow might be lacking in these and some other areas, but I am sure that you can find something valuable to add into your own workflow.

If you have any suggestions or criticism, feel free to reach through my email.

-1:-- My Design Stack (Post İsmail Efe Top (ismailefetop@gmail.com))--L0--C0--October 12, 2024 09:00 PM

Chris Maiorana: Second Brain, Second Nature

I finally got around to reading the big Zettelkasten book: How To Take Smart Notes: One Simple Technique to Boost Writing, Learning, and Thinking. The title alone makes you want to stand up and say, “Bravo!”

Here are some thoughts.

The Zettelkasten method is not a perfect catch-all tool for everyone.

This system is best intended for academics, particularly those in theoretical fields, academics whose chief output depends upon synthesizing new ideas from the thoughts and writings of others in their field. (This makes sense because the system’s inventor was a sociologist.)

Or, if you’re a casual writer writing about philosophy, history, literature, etc., this might help you take better notes.

I like how the system is focused on writing as a core discipline. The idea behind the system is to improve one’s writing by developing expertise in one’s chosen area of inquiry.

But I haven’t fully invested in the Zettelkasten hype. I’m not convinced that “those who take smart notes will never have the problem of a blank screen again.”

That’s a big promise, and I don’t think any notation system could deliver on it.

One of the big takeaways for me, which seems obvious when you think about it, is that all your notes should follow the same pattern. Meaning, don’t take hierarchical notes. For example, if you’re using text files, just put all of them in the same folder with some unique identifier on each file. (How you choose to parse these notes and organize them is up to you.)

But look around at how many software packages we have to choose from if we want to give Zettelkasten a try. Here’s just a short list:

  • Obsidian
  • Logseq
  • Roam Research
  • Org-roam (Emacs)
  • Denote (Emacs)

I’ve tried all of these.

The problem with many of these software implementations is that they have a plurality of features that complicate more than illuminate.

Denote is my favorite, because it is the most minimalist. However, I don’t like how it relies so heavily on tags. I don’t like tags. Tags are friction.

The best advice I could give anyone who is Zettelkasten-curious is just build your own system. Naturally, I think Emacs is the best canvas to start building on.

However, if you want to try something today, Obsidian seems to have the smallest learning curve. But why you’d ever need that massive graph view of hyperlinks, I just don’t know.

-1:-- Second Brain, Second Nature (Post chris)--L0--C0--October 12, 2024 08:44 PM

James Cherti: Emacs: Automating Table of Contents Update for Markdown Documents (e.g., README.md)

When working with markdown files in Emacs (e.g., README.md), users may need to manually update the table of contents. Automating this process saves time and ensures that the table of contents remains consistent with the document structure. This article presents an Emacs Lisp code snippet that uses:

  • The markdown-toc package to automatically generate or refresh a table of contents,
  • A custom function (my-markdown-toc-gen-if-present) that runs before markdown files are saved. It performs the following actions:
    • Updates the table of contents if one is already present.
    • Ensures that both the window start and cursor position remain unchanged, addressing a common issue with the markdown-toc package, which can disrupt the editing flow by moving the cursor and/or changing the window start. This behavior can be frustrating, as it interrupts the user’s focus and requires them to navigate back to their original position.

The code snippet that updates the table of contents and ensures that the cursor and window start remain unchanged

The following code snippet updates the table of contents while ensuring that the cursor and window start remain unchanged:

(The table of contents will be updated only if it is already present, so it is necessary to generate it at least once using the (markdown-toc-generate-toc) function. Additionally, ensure that the markdown-mode Emacs package is installed.)

;; Author: James Cherti
;; URL: https://www.jamescherti.com/emacs-markdown-table-of-contents-update-before-save/
;; License: MIT

;; Configure the markdown-toc package
(use-package markdown-toc
  :ensure t
  :defer t
  :commands (markdown-toc-generate-toc
             markdown-toc-generate-or-refresh-toc
             markdown-toc-delete-toc
             markdown-toc--toc-already-present-p))

;; The following functions and hooks guarantee that any existing table of
;; contents remains current whenever changes are made to the markdown file,
;; while also ensuring that both the window start and cursor position remain
;; unchanged.
(defun my-markdown-toc-gen-if-present ()
  "Generate a table of contents if it is already present."
  (let ((marker (point-marker))
        (current-visual-line
         (save-excursion
           (beginning-of-visual-line)
           (count-screen-lines (window-start) (point)))))
    (unwind-protect
        (when (markdown-toc--toc-already-present-p)
          (markdown-toc-generate-toc))
      (goto-char (marker-position marker))
      (beginning-of-visual-line)
      (when (> current-visual-line 0)
        (let ((window-start
               (save-excursion
                 (beginning-of-visual-line)
                 (let ((line-move-ignore-invisible nil))
                   (line-move-visual (* -1 current-visual-line)))
                 (beginning-of-visual-line)
                 (point))))
          (set-window-start (selected-window) window-start)))
      (goto-char (marker-position marker)))))

(defun my-setup-markdown-toc ()
  "Setup the markdown-toc package."
  (add-hook 'before-save-hook #'my-markdown-toc-gen-if-present nil t))

(add-hook 'markdown-mode-hook #'my-setup-markdown-toc)
(add-hook 'markdown-ts-mode-hook #'my-setup-markdown-toc)
(add-hook 'gfm-mode-hook #'my-setup-markdown-toc)

The above code snippet leverages the markdown-toc Emacs package to automate the generation of a table of contents within markdown documents. This package includes functions such as markdown-toc-generate-toc and markdown-toc-generate-or-refresh-toc, which facilitate the creation and updating of the table of contents as needed.

I implemented the my-setup-markdown-toc function to establish a hook that triggers my-markdown-toc-gen-if-present each time a markdown buffer is saved. This function guarantees that any existing table of contents remains current whenever changes are made to the markdown file, while also ensuring that both the window start and cursor position remain unchanged.

Requirement: Markdown Mode Setup

The table of contents update code snippet above will only function correctly only if the markdown-mode package is installed:

(use-package markdown-mode
  :ensure t
  :defer t
  :commands (gfm-mode gfm-view-mode markdown-mode markdown-view-mode)
  :mode (("\\.markdown\\'" . markdown-mode)
         ("\\.md\\'"       . markdown-mode)
         ("README\\.md\\'" . gfm-mode))) 

Conclusion

The my-markdown-toc-gen-if-present function automates the generation of a table of contents, ensuring that markdown documents consistently remain up-to-date with minimal effort.

-1:-- Emacs: Automating Table of Contents Update for Markdown Documents (e.g., README.md) (Post James Cherti)--L0--C0--October 12, 2024 12:19 PM

Emacs APAC: Announcing Emacs Asia-Pacific (APAC) virtual meetup, Saturday, October 26, 2024

This month’s Emacs Asia-Pacific (APAC) virtual meetup is scheduled for Saturday, October 26, 2024 with BigBlueButton and #emacs on Libera Chat IRC. The timing will be 1400 to 1500 IST. The meetup might get extended by 30 minutes if there is any talk, this page will be updated accordingly. If you would like to give a demo or talk (maximum 20 minutes) on GNU Emacs or any variant, please contact bhavin192 on Libera Chat with your talk details:
-1:-- Announcing Emacs Asia-Pacific (APAC) virtual meetup, Saturday, October 26, 2024 (Post)--L0--C0--October 12, 2024 12:02 AM

James Dyer: Simple Directory and File Creation Using Vertico Completion Exit With Input

In my previous post about creating simple functions to create a new directory and file in dired, I received an interesting comment suggesting another way to bypass the potential messiness of completion and pass through the literal text input.

My last post :

Simple Directory and File Creation in Dired

It is a subtlety of most if not all completion systems, and that is to exit with any input, hence exiting without having to necessarily match and complete.

Given this, and given that I’m using the completion framework of vertico, I thought I would revisit the vertico github manual : https://github.com/minad/vertico

and I find :

M-RET -> vertico-exit-input

vertico-exit-input exits with the minibuffer input instead. Exiting with the current input is needed when you want to create a new buffer or a new file with find-file or switch-to-buffer. As an alternative to pressing M-RET, move the selection up to the input prompt by pressing the up arrow key and then press RET.

Well this is exactly the issue I was having and why I wrote my two little simple functions. Now if I build in M-RET into my muscle memory (which already seems pretty natural), I can refine my Emacs init, while adhering more to vanilla Emacs concepts. Also as I now am being more idiomatic, I suspect the M-RET keybinding may just come in handy at some point in the future.

So, now rebinding dired-mode-map as follows:

("_" . dired-create-empty-file)

This is all that is required; note that dired-create-directory is already bound to my preferred keybinding.

So continues the evolution of my Emacs understanding!

As a side-ish note, I have found that writing this blog provides not only an opportunity to explore a topic further and thoroughly understand it, thereby enabling me to articulate the subject fully, but also to receive comments and discover subtle nuances that I hadn’t realized existed or hadn’t thought to explore!

-1:-- Simple Directory and File Creation Using Vertico Completion Exit With Input (Post James Dyer)--L0--C0--October 09, 2024 07:30 PM

Irreal: Writing With Emacs Redux

Four years ago I wrote about James Gill’s list of Emacs resources for writers. It was a curated list of resources that addressed writing prose of various sorts with Emacs. In April, I revisited the list. Judging from what I wrote, I had forgotten about my first post.

Now, I’m writing about it again because of Gill’s latest post about the list. In it, he says that surprisingly to him, that repository is the most popular of all his Github repositories. It’s not surprising to me because it’s a really great resource.

What was surprising to me, as I read down the his list, is how any are things that I have written about on Irreal. You may or may not think of that as an indication of quality but one thing for sure, it’s indicative of how interesting they are to me.

Regardless, if you use Emacs to write prose—for a blog, for reports, for articles, or even for books—you should take a look at this list. There’s sure to be something useful to you in it.

-1:-- Writing With Emacs Redux (Post jcs)--L0--C0--October 09, 2024 03:21 PM

Charles Choi: Referencing Org Table Cells with Text Regions

In a typical spreadsheet app, a common user interface practice is to avoid forcing the user to keep track of cell references as much as possible. This is usually seen in selecting a range of cells to construct a formula, where the user only needs to control the range of selection; the app keeps track of which cell references to pass into the formula.

Sadly, this feature is not available by default in Org tables. But no need to fret; Emacs and Org give you the mechanisms to build a reasonable emulation of spreadsheet-style cell range selection. This post shows you how.

Before going into details, here’s a demo of selecting a row of values and using that selection to compute its sum.

| a | b | c | Total |
|---+---+---+-------|
| 1 | 5 | 2 |       |
| 3 | 4 | 1 |     8 |
| 8 | 1 | 2 |       |
#+TBLFM: $4=vsum(@3$1..@3$3)

In the example above the following steps are taken:

  1. Place the point in the cell to enter a Calc formula, in this case vsum().
    • Note that vsum here stands for vector sum.
  2. Select a range of cells, typically with a mouse by pointing and dragging.
    • The selection can be either be a region or a region-rectangle.
      • Did you know that C-M-mouse-1 lets you mouse select a rectangle? I didn't until recently 🤯.
  3. Raise a context menu pressing the right mouse button over the selected region.
  4. In the context menu, a menu item showing the selected cell region is displayed (in this case @3$1..@3$3).
    1. Select this menu item to copy the cell references into the kill-ring.
  5. Move the point back to the initial cell in step 1 and yank the cell reference as an argument for vsum().
  6. Press TAB or RET to compute the formula.

Some observations:

  • Throughout this workflow, the user did not need to keep track of cell references.
  • The resultant table formula #+TBLFM: left-hand-side (lhs) is populated with only the column after step 6.
    • The user must amend the lhs to be @3$4 to specify that the formula should only apply to that cell.
    • AMENDED 2024-10-10: A workaround for this leveraging org-table-edit-formulas has been made. Details at end of this post.
  • The table formula can be modified to use relative references at the cost of requiring the user to truly understand Org table reference syntax.
  • Keyboard enthusiasts can use the command cc/copy-org-table-reference-dwim to convert a text region into an Org table reference.

Intrigued? Okay, let’s do this.

Org Table Reference Background

First off, let’s understand how Org tables address cells. A table cell is addressed using the following representation:

@ROW$COLUMN

A row is prefixed with @ whereas a column is prefixed with $. The row specification is placed before the column specification which is opposite of what's seen in conventional spreadsheets and Cartesian coordinates that specify the column first, then the row. Anyways, water under the bridge. With Org tables, it is always row first, column second.

A reference to an individual cell is called a field reference.

A reference to a set of cells is called a range reference. A range reference is constructed from two field references, where a and c are row values, b and d are column values.

@a$b..@c$d

Range references are translated into a vector of values that can be fed into Calc vector functions. Typically the two field references in a range reference are either in the same row or column. If not, then the vector of values is constructed using the two field references as a bounding box.

Most importantly, a range reference specifies values in a single vector. The orientation (row or column) of a range reference matters. To clarify, this is best illustrated by example.

#+NAME: vector-example
| a | b | c |
|---+---+---|
| 1 | 2 | 3 |
| 4 | 5 | 6 |
| 7 | 8 | 9 |

| Range      | Vector       | Notes                                                  |
|------------+--------------+--------------------------------------------------------|
| @2$1..@2$3 | [1, 2, 3]    | Cell values taken left to right.                       |
| @2$2..@4$2 | [2, 5, 8]    | Cell values "sliced" wrt column specification.         |
| @3$2..@4$3 | [5, 6, 8, 9] | Cell values taken using the extents as a bounding box. |
#+TBLFM: @2$2=remote(vector-example, @2$1..@2$3)
#+TBLFM: @3$2=remote(vector-example, @2$2..@4$2)
#+TBLFM: @4$2=remote(vector-example, @3$2..@4$3)

Design Requirements

With the background out of the way, let’s put down some requirements.

  1. Given an active region within an Org table, translate it to a range reference with the following specifics:

    1. If the selected region is a single column or row, return a range reference using the mark and point of the region.
    2. If the selected region crosses has multiple rows and columns, then treat the mark and point of the region as the bounding box specification for a matrix represented as a Calc vector of vectors.
    3. If the selected region is a in a single cell, only return the field reference for that cell.
    4. The bounding box calculation is the same regardless if the mark is before or after the point.
  2. Support both a mouse menu and mini-buffer command interface for obtaining an Org table region reference from a selected text region.

As a table is a convenient representation of a matrix, the above requirements makes the design decision to reflect that in mapping a text region having multiple rows and columns to a vector of vectors instead of a single vector.

Show Code

Here’s code that meets the requirements described above. Commands of note:

  1. cc/copy-org-table-reference-dwim
  2. cc/mouse-copy-org-table-reference-dwim

Given a point or region (text or rectangle) in an Org table, either of the two commands will create an Org table reference and push it in the kill-ring. The first command is intended to be called from the keyboard, the second from a mouse menu.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
;; Org Table Cell Reference Functions

(defun cc/org-table-cell-at-point ()
  "At point, return the cell object from an Org table.

A cell object is defined to be a list containing the row and the
column, successively."
  (if (not (org-at-table-p))
      (error "Not in a table"))

  (let* ((row (org-table-current-dline))
         (col (org-table-current-column)))
    (list row col)))

(defun cc/format-org-table-field-reference (cell)
  "Format CELL object into @r$c format.

CELL object obtained via `cc/org-table-cell-at-point'.

See Info node `(org) References' for more on Org table field
reference format."
  (let ((row (nth 0 cell))
        (col (nth 1 cell)))
    (format "@%d$%d" row col)))

(defun cc/org-table-range ()
  "Return range object from a region defined within an Org table.

A range object is a list of two cells computed via
`cc/org-table-cell-at-point', the first being the cell at the
start of the region and the last being the cell at the end of the
region."
  (if (not (and (org-at-table-p) (use-region-p)))
      (error "Not in an Org table"))

  (save-excursion
    (let* ((end (cc/org-table-cell-at-point)))
      (exchange-point-and-mark)
      (let ((start (cc/org-table-cell-at-point)))
        (list start end)))))

(defvar cc/last-org-table-reference nil
  "Last stored Org table reference.

State variable to store an Org table reference (field or range)
to be used in an Org table formula. This variable is set via
`cc/org-table-reference-dwim'

NOTE: This state variable to work-around my lack of clarity on
region and mouse menu interaction.")

(defun cc/org-table-reference-dwim ()
  "Org table reference given point or region is defined.

Return Org table reference (field or range) depending on whether
a point or region is defined in an Org table.

If the region is defined over multiple columns, then a Calc
vector matrix is returned. See Info node `(org) Formula syntax
for Calc' for more.

Calling this function will set `cc/last-org-table-reference'.

See Info node `(org) References' for more on Org table field
reference format."
  (if (not (org-at-table-p))
      (error "Not in an Org table"))

  (cond
   ((use-region-p)

    (let* ((range (cc/org-table-range))
           (start (nth 0 range))
           (end (nth 1 range))
           (msg (format "%s..%s"
                        (cc/format-org-table-field-reference start)
                        (cc/format-org-table-field-reference end))))
      (setq cc/last-org-table-reference (cc/org-table-range-to-reference range))
      msg))

   (t
    (let ((msg (cc/format-org-table-field-reference (cc/org-table-cell-at-point))))
      (setq cc/last-org-table-reference msg)
      msg))))

(defun cc/copy-org-table-reference-dwim ()
  "Copy Org table reference (field or range) into kill ring.

Given a point or region defined in an Org table, add to the
`kill-ring' an Org table field or range reference.

If the region is defined over multiple columns, then a Calc
vector matrix is returned. See Info node `(org) Formula syntax
for Calc' for more.

If the buffer *Edit Formulas* is available (usually via
`org-table-edit-formulas'), the reference will be inserted into
it.

See Info node `(org) References' for more on Org table field
reference format."
  (interactive)
  (if (not (org-at-table-p))
      (error "Not in an Org table"))

  (let ((msg (cc/org-table-reference-dwim))
        (formulas-buffer (get-buffer "*Edit Formulas*")))
    (if formulas-buffer
        (with-current-buffer formulas-buffer
          (insert cc/last-org-table-reference)))
    (message "Range: %s, Copied %s" msg cc/last-org-table-reference)
    (kill-new cc/last-org-table-reference)))

(defun cc/mouse-copy-org-table-reference-dwim ()
  "Copy Org table reference (field or range) into kill ring via mouse.

Given a point or region defined in an Org table, add to the
`kill-ring' an Org table field or range reference.

NOTE: This function is intended to be called from a mouse menu
after `cc/copy-org-table-reference-dwim' is called which will set
`cc/last-org-table-reference'. This is to work-around my lack of
clarity on region and mouse menu interaction.

If the region is defined over multiple columns, then a Calc
vector matrix is returned. See Info node `(org) Formula syntax
for Calc' for more.

If the buffer *Edit Formulas* is available (usually via
`org-table-edit-formulas'), the reference will be inserted into
it. If the point in *Edit Formulas* is at the beginning of line,
it will treat the reference as a left hand side (lhs) assignment.

See Info node `(org) References' for more on Org table field
reference format."
  (interactive)
  (if (not (org-at-table-p))
      (error "Not in an Org table"))

  (when cc/last-org-table-reference
    (let ((msg cc/last-org-table-reference)
          (formulas-buffer (get-buffer "*Edit Formulas*")))
      (if formulas-buffer
        (with-current-buffer formulas-buffer
          (if (bolp)
              (insert (format "%s = " msg))  ; treat reference as lhs assignment
            (insert msg))))
      (message "Copied %s" msg)
      (kill-new msg))))

(defun cc/org-table-range-to-reference (range)
  "Convert RANGE object to Org table reference (field or range).

If the region is defined over multiple columns, then a Calc
vector matrix is returned. See Info node `(org) Formula syntax
for Calc' for more.

See `cc/org-table-range' for more on RANGE object."
  (let* ((start (nth 0 range))
         (end (nth 1 range))
         (a (nth 0 start))
         (b (nth 1 start))
         (c (nth 0 end))
         (d (nth 1 end))

         (r1 (apply #'min (list a c)))
         (c1 (apply #'min (list b d)))

         (r2 (apply #'max (list a c)))
         (c2 (apply #'max (list b d)))

         (rowrange (number-sequence r1 r2))
         (buflist (list)))


    (cond
     ((and (= r1 r2) (= c1 c2))
      (format "@%d$%d" r1 c1 ))

     ((or (= c1 c2) (= r1 r2))
      (format "@%d$%d..@%d$%d" r1 c1 r2 c2))

     (t
      (mapc (lambda (r)
              (push (format "@%d$%d..@%d$%d" r c1 r c2) buflist))
            rowrange)

      (format "vec(%s)"
              (string-join (reverse buflist) ", "))))))

Original Source.

AMENDED 2024-10-10: cc/copy-org-table-reference-dwim and cc/mouse-copy-org-table-reference-dwim modified to insert content into table formula buffer when org-table-edit-formulas is called.

The following abridged code illustrates how one could configure their context menu to show the current Org table reference and copy it into the kill-ring if selected. See Customizing the Emacs Context Menu for more on Emacs context menus.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
(defun cc/context-menu-addon-items (menu click)
  "Context menu hook function using MENU and CLICK event.

MENU - menu to be configured.
CLICK - event"
  (save-excursion
    (mouse-set-point click)
    (cc/context-menu-org-table-items menu (not (org-at-table-p)))
    menu))

(defun cc/context-menu-org-table-items (menu &optional inapt)
  "Menu items to populate MENU for Org table section if INAPT nil."
  (when (not inapt)
    (easy-menu-add-item menu nil
                        ["Table Cell Info"
                         cc/mouse-copy-org-table-reference-dwim
                         :label (cc/org-table-reference-dwim)
                         :help "Copy Org table reference (field or range) into kill ring via mouse"])))

(add-hook 'context-menu-functions #'cc/context-menu-addon-items)

Original Source.

All code running on Emacs 29.4.

Examples

The following table illustrates the result of selecting the text region between the cell with value 2 (@2$2) and the cell with value 12 (@4$4) and inserting its translated Org table reference into different formulas.

The first formula in @2$5 is just the matrix representation between 2 and 12.

The second formula takes the transpose (trn) of the first formula.

The third formula uses some matrix arithmetic to get the sum of each row of the matrix in @2$5.

#+NAME: matrix-example
| a |  b |  c |  d | result                               |
|---+----+----+----+--------------------------------------|
| 1 |  2 |  3 |  4 | [[2, 3, 4], [6, 7, 8], [10, 11, 12]] |
| 5 |  6 |  7 |  8 | [[2, 6, 10], [3, 7, 11], [4, 8, 12]] |
| 9 | 10 | 11 | 12 | [9, 21, 33]                          |
#+TBLFM: @2$5=vec(@2$2..@2$4, @3$2..@3$4, @4$2..@4$4)
#+TBLFM: @3$5=trn(vec(@2$2..@2$4, @3$2..@3$4, @4$2..@4$4))
#+TBLFM: @4$5=@2$5 * [1 1 1]

Closing Thoughts

Manually dealing with Org table references is both tedious and error-prone. Automating their generation using text range selection seems like a good way to make this more bearable. If you're comfortable with Elisp, I recommend you give this code a try.

I’m considering publishing this code as a package on MELPA but I think the utility of it is high enough to merit being in Org itself. For next steps, I look forward to finding out if that is true.

Amendment 2024-10-10

In sharing this post at the 2024-10-09 Org Meetup, I was made aware by Ihor Radchenko that the point position in the special buffer (named *Edit Formulas*) created by the org-table-edit-formulas command (binding C-c ') will highlight any field or range reference. This special buffer provides context from which we can enhance the commands cc/copy-org-table-reference-dwim and cc/mouse-copy-org-table-reference-dwim to insert their results directly into it, removing the step to yank. cc/mouse-copy-org-table-reference-dwim is further enhanced to check if the point in *Edit Formulas* is also at the beginning of a line. If so, then the inserted field reference will be treated as the lhs argument of a formula. This approach can be viewed as a workaround the direct entry of a formula in a cell with the "=" character, which will only insert in the lhs a column reference.

-1:-- Referencing Org Table Cells with Text Regions (Post Charles Choi)--L0--C0--October 08, 2024 06:00 PM

Marcin Borkowski: Autoloads

I’ve known about the Emacs autoload feature for a long time, but I never bothered to read about it. I decided to fix that and finally read the relevant part of the Emacs Lisp manual. It turns out that autoloads are a pretty simple concept.
-1:-- Autoloads (Post)--L0--C0--October 07, 2024 06:56 PM

Sacha Chua: Yay Emacs 5: Tweaking my video workflow with WhisperX and subed-record

I'm tweaking my video workflow. I use Orgzly Revived on my Android phone to write the text, and I use Easy Voice Recorder to record it. Syncthing automatically copies both to my laptop. I use WhisperX to transcribe my recording, and I use a little bit of Emacs Lisp to figure out timestamps for each word. I edit this to fix errors. I can even rearrange things and get rid of umms or ahs or anything I don't want.Then I use subed-convert to turn it into a VTT file. I can tweak the start and end times by looking at the waveforms. Then I add comments with the visuals I want. I can add images, animated GIFs, or videos, and they're automatically squeezed or stretched to fit. I can also have them play at original speed. Then I set up open captions and use subed-record-compile-video. Tada!

Links:

You can watch this on YouTube, download the video, or download the audio.

View org source for this post
-1:-- Yay Emacs 5: Tweaking my video workflow with WhisperX and subed-record (Post Sacha Chua)--L0--C0--October 07, 2024 06:16 PM

Irreal: Emacs Configuration Can Be Easy

A frequent complaint we hear from n00bs is that Emacs out of the box is unusable, that it’s really hard to configure, and so you need something like Doom to get going. Generations of Emacs users have put the lie to that. Lots of us have been starting with vanilla Emacs and configuring it to our needs for 40 years.

Over at the Emacs subreddit, permetz suggests that it’s fine to have a simple configuration that builds on default Emacs. Permetz has been using Emacs since 1983 and considers himself a power user but he has a simple config file that mostly consists of setting a few variables to adjust things to his liking.

That’s how I started. Back then I was still writing in C so I spent a bit of time getting Emacs to indent C the way I liked. As I went along I added some packages and wrote some custom Elisp for bespoke operations that no one else would need. Even so, after 16 or 17 years my init.el is still pretty small and I could easily trim it down by getting rid of stuff I no longer need or use.

Permetz’s message is don’t be afraid of starting small from vanilla Emacs and having a simple configuration. You’ll be surprisingly productive and your init.el can grow organically as your needs change.

-1:-- Emacs Configuration Can Be Easy (Post jcs)--L0--C0--October 07, 2024 04:56 PM

Sacha Chua: 2024-10-07 Emacs news

Links from reddit.com/r/emacs, r/orgmode, r/spacemacs, r/planetemacs, Mastodon #emacs, Hacker News, lobste.rs, programming.dev, lemmy.world, lemmy.ml, communick.news, planet.emacslife.com, YouTube, the Emacs NEWS file, Emacs Calendar, and emacs-devel. Thanks to Andrés Ramírez for emacs-devel links. Do you have an Emacs-related link or announcement? Please e-mail me at sacha@sachachua.com. Thank you!

View org source for this post
-1:-- 2024-10-07 Emacs news (Post Sacha Chua)--L0--C0--October 07, 2024 12:22 PM

TheMKat: Quick tip: Exercism - an interactive exercise platform for programmers of ALL skill levels

Exercism is interactive platform for programming exercises, which are made from volunteer work. That means that Exercism is indeed completely free to use. No subscriptions, or anything of the sort.
-1:-- Quick tip: Exercism - an interactive exercise platform for programmers of ALL skill levels (Post)--L0--C0--October 06, 2024 12:00 AM

Irreal: 🥩 Red Meat Friday: Is Lisp Syntax Boring

Wait. What? Is Lisp syntax boring? My immediate response is, “Of course it is.” That’s its strength. Lisp doesn’t have much syntax so unlike other languages you can immediately start using the language without having to worry about learning a bunch of syntax rules. Everybody who’s learned a non-Lisp language knows that a significant part of learning the language is imbibing the syntax. An advantage of Lisp is that you can mostly avoid that step.

You’d think that would be obvious to anyone with a passing familiarity with Lisp but apparently not. Aggravating_Date_315 over at the Emacs subreddit asks if anyone else finds Lisp syntax boring. Not in the sense that I do but that there’s not enough structure and sugar. He wants superfluous keywords and structure because the simplicity of Emacs is boring. He loves how easy it is to edit Elisp in Emacs but finds Lisp joyless and sterile.

The commenters were not particularly supportive although a few did offer some suggestions for dealing with the matter. My favorite was from intergalactic_llama who says, “People looking to create problems for them selves always fascinate me.”

I don’t understand how anyone could think that making something more complicated would make it more natural and fun. To me, the joy of programming is writing code to solve a problem and I have no interest in making that code more convoluted than it needs to be.

-1:-- 🥩 Red Meat Friday: Is Lisp Syntax Boring (Post jcs)--L0--C0--October 04, 2024 02:24 PM

Jiewawa: Useful Emacs commands for reading

Since I started using Emacs, I’ve written hundreds of functions that I only used once and then were left to rot in the depths of my init.el.

Today I would like to share some simple commands that I wrote when I was just starting off with Emacs that I had forgotten that I had written and assumed that this was the default behaviour as it now seems to natural to me. A very small amount of the code here will be specific to evil-mode, but it shouldn’t be too difficult to adapt it to work without.

Removing visual fluff

I like to have a clean, distraction free reading experiences in major-modes such as elfeed, eww, and nov.

I achieve this by:

  1. Centring the text in a column and increasing padding.
  2. Hiding the mode-line
  3. Hiding the cursor

Centring text

I use olivetti for centring text and have no complaints. It works seamlessly for my needs. In fact, I also enable this in Org-Mode and Markdown-Mode.

(defun my/centre-visual-fill-on ()
  ;; Centre the text in one column
  (visual-line-mode 1)
  (setq olivetti-body-width 100)
  (olivetti-mode 1))

(defun my/centre-visual-fill-off ()
  (visual-line-mode 0)
  (kill-local-variable 'olivetti-body-width)
  (olivetti-mode 0))

Hiding mode-line

I’ve seen lots of people do this one and it is useful when wanting to focus. Unlike the previous commands, this is something that I sometimes toggle so I made an interactive function too.

(defun my/kill-modeline ()
  (setq-local mode-line-format nil))

(defun my/restore-modeline ()
    (kill-local-variable 'mode-line-format))

(defun my/toggle-modeline ()
  (interactive)
  (if (null mode-line-format)
      (my/restore-modeline)
    (my/kill-modeline)))

Hiding the cursor

This is one that I don’t remember seeing anybody else do, but it’s a game changer. When I’m reading, I’m following with my eyes and I don’t care where the cursor is unless I decide that I want to highlight some text. Again, I want to be able to toggle this quickly so I wrote an interactive function too.

(defun my/hide-cursor-evil ()
  (setq-local evil-default-cursor '(ignore))
  (setq-local cursor-type nil))

(defun my/show-cursor-evil ()
  (kill-local-variable 'evil-default-cursor)
  (kill-local-variable 'cursor-type))

(defun my/toggle-cursor ()
  (interactive)
  (if (null cursor-type)
      (my/show-cursor-evil)
    (my/hide-cursor-evil)))

I combine these three ideas into a simple hook that gets ran whenever I open a new buffer in one of my reading modes.

(defun my/reading-mode-hook ()
  (my/centre-visual-fill-on)
  (my/hide-cursor-evil)
  (my/kill-modeline))
Figure 1: Screenshot showing Org Mode on the left and eww with cursor hidden on the right

Figure 1: Screenshot showing Org Mode on the left and eww with cursor hidden on the right

I’ve seen takes on the previous ideas many times while reading other Emacs users' blogs, but I haven’t seen many users describe how they move around buffers that are primarily meant to be read.

Initially I tried using a form of paging, but I found it tedious to have to scan for where I left off before I scrolled down.

Ultimately, I settled on the following logic, which was very simple to implement:

  • If the cursor is visible, move the cursor up or down one line
  • If the cursor is not visible, scroll the buffer up or down one line
(defun my-view-down ()
  (interactive)
  (if (null cursor-type)
      (scroll-up-line)
    (next-line)))

(defun my-view-up ()
  (interactive)
  (if (null cursor-type)
      (scroll-down-line)
    (previous-line)))

Tying it all together

I could have come up with a minor mode for enabling this in each major mode, but I like how this reminds me of a time when I didn’t spend so long dicking about with functions that I only use once.

Here is a simple example configuration of how I have elfeed set up.

(use-package elfeed
  :hook
  (elfeed-show-mode . my/reading-mode-hook))

(evil-define-key 'normal elfeed-show-mode-map (kbd "j") 'my-view-down)
(evil-define-key 'normal elfeed-show-mode-map (kbd "k") 'my-view-up)
-1:-- Useful Emacs commands for reading (Post)--L0--C0--October 04, 2024 12:00 AM

Please note that planet.emacslife.com aggregates blogs, and blog authors might mention or link to nonfree things. To add a feed to this page, please e-mail the RSS or ATOM feed URL to sacha@sachachua.com . Thank you!