1
9
submitted 3 days ago by NanoooK@sh.itjust.works to c/emacs@lemmy.ml
2
17
Keyboard Macros are Misunderstood (www.masteringemacs.org)
submitted 1 week ago by mao@lemmy.sdf.org to c/emacs@lemmy.ml
3
7

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.

4
4
submitted 3 weeks ago* (last edited 3 weeks ago) by AlecStewart1st@lemmy.world to c/emacs@lemmy.ml

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.

5
10
submitted 1 month ago* (last edited 1 month ago) by AusatKeyboardPremi@lemmy.world to c/emacs@lemmy.ml

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.

U+200B in Neovim

Notice Neovim highlighting the character as <200B>.

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
6
29
submitted 1 month ago by kelvie@lemmy.ca to c/emacs@lemmy.ml

I've been using konsole (and iterm2 on my work mac) for most of my working career, but on the linux side, I've recently switched to Kitty, but now I'm wondering if I can finally get used to just using emacs on both.

Does anyone use emacs as their main terminal? Is there one better than ansi-term that supports modern features like libsixel?

I still can't quite get used to the keybindings (like C-c twice for ^C) and some other weirdness.

7
18
submitted 1 month ago by NanoooK@sh.itjust.works to c/emacs@lemmy.ml
8
9
submitted 1 month ago* (last edited 1 month ago) by nmtake@lemm.ee to c/emacs@lemmy.ml

I wrote this script to learn how completing-read's complex arguments works. Compared to other clients it's quite limited; but thanks to packages like Vertico and Orderless, it works quite well for my use cases.

Screenshot

9
20
submitted 1 month ago by 4ffy@lemmy.ml to c/emacs@lemmy.ml
10
5
submitted 1 month ago* (last edited 1 month ago) by DrOps@feddit.de to c/emacs@lemmy.ml

When I needed a taylored function for a problem, I tried if ChatGPT could help me.

11
9
submitted 1 month ago by DrOps@feddit.de to c/emacs@lemmy.ml

Making a Hydra for Denote was not as straightforward as I thought, Therefore I documented it

12
9
submitted 1 month ago by hellstabber@lemmy.ml to c/emacs@lemmy.ml

Hello!

Since I spend most of my day on the bus, I have a lot of time to read. Do you have any book recommendations for learning Emacs? I plan to use Emacs as a text editor for note taking and programming in general.

13
13
submitted 2 months ago by Ramin_HAL9001@lemmy.ml to c/emacs@lemmy.ml

A close friend of mine was "inspired" to write a song by my series of blog articles called "Emacs Fulfills the Unix Philosophy" (actually I think he is busting my chops a bit for being an annoying Emacs evangelist, but anyway...) I thought it was pretty funny and worth sharing here.

He wrote the lyrics and used one of those Large Language Models like Stable Diffusion (or something like it) to make the actual music, and settled on a few different renditions of the song. You can listen to them on his website: https://www.extrema.is/blog/2024/04/29/emacs-philosophy

14
6
submitted 2 months ago by StrangeAstronomer@lemmy.ml to c/emacs@lemmy.ml

... more an annoyance really, and not elfeed's fault at all but ...

[first posted on reddit/r/emacs but probably more interesting here]

lemmy RSS feeds (such as "https://lemmy.ml/feeds/c/emacs.xml") often (but not always) have mis-guided "Link:" elements which target an external link, an image file or other material instead of the lemmy post itself. Consequently, hitting 'b' elfeed-search-browse-url may send one on a surprising if not always useful journey.

eg

Title: Keymacs, a program to generate Emacs keybindings | Plain DrOps
Author: https://feddit.de/u/DrOps
Date: Tue, 23 Apr 2024 23:35:25 AEST
Feed: Lemmy - emacs
Tags: emacs, lemmy
Link: https://plaindrops.de/blog/2024/keymacs/

submitted by DrOps to emacs
8 points | 2 comments
https://plaindrops.de/blog/2024/keymacs/

In this case, the link to lemmy itself is in the "2 comments" => https://lemmy.ml/post/14798221

Here's a little hook to fix it up - it also marks the entry with the tag 'lemmy-fixed' ...

(defun elfeed-fix-lemmy-link (entry)
  "Fix lemmy.ml RSS feed links in elfeed."
  (when-let ((url-base-regexp "https://lemmy\\.ml/")
             (feed (elfeed-entry-feed entry))
             (feed-url (elfeed-feed-url feed))
             ((string-match-p (concat url-base-regexp "feeds/c/") feed-url))
             (entry-link (elfeed-entry-link entry))
             (link-url-regexp (concat url-base-regexp "post/[0-9]+"))
             ((not (string-match-p link-url-regexp entry-link))))
    (when-let ((content (elfeed-deref (elfeed-entry-content entry))))
      (let ((lines (split-string content "\n")))
        (dolist (line lines)
          (when (string-match link-url-regexp line)
            (let ((post-link (substring line (match-beginning 0) (match-end 0))))
              (setf (elfeed-entry-link entry) post-link)
              (elfeed-tag entry 'lemmy-fixed)
              (message "Fixed lemmy link in elfeed: %s" post-link)
              (cl-return))))))))
(add-hook 'elfeed-new-entry-hook #'elfeed-fix-lemmy-link)

Thanks to u/karthik for getting me started with this. The crappy elisp is mine not his (roast me!)

15
7
submitted 2 months ago* (last edited 1 month ago) by BenchpressMuyDebil@szmer.info to c/emacs@lemmy.ml

I was working with NPM package.json files a lot lately and I often found myself saving them in an unparseable state. json-ts-mode highlights syntax errors in yellow but it wasn't enough.

I didn't want to use flymake-eslint becuase it requires having the jsonlint binary in the PATH and I just wanted a simple Lisp solution.

The code tries to parse the current buffer on save using Emacs' built-in json-parse-string and moves the cursor to the location of the parsing error if it fails.

The below code naively assumes that the saved buffer is always the current buffer, which may very well not be the case (e.g. (save-some-buffers)).

It also probably won't save JSON5 files which have // comments inside because json-parse-string won't handle that.

(defun rtz/json-parse-pre ()
    (interactive)
    (if (eq major-mode 'json-ts-mode)
        (condition-case err
            (progn 
  	    (json-parse-string
  	     (buffer-substring-no-properties
  	      (point-min)
  	      (point-max)))
              nil)
          (json-parse-error
           (goto-char (nth 3 err)) (error err)))))

  (setq write-file-functions '(rtz/json-parse-pre))
16
25
submitted 2 months ago by dsemy@lemm.ee to c/emacs@lemmy.ml

A new backend for Gnus which I have been developing for a while was merged today into Emacs - you can now fetch and read Atom feeds right from Gnus.

The backend is extremely customizable, allowing you to swap any parsing function with a custom implementation (I use this feature to display youtube video descriptions from youtube channel Atom feeds, which are otherwise not picked up by the backend since they don't appear in a standard location, and also to be able to supply a youtube channel name instead of its web address to add it; see https://git.sr.ht/~dsemy/emacs-config/tree/master/item/init.d/init-programs.el#L90 if you're curious).

This is a result of this backend being actually made of two backends - an "abstract" backend (nnfeed) which handles feed data storage, talking to Gnus, and defining server variables which will hold parsing functions, and another (nnatom) which actually provides these parsing functions. This also means it is very simple to define new "feed-like" backends, since you don't need to implement data storage or the Gnus backend interface, only some parsing functions (their requirements are also designed to be fairly generic, so it would be easy to handle various types of feeds. nnfeed itself makes very little assumptions about the feed type).

It should be available with Emacs 30 (or right now from Git).

17
9
submitted 2 months ago by DrOps@feddit.de to c/emacs@lemmy.ml

For sure, I’m heading straight to Emacs hell for this.

Apparently, there are a lot of Emacs purists in the world who, over the years, have learned to type such complex key sequences as C-x r t M-. C-c C-p fluently. I'm not one of them. And when I tried to figure out how to customize it for myself, the web forums were full of comments saying it wasn't a good idea.

18
6
submitted 2 months ago by NanoooK@sh.itjust.works to c/emacs@lemmy.ml
19
7
submitted 2 months ago by nmtake@lemm.ee to c/emacs@lemmy.ml

In vim terminal I use C-[ for ESC to escape from insert mode a lot, but didn't know C-[ works in GUI version of Emacs until recently. Since Meta can be replaced with ESC, we can enter C-M-s, for example, with C-[ C-s.

20
9
submitted 2 months ago* (last edited 2 months ago) by AusatKeyboardPremi@lemmy.world to c/emacs@lemmy.ml

As a long time Vimmer, I have recently started using Emacs out of sheer curiosity. I chose Doom Emacs as it has evil-mode enabled by default, and do not want to dive down the rabbit hole of configuring the editor from scratch (at least, not yet!).

After installing and enabling libvterm in Emacs, I am having a frustrating experience. I configured ZSH shell to use vi-mode keybindings which interferes with evil-mode whenever I press Esc or C-[.

After having searched a little, I came across a workaround to disable evil-mode when in vterm. But it is still not a smooth experience. For instance, when switching between buffers (C-w C-w).

I would like to know how others in the community tackled this problem. Is there a better solution to this problem? Or have you made peace with the aforementioned workaround? Or have you stopped using vterm entirely?

21
14
submitted 2 months ago by yogthos@lemmy.ml to c/emacs@lemmy.ml
22
13
submitted 3 months ago by 4ffy@lemmy.ml to c/emacs@lemmy.ml

This release brings a host of user-facing refinements to an already stable base, as well as some impressive new features. There is a lot to cover, so take your time reading these notes.

Special thanks to Jean-Philippe Gagné Guay for the numerous refinements to parts of the code base. Some of these are not directly visible to users, but are critical regardless. In the interest of brevity, I will not be covering the most technical parts here. I mention Jean-Philippe’s contributions at the outset for this reason. Though the Git commit log is there for interested parties to study things further.

23
28
Emacs 29.3 released (lists.gnu.org)
submitted 3 months ago by 4ffy@lemmy.ml to c/emacs@lemmy.ml

cross-posted from: https://lemm.ee/post/27699104

From the NEWS file: Emacs 29.3 is an emergency bugfix release intended to fix several security vulnerabilities described below.

  • Arbitrary Lisp code is no longer evaluated as part of turning on Org mode. This is for security reasons, to avoid evaluating malicious Lisp code.

  • New buffer-local variable 'untrusted-content'. When this is non-nil, Lisp programs should treat buffer contents with extra caution.

  • Gnus now treats inline MIME contents as untrusted. To get back previous insecure behavior, 'untrusted-content' should be reset to nil in the buffer.

  • LaTeX preview is now by default disabled for email attachments. To get back previous insecure behavior, set the variable 'org--latex-preview-when-risky' to a non-nil value.

  • Org mode now considers contents of remote files to be untrusted. Remote files are recognized by calling 'file-remote-p'.

24
22
submitted 3 months ago* (last edited 3 months ago) by majjo@beehaw.org to c/emacs@lemmy.ml

(Video on Mastodon)

Inspired by a Reddit post some month ago, I wrote two patches:

  1. titlebar-colors.patch for syncing the colors of the titlebar with the rest of the frame. This uses GtkHeaderbar to allow Emacs to control the colors internally. I haven't gotten the foreground color to sync yet. The changes are done to GTK parts of Emacs and should work for both X and Wayland (pgtk) builds.
  2. rounded-corners.patch to make the shape of frames more consistent with other applications. The changes are made to PGTK parts of Emacs, but should be easily applicable to other places. Right now, it forces a 12 px radius. Ideally, it should just respect the shape of the underlying GtkWindow. This would make it more versatile and automatically change to a square shape in fullscreen (which is currently unimplemented).

The Reddit post mentioned got a lot of attention, but the poster did not provide any code. So I thought some people would find at least the first of these patches useful!

They both have their flaws (poor contrast in most dark themes and forcing 12 px radius, also seems to crash Corfu and possibly more), any help to improve them is much appreciated.

25
12
submitted 3 months ago by 4ffy@lemmy.ml to c/emacs@lemmy.ml
view more: next ›

Emacs

1978 readers
4 users here now

Our infinitely powerful editor.

founded 4 years ago
MODERATORS