Showing 603 to 606

How to Downgrade/Rollback an Emacs Package

They don't exactly tell you in the tutorial, so a quick remedial course.

In our example today, let's say we want to downgrade org-node to 1.6.2.

With vc-use-package (built into Emacs from Emacs 30+):

(use-package org-node
  :vc (:fetcher github :repo "meedstrom/org-node"
       :rev "6ed833d1025d5163137904f2a1f6d80d930610b4"))

With Quelpa:

(use-package org-node
  :quelpa (org-node :fetcher github :repo "meedstrom/org-node"
                    :commit "6ed833d1025d5163137904f2a1f6d80d930610b4"))

With Elpaca as follows. Note that if you had already installed the package, modifying the recipe to include :tag will only take effect after you do M-x elpaca-delete RET org-node RET and have it re-install. The idea is that Elpaca users will prefer to do this kind of thing manually inside the cloned repo.

(use-package org-node
  :ensure (:fetcher github :repo "meedstrom/org-node"
           :tag "1.6.2"))

With Straight, it's a bit different, since it cannot pin a commit nor a tag directly. Three methods:

  1. Create a Straight lockfile.
  2. If you know about Git, enter the cloned repo (M-x find-library RET org-node RET) and check out an old commit yourself. Tip: if you cannot see many old commits in the Git log, first run the command git fetch --unshallow.
  3. Easiest: Hope that the author made a branch for an old version.

It turns out we can use method #3 this time because org-node does have a branch for the 1.6.x series:

(use-package org-node
  :straight (org-node :type git :host github :repo "meedstrom/org-node"
                      :branch "v1.6"))

Bonus: Find out the installed version of a package🔗

You've probably seen a line like this near the top of an Emacs Lisp source file:

;; Version: 2.2.2

or

;; Package-Version: 2.2.2

Unfortunately, this number is not always present, nor is it always to be believed. It depends on the author's development style.

So unless you only install from GNU/NonGNU ELPA, which mandate the above line, it's worth knowing a reliable method specific to your package-manager:

  • Elpaca
    • type M-x elpaca-info RET org-node RET
  • Straight, Borg and anything that uses Git clones
    • go to M-x find-library RET org-node RET
    • then run the Git command git log --tags --pretty="%ci %d"
      • if that yields no answers, run git fetch --unshallow and try again
        • if still no answers, the ;; Version: line is right
  • The built-in package.el
    • If it came from MELPA Stable, look inside the autogenerated file org-node-pkg.el, because they'll put the tag there. Primary MELPA still needs to revamp their version naming scheme before they can do the same – correlate with the date.

Bonus: Explore past versions to find the correct commit🔗

The examples on this page were easy because org-node is a package that uses Git tags: we can see on the tags page that tag 1.6.2 corresponds to commit 6ed833d1025d5163137904f2a1f6d80d930610b4.

Alternatively, Straight users can check the branches page and hope that the author has seen fit to spin off branches for some old versions.

But what to do if there are no tags or branches? That occurs in two cases:

  1. The author doesn't version at all
  2. The author only updates the ;; Package-Version: header inside the source file. Typical on the GNU ELPA.

As far as I can tell, GNU and NonGNU ELPA use some specialized tool to crawl the commit history to look for the version header. I don't know what that tool is. So as an user, for now I'd just visit the commits page and pick any random old commit to try.

Created (5 weeks ago)

In what order does Emacs handle simultaneous process sentinels?

#emacs

Couldn't find this info in the manual.

Answer: The first process that finished is the first one handled.

Verified as follows:

(dotimes (i 10)
  (make-process :name (format "*%d*" i)
                :buffer (get-buffer-create (format "*foo-%d*" i) t)
                :command (list "emacs" "-Q" "--batch"
                               "--eval"
                               (prin1-to-string
                                `(progn
                                   (make-list (random 100)
                                              (make-list (random 100)
                                                         t))
                                   (print
                                    (format "%dth spawned, finished at %.3fs"
                                            ,i (time-to-seconds))))))
                :sentinel (lambda (proc _)
                            (with-current-buffer (process-buffer proc)
                              (message "%s" (buffer-string)))
                            (kill-buffer (process-buffer proc)))))

A result:

"6th spawned, finished at 1730132198.780s"
"2th spawned, finished at 1730132198.778s"
"0th spawned, finished at 1730132198.781s"
"1th spawned, finished at 1730132198.803s"
"3th spawned, finished at 1730132198.822s"
"4th spawned, finished at 1730132198.838s"
"9th spawned, finished at 1730132198.842s"
"5th spawned, finished at 1730132198.850s"
"7th spawned, finished at 1730132198.876s"
"8th spawned, finished at 1730132198.900s"

Related

Emacs async process performance

What links here

  • 2024-10-28
Created (5 weeks ago)

A/B testing

Quite common in website design and product development, but also for testing hypotheses on yourself.

E.g. you want to see if coffee affects your productivity, then you do 2 days with coffee, 2 days without, 2 days with, 2 days without and so on. And write down how productive you felt each day. See if you can spot a pattern.

What links here

  • 2024-10-24
Created (2 years ago)
Updated (6 weeks ago)

Share flashcards not for copying, but as inspiration

Common knowledge: the best flashcards are those you make yourself.

Some years back, I thought I could compromise, on content I had already read and understood. I tried to integrate some pre-made #lesswrong decks from www.stafforini.com/blog/anki-decks-by-lesswrong-users/. But they were not fun to review. The cards were not how I'd have written them, had the wrong emphasis, flagrantly violated Wozniak's 20 rules, etc…

So now I maintain a deck that's purely my own creation. Better.

Is sharing decks pointless then?

I think not. When summarizing an article/book in flashcards, I sometimes wonder what other people have made out of the same article/book. I'd like to see them. Not to copy verbatim, just get ideas for what questions I can pose to myself.

Created (6 weeks ago)
Showing 603 to 606