Emacs

!emacs

@lemmy.ml
Create post
use-package essentials [video]

use-package essentials [video]

Open link in next tab

Emacs: use-package essentials

https://protesilaos.com/codelog/2024-07-23-emacs-use-package-essentials/

Video demonstration of the ‘use-package’ configuration macro and its key features.

Emacs: use-package essentials
Announcing Casual RE-Builder

Announcing Casual RE-Builder

Open link in next tab

Announcing Casual RE-Builder

http://yummymelon.com/devnull/announcing-casual-re-builder.html

Knowing how to use regular expressions (regexp) is a superpower. While there are many different variants of regexp syntax, in Emacs the reward is handsome if you put in the effort to learn its...

Announcing Casual RE-Builder
Emacs Face Line Spacing / Margin / Height

Emacs Face Line Spacing / Margin / Height

I've been theming emacs, trying to get it to look just right, but the lack of a per face line spacing is making it kind of difficult. I've tried to use :box as a hack to add invisible spacing, but that started to look weird when the region is highlighted. Does anyone know why there doesn't seem to be much interest or discussion on this topic? I'd love to be able to just add a top or bottom margin to headings like in css.

Emacs RFC 2646 email flowing

Emacs RFC 2646 email flowing

Emacs RFC 2646 email flowing

Heck it Emacs!

A few months ago I fixed a bug in RFC 2646 handling where the last paragraph wouldn't get reflowed unless I remembered to add a hard newline (that is, a newline with the 'hard text property) after it, at EOT. I needed to hit one extra RET at the end. All other paragraphs would be wrapped, not just the last one.

(I even bugged @jas@fosstodon.org about it.)

But it still didn't always work and today I tried to get to the bottom of why, spending the entire day debugging it, finally realizing that... It's not even being called when there's only one paragraph in the email. I wasted so much time before realizing that! And then getting to the bottom of why that wasn't happening was the opposite of easy but it turnes out that Gnus by design doesn't call the fill-flowed-encode function when there aren't any hard newlines in the buffer. Which there aren't gonna be if it's a single-paragraph letter 🤦🏻‍♀️

Use-hard-newlines is beyond useless since that's always buffer-local and the text-reflowing is being done in a temp buffer. Instead since 2010 we're supposed to set mml-enable-flowed to true. But don't worry, fans of the messages-are-flowing package, I'm gonna send patches there to reflect that. I have a bunch of other changes to that package too since I've been using that a lot this summer.

This is all in bug#71017 (cursed palindrome!) for people who wanna dig in 👩🏻‍🏫

@emacs@lemmy.ml

Emacs: Denote version 3.0.0

Emacs: Denote version 3.0.0

Open link in next tab

Emacs: Denote version 3.0.0

https://protesilaos.com/codelog/2024-06-30-emacs-denote-3-0-0/

Information about the latest version of my Denote package for GNU Emacs.

Emacs: Denote version 3.0.0
The Modus themes can now be extended with a ‘user’ palette

The Modus themes can now be extended with a ‘user’ palette

Open link in next tab

Emacs: The Modus themes can now be extended with a ‘user’ palette

https://protesilaos.com/codelog/2024-06-25-emacs-modus-themes-user-palette/

I show the new feature of the Modus themes to define more colours for use as palette overrides

Emacs: The Modus themes can now be extended with a ‘user’ palette
Keyboard Macros are Misunderstood

Keyboard Macros are Misunderstood

Open link in next tab

Keyboard Macros are Misunderstood

https://www.masteringemacs.org/article/keyboard-macros-are-misunderstood

Keyboard macros are misunderstood: they are not just for text editing. You can record and play back nearly anything, so why not record your favorite window layouts and save them as a keyboard macro? Maybe open a shell and execute a few commands in it? And best of all, you can do all of this without knowing any elisp!

Keyboard Macros are Misunderstood
Suggestions for a complimentary typeface to JetBrains Mono for reading and writing documents or prose

Suggestions for a complimentary typeface to JetBrains Mono for reading and writing documents or prose

cross-posted from: https://lemmy.world/post/16240755

Suggestions for a complimentary typeface to JetBrains Mono for reading and writing documents or prose

I am looking for a typeface that complements well to the one that I use to write code (JetBrains Mono). I will be using this to write documents and articles.

For further context, I am configuring Emacs' org-mode where I would be using both typefaces together. I could use JetBrains Mono for both purposes as I find it capable. But I would like to explore my options.

I have also looked at Iosevka. It offers variants for coding, reading, and writing. But I would prefer to stick with JetBrains Mono as much as I can for coding purposes.

Complex Capture Template: rx '**' range error?

Complex Capture Template: rx '**' range error?

Hello, friends!

So I have a complex way of capturing TODO tasks for today or week. Someone will probably tell me that there's a package out there somewhere to do this easier, but regardless I would like to figure this out.

Here's the function I use:

(defun org-capture::today-task-tree ()
  "Create a task tree for tasks TODO today."
  (let* ((time-string (format-time-string "<%Y-%m-%d %a>" (current-time)))
         (heading (concat "[%] " time-string))
         (heading-rx
          (rx (group "[" (0+ num) "%]") (0+ space)
              (group (literal time-string)))))
    (goto-char (point-max))
    (if-let (pnt (re-search-backward
                  heading-rx
                  nil t))
        (goto-char pnt)
      (goto-char (point-max))
      (or (bolp) (insert "\n"))
      (insert "* " heading "\n")
      (beginning-of-line 0))
    (org-end-of-subtree)))

And here's the org-capture-templates entry:

("gt" "Today: A task for today" entry
                     (file+function
                      ,(expand-file-name "~/Documents/Org/GTD/work.org")
                      org-capture::today-task-tree)
                     (file ,(concat my-emacs-dir "capture-templates/datetree-weekly-tasks.tmplt"))
                     :empty-lines-after 1
                     :after-finalize (lambda () (org-update-statistics-cookies t)))

And here's the actual capture template that I store in a file in my config:

** [ ] [#%^{Priority}] %^{Task name}  %(funcall-interactively #'org-deadline nil (current-time)) %^g
    %? %i

Now when I'm in that file ~/Documents/Org/GTD/work.org and I run the above function with M-: org-capture::today-task-tree it works fine. An example of what the file will look like it:

* [100%] 2024-04-27 Mon
** [X] Do something important this Monday #[A] :work:
    CLOSED: 2024-04-27 Mon 12:42  DEADLINE: 2024-04-27 Mon
* [%] 2024-04-28 Tues
** [ ] Do something else that's not as important #[B] :personal: 
     DEADLINE: 2024-04-27

But for whatever reason when I run org-capture and finish the capture with C-c C-c or refile with C-c C-w I get

rx--translate-bounded-repetition: rx ‘**’ range error

Which I don't really know what that means nor how to fix it, and I can't really find anything useful via searching the internet at the moment. A possible thing to not is that I disable Org's element caching.

If you want to look at my configuration to dig around some, you can find it here and the part where my configurations for Org-Mode are here.

Show/highlight invisible characters like zero-width-space in Emacs

Show/highlight invisible characters like zero-width-space in Emacs

In my pursuit to migrate from Vim to Emacs, I have stumbled on yet another roadblock.

When working with files that contain special whitespace characters, Vim/Neovim would automatically highlight these. This saved me a lot of time during debugging or data analysis, and is a functionality that I struggled to get to work on more modern IDEs.

However, this does not work out-of-the-box neither on vanilla Emacs nor Doom Emacs. I am unable to find any working solutions online. I assumed whitespace-mode would have handled this, but it is not the case.

It would be really helpful if the community here can help solve my problem as I deal with such characters on a daily basis. Until then, I have to pause my pursuit and stick with the trusty Neovim.

::: spoiler U+200B in Neovim

Notice Neovim highlighting the character as <200B>.

:::

::: spoiler U+200B in Doom Emacs

Notice the think cursor between "hello" and "world".

:::


Thanks to the suggestion by @nmtake@lemm.ee, glyphless-display-mode allows me to view the characters. But it still doesn't play well with vim motions on Emacs.

Here is a demonstration, and below are the keystrokes.

  1. C-v to enable VISUAL-BLOCK mode.
  2. 9j to select all 9 occurrences.
  3. d to delete the selection.

The above vim-motion works on Neovim but not on Emacs with evil-mode.

If anyone wants to try out here is the text I am playing with:

hello ​ world
hello ​ world
hello ​ world
hello ​ world
hello ​ world
hello ​ world
hello ​ world
hello ​ world
hello ​ world
hello ​ world