This channel is a feed for r/emacs. @r_channels @reddit2telegram
What’s the current status of Emacs Lisp on Guile?
https://redd.it/14bjvem
@r_emacs
Emacs and Python Imports
Recently I have been doing some programming in python. I have got it working nicely in Emacs - I may share my configuration another time.
I'm have a problem with imports though. In Python you bring in a library by "importing" it. I often have to edit libraries that are part of the project I'm working on. The problem is that in Python 3 you can't unload a library, nor can you replace it with a newer version.
This is a problem because Emacs python-mode is based around the idea of sending python code to a python shell. This works fine unless imports get involved. Once imports get involved you run into the problem that python will never re-import a library after it has imported it once. So, if you're editing a library the only way to update to the new version (which could be what you just wrote) is to stop the python process and start another one.
Is there a fix for this? Has anyone written a package to at least make constantly restarting python more convenient?
https://redd.it/14bfcq9
@r_emacs
Consult-ripgrep search all your notes
Hi folks,
Does anyone have this working, I want to use consult-ripgrep package and I guess the package offers a search mechanism for org files within OrgRoam directory..
I am missing a search parameter using this config because key binding works but rg does not return anything because nothing was captured from typed-in string: Therefore ARG and OPTS must be replaced by something ? Otherwise (use-package consult)
(defun tomek/org-roam-rg-search ()
"Search org-roam directory using consult-ripgrep. With live-preview."
(interactive)
(let ((consult-ripgrep "rg --null --ignore-case --type org --line-buffered --color=always --max-columns=500 --no-heading --line-number . -e ARG OPTS"))
(consult-ripgrep org-roam-directory)))
​(global-set-key (kbd "C-c rr") 'tomek/org-roam-rg-search)
​
https://redd.it/14b5x1v
@r_emacs
I was using auto-dark in macos and then this happened
Here is what i used:
auto-dark-emacs
This is in dark mode in emacs set by auto-dark
and now the code in source blocks is not visible but in light mode it is
​
This is in light mode set by auto-dark
https://redd.it/14b26al
@r_emacs
Cannot save .authinfo.gpg
Hi I'm attempting to create a .authinfo.gpg file to use with forge, but I'm unable to save the file. When I click OK after marking the key to use, emacs just hangs. Has anyone experienced this before? If so, how did you resolve it?
I'm using an M1 Macbook Pro.
​
Thank you!
https://redd.it/14avgtf
@r_emacs
Struggling with javascript completion with LSP
Crossposting from github, because the response rate there has been pretty slow: https://github.com/typescript-language-server/typescript-language-server/discussions/730
So,
I'm writing an application using vanilla js + WebGL and my development stack is:
- emacs
- lsp-mode
- company-mode
- ts-ls installed through emacs
My LSP config is here, and I'm open to suggestions for improving it.
Completion works fine for the core parts of javascript, e.g. getElementByID()
and friends. But if I want to call into, let's say, the canvas API, I don't have completion working. Here's an example:
var canvas = document.getElementById("foo");
var ctx = canvas.getContext("bar");
screenshot
Note how the getContext
isn't offered by the language server as a completion option.
Here's a second example:
xmlr = new XMLHttpRequest();
xmlr.open('GET', url, false);
Similarly, the open
isn't offered as a completion option.
How do I fix this? I've tried setting both a tsconfig.json
and a jsconfig.json
with the following contents:
{
"compilerOptions": {
"target": "es2020",
"lib": "es2020",
"module": "commonjs"
}
}
But no dice. I still don't get completion in the examples above.
What do?
https://redd.it/14anu9e
@r_emacs
Use Elixir with Emacs ?
Hello, I'm new on Emacs and I'm trying to use Elixir with Emacs
I installed the elixir-mode M-x package-install [RET] elixir-mode [RET]
https://github.com/elixir-editors/emacs-elixir
and added
(load-file "~/.emacs.d/elpa/elixir-mode-2.4.0/elixir-mode.el")
(require 'elixir-mode)
to \~/.emacs
But elixir's files are still in fundamental mode, I guess I'm missing something ?
Thank you for your help :)
​
EDIT: Thank you the problem is solving :)
I added this in \~/.emacs
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
and installed elixir-mode via M-x list-packages
who created elixir-mode-20221017.2044
folder and now it's working :)
https://redd.it/149194u
@r_emacs
Tab Bar Mode - Thinking about moving to beframe instead
Looking for any opinions for anyone else who has made this move. How are you liking it? I do use a tiling window manager normally so this may be a good fit.
https://redd.it/13obu3t
@r_emacs
The Strange and Peculiar World of Emacs Regular Expressions
https://youtu.be/qHaEkTZ3XCk
https://redd.it/13o89ts
@r_emacs
Org-mode code block evaluation is not working (doom emacs).
I am getting
>Evaluation of this <language> code block is disabled
I have this in ~/.config/doom/config.el
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(python . t)
(js . t)
(clojure . t)))
It is supposed to work by default, from YouTube videos. What am I missing?
https://redd.it/13nzl5l
@r_emacs
Emacs-written novel on the German bestseller list
This week my novel »Der letzte Auftrag« climbed to 11th place on the bestseller list in Germany. Planned and written completely in Emacs, with the help of Orgmode, Olivetti, and you guys here at Reddit. Thank you so much!
https://preview.redd.it/h65k41u1j51b1.png?width=1063&format=png&auto=webp&v=enabled&s=d0e2a4f014fac06722ea13df2624f842f6a14329
My website as a writer is (after the old typo3-setup has broken down) is also done via Emacs, it is all static HTML now, but better for viewing with the smartphone than my old page. I tangle the website out of Orgmode into HTML files. If you are interested, the english version, which is somewhat outdated though, is www.titusmueller.de/index\_en.html. I need to get the German content translated and bring it up to date.
Then there is the Agenda for my reading tour through many cities, my e-mails via Mu4e ... You get it: I am hooked. Thank you for making it such a joy even for a non-programmer to use Emacs!
https://redd.it/13no4q3
@r_emacs
What do you all think
I started work on this theme called "Cacao". I do tech su pport work during the day and happen to reverse colors on an image and got a very pleasing set of colors and decided to try it on EXWM (Emacs window manager). It's still a work in progress, but I thought it wouldn't hurt to get a few opinions as it's more or less up and running!
Feel free to let me know whether it's good, bad or indifferent. I'm pretty thick skinned :) .
​
​
​
Cacao-theme on EXWM in FreeBSD 12-1
https://redd.it/13ncnxg
@r_emacs
lisp nesting exceeds max-lisp-eval-depth
Hi! I was trying to use emacs as an emacs ide howver the above error kept popping up How do i fix it?
(setup (:pkg lsp-mode)
(:hook-into typescript-mode js2-mode web-mode python-mode)
(:bind "TAB" completion-at-point)
(:option lsp-headerline-breadcrumb-enable nil
lsp-enable-snippet nil))
(setup (:pkg lsp-ui :straight t)
(:hook-into lsp-mode)
(:when-loaded
(progn
(setq lsp-ui-sideline-enable nil)
(setq lsp-ui-sideline-show-hover nil)
(setq lsp-ui-doc-position 'bottom)
(lsp-ui-doc-show))))
(setup (:pkg lsp-pyright)
(:load-after python-mode)
(:hook python-mode . (lambda () (require 'lsp-pyright))))
(setup (:pkg blacken)
(:option blacken-fast-unsafe t
blacken-line-length 80)
(:hook-into python-mode))
(setup (:pkg pyvenv)
(:hook-into python-mode))
https://redd.it/13n5hcf
@r_emacs
Best way to version control .emacs.d for cross platform portability?
I regularly swap between Windows, macOS, and Linux computers. Sometimes I have internet, sometimes I'm on a vpn that blocks package downloads, and sometimes I don't have access to internet at all. This makes it difficult to download and install the Emacs packages I normally use through melpa and elpa. I'd like to version control my .emacs.d for when I have internet access, and keep it on a thumbdrive when I don't.
But I'm not entirely sure what the best way to go about this is portably. Do I just
1. Create a folder called offline-packages
2. Download each package I use from git
3. add this line to my .emacs.d? (add-to-list 'load-path "\~/.emacs.d/offline-packages/my_package")
(require 'my_package)
Can I just do git add elpa
and just commit the entire folder under version control? If I do this on my Windows PC will the .elc files work on my macOS or Linux pc? If not how do I handle the recompilation? How have other people approached this?
https://redd.it/13mxkf3
@r_emacs
Window management customisation appreciation post
TLDR: side windows are awesome, you should use them.
A while ago I posted https://www.reddit.com/r/emacs/comments/12jfsan/fixedwindowlayoutlikecedet/ and got a reference to https://www.masteringemacs.org/article/demystifying-emacs-window-manager - and that has been life-changing. I've ordered the book purely to appreciate the insights in this article. I'm of course convinced I will find a lot of good stuff in it, but I haven't even began digging into it. But I did create the following little snippet that has in the last 24h already improved my quality of life significantly:
(setq switch-to-buffer-obey-display-actions t)
;; Introduce a bottom side window that catches
;; compilations, deadgreps etc.
(add-to-list 'display-buffer-alist
'("\\*deadgrep.*\\|\\*Compilation\\*"
(display-buffer-in-side-window)
(side . bottom)
(slot . 0)
(window-parameters
(no-delete-other-windows . t))))
(defun deets/side-window-resize (enlarge)
(let ((bottom-windows (window-at-side-list (window-normalize-frame nil) 'bottom)))
(dolist (window bottom-windows)
(when (symbolp (window-parameter window 'window-side))
(if enlarge
(window-resize window (window-height window))
(window-resize window (- (/ (window-height window) 2))))))))
(defun deets/side-window-toggle (arg)
(interactive "P")
(cond ((null arg) (window-toggle-side-windows))
((listp arg) (deets/side-window-resize t))
((symbolp arg) (deets/side-window-resize nil))))
;; Remove our side-windows
(global-set-key (read-kbd-macro "C-x w") 'deets/side-window-toggle)
LSP not working properly with c++ template implementation files.
I am currently using C++ in Emacs with lsp-mode. I use CMake to generate compile_commands.json with `set(CMAKE_EXPORT_COMPILE_COMMANDS ON)`.
So far, this has been working great -- until I had to write template implementation files:
Refresher:
- In non-templated C++, ```#include "header.hpp"``` goes at start of `implementation.cpp` file.
- In templated C++, ```#include "implementation.tpp"``` goes at end of `header.hpp` file.
Basically, since `implementation.tpp` doesn't explicitly "include" its header definitions, the LSP thinks I am just writing out things without defining them, resulting in a bunch of squiggly lines.
I know a lot of people just put their template implementation code in the header file, but I really want to keep it separate. Have any C++ users encountered this problem before and found a solution? Thanks.
https://redd.it/14bf1uw
@r_emacs
Take Screenshots Straight into Org Files in Emacs on Win10
Hi all,
in this blog post I wrote back in 2018, I had described how to set up a function for org-mode in EMACS, that allows you to take screenshots and include them in your org-file with just one move. An example application looks like this: GIF
There is now a new version of the function with improved interface and functionality, you can find it in the post above, or directly in the gitlab repo. The corresponding snippet can be found here.
Hope it helps, I'm looking forward to any kind of feedback.
https://redd.it/14b8x4v
@r_emacs
Is doom emacs still actively maintained?
Hello!
I hope you're all having a great day. I'm a newbie to Emacs, and I've been doing some exploring to find the best fit for me. I started with Spacemacs, but to be honest, it felt overwhelming, and I couldn't get all its spirit.
Then, I gave Doom Emacs a shot, and I was simpler, yet it still seems to have all the functionality I need. For me, doom-emacs offers me a great experience, though.
That said, I have a minor concern. I noticed they released the last significant update back in March. More concerning, though, is that there seem to be quite a few unanswered pull requests, some of which appear to be pretty important in terms of features or fixes.
So, in my complete ignorance, I first want to ask you guys experts about the situation.
Is Doom Emacs still being actively maintained? If not, what do you think is the best way, return to Spacemacs or try another configuration kit?
Thanks for your insights and suggestions.
Best.
https://redd.it/14b41e4
@r_emacs
org-batch-agenda-csv
Hi guys! I want to export a certain company/project TODO list I am working on, to a CSV file, in order to produce a shareable ongoing progress report of my work onlne. I've gotten the Emacs built in macro org-batch-agenda-csv working somewhat using a command like this:
(org-batch-agenda-csv "MYTAG1|MYTAG2")
Where I'm struggling is with date/time information. I assumed that if my TODOs have a typical SCHEDULED attribute that i'd easily discover date/time info in the generated csv. So far, no such luck.
The help for org-batch-agenda-csv macro talks about optional (rest) Parameters that "are alternating variable names and values that will be bound before running the agenda command." This sounds extremely useful but I'm not sure how to proceed without perhaps examples of how these could be used for some typical uses.
There are also a handful of references to date/time things in both the Emacs online help for the macro, and in the elisp macro definition. I am not an Emacs Lisp expert though and so far my randomish trial and error has gone nowhere.
Can you help?
Thanks!
https://redd.it/14aygkr
@r_emacs
Need help with Emacs window sizing in MacOS
Does anyone know how do i fix this in macos? I also use amethyst wm to organize all my windows
​
https://preview.redd.it/u8fmlb30bd6b1.png?width=2880&format=png&auto=webp&v=enabled&s=f9f4c02a0742376bcc24522e66e1446f5d86b22a
https://redd.it/14auoq4
@r_emacs
Highlight multiple lines in consult-line
Today I finally found a few hours to implement 2 features from swiper that I missed in consult-line:
​
Smart recenter: buffer is recentered only if you jump to match outside of current view. (This can be done in a pretty non-invasive way via hooks)
Highlighting of matches on all visible lines in buffer. This is a noticeable patch to core consult code. Instead of creating a patch/fork, I just put into a separate file which I load after consult itself, it redefines quite a few core functions. It might break with newer consult versions.
​
Feel free to try: https://gist.github.com/lazy/4f609cf2b956de2531885747e3c3bf88
Save it to "consult-patch.el" file, open in emacs, M-x eval-buffer, run consult-line, search for something like "let" and enjoy.
​
UPD: gist was updated at least once. Overlay caching didn't move overlays between windows. Now it doef.
​
P.S. I saw another approach to doing that: https://github.com/minad/consult/pull/774. But minad decided not to merge it due to perf and personal preference. Mine is a little better performance-wise: it checks for highlighting only visible candidates and caches the highlight overlays (of which there can be many). But I am not sure if I will be able to overcome minad's personal preference, so don't want to bother with PR. If someone wants to polish this code and try merge into mainline, I won't mind. Think of this code as "public domain".
P.P.S. I don't use swiper because I have quite a lot of custom vertico/vertico-posframe/consult configuration which I do not want to replicate for swiper.
https://preview.redd.it/97bdpwbdi96b1.png?width=2529&format=png&auto=webp&v=enabled&s=6b9f4a05ebb6ed11b14381efc4437995b160ae3e
https://redd.it/14aglvm
@r_emacs
bind.el is now on MELPA with synonym support
For those of you want to try bind.el
but don't want to install from source, bind.el
is available on MELPA.
Now you can remove any package prefix and write,
(bind (my-window-map
(:prefix "m"
(:repeat
"h" #'windmove-left
"j" #'windmove-down
"k" #'windmove-up
"l" #'windmove-right)
"d" #'delete-window
"D" #'delete-other-windows))
((:global-map)
"w" my-window-map))
in bind
block instead of fully typing bind-prefix
, bind-repeat
, bind-global-map
etc.
Homepage
Previous Reddit Post
https://redd.it/13ob11s
@r_emacs
Naming guidelines for ELPA packages
https://lists.gnu.org/archive/html/emacs-devel/2023-05/msg00368.html
https://redd.it/13o7e07
@r_emacs
Processing shorter key combination when emacs expects a longer one
Hi, so for example I have the key combination C-c C-x set up to open neotree and it works fine, however in certain modes (e.g. inferior lisp mode), I suppose that there are longer key combinations that seem to start with my combination for neotree, because when I type it, it shows "C-c C-x-" in the status bar as if it were waiting for me to input more keys
Is there some on the go way I can have it accept C-c C-x as the whole input? there are other cases like this one and I'd like to know the way to have it accept the shorter key combinations defined when I'm finished typing them
https://redd.it/13o3th9
@r_emacs
How to move .emacs.d/ and .doom.d/ to .config directory?
I know emacs and doom now support storing configs in .config/emacs/ and .config/doom/
I tried creating those directories and moving all the files into them and then deleting .emacs.d/ and .doom.d/ but my configs do not load.
https://redd.it/13nouar
@r_emacs
dired and save-excursion
Hi, I want to do the following in dired mode: if the object at point is an org-roam file, rename it (move it). However, I want the function to return to the dired buffer after it has done its work. I know I should use save-excursion
, however, I am not able to understand how I can combine it with org-roam-buffer-p
. Any ideas or help would be awesome. Thank you!
https://redd.it/13nemzh
@r_emacs
Emacs freezes and is wrong size when running startx
the second time when using emacs --daemon
and emacsclient -c
Howdy! I'm running Gentoo and using EXWM.
I'm trying to set it up so that startx
launches emacsclient
. I start the server with emacs --daemon --eval "(require 'exwm)" -f exwm-enable
(I've tried running this both from TTY and from within .xinitrc
). In .xinitrc
I start emacsclient with exec emacsclient -c
.
Once I've started the server and run startx
, Emacs works perfectly the first time. But if I exit with C-x C-C
(or switch to TTY2 and killall emacsclient
) and run startx
a second time, Emacs freezes and the frame shows up smaller and in the top-left corner of the screen.
If it helps here's my .xinitrc
:
# Disable access control for the current user
xhost +SI:localuser:$USER
# Make Java applications aware this is a non-reparenting window manager
export JAVAAWTWMNONREPARENTING=1
# Set default cursor
xsetroot -cursorname XCcrosshair
# Set keyboard repeat rate
xset r rate 200 60
# Start emacs
# emacs --daemon --eval "(require 'exwm)" -f exwm-enable
exec emacsclient -c
And here's the relevant bit of my init.el
:
(use-package exwm
:straight t
:config
(require 'exwm-config)
(setq exwm-workspace-number 1)
(exwm-enable))
Also there's this in early-init.el
that might be relevant but I doubt it:
(push '(fullscreen . maximized) initial-frame-alist)
(push '(ns-transparent-titlebar . t) default-frame-alist)
(setq frame-inhibit-implied-resize t
frame-resize-pixelwise t)
How can I find out what's causing the issue? I just can't understand why it works the first time but not the second time.
Thanks in advance!
https://redd.it/13nav6t
@r_emacs
Emacs instance jupyter notebook
Can i using emacs instance jupyter notebook for my project for example using org mode for this please guide me
https://redd.it/13mywtt
@r_emacs
with images in org mode, how set their max width and height by default?
I want to set max width and height of images in org and tried as:
(setq org-image-actual-width 500)
(setq org-image-actual-height 300)
However, only "(setq org-image-actual-width 500)" works, "(setq org-image-actual-height 300)" did nothing to images.
is it possbile set org image's max size as it does markdown mode:
(setq markdown-max-image-size '(500 . 300))
https://redd.it/13mpnz3
@r_emacs
Org-remark Demo #2 - Recap & New Features v1.1.0
Org-remark lets you highlight and annotate text files and websites with using Org mode.
Published a new 12-minute video walking you through basic features and new ones that come with version 1.1.0 just released (GNU ELPA should be updated overnight if all goes well).
https://youtu.be/BTFuS21N00k
https://redd.it/13mlain
@r_emacs