This channel is a feed for r/emacs. @r_channels @reddit2telegram
emacs pgtk system clipboard copy only works in edebug mode
I am running the emacs pgtk build on Wayland and haven’t been able to get clipboard kill/save to work. Yank works successfully and kill/save only works when running the function under edebug… it successfully shows up in my system when stepping through and just letting it continue. But when I disable debug on entry it stops working again.
In debug mode I see it enters the following function, iterates through some selection stuff, then shows up in my clipboard. Has anyone seen this before, the C code hasn’t seem to changed in years.
https://github.com/emacsmirror/emacs/blob/670e8db683c94cfaf7c3328b47be54147795250f/src/pgtkselect.c#L143.
https://redd.it/1avck9g
@r_emacs
Installing emacs from source
i am tying to install emacs with nativcomp from source in manjaro i3 editioni got this error
make3: Entering directory '/home/mohammed/emacs/src'
GEN globals.h
CC dispnew.o
CC frame.o
CC scroll.o
CC xdisp.o
CC menu.o
CC xmenu.o
CC window.o
CC charset.o
CC coding.o
CC category.o
CC ccl.o
CC character.o
CC chartab.o
CC bidi.o
CC cm.o
CC term.o
CC terminal.o
CC xfaces.o
CC xterm.o
xterm.c:602:10: fatal error: X11/extensions/Xinerama.h: No such file or directory
602 | #include <X11/extensions/Xinerama.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
m
​
https://redd.it/1av8i9r
@r_emacs
Tree-sitter version of TSX mode does not color the code
My config is very simple:
>(add-to-list 'auto-mode-alist '("\\\\.ts\\\\'" . typescript-ts-mode))
>
>(add-to-list 'auto-mode-alist '("\\\\.tsx\\\\'" . tsx-ts-mode))
>
>(add-hook 'typescript-ts-base-mode-hook (lambda () (lsp)))
I also have the grammars (TS and TSX) installed with treesit-install-language-grammar
from GitHub.
The treesit-font-lock-level
is the default 3.
It seems to work OK except that it does not color the code (for instance, the HTML tags and classes):
Am I missing something important in my configuration?
# Edits
There might be something wrong with my grammar, still. The error in my *Messages*
:
>Error during redisplay: (jit-lock-function 1692) signaled (treesit-query-error "Node type error at" 2 "(function name: (identifier) u/font-lock-function-name-face) (function_declaration name: (identifier) u/font-lock-function-name-face) (function_signature name: (identifier) u/font-lock-function-name-face) (method_definition name: (property_identifier) u/font-lock-function-name-face) (method_signature name: (property_identifier) u/font-lock-function-name-face) (required_parameter (identifier) u/font-lock-variable-name-face) (optional_parameter (identifier) u/font-lock-variable-name-face) (variable_declarator name: (identifier) u/font-lock-function-name-face value: [(function) (arrow_function)\]) (variable_declarator name: (identifier) u/font-lock-variable-name-face) (enum_declaration (identifier) u/font-lock-type-face) (extends_clause value: (identifier) u/font-lock-type-face) (extends_clause value: (member_expression object: (identifier) u/font-lock-type-face property: (property_identifier) u/font-lock-type-face)) (arrow_function parameter: (identifier) u/font-lock-variable-name-face) (variable_declarator name: (array_pattern (identifier) (identifier) u/font-lock-function-name-face) value: (array (number) (function))) (catch_clause parameter: (identifier) u/font-lock-variable-name-face) (import_clause (identifier) u/font-lock-variable-name-face) (import_clause (named_imports (import_specifier alias: (identifier) u/font-lock-variable-name-face))) (import_clause (named_imports (import_specifier !alias name: (identifier) u/font-lock-variable-name-face))) (import_clause (namespace_import (identifier) u/font-lock-variable-name-face))" "Debug the query with `treesit-query-validate'")
# Solution
One needs to downgrade the Tree-sitter grammars to match their Emacs. For me, it was v0.20.3 grammar with Emacs 29.1.
Perhaps the most straightforward way is to go delete your ~/.emacs.d/tree-sitter
, then reopen Emacs and do treesit-install-language-grammar
entering v0.20.3
as the "branch/tag" when prompted.
Find more details in these posts:
[https://www.reddit.com/r/emacs/comments/1apj22g/typescript\_treesitter\_mode\_syntax\_highlighting/](https://www.reddit.com/r/emacs/comments/1apj22g/typescript_treesitter_mode_syntax_highlighting/)
https://genehack.blog/2024/02/fixing-an-emacs-typescript-ts-mode-problem/
https://redd.it/1auyzgp
@r_emacs
Making imenu-list a bit prettier
I've been fooling around trying to get the outline sidebar I use (imenu-list) to look more like I want it to So far I've fiddled with the modeline and markers used at. each level. I'm tempted to try replacing the current buttons it depends on with a tree widget or perhaps try my hand at getting the caret icon to change from left to down depending on whether the subsection is folded or not.
https://preview.redd.it/nug3xprh3mjc1.png?width=1515&format=png&auto=webp&s=97a81fbdbbf191b40342f7e52529f2a2ee8c8034
https://redd.it/1auzked
@r_emacs
emacs 29.2 on MacOS Sonoma takes 40 seconds to exit - installed via Homebrew
I recently upgraded to emacs 29.2 on MacOS Sonoma via brew. Not thoughtfully as a mass update of everything. Things are mostly working with one exception that is very annoying to me. If I enable and use the auto-complete package, quitting emacs takes approximately 40 seconds.
I've profiled the functions listed in kill-emacs-hook and the problematic function is ac-comphist-save. This function writes out a file: \~/.emacs.d/ac-comphist.dat, which on my system is approximately 73K. I searched and found an exchange about someone having the same problem on an older version of emacs on linux, and the only offered solution was to remove ac-comphist-save from kill-emacs-hook. Sadly, this affects the effectiveness of auto-complete as it doesn't remember what completions you've used repeatedly and recently. Deleting ac-comphist.dat while emacs is not running "solves" the slow exit problem, but leaves me without my long history of auto-completion data.
**I'm at a loss of what to try next. Does anyone have any suggestions?**
My desired outcome is for exiting to take the split second that it did immediately prior to the update, and to have a fully functional auto-complete. My primary use of emacs is taking extensive notes for my work as a GIS analyst and I realize tremendous savings in having auto-complete suggestions for often repeated long detailed file names or function parameters that I need to have documented for my analyses, also it really helps with spelling peoples names in meeting notes.
Some details
The resulting install of emacs :
GNU Emacs 29.2 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60
Version 10.14.6 (Build 18G9323)) of 2024-01-18
Copyright (C) 2024 Free Software Foundation, Inc.
The messages written to the terminal while upgrading emacs.
==> Upgrading emacs
==> Downloading https://emacsformacosx.com/emacs-builds/Emacs-29.2-universal.dmg
==> Downloading from https://emacsformacosx.com/download/emacs-builds/Emacs-29.2-universal.dmg
################################################################################################### 100.0%
==> Backing App 'Emacs.app' up to '/usr/local/Caskroom/emacs/28.2/Emacs.app'
==> Removing App '/Applications/Emacs.app'
==> Unlinking Binary '/usr/local/bin/emacs'
==> Unlinking Binary '/usr/local/bin/ebrowse'
==> Unlinking Binary '/usr/local/bin/emacsclient'
==> Unlinking Binary '/usr/local/bin/etags'
==> Unlinking Manpage '/usr/local/share/man/man1/ebrowse.1.gz'
==> Unlinking Manpage '/usr/local/share/man/man1/emacs.1.gz'
==> Unlinking Manpage '/usr/local/share/man/man1/emacsclient.1.gz'
==> Unlinking Manpage '/usr/local/share/man/man1/etags.1.gz'
==> Moving App 'Emacs.app' to '/Applications/Emacs.app'
==> Linking Binary 'Emacs' to '/usr/local/bin/emacs'
==> Linking Binary 'ctags' to '/usr/local/bin/ctags'
==> Linking Binary 'ebrowse' to '/usr/local/bin/ebrowse'
==> Linking Binary 'emacsclient' to '/usr/local/bin/emacsclient'
==> Linking Binary 'etags' to '/usr/local/bin/etags'
==> Linking Manpage 'ctags.1.gz' to '/usr/local/share/man/man1/ctags.1.gz'
==> Linking Manpage 'ebrowse.1.gz' to '/usr/local/share/man/man1/ebrowse.1.gz'
==> Linking Manpage 'emacs.1.gz' to '/usr/local/share/man/man1/emacs.1.gz'
==> Linking Manpage 'emacsclient.1.gz' to '/usr/local/share/man/man1/emacsclient.1.gz'
==> Linking Manpage 'etags.1.gz' to '/usr/local/share/man/man1/etags.1.gz'
==> Purging files for version 28.2 of Cask emacs
🍺 emacs was successfully upgraded!
​
https://redd.it/1aufbqh
@r_emacs
Save org files after every change
I'm currently trying to save my org files after every change. I know this might be sub optimal but I want to finish this at least for the purpose of learning how to do something like this.
So my approach was to add a hook for org mode that adds a hook for after-change-functions. Unfortunately this is active for all files once I've opened an org file. This is the code
(defun savebuf(begin end length)
(if (and (buffer-file-name) (buffer-modified-p))
(save-buffer)))
(add-hook 'org-mode-hook
(lambda()
(add-hook 'after-change-functions 'savebuf)))
So I added another hook for major mode changes to remove the after-change-functions hook like this
(defun leave-org-mode-function()
(when (eq major-mode 'org-mode)
(lambda()
(remove-hook 'after-change-functions 'savebuf))))
(add-hook 'change-major-mode-hook
'leave-org-mode-function)
Unfortunately this doesn't seem to work. The first hook still stays active and saves everything regardless of major mode. Any Ideas how I could make this work?
https://redd.it/1aufydk
@r_emacs
Update to dired-auto-readme-mode
https://github.com/amno1/dired-auto-readme
https://redd.it/1au6j6p
@r_emacs
how to import mails in notmuch
How to import emails from mailing list archives? In example I would like to have https://lists.gnu.org/archive/mbox/emacs-orgmode/ I converted format with https://manpages.ubuntu.com/manpages/focal/man1/mb2md.1.html to Maildir format. But where to put all files in my Mail folder? Just throw everything into Gmail/Inbox/new? Or maybe better to create new folder? I use only 1 gmail account. Here's my dir structure:tree -d
.
├── drafts
│ ├── cur
│ ├── new
│ └── tmp
├── Gmail
│ ├── [Gmail]
│ │ ├── All Mail
│ │ │ ├── cur
│ │ │ ├── new
│ │ │ └── tmp
│ │ ├── Drafts
│ │ │ ├── cur
│ │ │ ├── new
│ │ │ └── tmp
│ │ ├── Important
│ │ │ ├── cur
│ │ │ ├── new
│ │ │ └── tmp
│ │ ├── Sent Mail
│ │ │ ├── cur
│ │ │ ├── new
│ │ │ └── tmp
│ │ ├── Spam
│ │ │ ├── cur
│ │ │ ├── new
│ │ │ └── tmp
│ │ ├── Starred
│ │ │ ├── cur
│ │ │ ├── new
│ │ │ └── tmp
│ │ └── Trash
│ │ ├── cur
│ │ ├── new
│ │ └── tmp
│ └── Inbox
│ ├── cur
│ ├── new
│ └── tmp
└── sent
├── cur
├── new
└── tmp
https://redd.it/1au73ys
@r_emacs
Upvote this PR to give VS Code buffers like Emacs
🙏 Please toss an upvote on this issue—it needs 20 upvotes in 90 days to be merged. https://github.com/microsoft/vscode/issues/204942
Sometimes I use VS Code for work, to understand a plugin, and just to explore.
Window splitting in VS Code drives me nuts. Window management is too closely tied up with tabs. You end up with an hierarchy of "Editor Groups" and "Editors" instead of being able to recall any buffer wherever you want. Then Quick Open (buffer switcher) opens a file multiple times—one per Editor Group. Using VS Code's `revealIfOpen` option partially addresses this, but reveals in the previous Editor Group—it can't recall the file into the Editor Group your cursor is currently in like in Emacs.
We added `revealIfOpenInActiveGroup` to fix this. This allows you to make VS Code work just like Emacs buffers. Here are the docs for the Get Started page in VS Code docs:
\### Simulating Buffers
If you're coming from buffer-centric editors such as Emacs or vi, you can emulate that workflow with:
"workbench.editor.showTabs": "single",
"workbench.editor.revealIfOpen": true,
"workbench.editor.revealIfOpenInActiveGroup": true,
"workbench.editor.closeEmptyGroups": false,
VS Code has a model where Editors live hierarchically within Editor Groups, and to split your screen you must use Editor Groups. Using `revealIfOpen` with `revealIfOpenInActiveGroup` causes Quick Open to move already-open Editors into the active Editor Group. This allows you to emulate buffer-centric environments—no tabs, split your screen, and you can view any Editor within any Editor Group without opening a file multiple times.
PR (with video!): https://github.com/microsoft/vscode/pull/205442
Issue: https://github.com/microsoft/vscode/issues/204942
Docs PR: https://github.com/microsoft/vscode-docs/pull/7043
https://redd.it/1au4mjg
@r_emacs
declare multiple fold syntax'es
I want to tell emacs to, for every c/c++ file, fold every syntax which starts and ends with, lets say:{{{
and }}}
#ifdef PLATFORM_*
and #endif
(*
being wild-card)
and maybe i want to add few other syntaxes
how to do that?
(i'm aware outline-mode and hs-minor-mode exist, idk if i'm even supposed to use them together, or are they their own separate things..?)
https://redd.it/1atuweq
@r_emacs
is there a way to restore an emacs session based on a directory?
i started using emacs only for org-mode but i want so bad to just live in it while coding too.
one thing that's keeping me is that i can't restore open buffers and what i was working on when opening a directory.
in neovim it is as easy as installing a plugin an then it will work whenever you open neovim inside a directory.
in doom emacs i found the workspace feature that i liked because it creates a new workspace whenever i use "projectile switch" but when i kill emacs all i find left is the last workspace (i don't know if i am doing anything wrong but i am using SPC TAB . which is like "M-x workspace switch to")
i believe that i just don't know the keyword to look for my solution (because that's how i descovered Projectile too ^+^ )
thanks for any help
https://redd.it/1atnbz7
@r_emacs
I am on mac and have been trying to solve this issue for days.
I got doom emacs, running org roam via adding (package! org-roam) to packages.el, and set the org roam directory in config.el with (setq org-roam-directory "\~/Documents/romes"). But when I run org-roam-db-sync it gives me finalizer failed: (wrong-type-argument sqlitep nil) and I do not have a org-roam.db in that folder. I am so stuck on what to do, when running doom doctor I get "! The installed grep binary was not built with support for PCRE lookahead" which might be a clue? but I think its something with sqlite?
https://redd.it/1atg3qz
@r_emacs
Making emacsclient follow config.el
I just started using doom emacs and I wanted to increase it's font size so I added the line
doom-font (font-spec :family "Fira Code" :size 18 :weight 'regular))to the config.el file in ~/.doom.d folder. Now the font size in emacs has increased but it is still the same as it was before in emacsclient. How do I make changes in the configuration so that they are reflected across both emacs and emacsclient? Any help would be appreciated.
Emacs: modern minibuffer packages (Vertico, Consult, etc.)
https://www.youtube.com/watch?v=d3aaxOqwHhI
https://redd.it/1ata3o3
@r_emacs
TIL: Emacs has a very nice built-in binary data library
https://www.gnu.org/software/emacs/manual/html\_node/elisp/Byte-Packing.html
I found it useful in exploring elisp's network libraries.
​
https://preview.redd.it/qm4slesg95jc1.png?width=2480&format=png&auto=webp&s=b277650a4c9fb4ec8bb27a206c0106b158f3d999
​
https://redd.it/1at1iy0
@r_emacs
Installing emacs from source
i am tying to install emacs with nativcomp from source in manjaro i3 edition
i got this error
https://redd.it/1av8i98
@r_emacs
Emacs Keybindings vs. Vim (Evil Mode) in Emacs: Which Offers a More Seamless Transition and Productive Editing Experience?
In the world of Emacs, there's a perennial debate between purists who swear by Emacs' native keybindings and those who find solace in the familiarity of Vim keybindings through Evil Mode. Proponents of Emacs keybindings argue for their extensibility and deep integration with Emacs' ecosystem, while advocates of Evil Mode tout its efficiency and the muscle memory carried over from Vim.
For those who've made the switch, what are your experiences with either Emacs keybindings or Evil Mode? Did you find one to be more intuitive or productive than the other? How seamless was the transition from Vim to Evil Mode within Emacs? And for Emacs veterans, do you find that sticking to Emacs keybindings offers advantages that outweigh the allure of Evil Mode?
Share your thoughts, tips, and insights on navigating the Emacs keybindings vs. Vim (Evil Mode) dilemma in Emacs, and help others find their preferred path to a more efficient editing experience.
https://redd.it/1av7fde
@r_emacs
My new Emacs macOS icon
Hey folks, I know many of you use one of my macOS icons available via emacs-plus. I just finished another one and in the next couple of days I'll add it to https://github.com/SavchenkoValeriy/emacs-icons and emacs-plus.
What do you think?
https://preview.redd.it/fm2ikgveamjc1.png?width=1024&format=png&auto=webp&s=153b707d258845b35b9ef666bb3d7db51e838fee
https://redd.it/1av0ndp
@r_emacs
[Windows] Why is my Emacs in low resolution? Other applications are fine
https://redd.it/1aun0vg
@r_emacs
How to set faces using dynamic colors?
I want to change org-todo-keyword-faces
and make TODO yellow and Done Green for example, but I don't want to use a fixed yellow color, I want to use my current theme yellow or blue or whatever, I have a variable called ef-dark-palette
that has the theme colors, but what if I switched my theme? how can I use dynamic colors that change depending on my current theme instead of fixed colors?
https://redd.it/1auhjpb
@r_emacs
I want to learn what Emacs offers for editing text and doing things faster.
I did the first half of the tutorial and skimmed the second half. I learned the hotkeys for moving around sentences and lines, moving up and down screenfuls etc. I did a lot of looking up about Emacs and am overwhelmed on how to get out of it what I want to. I want to learn more things like those hotkeys and how Emacs can be used to edit and navigate text fast. Are there any resources for that specifically, as well as complete guides to not only Emacs itself but the whole Emacs ecosystem? Are there any lists for all the popular ecosystem things like Spacemacs and Evil mode?
https://redd.it/1au10ha
@r_emacs
Lookup the Documentation of Functions, Variables and Faces
https://emacsredux.com/blog/2024/02/18/describe-symbol/
https://redd.it/1au6v8o
@r_emacs
how to run a command/script on html file exported by emacs orgmode
so i want to share exported html notes to buddies and i wanted to embed images i wrote a python script and i can run it manually from the cli and be happy. but it tedious
can u help me here how can i automatically run this python script on the html exported my orgmode, preferably i would want to do so on specific files only not all exports.
if this functionality and the python script itself could be written in elisp that would bee super awesome to see but for the time being if u just help me to write a function to get mentioned functionality would be enough
https://redd.it/1au40d8
@r_emacs
A small update to org-view-mode
https://github.com/amno1/org-view-mode
https://redd.it/1au2nh3
@r_emacs
Is there anyway to crop the file column length to 10 characters on agenda clock view? or remove it if not
https://redd.it/1atpx4d
@r_emacs
EXWM not working
I installed emacs from source and from package install and every time i login to emacs its not full screen and when i try to run ANY exwm command it gives me an error saying something about xcb. EVERYTIME no matter what i do i have no idea how to fix this but i hope someone can help me.
https://redd.it/1atmhj3
@r_emacs
LSP Best Practices in Emacs?
Hi there. I've been back and forth with emacs and neovim for a long while now, preferring emacs but also kind of getting wrapped around the axel a bit with lisp. But, now as I start to move back to emacs (ORG mode is just too good, and I like some of the TUI abilities elsewhere that emacs gives me) , I'm looking for if there's a generic and good way to set up LSP akin to neovim's "Mason" project, which lets me just select the languages I need and properly set everything up.
If not, that's cool, but discoverability is still very weird in the editor world. I know how to use package managers and plan on starting a config with elpaca or straight, and then adding on evil and which-key and some doom-themes and doom-modeline, but the whole setup and configuration of various LSPs are where there's a plethora of choice and I'm curious to see how people do it.
Thanks!
https://redd.it/1atge4a
@r_emacs
What are the best practices in laying out an init.el that won't turn into spaghetti after a year or two?
I last rewrote my init.el a decade ago, before use-package, and now it's a giant heap of files, often one per added package to init a package, that get loaded in, along with various global settings that are adjusted through setq
or function calls and then a custom.el
And this works, but it takes some time to start emacs up....
So I was thinking of re-doing this with the new fangled use-package
all the kids are doing and was a bit dismayed to find now there are several other package managers, we went from none to plethora.
At any rate, I was wondering what the best way to lay out an init.el was, especially regarding ordering of things like
+ loading of packages
+ loading of custom.el (do I even need to explicitly load custom.el)
+ setting of global settings via setq or function call
+ key bindings
+ other??
When I lay it out like this, I think that's a pretty logical way of laying it out, but is it?
What else should be considered in laying out an init.el to make it survive the decades?
https://redd.it/1ata6ag
@r_emacs
Can LSP browse modules?
One thing I miss from other packages is the ability to ask eglot for all the modules/functions/symbols it is aware of, whether used or not, so I can quickly visit them. Am I missing this, or is it not part of the LSP spec? Any workaround people use?
https://redd.it/1at59of
@r_emacs
emacs version for Fedora does not exist on the emacs version web page
When I looked at the version of emacs on Fedora using dnf info
, it shows 28.3 but the versions I see on the gnu website show 28.2 then 29.1.
So I am not sure which version of emacs is the safest to install : the 28.3 one on Fedora that does not exist in the releases page, the 28.2 which got an update, the 29.1 or 29.2 that Fedora does not provide ?
https://redd.it/1at0vf4
@r_emacs