This channel is a feed for r/emacs. @r_channels @reddit2telegram
White-background theme for e-ink screens?
I've been really frustrated lately, trying to get black text on white background. I want to I use my e-ink tablet as an external screen when programming out in the sunshine. But it has turned out that something as simple as a high contrast theme with a pure white background and black text is beyond my abilities.
For some reason, M-x set-background-color white
sets the background to gray when running emacs in a terminal. Even setting the background color to #ffffff
results in a gray background (and in me shouting frustrated at the monitor). I can get pure white with xemacs, but I'm mostly working on our development servers remotely over slow ssh connections, so xemacs is out of the equation.
Of the standard themes, whiteboard
comes closest, but is also gray background, smudged and hard to read on e-ink. Literally every light theme I've downloaded has been some variant of smudgy yellow, gray or teal for the background. Grayish text on grayish background is virtually illegible on e-ink.
I found an "e-ink" theme here: https://emacsthemes.com/themes/eink-theme.html. This gets me black text on a white background... mixed with white text on a white background (#include
s and other syntax highlighting), so also not useable.
Can it really be that difficult to get real black text on real white background?
What is the obvious thing I'm missing? I'm happy to have some syntax highlighting in (dark) gray, but the main text needs to be pure black, and most importantly the background should be actual white.
Please help, my inability to get something so trivial to work is hurting my self-esteem!
https://redd.it/14elu72
@r_emacs
Magit-branch-checkout list order
Hello!
I really love Magit (as I am sure a lot of people do). One thing that annoys me quite a lot is that, when I run magit-branch-checkout
, the list of branches are shown alphabetically I think, when what I really want is the branches to be ordered by my most recent.
Any idea on how to achieve this?
Thanks :)
https://redd.it/14eaiz0
@r_emacs
XEmacs: XEmacs 21.5.35 "kohlrabi" is released
https://www.xemacs.org/Releases/21.5.35.html
https://redd.it/14eatwb
@r_emacs
How do I make Emacs read navigation normally.
Hi, sorry if theres a huge lack of context. But I am banking on the community expertise. Basically, I started the Emacs journey from Spacemacs, to another programmers (stranger, Kaushal Modi) config (init.el). Im okay with learning slowly at my own pace, and Im learning eLisp at my own pace. I ve been using S-<right> and S-<left> for navigation (same goes for up and down). I was okay for months, but now Im looking to remove that Shift for good. Using hardcore-mode seems to work, but Id have to do it everytime I startup. Setting (hardcore-mode 0) doesnt work.
https://redd.it/14e31zo
@r_emacs
Give some tips on note-taking for an-interested-but-not-tech-savvy fan?
I've been making "come-here..." eyes at emacs for a year or more now, but also had a pretty crazy year, which has led to a return to school for a career change. Looking for a good, cross-platform note-taking/workflow thing, and heard about Obsidian, Evernote, Roam, Foam...and came across this thread. Talm' bout eMacs being able to do a lot of what the new-fangled apps are bragging about. Put it this way - I got a couple months that are kinda-sorta free, so if you're telling me this is a valid excuse to run through emacs, I'm sold. One step closer to achieving true FOSS nerd-dom, after dabbling in it from the edges.
But, like I said in the title, I'm mostly a fan of FOSS for ideological reasons, and past recognizing names of things I don't actually have that much ability. So, I gotta be that guy and ask for any advice on easy-to-set-up-and-understand emacs-centered solutions to note-taking. Specifically, I need something that I can sync between my Linux Mint laptop and Android, or that I can make sync. If I can go a step further in being an entitled new guy, if there are any good resources - youtube playlists, blogs, articles, whatever - on something like "designing/customizing workflow for your industry/goals in emacs," that'd be cool, too.
Thanks for bearing w/me, here's hoping I'll finally be joining this community.
https://redd.it/14dyri0
@r_emacs
Any way to quickly set my keybinds to be like Doom Emacs or otherwise copy key combinations into other key combinations?
Hey! I'm a new Emacs user who's been using Doom Emacs but I recently decided to switch over to a personal config. One things that I want to do asap is set up a lot of my keybinds to mostly mirror the ones set by Doom. That being said, there are a lot of binds to copy over and I don't want to do all of the hard manual labor of setting them all. More specifically, I want to copy over a lot of the useful leader key functionality that Doom sets. For instance, if I were to hit <leader> W in Doom, it would function about the same as if I hit <C-w> in evil mode. As of right now, I'm using the general package to set my binds for the leader key manually but it's kind of a pain in the ass, especially for such a massive set of commands like the <C-w> or <C-h> functionality. Is there a way to either
A.) More easily port over most of the keybinds from Doom? (I know a lot of them are package specific but still)
B.) Easily set certain default Emacs keybinds to other key combinations? (E.g set <Leader> W to be equivalent to <C-w> and <Leader> H to be equivalent to <C-h>
https://redd.it/14dtfs9
@r_emacs
Importing a clocktable as variable in a babel block
Why this is not working?
#+NAME: mytable #+BEGIN: clocktable :maxlevel 2 :emphasize nil :scope file #+END:
#+BEGIN_SRC emacs-lisp :var table=mytable
(print table)
#+END_SRC
org-babel-ref-resolve: Reference not found
Please help collecting statistics to optimize Emacs GC defaults
TL;DR: Please install https://elpa.gnu.org/packages/emacs-gc-stats.html and send the generated statistics via email to emacs-gc-stats@gnu.org after several weeks.
Many of us know that Emacs defaults for garbage collection are rather ancient and often cause singificant slowdowns. However, it is hard to know which alternative defaults will be better.
Emacs devs need help from users to obtain real-world data about Emacs garbage collection. See the discussion in https://yhetil.org/emacs-devel/87v8j6t3i9.fsf@localhost/
I wrote a small package https://elpa.gnu.org/packages/emacs-gc-stats.html that will collect garbage collection stats during Emacs sessions. Please, install it and later (after few weeks) submit the results to emacs-gc-stats@gnu.org
Usage:
Add
(require 'emacs-gc-stats)
(setq emacs-gc-stats-gc-defaults 'emacs-defaults) ; optional
(emacs-gc-stats-mode +1)
to your init file to enable the statistics acquiring.
When you are ready to share the results, run M-x emacs-gc-stats-save-session
and then share the saved emacs-gc-stats-file
(defaults to~/.emacs.d/emacs-gc-stats.eld
) by sending an email attachment to
<mailto:emacs-gc-stats@gnu.org>.
You can use M-x emacs-gc-stats-clear
to clear the currently collected
session data.
The following data is being collected after every command:
- GC settings gc-cons-threshold
and gc-cons-percentage
- Emacs version and whether Emacs framework (Doom, Prelude, etc) is used
- Whether gcmh-mode
is used
- Idle time and Emacs uptime
- Available OS memory (see memory-info
)
- Emacs memory allocation/GC stats
- Current command
https://redd.it/14dej62
@r_emacs
How Do I Refile Org Mode Tasks Under Any Level Heading?
Hello,
I am trying to refile a cancelled task under the '*CANCEL' heading.
I want to refile the following task:
```
*** CANCELLED Match Figma Templates
```
​
Remaining File For Context
```
* Jira Tickets
** Todo
** In Progress
*** CANCELLED Match Figma Templates
** COMPLETE
** CANCEL
```
When I hit 'C-c C-w' to use 'org-refile', I can only refile the '*** CANCELLED Match Figma Templates' under '* Jira Tickets'.
Is there a related Emacs config variable I can use to allow any level heading?
Thanks!
https://redd.it/14cv91c
@r_emacs
noweb: the lesser known org babel glue
https://redd.it/14cl7tv
@r_emacs
API lockout discussion?
Aside from the message that came up during the lockout, I haven't been able to find out much about how Reddit's new API charges affect this subreddit. Could the moderators put up a sticky post with some details?
https://redd.it/14caiod
@r_emacs
All-the-icons SVG beta
Hi,
All-the-icons maintainer here.
Over the years, all-the-icons have been inundated by user issues about mis-aligning fonts, TOFUs and font installation or code point clashing problems. This is all the result of cross-pollination of a set of Web front end tricks of a certain era to Emacs.
The problems of using icon font are
1. They require extra manual installation of fonts
2. They don't work in the terminal unless you patch the fonts
3. Amalgamation of different icon fonts designed for different grids and negative spaces result in non-uniform display of fonts
4. Unicode point clashes
5. Updating the fonts and their mappings are painful
6. Fonts don't scale properly even with a lot of manual adjustments
7. The project get an incessant amount of issues opened due to all of the above
Since last August, I have been experimenting with simply using the SVG sources of these fonts directly instead, and I'm happy to announce that I'm satisfied with the result enough that I want to invite the community to try out the beta branch.
There are now over 18000 icons included in the package, and over 31000 when you count all the variations. Chances are, if you are looking for an icon that looks good and appropriate, it's probably in there.
The public API largely remain the same, but there are some backward incompatible changes in private APIs. Please refer to the README for details.
Judging from Github searches, these changes do not appear to cause too much breakage, but I could be wrong. Please let me know on Github as I do not plan to come back to Reddit too often because of a certain u/spez.
https://github.com/domtronn/all-the-icons.el/tree/svg
https://redd.it/14c5u1w
@r_emacs
Saving org file content to sqlite database
So I'm interested in creating forms using org-mode where information entered beneath each heading can be saved to an sqlite database, with each org-mode heading being the column heading for the sql table.
I am using the emacsql package for saving the information to the database, and so long as the entries are placed in a vector, an emacsql function will be able to save the entries to the sql table.
With the help of chatgpt, I've found several ways of parsing the org-mode headers and saving the entries within each header to a vector. When I display the vector in emacs, the entries look exactly as I would expect.
However, when I save them to the database, each entry not only includes the text that I want, but a bunch of elisp code around it that appears to be coding the relative position of the text within the org file. It's as if the text has a bunch of Metadata attached to it that is invisible within emacs but becomes visible when taken out of emacs and put into the database. I've tried many different ways but all end with the same outcome.
It's clear that there's a problem with the methods im using, so I'm wondering if anyone has been able to successfully do something like this before or has some suggestions as to why this is happening and how to fix it. Thanks!
https://redd.it/14c0mpd
@r_emacs
Concealing Star Buffers with Consult
Star buffers are sometimes useful but I almost never need them and see them as clutter. Consult makes it really easy to modify and add sources. Here how to put star buffers out of mind but still include them in the buffer list by putting them at the bottom of your buffers list when using consult-buffer
. This example removes star buffers from the main buffer source and creates a new source for them.
(defvar consult--source-star
(list :name "Star-Buffers"
:category 'buffer
:narrow ?s
:face 'consult-buffer
:history 'buffer-name-history
:state #'consult--buffer-state
:items
(lambda () (consult--buffer-query :sort 'visibility
:as #'buffer-name
:include '("\*.")))))
;; modify buffer source to exclude star sources
(setq consult--source-buffer
(plist-put
consult--source-buffer :items
(lambda () (consult--buffer-query :sort 'visibility
:as #'buffer-name
:exclude '("\*.")))))
;; reorder sources and add star source at the end
(setq consult-buffer-sources '(consult--source-hidden-buffer
consult--source-modified-buffer
consult--source-buffer
consult--source-bookmark
consult--source-recent-file
consult--source-file-register
consult--source-project-buffer-hidden
consult--source-project-recent-file-hidden
consult--source-star))
If you truly want to hide them you can use :hidden
per the documentation https://github.com/minad/consult#multiple-sources but I find putting them under recent files good enough.
https://redd.it/14bx3m9
@r_emacs
Two finger swipe in Emacs?
Is there a way to configure two-finger swipe on a touchpad to trigger next buffer and previous buffer?
https://redd.it/14bqqvy
@r_emacs
run emacs inside multi-term (with ssh remote) inside emacs
I use tmux on a remote server for persistence. I find it useful to have a multi-term buffer inside my local emacs that is then ssh'ed into this server and then I can also attach to my persistent tmux session.
My question applies even if I skip the tmux step. In my term window I may want to edit a file that is local to the remote. Running emacs in that window, I loose control of emacs shortcuts: everything including closing the remote emacs goes to my emacsclient running on my laptop. Is there a way to solve this? Can I keep my workflow, and edit a file remotely like this?
In solving this, I don't want to give up on all shortcuts passed to my local emacsclient when I am not editing a file remotely like this.
This is not the same as running emacs inside multi-term that is running bash locally. For that, I use emacsclient (my local emacs is running as a server) and so I can open any file in my emacs client locally. One solution would be to pass -X to ssh and have a gui running locally.
https://redd.it/14ea6qz
@r_emacs
LSP-Mode doesn't find pylsp even though it's in PATH
Hello there!
I am pretty new to emacs and at the moment I try to configure lsp-mode with pylsp. In my understanding I can just use a hook at prog-mode
to run lsp (seems to work). The only problem is that emacs wont find pylsp. I allready hacked something together to prepend the emacs intern PATH var (read by using (getenv "PATH")
with the path to the directory which contains the pylsp executable but it just says that it cannot find it. This problem only exists when starting emacs via dmenu and not via a "normal" terminal which uses my zshrc with the appropriate PATH var I guess.
My config can be found here
Any help would be appreciated.
Have a Great Day!
https://redd.it/14e71tc
@r_emacs
Quick fix to make buffer cycling easier in Emacs
https://youtu.be/Hql1ySbTGbE
https://redd.it/14e0clt
@r_emacs
Issue while updating header line?
Hey guys
I have found an issue when update the header line(although I am not sure if this even is an issue).
While displaying information in the header line, not everything is updated at the same time in the *Messages* buffer.
Code I used to enable header line in scratch buffer:
(setq wat 0)
(defun initialize-header-line ()
(interactive)
(setq header-line-format '(:eval (message (format "header line updated %d" (setq wat (+ wat 1)))))))
My question is:
Why is the header line being updated on every key movement, but the *Messages* buffer doesn't display the "header line updated" on every key movement? Is this expected?
I also added a gif screencast to show this issue(sorry for the quality, This is the best that I was able to record):
https://i.redd.it/yvfshhhc2y6b1.gif
https://redd.it/14d9t05
@r_emacs
Make desktop-save-mode work with emacsclient?
I am using desktop-save-mode with the following settings, which basically saves all open frames and restores them on startup:
;;;; Persistent sessions
(desktop-save-mode 1)
(setq desktop-dirname "~/.cache/emacs")
(setq desktop-path '("~/.cache/emacs"))
(setq desktop-auto-save-timeout 0)
(setq desktop-auto-save-timer nil)
I want to switch to use Emacs daemon with the provided systemd user unit emacs.service
for quicker startup but if I simply enable and start it, it doesn't restore any frames. I see that there's this thread which seems to work on restoring a single frame, but how to restore/save multiple frames like my initial setup? Unfortunately I barely know any elisp.
Much appreciated.
https://redd.it/14dhuby
@r_emacs
Share an Org buffer as a web page. In addition, a URL will be created that you can share to view it.
https://github.com/tanrax/org-share-to-web.el
https://redd.it/14dfko1
@r_emacs
Problem with emacs running as a daemon on Majaro
Hello,
I have a subtle problem with Emacs, AUCTeX, and TeXLive.
In the current state, every time I log into GUI I have to run emacs --daemon
manually in the terminal in order for emacsclient
to work. More precisely, the issue is with a correctly working package AUCTeX. For convenience, I'd rather have emacs --daemon
run automatically at startup. Manjaro is installed with XFCE gui in case this might be important.
I have tried three things so far:
1. A simple entry emacs --daemon
in startup script: in Manjaro, this is Session and Startup
2. Extra line emacs --daemon
in ~/.xinitrc
3. A new systemd
service emacs.service
for a user, which I created using a template.
Every time emacs --daemon
is run by the system using any of the methods I listed, AUCTeX does not work correctly.
For clarity, the issue is AUCTeX does not recognise my custom packages: *.sty
. Otherwise, if the daemon is run manually everything works just fine. In order to make sure TeXLive works, I checked kpsewhich <package name>
and the file is recognised, I compiled LaTeX file in the terminal etc. and everything is completed etc. The issue seems to be specifically with the Emacs and AUCTeX.
Thanks
https://redd.it/14db5nw
@r_emacs
Easiest Way To Switch Emacs Configs On The Fly?
I tried Chemacs2 but switching to my Org Mode based Emacs config that has a '[config.org](https://config.org)' with 'init.el' doesn't work as easy as just literally using GNU Stow with 'stow -t \~/.emacs.d'. The problem with that is that I have to constantly wipe out that '\~/.emacs.d' directory each time, let it install everything, and let 'vterm' compile again which takes a good 5 mins each time.
​
**Goal:**
* I'm trying to switch between my normal config and the Spacemacs config.
* This is because I've been trying to check out Spacemacs to see what I like from it to later then adapt it with my own config or just use Spacemacs for web dev projects since I hate configuring LSP myself.
​
**Questions:**
Q1. Has anyone with an Org Mode based config used anything similar, and if so, what have you used?
Q2. Or should I somehow add my actual Emacs config to the Spacemacs config too? If so, how?
* I ask this because there are some quality of life changes I have in my normal Emacs config that annoy me so much for the defaults for Emacs in general, especially with Org mode defaults sometimes.
Thanks
https://redd.it/14cuzh5
@r_emacs
Is pgtk for MacOS worth it?
I built emacs from source, native comp, a few months ago and recently heard about pgtk. Is this worth it (for more smoothness, better user experience) on MacOS? I saw this thread: https://github.com/jimeh/build-emacs-for-macos/issues/45 where it was mentioned that you have to turn off the MacOS specific flag, so I’m not sure if it’s more harm than good, and what benefit it may serve. Anyone have experience optimizing their emacs on MacOS as much as possible? I basically run native comp vanilla emacs with only about 100 lines in my init file, which I byte compile (I’m not sure if the init file byte compilation helps? It seems like even though packages get compiled down natively, going into the native code folder (alongside byte compilations) , init.el doesn’t have an option for it).
https://redd.it/14ce4va
@r_emacs
Eglot + clangd not working for NetHack code base
My configuration of Eglot is simple: (use-package eglot :hook (c-mode . eglot-ensure))
. And it works for a single c file. But when I use this setup to read the code of NetHack, it doesn't work for linting and definition finding (M-.), even though eglot connection has no problem. I observed the same problems when reading the code of SQLite. Some specific problems I observed:
for #include "hack.h"
>clang [pp_file_not_found\]: 'hack.h' file not found
for boolean known;
>clang [unknown_typename\]: Unknown type name 'boolean'
I think the problem may be due to a mismatch of C version between the code and clangd. But how can I tell clangd to check a specific version of C (eg. C99)?
(Edit) I just tried to use `c-ts-mode`, and for some reason the linting issues went away but I still cannot jump using (M-.).
(Edit 2) It seems that the problems in SQLite source code went away when I use c-ts-mode.
(Edit 3) Still have the following problem when I use (M-.) in NetHack code:
>No definitions found for: LSP identifier at point
https://redd.it/14bvsde
@r_emacs
Way to make Emacs feel smoother?
Hey, the following question might seem pretty silly and unimportant, but I'm a freak so seriously value something like this. I'm running on a really powerful desktop setup rn with a 165 Hz referesh rate monitor and right now I am stuck between the choice of Neovim and Doom Emacs for my preferred choice of text editor/productivity program. I really really like the integrated environment and the raw amount of power that Emacs provides, and features like Org mode especially are enticing. I've tried emulating the org-mode experience in Neovim with Neorg but it's honestly pitiful in comparison, at least at the very moment. However, the biggest thing that bugs me with Emacs compared to Vim right now is just speed.
Now, I'm not talking about startup speed. I know about the Emacs --daemon and Emacsclient commands and how to set all of that up. Rather, I want to know if there's any way to speed up the text-editing and general UI experience. Vim is hyper-silky smooth, when I type in text it shows up almost instantly. Emacs is not laggy but it just feels sluggish in comparison, especially to someone like me who is a freak when it comes to things like this. Plus, Nvim's autocomplete functionality is incredibly fast to appear whereas in Emacs I often have to wait half a second or so to show up which is pretty annoying!
Now, I understand that realistically, this is a difficult ask. Vim is a quick little TUI application - whereas Emacs is a massive GUI application which doubles as a LISP interpreter and all this other junk. But honestly, considering the specs of my computer, I feel like there should be some sort of way for me to speed up the Emacs experience to make it silky smooth.
https://redd.it/14c4l8j
@r_emacs
emacs ft. moonlander
I just buy a moonlander keyboard and been trying it out. So anybody have some advice to use it with emacs? I have set various 'global-set-key' in my emacs config and beeing setting up my keyboard, but when I fix some keybinding another gets broken xd.
Any advice or some config to start using?
https://redd.it/14byak7
@r_emacs
Build Emacs for iPad using WASM
Has anyone tried building Emacs for iPad by targeting WASM, which can run on the JavaScriptCore framework? Applications such as a-Shell already provide a terminal environment for running WASM binaries. Running Emacs locally on your iPad has many benefits compared to running it on a remote host.
One of the challenges with cross-compiling Emacs is the dumping. Perhaps a way around that is to just use “temacs”, which avoids the dumping step.
https://redd.it/14buxle
@r_emacs
Eglot + pyright can not get completion on django.db.models
Recently, I tried to use Eglot + pyright on Django project.
But pyright doesn't works as expected, can not get completion on when import django.db.model
Any one known how to make pyright works with Django?
Steps to reproduce:
​
1. setup project
​
pip install django
mkdir django-project
cd django-project
python3 -m venv ./.venv
.venv/bin/python3 -m pip install django
source .venv/bin/activate
django-admin startproject CoreRoot .
django-admin startapp core
python manage.py migrate
python manage.py runserver
2. Install Pyrightsudo npm install -g pyright
3. Install pyvenv for activate virtual environment in Emacs
(use-package pyvenv
:hook (python-mode . pyvenv-mode)
:config
(setq pyvenv-post-activate-hooks
(list (lambda ()
(setq python-shell-interpreter
(concat pyvenv-virtual-env
(if (eq system-type 'windows-nt)
"scripts/python"
"bin/python")))))))
4. Start Emacs and open the file: django-project/core/models.py
5. M-x pyvenv-activate
and choose the .venv
directory
6. M-x eglot
, and choose pyright-langserver
7. Try some example code in django-project/core/models.py
as below:
from django.db import models
class Person(models.Model):
firstname = models.CharField(maxlength=30)
lastname = models.CharField(maxlength=30)
8. You find that you can't get completion for "CharField", see pictures as below:
​
can get models
​
Can not get CharField
​
9 . I also tried python-language-server(pylsp), it can get completion but the server is a little slow, I can feel delay while input characters.
​
works as expected with pylsp
You can test with this example project: https://github.com/Eason0210/django-project.git
My personal Emacs config: https://github.com/Eason0210/.emacs.d
my Emacs version:
GNU Emacs 30.0.50 (build 1, x86_64-apple-darwin22.5.0, NS appkit-2299.60 Version 13.4 (Build 22F66), git sha1 8657afac774) of 2023-06-16
​
https://redd.it/14bjioi
@r_emacs