bram85

@bram85@emacs.ch

Tooting mostly about #emacs.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

bram85, to emacs

magit-find-file allows you to open a file at a certain revision, which could be a (relative) timestamp. Notation: HEAD@{3 days ago}.

Using these bits, I wrote a small #emacs command that displays a file at a certain moment, chosen with the built-in calendar.

(defun bram85-magit-find-file-as-of (datetime)  
 (interactive (list (org-read-date)))  
 (let ((rev (format "HEAD@{%s}" datetime)))  
 (magit-find-file rev (magit-read-file-from-rev rev "File: "))))  

#magit #git

bram85, to emacs

Inspired by @howard 's recent post sharing his configuration, I'm sharing mine. Elfeed is a powerful RSS feed reader for with a number of hooks to customize it.

My configuration:

https://apps.bram85.nl/git/bram/gists/src/commit/fd3d0991055863526be07dd12f4857ab32826768/gists/elfeed.el

Among others, it contains the following elements:

  • Custom function for printing entries:

  • Relative dates (using the relative-date package by @rougier )

  • Tags printed in :orgmode: notation

  • Ability to omit some tags from printing.

  • Record read dates in the elfeed database when entries are opened.

bram85, to orgmode

.el 0.5 was released yesterday and is now available on MELPA Stable. Most of the highlights have already been mentioned on my timeline:

• Define your own prompts with define-kagi-fastgpt-prompt' • Embed prompts and responses inside #orgmode • A no-cache' parameter for some summarizer commands (so your text flows through Kagi's infrastructure without retention)

You can find the full changelog in the README.

<https://codeberg.org/bram85/kagi.el>

bram85, to orgmode

Now it's possible to access FastGPT from :

#+begin_src kagi-fastgpt
A prompt inside an Org Babel block.
#+end_src

Check the README how to configure.

http://codeberg.org/bram85/kagi.el

bram85, to emacs

It became a bit easier to extend kagi.el with your own FastGPT prompts. You could define the following prompt in your configuration:

(define-kagi-fast-prompt  
 my/synonym  
 "Give a synonym for the word: %s")  

Now, my/synonym becomes a real command that accepts text to fill in for the placeholder. You could use it from Lisp:

(my/synonym "happy")  

Or use it interactively, where the word will be retrieved from the region or by reading the minibuffer.

Demo: https://asciinema.org/a/653482

The new kagi package is available in MELPA, or from Codeberg:

https://codeberg.org/bram85/kagi.el

bram85, to emacs

Here's a function to generate QR codes inside . Select a region or enter the text in the minibuffer and it will be encoded with the external qrencode tool. By default it generates an UTF8 QR code, with a universal prefix an PNG is created.

https://apps.bram85.nl/git/bram/gists/src/commit/73a87ed7675e9f71de3a7cb0cd2c43727dd34e05/gists/generate-qr.el

This is different from the qrencode.el package which is a native QR encoder:

https://github.com/ruediger/qrencode-el

bram85, to emacs

kagi.el now has the kagi-translate command, a versatile command to translate text to another language using

With kagi-translate you can:

  • translate simple words from the minibuffer
  • translate the region
  • translate a whole buffer
  • use it as a function to translate text from
  • Not limited to spoken languages, you can convert a code buffer to another programming language (see demo below).

https://asciinema.org/a/633592

Should come to MELPA soon on the next build, or if you can't wait clone from the git repo at:

https://codeberg.org/bram85/kagi.el

As with all other kagi.el functionality, please check the project's README on how to get your API token, if you haven't done so already.

Demonstration of the

bram85, to emacs

meets inside

Given an URL, a new denote is created, the title is fetched an prefilled. With the kagi.el package it's possible to insert a summary automatically.

The screencast below shows how I create a new note from Prot's video on customizing modeline colors, and insert a Dutch summary right away:

https://asciinema.org/a/631451

The full code is linked below. Make sure to update kagi.el from MELPA first.

https://apps.bram85.nl/git/bram/gists/src/commit/73a2cb21ecda81eb374174696150e04916faa548/gists/denote-create-note-url.el

bram85, to emacs

In , dired-mode and occur-mode both have edit modes.

In dired-mode, you enter edit mode by disabling read-only mode (C-x C-q), while in occur-mode you press 'e'. To address this inconsistency, add the following to your init file:

(keymap-set occur-mode-map "C-x C-q" #'occur-edit-mode)

bram85, to emacs

kagi.el is now available on MELPA and MELPA Stable.

https://melpa.org/#/kagi

This package provides access to 's (inspired my chatgpt-shell) and the Universal Summarizer to summarize buffers, regions or URLs.

In the future I hope to implement the other APIs as well, which are more search oriented.

Check the README for the setup instructions.

https://codeberg.org/bram85/kagi.el/src/branch/main/README.org

bram85, to random

A while ago I shared a [toot] to create a denote entry from a URL. It fetches the URL
from the clipboard, retrieves the default title from the web and proposes it as such.
In the meantime I made this a bit smoother. Next to the clipboard, it will also look
at the text at point and the current elfeed entry to get URL candidates.

I put a short demo on Asciinema: https://asciinema.org/a/oWH0taGbOHbfOBcmdOsEO9wUu

The current implementation can be found on my site: [https://apps.bram85.nl/git/bram/gists/src/commit/b04e6762031db22ea53de64c5e478fb16191](https://apps.bram85.nl/git/bram/gists/src/commit/b04e6762031db22ea53de64c5e478fb16191)
e1f1/gists/denote-create-note-url.el

Previous toot: https://emacs.ch/@bram85/111150204263888493

bram85, to emacs

Added a section to the README to integrate my .el package with .

This allows you to:

  • Summarize buffer content from the minibuffer (e.g. from switch-buffer)
  • Summarize a URL when calling embark-act while point is on a URL.
  • Summarize the region when calling embark-act.

In all these contexts, hit 'K s' from the embark-act menu.

Might be turned as part of the package in some way.

https://codeberg.org/bram85/kagi.el#user-content-headline-7

Demonstration of summarizing the region with kagi.el and Embark.

bram85, to random

The screenshot in yesterday's toot on displays the question: what makes it better than ChatGPT?

The funny thing is it missed out on two major aspects:

  1. The model is open source:

https://github.com/labring/FastGPT/

  1. Also I like the fact more that Kagi provides the search results on which the answer was based. This gives more transparency than ChatGPT does.

Downside: it's not really a chat, it answers one question at a time without followup. But that is being worked on, apparently.

If you're curious, you can see for yourself at https://kagi.com/fastgpt.

https://emacs.ch/@bram85/111620681768693603

bram85, to emacs

Started a new package providing a shell for : kagi.el.

Of course, inspired by @xenodium's fantastic chatgpt-shell package. In fact, both use the underlying shell-maker package for the heavy lifting.

Still very rough, lots of refinements to be done. But the basics work.

https://codeberg.org/bram85/kagi.el

bram85,

@panmaster that's just the keyboard bar. I use Emacs a lot on my phone, including some package development.

By the way, I tailored the bar for some Emacs shortcuts (e.g. M-x, C-g, etc.).

https://apps.bram85.nl/git/bram/gists/src/commit/0fae583d4ecde480454cb2060e80f40b2941ed53/gists/termux-emacs-keys.conf

bram85,

@kir @louis do you have credit on your Kagi account? Without balance the API will spit out a 502.

bram85, to emacs

Here's a function using to show the diff of the current buffer since a certain date/time.

My use-case: I put my work notes in a single org file. When our daily standup starts I can quickly review what I worked on / wrote down in the last 24 hours.

https://apps.bram85.nl/git/bram/gists/src/commit/cb4c371e5ce68ba89afce0ae020e6b6f4161d237/gists/magit-diff-range-current-buffer.el

louis, to random
@louis@emacs.ch avatar

@bram85 I stumbled over your post about you learning Toki Pona:

https://bram85.emacs.ch/110963257742963713

As I'm also interested in languages in general, can you share a little bit about your learning experience and the resources you used? How does Toki Pona feel?

bram85,

@louis Overall speaking I like the toki pona language, although I still have some doubts with the level of expression you can reach with the limited vocabulary. Time will tell.

A few observations after a few weeks:

  • The limited vocabulary is a feature: it makes you more mindful about what you say and how to decompose something in more elemental concepts. I think that was also the intent of the language's creator.
  • The grammar is simple and (almost) free of exceptions.
  • I like the blend of many 'real' languages coming together: English, Dutch / German, Russian, Mandarin and more (but those are the ones I'm familiar with to different extents).

So at least it's a fun language to learn, its usefulness is yet to be seen. But learning a language is more than learning some words and rules, I already notice how it changes the way you think.

bram85, to emacs

I like languages, and not just programming languages. During this holiday I've started to learn toki pona[1]. Of course using and .

There is a flashcard package for Emacs akin to Anki: org-fc[2]. It allows you to practice flashcards with spatial repetition, so you spend less time on the easy stuff and practice the harder items more often.

An heading can be turned in a card with a single command. The heading is one side, the body the other side. A card can be practiced in one direction but optionally also the other direction as well. For learning a language I typically practice in both directions. There is another card type for clozes (blanks) and the package can be extended with custom card types. All card administration is recorded inside each heading with properties and a drawer with things like ease and due date. That makes the Org file with cards self-contained.

When reviewing, all administration is updated automatically based on your own judgment (easy, good, hard, again and suspend). Just start a review and spend a few minutes per day to process your backlog.

Your review steps are recorded in a separate TSV file in your Emacs config directory, in order not to pollute your cards directory. I chose to store it along with my cards nevertheless, so I can track the cards and review steps with `git' and sync the data with other machines. So the dashboard (see screenshot) with stats and progress looks the same everywhere.

Unfortunately org-fc is not available on MELPA but with some `git' proficiency easy to install. Here is my config:

┌────
│ (defconst my/flashcards-directory "/home/bram/cards")

│ (use-package org-fc
│ :after org
│ :ensure nil
│ :load-path "path/to/org-fc"
│ :custom
│ (org-fc-directories (list my/flashcards-directory))
│ (org-fc-review-history-file (expand-file-name "org-fc-reviews.tsv" my/flashcards-directory)))
└────

[1] <https://tokipona.org/>

[2] <https://www.leonrische.me/fc/index.html>

bram85, to emacs

This piece of makes execute certain code when opening a file with a particular name. This is useful for files that have no clear extension or mode setting.

I use it to enter yaml-mode whenever I open a .clang-format file (which I don't want to pollute with -*- magic).

https://apps.bram85.nl/git/bram/gists/src/commit/ad450efe2064441477a9f5e8bd97cf83efd00e5a/gists/find-file-hook-for-certain-filenames.el

The original code was inspired by this StackExchange post, but I found the implementation quite cumbersome so I rewrote it to make it more condense.

https://emacs.stackexchange.com/a/77480/34645

bram85, to emacs

package persist-state 0.3 available on (stable) MELPA.

This package regularly saves your Emacs state (bookmarks, history,
recent files, etc.) when idle for a brief moment. In case Emacs is
idle for a longer time, no state is saved.

Version 0.3 adds support for regularly saving your buffer positions using the builtin saveplace package.

https://stable.melpa.org/#/persist-state

bram85, to emacs

My new package persist-state, to regularly save bookmarks, history, recent files (and more), has reached MELPA:

https://melpa.org/#/persist-state

Why such a package, as all of these packages have save functionality out of the box? Most often, these save functions are called on emacs-kill-hook. This works nice if you always exit Emacs cleanly. However, Emacs may crash, freeze or the underlying host may fall flat on its face, and all updates to the list of recent files, bookmarks, history, etc. are lost during your 183 days of emacs-uptime.

This package silently saves all of this metadata regularly. Note it does not replicate auto-save-mode, which saves buffer content regularly.

persist-state supports a number of packages out of the box:

  • bookmark
  • desktop
  • Eshell history
  • Prescient
  • recentf
  • savehist

For other packages that have some form of save functions, you can customize the list of save functions to be called regularly.

Check the README for more info.

https://codeberg.org/bram85/emacs-persist-state

bram85, to random

Giving a try, turns out I've been missing modal editing a bit. After all, I've used Vim for a longer time than so far.

Meow does not mimic the same keys as vim, which is OK since I've forgotten most of the keys anyway. Still it needs a bit of time to get used to.

One question though, how to move to a visual hint number >10?

https://github.com/meow-edit/meow

anniegreens, to random
@anniegreens@social.lol avatar

What Github alternative are people using now? I've used many others for work projects, but never for personal, but I'd like to migrate out of Github at some point.

bram85,

@anniegreens using @forgejo. In principle it's , but you can also use the instance at @Codeberg .

indieterminacy, to random

@bram85

I like your gists but the wording on your repo is ambiguous:

Are you parsing your toots and having them be read into your local gist repo?

Or is it the other way around?

https://apps.bram85.nl/git/bram/gists

Do you have a specific workflow for that?

bram85,

@indieterminacy the toots and the repo are not really connected or automatically synchronized. Whenever I have more than one line to share I put it in a file, create a permalink and refer to it from here.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • rosin
  • InstantRegret
  • ethstaker
  • DreamBathrooms
  • mdbf
  • magazineikmin
  • thenastyranch
  • Youngstown
  • everett
  • slotface
  • osvaldo12
  • khanakhh
  • kavyap
  • anitta
  • Durango
  • vwfavf
  • GTA5RPClips
  • cubers
  • tacticalgear
  • tester
  • cisconetworking
  • ngwrru68w68
  • Leos
  • normalnudes
  • provamag3
  • modclub
  • JUstTest
  • All magazines