r_emacs | Unsorted

Telegram-канал r_emacs - /r/emacs

-

This channel is a feed for r/emacs. @r_channels @reddit2telegram

Subscribe to a channel

/r/emacs

Is there a config to make emacs look as astronvim, nvchad and similar?

I've used vanilla emacs for a long time for microcontroller work with stm32 and recently had to use vscode because of my work as a C++ developer. There I appreciated many of VsCode's features, but being based off Microsoft once my job finished I began planning on dropping it. However seems to be neovim with many of its distros is nowadays the best experience for out of the box similarity with many of vscode's features, however knowing emacs is emacs I know everything's possible but is it worth the effort? Also with vanilla emacs I've seen some performance drawbacks whit heavy configurations and things were sometimes not as smooth even as vscode and I've heard neovim is very fast and light. Do you think emacs is a good idea for my goals? Maybe doom emacs already has what I want? So I don't have to spend weeks configuring emacs.....


Thnx in advance

https://redd.it/1c6thvj
@r_emacs

Читать полностью…

/r/emacs

emacs glitch

For a long time I have been having the issue where my emacs would occasionally glitch, in the following 2 ways:

1. it will randomly hang when I'm doing something. this happens with M-x and honestly everything so I don't think it's caching
2. when I type, it will randomly hang a bit and emit the text I type, but in the wrong sequence of keystrokes. I used to think that it might be completion-at-point taking too much time, but there's honestly nothing there, and there are various of times they are very fast.

I used to assume that it was my keyboard as I basically only use emacs when I'm using my computer, but I just tested that other program don't seem to have this problem

So I suspect it is something with emacs.

​

I tested the typing problem in firefox(I rolled "123123123" on my keyboard) and emacs. In firefox there's occasional delay but very brief and no sequence error, and in emacs this happened

"123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123121323232311123123123123123123123123"

notice the "121323232311" part at the back, that's when emacs hangs and emit the whole of them out altogether. My hand is quite consistent as you can see all other parts are consistent "123123123".

​

I have no idea why this happens, my machine is generally fast, nothing else (that is only firefox) glitch, and emacs only takes 7% of CPU. I wonder if anyone else have seen this before?

my emacs version is 29.1 with doomemacs. my config is on z.gehninfel.xyz/20230914114145-doomemacs\_configuration.html

​

https://redd.it/1c6ib8n
@r_emacs

Читать полностью…

/r/emacs

axy - Ad hoc expansion of yasnippet from anywhere in emacs
https://github.com/naiquevin/axy

https://redd.it/1c66ad9
@r_emacs

Читать полностью…

/r/emacs

How to make sure a function is available and returns the desired values on init?

I've been running into this in my config every now and then and can't seem to find a "reliable" solution for the order to load stuff in.

In this specific case, modus-themes provides a function modus-themes-get-color-value that allows me to customize faces with the correct colors, depending on which modus theme loads at init. I load modus-vivendi and operandi based on the time of day. So, i don't want to set fixed colors for stuff like the tab-line and such.

My specific issues currently is, that the function seems to be available, but the face customization for tab-line is run before the modus theme is loaded, which results in the wrong colors being loaded. But i've also run into the situation that a package tried to configure itself before the modus-themes package was available, so that function didn't work.

My current tab-line config looks like this:

(use-package tab-line
:ensure nil ; For elpaca
:after (modus-themes)
:init (global-tab-line-mode)
:custom-face
(tab-line-tab-current ((t (:box (:line-width (10 . 5) :color ,(modus-themes-get-color-value 'bg-tab-current))))))
(tab-line-tab-inactive ((t (:box (:line-width (10 . 5) :color ,(modus-themes-get-color-value 'bg-tab-other))))))
(tab-line-tab-modified ((t (:box (:line-width (10 . 5) :color ,(modus-themes-get-color-value 'bg-tab-current))))))
)

But this results in black(ish) boxes, instead of the correct colors.

How can i, in general, make sure that the modus-theme is loaded first and all packages i'd like to customize only do so after the theme and colors are properly available? This doesn't seem to be influenced by actually enabling the tab-line. I can leave out the :init statement and later enable the tab-line manually, but the face customization seems to happen anyways.

I also thought about grouping the face customization in the mods-themes packages use-package block, as the colors are specific to that, but the :custom-face stuff runs before the package is loaded, so the entire function isn't available.

If needed, my entire config lives here: https://gitlab.com/domsch1988/domacs

https://redd.it/1c63uvv
@r_emacs

Читать полностью…

/r/emacs

Circle Packing Animation in GNU Emacs

Elisp implementation of circle packing algorithm by Wang et. el.

Demo: **https://youtu.be/qPNVMQF9zK4**

Details: https://lifeofpenguin.blogspot.com/2024/04/circle-packing-animation-in-gnu-emacs.html

https://redd.it/1c60fej
@r_emacs

Читать полностью…

/r/emacs

No I don't want 2, Emacs
https://www.emoses.org/posts/dont-write-2/

https://redd.it/1c5ptgv
@r_emacs

Читать полностью…

/r/emacs

Release v0.15 · Ement.el (Matrix client for Emacs)
https://github.com/alphapapa/ement.el/releases/tag/v0.15

https://redd.it/1c5iwh6
@r_emacs

Читать полностью…

/r/emacs

org-mode slow in large files because of tree-sitter tsc-parse-chunk

Hi, doeas anybody know how to disable tree-sitter mode for org files/org-mode

Manually i can disable it by setting tree-sitter-mode to nil, but I cannot find a way to do it automaticaly.

Profiling shows

356 100% - command-execute
349 98% - funcall-interactively
349 98% - org-self-insert-command
349 98% - apply
348 97% - #<subr org-self-insert-command>
347 97% - tree-sitter--after-change
345 96% - tree-sitter--do-parse
4 1% tsc-parse-chunks
1 0% + org-element--cache-after-change
7 1% + byte-code
0 0% + ...


My tree-sitter config


(use-package tree-sitter
:config
(require 'tree-sitter-langs)
(global-tree-sitter-mode nil)
;;(add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode)
(setq tree-sitter-major-mode-language-alist (delete '(org-mode . org)
tree-sitter-major-mode-language-alist))

)



(use-package tree-sitter-langs
:config
(setq tsc-dyn-dir (expand-file-name tree-sitter-subdir user-emacs-directory))
;; Custom patterns to make it look like in old versions:
;; See: https://github.com/ubolonton/emacs-tree-sitter/issues/153
(tree-sitter-hl-add-patterns 'python
(assignment left: (identifier) @variable))

(tree-sitter-hl-add-patterns 'python
(decorator (call (identifier) @function.special)))
(setq tree-sitter-major-mode-language-alist (delete '(org-mode . org)
tree-sitter-major-mode-language-alist))

)

I tried this hooks:

(setq tree-sitter-major-mode-language-alist (delete '(org-mode . org)
tree-sitter-major-mode-language-alist))

(dolist (mode '(org-mode-hook))
(add-hook mode (lambda ()
(progn
(setq tree-sitter-mode nil)
(setq tree-sitter-major-mode-language-alist (delete '(org-mode . tree-sitter-major-mode-language-alist))
)))
)

https://redd.it/1c5duqy
@r_emacs

Читать полностью…

/r/emacs

More pictures from MITs annual GNU emacs festival
https://www.reddit.com/gallery/1c5db2a

https://redd.it/1c5dbep
@r_emacs

Читать полностью…

/r/emacs

Org-Agenda: Best Approach For Multi-Project Workflow?

I was introduced to Emacs at work and would like to migrate my physical *todo* list to `org-agenda`. This process is much easier thanks to the introduction materials by [DistroTube](https://www.youtube.com/watch?v=8BOiRmjw5aU&amp;t=939s), [SystemCrafters](https://www.youtube.com/watch?v=PNE-mgkZ6HM&amp;t=2728s), and [Prod](https://www.youtube.com/watch?v=UqtBXrzXPgQ). While the aforementioned youtube videos are useful, I am having difficulty envisioning how best to organize my todos -- especially across multiple projects.

It seems to me that there are three options (please correct me if I am wrong):

* Single `.org` file -- top-level todo headers, :tags: used to organize per project
* Single `.org` file -- second-level todo headers organized under project-specific top-level headers
* Multiple `.org` files -- top-level todo headers organized in project-specific `.org` files

**What is your approach for tracking/organizing todos across multiple projects?**

I find myself drawn to the idea of having a separate `.org` file per repository at work, organizing git-issue todos in the top-level header and task "steps" todos at the second-header level. However, I question whether this is the best approach because it would require me to update my configuration *(setq org-agend-files ...)* should I work on a new repository -- however unlikely.

&#x200B;

Any recommendations from seasoned \`org-agenda\` users is welcome!

https://redd.it/1c59v7r
@r_emacs

Читать полностью…

/r/emacs

Announcing ShannonMax: analyze your keybindings with information theory
https://github.com/sstraust/shannonmax

https://redd.it/1c4yeme
@r_emacs

Читать полностью…

/r/emacs

yasnippet template indenting randomly

I'm newish to emacs, been fiddling with it on/off for about a year but only really had it start to click in the last four months. Anyhow, I'm trying to setup yasnippets and something is jacking up the basic template you get on invoking yas-new-snippet:

# -- mode: snippet --
# name:
# key:
# --

For some reason everything past the mode declaration is quasi-randomly indented. I cannot figure out what is doing it and looking at the yasnippet docs this does not seems like the intent.

My mode line tells me Snippet, ws, yas, company, and wrap are all activated when I invoke yas-new-snippet.

This is my configuration for yasnippet:

(add-to-list 'load-path
"\~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(define-key yas-minor-mode-map (kbd "<tab>") 'yas-expand)

(setq yas-snippet-dirs
'("~/.emacs.d/snippets"
))
(yas-global-mode 1)

Is there something I am missing? Do I have to configure snippet-mode separately as well?

https://redd.it/1c4sxun
@r_emacs

Читать полностью…

/r/emacs

Watch for changes in project?

I want to run a callback function when files change in a project. I see that it's possible to watch individual files, but that's not what I want. Yes, I could write some code to extend this to my entire project, but I'd rather leverage existing solutions if there are any. (Yes, I'm aware LSP file watchers exist, but I use Eglot).

https://redd.it/1c4miws
@r_emacs

Читать полностью…

/r/emacs

"Tomorrow Night Deepblue" Emacs theme, a beautiful deep blue variant of the Tomorrow Night theme
https://github.com/jamescherti/emacs-tomorrow-night-deepblue-theme

https://redd.it/1c4hz79
@r_emacs

Читать полностью…

/r/emacs

Emacs 2011-2023
https://bastibe.de/2024-03-24-rip-emacs-2011-2023.html

https://redd.it/1c4dbrv
@r_emacs

Читать полностью…

/r/emacs

Eglot is overriding parentheses style and indentation for modes. How do I stop it?

New to emacs and I've been struggling so much with this.

I've already tried customizing the emacs variables, I tried Editorconfig as well, nothing works.

https://redd.it/1c6nrni
@r_emacs

Читать полностью…

/r/emacs

lasgun.el: Avy-backed, actionable placement of multiple marks

&#x200B;

Demo of lasgun.el

After writing some functionality for my personal configuration, I figured I may as well take a stab at writing my first package out of it.

lasgun.el takes the Filter -> Select -> Act loop of avy and allows you to repeat the first two steps as needed, then act on the selections in bulk.

It comes with two actions preloaded: one to place multiple-cursors.el cursors at each mark, and one to run embark-act-all on the positions. Users can define their own actions with the macro define-lasgun-action. Docstrings have usage information.

Besides avy, there are no dependencies (optionally mc and embark are needed for the aforementioned actions).

&#x200B;

https://github.com/aatmunbaxi/lasgun.el

https://redd.it/1c6epwl
@r_emacs

Читать полностью…

/r/emacs

Weekly Tips, Tricks, &c. Thread

This is a thread for smaller, miscellaneous items that might not warrant a full post on their own.

See this search for previous "Weekly Tips, Tricks, &c." Threads.

Don't feel constrained in regards to what you post, just keep your post vaguely, generally on the topic of emacs.

https://redd.it/1c64gcj
@r_emacs

Читать полностью…

/r/emacs

Trouble installing eclipse-jdt

I'm trying to install the lsp for java and pre-requisite is this.

https://projects.eclipse.org/projects/eclipse.jdt.ls

I've installed "eclipse-jdt" which is present in the openSUSE repository.
But, I think LSP is not present in this and there's no similar package in the repositories.

I'm getting this error whenever I try to open a Java project -

 mode specification error: (error Autoloading file /home/asd/.emacs.d/elpa/lsp-mode-20231227.620/lsp-mode.elc failed to define function lspdeferred)


Am I doing something wrong?

https://redd.it/1c62yks
@r_emacs

Читать полностью…

/r/emacs

server-after-make-frame-hook not triggering

Hook to save desktop on daemon exit doesn't seem to work, any ideas? Restoring the desktop works if I manually save the desktop:

(add-hook 'server-after-make-frame-hook
#'(lambda ()
(unless desktop-save-mode
(add-hook 'server-done-hook #'(lambda ()
(desktop-save "~/.cache/emacs")))
(desktop-save-mode 1)
(desktop-read)))))


The desktop file doesn't get written to disk on C-x C-c or emacsclient -e "(kill-emacs)" so I need to manually evaluate (desktop-save "~/.cache/emacs"). I can also confirm the hook gets updated--it just doesn't seem to apply on daemon exit.

Disclaimer: not a programmer :(

Edit: formatted code as suggested.

https://redd.it/1c5vbml
@r_emacs

Читать полностью…

/r/emacs

what is the current best setup?

im coming from neovim and ive been starting to learn emacs this whole day, i managed to get the basic stuff but now when i try to look at other peoples configs its just so different that i have no idea, so i think I'll be rewriting my config from scratch.

so my basic questions are:

what is the best package manager, is it use package, straight, elget..? oh so many...

how should i structure my emacs config? is it only a .emacs or is it separated in init.el package.el straight.el whatever.el? i have no idea

also i wonder if there is a proper "guide" to all of this, and if so, please tell me

i also didnt manage to setup lsp because use package was complaining

but anyways ty very much everyone

https://redd.it/1c5mss0
@r_emacs

Читать полностью…

/r/emacs

Auction - an exporter and web UI for org mode
https://monospace.games/misc/auction/manual

https://redd.it/1c5hcdh
@r_emacs

Читать полностью…

/r/emacs

How to modify syntax highlighting in treesitter major modes?

I've been looking at trying out treesitter support again (specifically, c-ts-mode), and one thing that's got me stuck is how to modify the rules that are used to highlight the text. c-ts-mode makes some baffling decisions where it deviates from cc-mode in how certain things get highlighted, and I'd like to change this.

I haven't been able to see anything about how to modify the highlighting so far. c-ts-mode doesn't offer anything like c-ts-mode-indent-style for modifying indentation, and the general treesitter documentation for font lock stuff doesn't really help. The closest I've figured so far is that maybe you can write a mode hook that adds entries to the treesit-font-lock-settings list, but there's no indication if this would actually work, and if so how.

I'm worried that the only "solution" right now is to copy-paste the font lock rules in c-ts-mode and manually maintain a separate copy just to change a couple things, which would obviously be unacceptable. And I can't sidestep the issue by, say, modifying font faces to look better, because the issues I want to fix have to do with poorly-chosen generic font faces for some of these rules.

If modifying syntax highlighting isn't possible right now, then I'll make a feature request and go back to waiting for treesitter support to be usable. I'm just not sure what part of emacs would be responsible for the new feature. I get the impression that the font lock rule system as it is now makes it really difficult for a major mode to let you extend its rules, so I'm leaning towards it being a treesitter feature request (as opposed to a c-ts-mode feature request).

https://redd.it/1c5dkup
@r_emacs

Читать полностью…

/r/emacs

How to add marginalia support to my package?

Hi. I'm making a package that sometimes asks for user input with completing read. I would like to add marginalia annotations for the candidates.

Is there an example as to how I should do it? My candidates are already a list in the form of ("candidate" . "content"). I would like for "content" to be displayed as a marginalia annotation.

I would also like to not have a hard dependency on marginalia, of course. I read the README in marginalia's github, and there seems to be a way to do it, but it kinda went over me, didn't quite get it. Thanks.

https://redd.it/1c5b39q
@r_emacs

Читать полностью…

/r/emacs

dumb question on compatibility of packages

So corfu replaces company? vertico replaces ido? X replaces Y.

It's sorta niggled at the edges of my brain for a while now - and it must confuse the heck out of newbies as well as those of us (ahem) who stuck stuff into init.el several decades ago and forgot about it. So I thought I'd ask the cool dudes who know ...

Do packages generally have some kind of protection mechanism to avoid functional conflicts like this? Or at least a warning?

Or perhaps there's a document somewhere that goes into incompatibilities or maybe just "it makes no sense installing X if you have A, B, C..."

https://redd.it/1c4zu3z
@r_emacs

Читать полностью…

/r/emacs

lexical-binding: t acting strangely

I'm using Doom Emacs, with Emacs v. 28.1. I'm trying to run code to filter Org roam notes by tag-name. I've added it to Doom's config.el, which I believe is analogous to Emacs init.el. My config.el file has ;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- at the top, and describe-variable shows that the value for lexical-binding is indeed 't' in this buffer. When I evaluate the entire buffer, I catch a void-variable (tag-name), which (I believe?) shouldn't be happening when lexical-binding is turned on. However, evaluating only the additional region within the same buffer works fine (temporarily, of course). How can I figure out what's going on?

Edit #1: selecting every line in the buffer and evaluating as a region works as well. Is my lexical-binding local variable being overlooked for some reason?

Edit #2: Solved - It was because there was a single white character before ;;; $DOOMDIR.

;;; $DOOMDIR/config.el -- lexical-binding: t; --
.
.
.

(use-package! org-roam
:defer t
(...))


(defun my/org-roam-filter-by-tag (tag-name)
(lambda (node)
(member tag-name (org-roam-node-tags node))))

(defun my/org-roam-list-notes-by-tag (tag-name)
(mapcar #'org-roam-node-file
(seq-filter
(my/org-roam-filter-by-tag tag-name)
(org-roam-node-list))))

(defun my/org-roam-find-project ()
(interactive)
;; Select a project file to open, creating it if necessary
(org-roam-node-find
nil
nil
(my/org-roam-filter-by-tag "Project")
nil
:templates
'(("p" "project" plain "%?"
;:if-new
:target (file+head "${slug}-%<%Y%m%d%H%M%S>.org" "#+title: ${title}\n#+category: ${title}\n#+filetags: Project\n")
:unnarrowed t))))

(global-set-key (kbd "C-c n p") #'my/org-roam-find-project)

&#x200B;

https://redd.it/1c4qqlf
@r_emacs

Читать полностью…

/r/emacs

Corfu + Cape: how to complete words in buffer and from dict

I use Emacs mainly for typing English and Dutch. I would like to have completion candidates pop up from words typed in the current and other open buffers, and from an English and a separate Dutch dictionary file. I have got the English dictionary working, and I can use cape-abbrev by using the binding I defined, but not automatically. My corfu and cape settings follow. Any pointers are greatly appreciated:)

(use-package corfu
:custom
(corfu-cycle t) ; Allows cycling through candidates
(corfu-auto t) ; Enable auto completion
(corfu-auto-prefix 2)
(corfu-auto-delay 0.1)
(corfu-popupinfo-delay '(0.4 . 0.2))
(corfu-preview-current 'insert) ; Do not preview current candidate
(corfu-preselect-first nil)
(corfu-on-exact-match nil) ; Don't auto expand tempel snippets

:bind (:map corfu-map
("M-SPC" . corfu-insert-separator)
("TAB" . corfu-next)
([tab] . corfu-next)
("S-TAB" . corfu-previous)
([backtab] . corfu-previous)
("S-<return>" . nil) ;; leave my entry as it is
("RET" . corfu-insert))

:init
(global-corfu-mode))

;; Add extensions
(use-package cape
;; Bind dedicated completion commands
;; Alternative prefix keys: C-c p, M-p, M-+, ...
:bind (("C-c p p" . completion-at-point) ;; capf
("C-c p t" . complete-tag) ;; etags
("C-c p d" . cape-dabbrev) ;; or dabbrev-completion
("C-c p h" . cape-history)
("C-c p f" . cape-file)
("C-c p k" . cape-keyword)
("C-c p s" . cape-elisp-symbol)
("C-c p e" . cape-elisp-block)
("C-c p a" . cape-abbrev)
("C-c p l" . cape-line)
("C-c p w" . cape-dict)
("C-c p :" . cape-emoji)
("C-c p \\" . cape-tex)
("C-c p _" . cape-tex)
("C-c p ^" . cape-tex)
("C-c p &" . cape-sgml)
("C-c p r" . cape-rfc1345))
:init

(add-to-list 'completion-at-point-functions #'cape-dabbrev)
(add-to-list 'completion-at-point-functions #'cape-abbrev)
(add-to-list 'completion-at-point-functions #'cape-dict)
(add-to-list 'completion-at-point-functions #'cape-file)
)

https://redd.it/1c4p0hy
@r_emacs

Читать полностью…

/r/emacs

Emacs equivalent of NvChad?

Hello tehre,

I've recently taken to start learning how to use emacs after a nice stint in nvim. I really like the IDE-like features of nvchad, and wonder if there exists such a project/fork of emacs that can replicate it.

&#x200B;

Thanks!

https://redd.it/1c4kbsq
@r_emacs

Читать полностью…

/r/emacs

Any ways to get tabs in Emacs but like Geany/Pycharm so when there are too many tabs it get hidden beyond the tab view in the tabbar?

as it say in the title. I tried tabbar mode but I noticed the tabs just take the "next line" in the tab bar instead of staying onn a single line like in Geany/Pycharm when there are too many tabs. Tabs also seem to shrink in size too.

&#x200B;

Any existing Emacs packages that does this or I'm I really the only one that would want that?

https://redd.it/1c4gr3v
@r_emacs

Читать полностью…

/r/emacs

Introducing modern-tab-bar-mode

After my last post with my tab-bar-mode visuals, I decided to extract it to a package for anyone who may want to use it.

https://github.com/aaronjensen/emacs-modern-tab-bar

Screenshot of modern-tab-bar

Please let me know if it works for you and if there's anything you'd like to customize that you can't with this version of the package. No guarantees that I can or will add additional customization options, however.

https://redd.it/1c4bsu2
@r_emacs

Читать полностью…
Subscribe to a channel