sops: SOPS encrypt and decrypt without leaving the editor.
https://github.com/djgoku/sops
https://redd.it/1bcp5s2
@r_emacs
Weird issue with emacs + flycheck configuration
Hi,
Emacs newbie here. I have an issue regarding flycheck as in a gif below.
When removing something in a buffer<1> sometimes the error doesn't propagate to another buffer, buffer<2> when method is removed. The error is shown in rust, however the error as well occurs in some other languages. It doesn't matter if I'm taking someone's config or my own, the error will occur.
Example scenario (occurs in config from a link pasted below):
1. Go to buffer 1.
2. Remove method.
3. Error occurs on buffer 2.
4. paste back method on buffer 1.
5. Error still occurs on buffer 2 after switching to buffer 2, despite implementation being already pasted back in buffer 1 (which is incorrect behaviour).
Another scenario shown on gif:
1. Go to buffer 1.
2. Remove method.
3. Save buffer.
4. Go to buffer 2
5. method use map.clear_content_index() isn't highlighted as an error.
​
https://i.redd.it/btmghtjxzsnc1.gif
Did anyone have such an issue before or I need to add a specific config in order to highlight the errors when switching back and forth between buffers?
​
What's helping is doing:
M-x lsp
M-x lsp-restart-workspace
However I believe it should work out of the box.
Cargo build shows an error, however flycheck doesn't. The error occurs in a very specific circumstances, however it confuses me very often as I don't know if problem is in my implementation or because of "frozen" flycheck.
Here's my checkers configuration:
​
https://preview.redd.it/a0s0pyx10tnc1.png?width=826&format=png&auto=webp&s=b374349adf418587ddb0c973f76b59980ce289b1
Adding rustic-clippy as a second checker doesn't help.
M-: (setq debug-on-error t) doesn't help as well as there's no issue in the buffers about the error.
Any idea how could approach this issue? I was googling it for few hours but no result.
My emacs version:
GNU Emacs 29.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.40, cairo version 1.18.0)
OS version:
6.1.77-2-MANJARO
​
In below link there's an example configuration in which the problem occurs:
https://github.com/rksm/emacs-rust-config
I would appreciate any help of how to tackle this issue. Thank you!
​
https://redd.it/1bckhud
@r_emacs
EWW Redirecting reddit to old.reddit.com automatically
Posting this for any of y'all interested. I had to compile emacs 29.2 the libxml2 support because the eww-url-transform url wasn't available on the emacs 28.
You can create a function that takes a URL as input and returns a "transformed" version of the URL. The eww-url-transformers variable will be a list of all the "transform" functions you create. When you click on a link, eww will automatically run the URL through all the functions in that list before bringing you to the webpage.
Adding this to your init.el will automatically redirect www.reddit.com to old.reddit.com
(defun eww-reddit-redirect(url)
"Redirect reddit.com to old.reddit.com automatically."
(replace-regexp-in-string "https://www.reddit.com" "https://old.reddit.com" url))
(setq eww-url-transformers '(eww-remove-tracking eww-reddit-redirect))
Note, the eww-remove-tracking is a function built into eww.el to remove some tracking information from URLS.
Source: https://www.gnu.org/software/emacs/manual/html_node/eww/Advanced.html
Thanks,
Quezta3
https://redd.it/1bcf8v3
@r_emacs
Background frame
I am trying to make e-mail scheduling possible in Emacs based on gnus-delay
but for notmuch.
A lot of stuff in notmuch calls pop-to-buffer-same-window
and similar functions which is making things complicated. Like when calling notmuch-draft-resume
(which I call to bring up the postponed message, check headers and send).
I would also like to run the queue processing in the background on a schedule, which will disrupt my work if I am doing something and all of a sudden windows start to move around.
So I think I have two options when processing the queue:
1. Save the current window configuration, process the queue and restore it.
2. Create a new frame, make-frame-invisible
it, and delete the frame when done.
On the second option, something does not work after calling make-frame-invisible
, as if pop-to-buffer-same-window
would not work on an invisible frame. Is that possible?
On the first option, as I would like to have the queue processing run on a schedule, I guess I'd need some way to "run this function every X minutes ONLY ONLY ONLY if the session is inactive" to not disrupt my work. Is there such a function/package available to detect if the session is inactive?
https://redd.it/1bc9vka
@r_emacs
Unreadable error lines with LSP
Hey all,
LSP errors look unreadable as they're single line... Anyone knows how to configure these errors to look more readable? Or to see one error at a time? Or open details of an error?
​
https://preview.redd.it/txyujv4r0qnc1.png?width=3024&format=png&auto=webp&s=efeab063271cb0340650a9f7021220f22f2ae462
https://redd.it/1bc5gsc
@r_emacs
Block commenting in C
Is there some kind of option/package, which can create C block comments in a way that it only puts a comment marker at the beginning and at the end of region?
I mean, if I comment this with comment-region
:
Something here
and there
I get this:
/ Something here /
/ and there /
But I'd like to have this:
/ Something here
and there /comment-region
is inconsistent with the behavior if I write the comment by hand. I mean, if I start creating the comment by /* Some ...
, emacs creates the second version. But if I uncomment it with uncomment-region
, and then add the comment back with comment-region
, I get the first version.
https://redd.it/1bbztuy
@r_emacs
Why I a not using Emacs full time yet
If you see my post history, I have been trying to move to Emacs full time for both, work and personal. I used my own config, then moved to Spacemacs, tried Doom and finally settled in Spacemacs.
For personal stuff, I have a few annoyances but nothing major but, for work, there are a few things that hurt my productivity - I need to get things done and don't have much time to fix, so I am using VSCode instead.
Some of the things that are blocking me:
- multi-vterm refuses to work. It just says that it cannot find vterm-mode. vterm works, so the mode is there but nope
- vterm keeps on scrolling down to the prompt, making going through logs or things like that impossible
- LSP seems to be unable to find my .venv and use the pyright inside, even when I start it from the shell
It is possible that I am 'holding it the wrong way' but I am not ready to change my full workflow for this.
This is not a complain, just a post so people see what it is if you are not an expert - Google shows no solutions to these issues, no matter what I do and I don't have the time to fix them. I understand that Emacs is more of a 'here are the parts, put them together in any way you want' but that same approach, while mitigated by distributions like Spacemacs, make it way harder for people who need to get things done now, if you happen to hit any issues.
https://redd.it/1bc020j
@r_emacs
Buffer Local Keybindings
Hello everyone, how do you handle the situation where you want certain keybindings to be conditionally bound. Here is what I have as an example:
...
(defvar-keymap my/code-keymap
"d" #'xref-find-definitions
)
(defvar-keymap my/lsp-code-keymap
"d" #'lsp-find-definition
"i" #'lsp-find-implementation
)
(defvar-keymap my/leader-keymap
"." #'find-file
"/" #'consult-ripgrep
"g" #'magit
":" #'consult-mode-command
"Q" #'ave-buffers-kill-terminal
"f" my/file-keymap
"p" my/project-keymap
"w" my/window-keymap
"b" my/buffer-keymap
"r" my/rings-and-regs-keymap
"e" my/edit-keymap
"!" my/error-keymap
"i" my/insert-keymap
"t" my/toggle-keymap
"c" my/code-keymap
)
(unbind-key "SPC" evil-motion-state-map)
(bind-key "SPC" my/leader-keymap evil-motion-state-map)
(add-hook 'lsp-mode-hook
(lambda ()
(make-local-variable 'my/leader-keymap)
(bind-key "c" my/lsp-code-keymap my/leader-keymap))
)
my-code-keymap
with my-lsp-code-keymap
if I am in an lsp-mode buffer. This nearly works, but making the keymap buffer-local doesn't seem to work. Thus once lsp-mode is turned on in any buffer, all buffers have their code keymap replaced. (defvar-keymap my/not-wanted-lsp-code-keymap
"d"
(lambda ()
(if lsp-mode
(call-interactively #'lsp-find-definition)
(call-interactively #'lsp-find-definition)))
"i"
(lambda ()
(if lsp-mode
(call-interactively #'lsp-find-definition)
(message "lsp is not available")))
)
Did a moderator remove the recent post asking for someone to self-nominate themselves as a moderator?
Did a moderator just remove the recent post asking for someone to self-nominate themselves as a moderator? - https://www.reddit.com/r/emacs/comments/1bbgby0/callforremacsmoderatorselfnomination/?
If so which one?
https://redd.it/1bbnxsk
@r_emacs
Send code block through serial when evaluing org src?
I have been using a beaglebone through serial, and I have a couple of commands for u-boot that I have to send. I usually copy & paste them, but I'm wondering if there's a way to send it when doing C-c C-c
https://redd.it/1bbdt5q
@r_emacs
Introducing consult-mu
​
Using consult-mu to search mu4e with dynamic completion
https://redd.it/1bb4iii
@r_emacs
Condition specific buffer local keybindings
Hello everyone, I am relatively new to emacs and have stumbled on a problem that has completely stumped me.
#My setup:
I have a leader keybinding setup. I press “SPC” and which key shows the next prefix keys. I can do “SPC b” to get to buffer-specific keybindings and “SPC c” for code-specific keybindings.
This is achieved by having a my-leader-key-map
, where “c” is bound to my-code-key-map
, and “b” is bound to my-buffer-key-map
.
“d” is bound to xref-find-definition
in my-code-key-map. Thus “SPC c d” will call that command.
#What I am trying to accomplish:
1. “SPC c d” to be lsp-find-definition
if and only if I am connected to lsp in that particular buffer.
2. “SPC c i” to be lsp-find-implementation
if the lsp supports it and I am connected to lsp in this particular buffer. Keep in mind that “SPC c i” should not be bound in non-lsp buffers.
3. “SPC c i” should only be displayed in the which key menu after I press “SPC c” if and only if the lsp-find-implementation
function is actually bound as per the criteria.
#Generally, I would like to learn a framework of how I can:
1. Make keys be bound to different commands depending on certain conditions.
2. Make sure these conditional key binds are buffer-local. (Shouldn’t change “SPC c d” to the lsp version in all buffers if just one lsp buffer is open)
3. Ensure which key does not show keybindings that are not bound because of conditions unmet. Also, ensure the which-key description matches the currently chosen command that conditions dictate.
4. My keys are not overridden by anything else.
Note: I am aware of how to check if lsp is connected and I know how to check if an lsp has a particular functionality. My question is purely how to get the emacs keybindings set up the way I want.
#Things I have thought of and why they don't work:
1. Make a minor mode keymap that has “SPC” which acts as the prefix key to all of my key-binds. The issue is that I can’t change the binding of “SPC c d“ if I have lsp connected because it is a minor mode map which is not buffer local. This means that it would change “SPC c d” in all buffers which wouldn’t make sense.
2. Make my-leader-key-map local and hook on the lsp turning on. Once it is on in a buffer, I will dynamically create a code-keymap and bind “SPC c” to the dynamically created keymap that includes all lsp-mode functionality and inherits from the regular code-keymap so we can fall back to things defined there for non-overridden keys. This doesn’t really work because minor modes can override my “SPC” leader prefix binding.
3. Have each key bound to a custom function that calls the lsp command interactively if conditions are met and otherwise calls the default function interactively. The issue is for things that don’t have a default command (like lsp-find-implementation
in my example) is that which-key will still show a description, even if that key won’t work because of unmet conditions.
#Idea:
Maybe have a minor mode that binds the leader prefix “SPC” in its key map. Then all subsequent key maps inside it would be buffer-local. This way we sort of have the main key not able to be overridden by things, but all sub key maps would be buffer-local. We would then hook on an lsp starting and create a new lsp-code-key-map that has the functions supported by the lsp, and inherit from the default code-key-map to make sure we can fall back on defaults.
I want to know some veteran’s opinions on this. Am I missing something? Is there some obvious go-to way of doing it?
Overall this is one of the toughest things I have had to do so far in emacs. I also hope that once this gets answered other newbies can learn from this because I know how tough it can be to find info like this.
Please link your configs and examples of how you handle this situation. I really want this post to be a one-stop shop source of truth so people don’t have to struggle to find answers like I did.
https://redd.it/1bb0dxb
@r_emacs
https://github.com/HamedStack/HamedStack.VSTest/blob/main/HamedStack.VSTest/Schema/vstst.xsd
4 https://github.com/x97mdr/pickles/blob/master/src/Pickles/Pickles.Test/results-example-mstest.trx
5 https://codeberg.org/emacs-weirdware-abandoned/test-case-mode
6 https://github.com/bmag/imenu-list
https://redd.it/1bavvhs
@r_emacs
Eglot code actions do not change the buffer
I am trying to get to the bottom of a strange issue with omnisharp 1 and eglot, and I'd appreciate any pointers. The issue is documented here 2 and here 3, but I haven't got very far with it so I thought I'd ask here. My setup is as follows:
- Operative System: Windows 10
- LSP server: Omnisharp 1.39
- Emacs: 29.1
- Programming language: C# (csharp-mode)
In general, omnisharp and eglot work great, but when I choose code actions nothing seems to happen. You can see a screenshot of this as well as the JSON RPC debug log:
- https://github.com/joaotavora/eglot/discussions/1322#discussioncomment-8711304
I am just trying to understand:
- if this is an eglot issue or an omnisharp issue;
- any pointers as to additional means to figure out what is failing. I have tried debugging with edebug as well as additional logging (JSON RPC etc) but no luck.
Tia
1https://github.com/OmniSharp/omnisharp-roslyn
2 https://github.com/joaotavora/eglot/discussions/1322
3 https://github.com/OmniSharp/omnisharp-roslyn/issues/2607
https://redd.it/1bawgko
@r_emacs
Emacs Forge Issue Board
Hello Emacs Community!,
​
I just configured Forge at some Gitlab Repositories, I now can see issues related to the projects I'm in,
Now, my team doesn't use the issues on specific projects much, but open issues in a different Board on gitlab, which is not a project but contains all the important issues I do want to see.
​
I see that I can see issues and posts on each project, but I want to see the one that is in a board, problem being that as it is not a project, it doesn't end with .git, but /team-1/board, while a project would be /project-1.git.
​
Adding the board repository will result in a wait without messages, just a Pulling wait that doesn't seem to be pulling anything.
​
Is there a way to add this board?, and even better, to have it globally?, or can I only see those PRs and issues related to the project I have added?
​
Thanks!
https://redd.it/1basyja
@r_emacs
Is it possible to change the Code Block Syntax in Emacs?
Hello I am new to Emacs and I was wondering if its possible to change the code blocking syntax in Emacs. Currently Emacs uses the following syntax to contain code...
\#+begin_src cpp
\#+end_src
Instead I wanted use the following...
```cpp
```
How do I go about in making this happen?
https://redd.it/1bch5a3
@r_emacs
GC-geiger: Make a click sound when emacs does garbage collection
https://github.com/mpardalos/gc-geiger
https://redd.it/1bcfehe
@r_emacs
emacs-jupyter: Get errors when running jupyter-server-list-kernels
I'm trying to use this famous package. Most things are fine, but the function jupyter-server-list-kernels
returns error say wrong url. Does anybody experience similar issues?
https://redd.it/1bccap0
@r_emacs
Looking for something like org-roam but for whole directories
Hi,
Before someone runs in and suggests project.el or projectile, hear me out please.
My work consists of both programming and a lot of designing. I manage my repositories nicely with projectile, but my design resources are a complete mess.
I have directories with org-mode files, diagrams made both inside of emacs (with plantuml) and outside of emacs. I also have presentations and other miscellaneous files.
I am looking for a smart way to access and organize all these directories and files in a way that resembles org-roam. Would such a thing exist?
My current alternative approach that I haven’t tested yet involves swapping altering the org-roam database using .dir-locals.el together with projectile, but I haven’t tried this.
https://redd.it/1bc74v5
@r_emacs
Question about Org-Habit display
Is it possible to have the org-habit graph display a day where a task was missed with a solid colour block rather than a glyph? For example having a red block on a day where a habit was missed followed by a green block where it was done? It seems that all the various org-habit faces are used to identify when habits are due vs overdue and such but there are none that actually denote what is a completed task vs failed one. Is a glyph the only way to identify this or is there any alternative?
https://redd.it/1bc1d3d
@r_emacs
Is Emacs Right For Me?
I picked up obsidian recently after taking over a job from another guy. I love its TODO features and the beautiful markdown format it has which is really easy to use, but that is all I really use it for. I am normally a minimalist, I used to take notes and todo lists only in notepad (its very manageable with ok formatting), as well as physical notes in a few notebooks I regularly replace. My work is in Mechanical Engineering so its normally just about task management in the background while I have my CAE software & outlook in front. Work PC is windows and obviously I cannot change that.
I discovered Emacs a few weeks ago, and its been rough trying to learn its systems since I have limited free time. I am really interested in org-mode, and the possibility of not only task management, but interlocking its systems with email, IRC (and therefore slack/discord), maybe learning VIM keybinds, etc but I really have no interest in using it as a coding interface, or in writing academic papers.
Is emacs right for my use case?
https://redd.it/1bbzicd
@r_emacs
Is there a way to get Eglot-like variable highlighting in elisp?
Eglot has this feature where the variable at point and its references in the code below get highlighted in bold.
Does anyone know a feature or package that adds the same or similar highlighting to emacs lisp?
And I mean not just highlight by name, but by binding, so if I (re-)bind the same name many times in multiple nested let
expressions or let*
, it should correctly highlight only the references of the same binding.
Side-note:
I really feel like emacs lisp is falling behind a bit with all the cool treesitter and LSP features other languages have now. I understand that treesitter support would be hard due to elisp's syntactic ambiguity between macros and functions and highlighting and indentation would probably be worse than emacs itself which can respect the indentation guides and highlighting provided by the functions/macros themselves.
But a language server would really help a lot, for example to get xref-find-references
working with functions not currently defined in the running emacs instance, for example when writing stand-alone scripts.
https://redd.it/1bby3cq
@r_emacs
I made a small video about the pain of watching others use anything but emacs
https://youtu.be/jf0mmd3rARg
​
Its actually more of a rant about people not learning their tools. But I use my emacs setup to drive the point home.
​
Would love some feedback!
https://redd.it/1bbo84l
@r_emacs
Call for r/emacs Moderator Self-Nomination
r/emacs is such a valuable resource; I've learned so much in conversation with you all. I've recently discovered that we have only one active moderator (thanks to them!). While so far I haven't noticed issues arising from this, I think we can all agree that drawing additional moderator support from among our most active members would strengthen an already strong community. The advantages of a larger pool of moderators include distributing the work effort and bringing in other viewpoints. The former is especially important, as we all know how work and life commitments ebb and flow.
If you are interested in serving as a moderator for r/emacs, please reply with your short "Emacs bio" — how long you've been involved with Emacs, what areas of the Emacs landscape most interest you, and what approach you'd bring to moderation.
If you have concerns about moderation in general, please save those for another thread. If, like myself, you are supportive but cannot yourself commit to moderating, please join me in thanking our current moderator along with those who volunteer!
https://redd.it/1bbgby0
@r_emacs
How to have history and automagic autocomplete in ipython
Hi, I'm coming from helix + tmux + ipython and in ipython shell I have history of previous commands and autocomplete of magic command. I wanted to have same experience with emacs, but I don't have above features and I would like to have them. If that helps, I'm opening ipython shell with run-python
and have
(setq python-shell-interpreter "ipython"
python-shell-interpreter-args "-i --simple-prompt --InteractiveShell.display_page=True")
.emacs
.Emacs With Blurred Background
I just managed to get my emacs to have that modernistic blurred background look so I thought I'd share the result. My approach is unfortunately platform specific (requiring some modification to the wayland compositor). I'm not sure if this belongs here so sorry in advance if it doesn't!
​
https://preview.redd.it/k6dfbonipgnc1.png?width=3840&format=png&auto=webp&s=35482e70eef8dc05448b991ff734188dc25639f6
https://preview.redd.it/fd5603a8ngnc1.png?width=3840&format=png&auto=webp&s=13e55aff10ddd6f24afeb0c624d83de847c6a9b7
https://redd.it/1bb4qki
@r_emacs
latex preview pane not updating bib
I make updates to my bib file that I have embedded, and the changes do not take effect when I refresh the preview pane (all changes within the .tex do) and even when I fully exit my emacsclient.
Even killing the preview buffer, re-starting emacs client, does not help. Even with using a new emacs instance it does not work. Last time to fix this, I wiped the files in the directory and re-opened the tex file (after copying them in from another place) for the bib to work.
https://redd.it/1barocu
@r_emacs
Mode for running .NET / C# unit tests
# Overview
I am considering writing a new mode for running .NET / C# unit tests, and I thought I'd ask for some advice on how to go about it. Or, if there already is an existing mode which does what I'm after, if you could please point it out. The remainder of this post describes my requirements, what I have found out so far, and the approach I intend to take. I apologise in advance for the length of this post, but it seemed easier to lay down all the information I have thus far.
# High-Level Requirements
My requirements are as follows:
- the ability to see a unit test tree across all projects in a solution.
- ability to run individual tests, or nodes from the tree.
- ability to see which tests have failed and which tests have passed within the tree.
- ability to see details of the failure.
- ideally, resolve tests and stack trace elements back to source code.
- approach must rely on the
dotnettool. It can output test results in a format called TRX (Microsoft Visual Studio Test Results File), via its logger parameter
--logger=trx1, 2. TRX is XML based, and the XSD is available here 3. An example TRX for is available here 4.
test-case-mode
boost-test
nunit-results
boost-testand
nunit-results- parse the XML using lisp. However, after that, it becomes a bit hazy:
compilation,
flycheck
flymakefor error display or is this a bad idea?
lsp/
eglotto locate types or is it better to keep the mode stand alone?
imenu-list6 a fair bit with
eglot; is imenu a good candidate for keeping the test tree or am I abusing its functionality?
Making Flymake supports error indicators in Margin
Hello, i'm a little new in this subreddit, i want to share with you all a little hack that makes flymake support error indicators in margins, like flychecks does.
This allow showing flymake's error indicators in TUI and in GUI makes it more modern with scaling better for HIDPI screens.
The solution i've found is make an advice for flymake--fringe-overlay-spec function:
(advice-add #'flymake--fringe-overlay-spec :override
(lambda (bitmap &optional recursed)
(if (and (symbolp bitmap)
(boundp bitmap)
(not recursed))
(flymake--fringe-overlay-spec
(symbol-value bitmap) t)
(and flymake-fringe-indicator-position
bitmap
(propertize "!" 'display
((margin left-margin)
(:inherit (error default) :underline nil)))
,bitmap))))))
The only change here is in the propertize part for use left margin instead of fringe (if you want to use the right margin change 'left-margin' to 'right-margin')
Now it's necessary to change the flymake-bitmap value from flymake's error types or the string won't be displayed for that we can do this:
(put 'flymake-error 'flymake-bitmap (propertize "⚠️" 'face
(put 'flymake-warning 'flymake-bitmap (propertize "⛔" 'face (:inherit (warning default) :underline nil)))
(:inherit (success default) :underline nil)))
(put 'flymake-note 'flymake-bitmap (propertize "🟢" 'face
Propertize is necessary due the function don't apply any face to our string, you can use the face you want but i don't recommend changing or removing the :underline parameter and default from :inherit.
Unless you prefer 'nerd-icons' or 'all-the-icons' icons sets use this advice instead:
(advice-add
#'flymake--fringe-overlay-spec :override
(lambda (bitmap &optional recursed)
(if (and (symbolp bitmap)
(boundp bitmap)
(not recursed))
(flymake--fringe-overlay-spec
(symbol-value bitmap) t)
(and flymake-fringe-indicator-position
bitmap
(concat
(propertize "!" 'display
((margin left-margin)
((margin left-margin)
,bitmap))
(propertize " "
'face
'(:inherit default
:underline nil
:stipple nil)
'display
(space :width 5))))))))
This is due emacs doesn't display well the icon (atleast for me) also when there is multiple erros in the same line icons will be displayed above, adding 5 space from a propertize fix this issue (we can add some extra spaces to our icon string but it doens't play well with whitespace-mode enabled)
Here the final result:
GUI with nerd-icons
​
Terminal with nerd-icons
https://redd.it/1bawdau
@r_emacs
Enabling jinx using file local variable
Whenever I try to enable jinx using a file local variable (by putting # -*- eval: (jinx-mode 1) -*-
in the first line) it fails with an error: Lisp nesting exceeds ‘max-lisp-eval-depth’
. This happens even with emacs -Q
. Just wondering if anyone here has had the same problem? Otherwise I'll open a bug report. Thanks!
https://redd.it/1bask59
@r_emacs