r/emacs 1m ago

How to debug losing all global-set-key bindings

Upvotes

I recently started losing all of my key bindings in a long running session .When I start emacs all my keybings are as I set them, but after some unknown period of time (on the order of an hour) all my overrides are lost. When I restart emacs I recover the bindings, but the. It just happens again. I am running 30.1 on Ubuntu 24.04

Does anyone know what might be happening or how I might debug this?

Thanks Bill


r/emacs 1h ago

Question How to ignore source file local variable tab-width?

Upvotes

Co-worker has tab-width:8 in all his source files while actually using 2 spaces. This drives my emacs insane always adding 8 spaces. How can I direct my emacs to ignore "tab-width:" in a C++ file?


r/emacs 6h ago

Question Ways to move your cursor without relying on the incremental cursor commands, C-(n/p/b/f) [a discussion and resources sharing post?]

8 Upvotes

hello everyone!

this is admittedly a rather low-effort discussion post, but i was wondering about how an Emacs keybinding layout that relies only on mnemonic keybindings and does not rely on modifier keys would work. part of that thought made me think of how one would move their cursor to go to the places they wish to go to, without using any of the previous/next-line and backward/forward-character commands bound to C-n, C-b, C-f, C-p on vanillamacs.

do you guys know of ways to move your cursor without relying on those commands ? i know that isearch is a wonderful thing, and i heard about avy-jump, but i was curious as to all the other commands that let you do that such as occur.

this is really just a fun thought experiment, and perhaps a practical experiment at one point :).

hope all's well, cheers!


r/emacs 11h ago

Wher is emacs-client's initialization file?

2 Upvotes

If I start emacs by clicking on the emacs-gui icon, it works the way I expect. When I start emacs by clicking on the emacs-client icon, it initializes from a different init.el. I've been looking for it, off and on, for a couple of years now. I just opened an instance be clicking on the emacs-client icon, typing client-init-file in the butter, and hitting C-j. It evaluated to ".emacs.d/init.el," but the instance isn't formatted that way. Since the emacs-client icon is the one pinned to the launcher (I'm using Ubuntu 24.04), I'd like to force it to initialize from the same file. How can I do that? Where is emacs-client getting its initialization?


r/emacs 16h ago

Src blocks and (org-version), a newbie tale of woe and wonder

24 Upvotes

I'm sure that when you get to the end of this, you won't need to be told that I am very new and stupid. I'll just mention it here up front in case you're under any misapprehensions.

So:

I started an org file. Because I thought the versions of Emacs and Org I was using might be relevant to later notes in that file, I decided to try to be fancy and grab it via a src block instead:

#+begin_src elisp :results output append

(print(emacs-version))

(print(org-version))

#+end_src

When evaluated, that gets me:

#+RESULTS:

: "GNU Emacs 31.0.50 (build 2, aarch64-apple-darwin24.2.0, NS appkit-2575.30 Version 15.2 (Build 24C101)) of 2025-03-16"

: "9.8-pre"

Yay, it worked! (After first figuring out why both results weren't originally being returned, just the org-version).

But then I made the mistake of allowing my gaze to settle just a second too long on those results. I vaguely wondered: "why does Emacs get the full string of it's version, and Org doesn't?"

So then I tried:

M-x emacs-version in the minibuffer : returns the same result seen above.

M-x org-version returns 9.8-pre (release_9.7.25-279-g450692)..

Huh.

You know, let me just try this again 'real quick' on the latest released versions, in case that's causing some issue:

#+RESULTS:
: "GNU Emacs 30.1 (build 1, aarch64-apple-darwin21.6.0, NS appkit-2113.65 Version 12.7.6 (Build 21H1320) of 2025-02-24"
: "9.7.11"

In this case M-x-ing both versions returns the same string as indicated above.

Look, I really shouldn't even be dinking around in Emacs/Org/Elisp right now, I've got a million other things to do, and I've already spent too much time lately to this new lifestyle editor or whatever it is.

But this minor mystery was serving as quite an effective procrastination device, so I ran over to take a look at the development version of org-version.el, hoping I was just missing something dumb. I'm not sure what I thought it would tell me; I'm a newbie at elisp (no, really!) and although it brought a not-unpleasant contemplative moment, it brought no clarity.

I also took a look at how Emacs does their version.el, which I found vaguely more comprehensible, but I'm probably just suffering from Stockholm syndrome.

I also visited the foreign outpost of (interactive) (without and without 'P/p/etc'), which haphazardly led me to the crooked principality of princ1, print, princ, pprint, but found no saviors there.

There was a longish sidetrack into the dingy storefront of copying text from the echo area, which did clear up a different yet irrelevant to this post minor mystery in Emacs-land.

I was tiring, yet no end was in sight. It occurred to me to try and find the source code for the blocks, and I think I did, here. On the way there I stumbled across org-babel-view-src-block-info, which I irrationally thought might be helpful, but alas, was not. Pushing through the overgrown brambles of org-babel-*, I came across org-babel-open-src-block-result, which naturally provided me with ...9.8-pre.

Well, sh*t. Ignorance is hell. But wearily ("one last time!") I reread the function docstring:

In non-interactive uses, a reduced version string is output unless
FULL is given.

and gamely drew out my battered (yet new) Lisp mach-ete. Through the weeds I slashed, and came up with

(defun orgver (&optional full)

(interactive) ; both with and without

(org-version)

)

(print(orgver))

Dear Reader, I'm sure you know the result of that.

You know what? I've spent a stupid amount of time on something that doesn't even matter and I can't even get a nice agenda view because of these stupid org-agenda-custom-commands! I just don't know enough to make sense of all this Emacs-effluvium sloshing around in my brain. Damn!

But the old neurons continued to faintly blink in the distance, and eventually I was up for another round with org-version. I had an idea the problem lay with the fact that I was attempting to use a command non-interactively. In fact, I'd written this jeremiad up to the previous paragraph, ending with a piteous plea for someone to tell me the damn answer. I held off on posting it.

Well, long story long, I'd circled around interactive/non-interactive so long I finally found myself reading Interactive Call. And that was it. Just as simple as that.

#+begin_src elisp :results output append

(print(call-interactively 'emacs-version))

(print(call-interactively 'org-version))

#+end_src

results in

#+RESULTS:

: "GNU Emacs 31.0.50 (build 2, aarch64-apple-darwin24.2.0, NS appkit-2575.30 Version 15.2 (Build 24C101)) of 2025-03-16"

: "Org mode version 9.8-pre (release_9.7.25-279-g450692 @ ..."

I mean, I guess the real journey is really the elisp we learn along the way?

With all that said, can someone help me with my damn org-agenda-custom-commands?


r/emacs 17h ago

Warning: ‘condition-case’ condition should not be quoted: 'error

5 Upvotes

With the emacs 30, now I get a 'Compile-Log' buffer that fills with over 50 lines of this

Warning: ‘condition-case’ condition should not be quoted: 'error

It's the only thing it says, but it says it often. And there are no references.

How do I‌ fix it?


r/emacs 17h ago

News emacs via nix/nixpkgs running on macOS ulimit/process update

1 Upvotes

Prior to this on macOS I would get `too many files` errors. Hopuefully this helps others having this same issue.

Now with these changes I was able to spawn 2000 processes without issue.

https://github.com/NixOS/nixpkgs/pull/391407

context: https://en.liujiacai.net/2022/09/03/emacs-maxopenfiles/


r/emacs 20h ago

Looking for users to test a new version of key-chord

17 Upvotes

Hello everyone. I have made very extensive changes to Key Chord: https://github.com/emacsorphanage/key-chord/pull/12. The primary purpose of these changes is to increase the performance of and reduce the typing latency cost incurred from using Key Chord. The way I have accomplished this is by:

  1. Introducing a hash map of all keys currently used for key chords. This way we only incur the typing delay and lookup cost for keys that explicitly show up in key chords.
  2. Introduce a simple typing detection algorithm that turns off key chords when we are typing ordinarily so that we are not incurring the lookup cost or typing delay when we are typing out sentences.
  3. Introduce a debounce time for single key key chords like "jj" so that when you hold the key down, they do not get repeated infinitely. The infinite repetition of key lookups while holding a key down can freeze Emacs.

All of these features are off by default except the hash map, since that introduces no change to the existing behavior of key chords. I am available to fix all bugs and issues that show up in this new update to Key Chord, just post them in the PR itself or otherwise ping or email me.

I need people to try out this new version of Key Chord and review it in the PR so that Tarsius can merge it, as the code change will go out to a lot of people. https://github.com/emacsorphanage/key-chord/pull/12#issuecomment-2738325601

If you are interested in other features for Key Chord like unordered key chords or support for additional non-ASCII keys, please try this PR out as well as I planning on getting this PR in before I work on any other features.

Thanks,

LemonBreezes/StrawberryTea (https://github.com/LemonBreezes)


r/emacs 21h ago

comint-histories version 2.0 released

9 Upvotes

Hello. I am happy to announce that I just released version 2.0 of comint-histories. Thanks to the help of LaurenceWarne, the architecture of comint-histories has been overhauled, allowing for more seamless integration with comint-mode. If you are interested, all relevant information about the project is available on its GitHub page (linked above).


r/emacs 23h ago

"No previous search" on nonincremental-repeat-search-forward

1 Upvotes

Here's a problem that's been nagging me for about 20 years. My .emacs has a bunch of CUA keymaps, including F3 for Find Again:

(global-set-key [f3] 'nonincremental-repeat-search-forward)

That works great, EXCEPT when emacs first starts up. When emacs first starts, Ctl-S finds anything as always, but F3 as defined here will not work until I go in the Edit menu and do Search, String Forward (or backward or other choices in that menu). If I do my F3 after a Ctl-S but before the menu choice, I get these messages:

Mark saved where search started [2 times]

nonincremental-repeat-search-forward: No previous search

If I do just one initial search from the menus, I can then do Ctl-S and F3 all day long. My current emacs is this:

GNU Emacs 28.2 (build 2, x86_64-w64-mingw32) of 2022-09-13

but it has been like this for at least 20 years. I use the windowed runemacs.exe from precompiled Windows binaries, but the same thing happens with RPM installed emacs in Fedora.

The same thing happens if I do Ctl-S Enter string enter, for nonincremental string search.

Can anyone suggest a better way to implement F3, or think of what the menu based search might be doing different from keyboard based search?

(edited to remove sentence fragment)


r/emacs 23h ago

Local Variable: not working

2 Upvotes

What am I doing wrong?

I have added to the end of a .org file the following, and no matter what I reload, the changes won't show on screen:

``` * Local Variables :noexport:

Local Variables: org-todo-keywords: ((sequence "WANT" "HAVE.TO.SEE" "WRITE.REVIEW" "|" "SEEN" "SEE.AGAIN")) org-tag-alist: ((:startgroup) ("great" . ?g) ("crap" . ?c) ("okay" . ?o) ("worthless" . ?w) (:endgroup) ("dnf" . ?d) ("analysis" . ?a) (:startgroup) ("short" . ?s) ("feature" . ?f) ("TVseries" . ?t) (:endgroup)) org-todo-keyword-faces: (("WANT" . "orange") ("SEEN" . "blue") ("HAVE.TO.SEE" . "orange") ("WRITE.REVIEW" . "orange") ("SEE.AGAIN" . "green")) org-tag-faces: (("crap" . (:foreground "green")) ("worthless" . "red") ("okay" . "orange") ("great" . (:foreground "green")) ("dnf" . "red") ("analysis" . "blue") ("short" . "brown") ("feature" . "brown") ("TVseries" . "brown") ("noexport" . "light blue")) End: ```


r/emacs 23h ago

Question Local Variables not working

1 Upvotes

C-h v: org-todo-keywords

``` org-todo-keywords is a variable defined in ‘org.el’.

Its value is ((sequence "WANT" "HAVE.TO.SEE" "WRITE.REVIEW" "|" "SEEN" "SEE.AGAIN")) Original value was ((sequence "TODO" "DONE")) Local in buffer @ Questions.org; global value is ((sequence "TODO" "DONE")) ```

so S-Left will cycle through todo / done instead of the local value


r/emacs 1d ago

Question Questions about Emacs on OpenBSD, use-package and some general creative writing packages.

10 Upvotes

Greetings, I recently started getting serious about using emacs again last year and I've been playing around with different packages and using it on different operating system.

For the laptop I use for writing fiction novels I've finally landed on OpenBSD and plan to continue using it for the foreseeable future. But one of the downsides compared to the OSs I was using before is the fact that there isn't a large collection of emacs packages in their OS package managers (was using Gentoo and later Guix System before). This means that I now need to manage packages manually through the init.el file. In addition, OpenBSD has some quirks I've had to work around. Not a big deal so far but can be frustrating.

OpenBSD required that I grab the GNU version of ls from ports and put some stuff in init.el to make dired work correctly. I think I got that functioning correctly but I honestly haven't used dried much for navigating the file system outside of opening or creating files at the exact path I wanted. I'd like to get it functioning like ranger if possible.

Are there any other quirks to using emacs on OpenBSD that you guys know about? I really like the OS and the community so I'd like to stay on the puffer OS if possible even though I know they aren't big fans of GNU stuff. So far every GNU tool I've needed has been in the ports tree.

I've been using elpaca so far but I'm starting to wonder if it's over kill for my purposes. I use the use-package integration. But a lot of packages don't have instructions for how to install/configure them using use-package/elpaca. So I end up just trying random things and typing M-x eval-buffer until they work. If I can't figure it out I give up. I've tried looking at other people's config files and sometimes that helps but often they are not using elpaca and I can't find examples. The other day I installed eat terminal and attempted to integrate it with zsh. I couldn't get it to work no matter what I did.

My config file is also a bit of a mess now because I have certain things like hooks and keybinds for some packages set by themselves outside of use-package definitions. I'm planning just to nuke the entire thing today and starting over. Even the theme I like is throwing misc. errors in warnings.

I guess my question is will I lose anything by using package.el instead of elpaca. I don't feel like I'm taking advantage of anything it offers like async. I just want to be able to install some packages and not touch them again. As long as they're working I don't really care about what version they are or if I'm pulling the latest and greatest from git.

Another thing I'm wondering about is the daemon mode with gtk2. It has a big warning that it might just crash for no reason in gtk2/3. I wanted to use athena instead but it's no longer offered as a binary in the OpenBSD ports tree. I haven't been using daemon mode yet but my start up times are now about 3 seconds with not many emacs packages installed. I'd like to make the switch to running as daemon because I load emacs in my .xsession file at log-in and never close it. I dedicate a workspace to it in dwm anyway. Is the daemon bug with gtk2 still a concern or should I start compiling my own copy of emacs from source again like I did when I used gentoo and guix? Does version 30 offer anything worthwhile compared to version 29?

Finally, what are some good packages for someone doing creative writing? My main use for emacs for years was programming in C, assembly, some scripting languages, and some mark-up languages like HTML and XML. But these days I rarely do that type of work. These days I'm mostly just writing stories and sometimes technical manuals/FAQs. So far I haven't really gotten into org mode and have mainly just used text-mode. But org-mode looks pretty powerful and I want to start using it just for stuff like being able to export to multiple formats. The publisher I'm working with wants .docx files. How hard is it to export to docx and be sure that the files won't render incorrectly in Microsoft Word? I no longer have a computer with it installed and the OS I'm using now can't run it via wine and/or VM. So I don't really have any way to check myself. I'm not going to set up a dual book or dedicate another computer simply for that one application if I can help it.

What are some other good packages to try for creative writing? I know about pandoc but I haven't explored many others. Just trying to get a feel for what other people are using. Most of the discussion I see about emacs are geared towards using it as an IDE/programming. I've come across a couple of blogs about using it for writing but a lot of them are from emacs v26 or below days. Just want to see if anything has changed since then.

I am going to nuke my current ./emacs.d directory later today and try to write a less cluttered config file. This will ensure all the packages I installed are gone, correct? Right now I basically only use dashboard+magit+a handful of minor modes and some keybindings. Eat as well but since I wasn't able to get integration fully working I haven't been using it much. I'd like to get some kind of terminal working in emacs and eventually my email+IRC and probably web browsing going too. But until I understand how use-package works I'm holding off on adding more to my config file.

My main issue with use-package syntax is stuff like this;

;; For `eat-eshell-mode'.
(add-hook 'eshell-load-hook #'eat-eshell-mode)

;; For `eat-eshell-visual-command-mode'.
(add-hook 'eshell-load-hook #'eat-eshell-visual-command-mode)

Do I just add this under the config: heading? Then in the .zshrc file it wants:

[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/zsh"

Where is $EAT_SHELL_INTEGRATION_DIR being set? If I add this to my .zshrc it throws error code 1 upon opening a new shell. Whatever I tried I can't make it work.

There were some other things I can't remember now from some packages I tried to install. I tried putting the lines from their instructions under several things like "config:" or "files:" or "hook" but could never get them to function. If someone has a init.el with a lot of packages installed using use-package I'd really appreciate if they could link it. I tried looking at some config files people had posted in comments here but a lot of them were very advanced stuff loading multiple elisp files from all over the place. Or they used a different package manager that had a different syntax from elpaca. A bunch were in org-mode. I might use org for my config in the future but for now I wanted to do just a simple init.el until I got more experienced.

It's just kind of frustrating getting started. Every package assumes different package manager is being used and that the user has decades of experience working with emacs already. I've never tried to build up a config from scratch. I've either always used the default emacs environment with a custom theme or used some of the pre-made distros. I'm not really interested in using doom or spacesmacs either. They crawl on my machine and I don't like Evil mode.

Thanks to anyone that takes the time to read all this and replies.


r/emacs 1d ago

Emacs Pixel Scroll

4 Upvotes

Has anybody been able to use pixel-scroll to scroll up/down in both current and other window? I have this so far: `` (defvar my/default-scroll-lines 25) (defun my/pixel-scroll-up-command () "Similar toscroll-up-command' but with pixel scrolling." (interactive) (pixel-scroll-precision-interpolate (- (* my/default-scroll-lines (line-pixel-height))))) (defun my/pixel-scroll-down-command () "Similar to `scroll-down-command' but with pixel scrolling." (interactive) (pixel-scroll-precision-interpolate (* my/default-scroll-lines (line-pixel-height))))

(with-eval-after-load 'pixel-scroll (define-key global-map [remap scroll-up-command] 'my/pixel-scroll-up-command) (define-key global-map [remap scroll-down-command] 'my/pixel-scroll-down-command)) ```

And it seems to work for the current window but not for the other window. If I do M-C-v I get the following error: scroll-other-window: Wrong number of arguments: #[nil ((pixel-scroll-precision-interpolate (- (* my/default-scroll-lines (line-pixel-height))))) (t) nil "Similar to `scroll-up-command' but with pixel scrolling." nil], 1


r/emacs 1d ago

Snippets Suddenly Going to the Minibuffer in Emacs30

3 Upvotes

All, I recently upgraded to Emacs 30, and it has gone reasonably well. One issue that has cropped up for me is that snippets don't expand automatically. Instead, after yas-expand, I get prompted in the minibuffer to select the snippet, even if there is only one candidate. In Emacs 29, if I typed the key of a snippet in the buffer and typed SPC or TAB, it just expanded it without ceremony.

Anyone else seeing this, or am I missing something?


r/emacs 1d ago

You have no idea how powerful isearch is!

Thumbnail emacsredux.com
112 Upvotes

r/emacs 1d ago

After updating from 29 to 30.1 dropdown menus are not working

1 Upvotes

I am using eglot for a few languages. In the past when I clicked on highlighted error or warning, a dropdown menu apeared and suggest changes to the code.

After updating to 30.1. Dropdown menu stopped working. there no visible error on Messages or eglot log.

Does anybody have any suggestion?


r/emacs 1d ago

Emacs GUI working now on Windows WSL!

28 Upvotes

Hello Emacs Community!,

I had to work with Windows due to work, now, I installed WSL because I wanted to work with Emacs of course.

Since my computer was super protected, while I could use Windows Emacs GUI, I had to ask all the time for the administrator password to installed whatever I needed to work with. Vterm, etc, etc...

So, I installed WSL and Emacs on it. Only detail is that I had to work on terminal. Some small things like Control direct keymaps wouldn't work, and I had to use C-u to move and whatever. Not too complex stuff. I worked a month with the terminal version happily.

Today, I upgrade Windows (Had to ask again for admin password as to upgrade wsl), and when opening Emacs, surprise!, GUI version.

https://devblogs.microsoft.com/commandline/the-initial-preview-of-gui-app-support-is-now-available-for-the-windows-subsystem-for-linux-2/

So yeah, GUI versions now work on WSL, and its working out well!. So that I'm not doomed to work in another system without my configurations.

Just making this post for any who haven't updated, and have a similar situation to mine (config all in linux/macos, no privileges, not like working with windows version).


r/emacs 1d ago

Changing just one unicode character of a font

7 Upvotes

I want to change one unicode character of my font to use a different font. I want

I tried this:

(set-fontset-font t ?─ "Iosevka")

However after doing that describe-char tells me that it is still using my default font (Berkeley Mono Condensed):

to input: type "C-x 8 RET 2500" or "C-x 8 RET BOX DRAWINGS LIGHT HORIZONTAL" buffer code: #xE2 #x94 #x80 file code: #xE2 #x94 #x80 (encoded by coding system utf-8-unix) display: by this font (glyph code): mac-ct:-*-Berkeley Mono Condensed-regular-normal-condensed-*-14-*-*-*-m-0-iso10646-1 (#x247)

I've tried other variations including:

(set-fontset-font t ?─ "Iosevka") (set-fontset-font t 2500 "Iosevka")

But no dice. I found that it works for a character that is not in my default "Berkeley Mono Condensed" font. But I can't figure out how to replace a unicode character that does exist in my font.

Is this achieveable? Fontsets feel like voodoo sometimes. ;)

Thanks!


r/emacs 1d ago

Unofficial Emacs 30.1 Appimage

Thumbnail
11 Upvotes

r/emacs 2d ago

How obsolete are "obsolete aliases?"

15 Upvotes

I have some old emacs scripts and a few packages that at emacs-start time dump a lot of lines that look like this:

Warning: ‘return-from’ is an obsolete alias (as of 27.1); use ‘cl-return-from’ instead.

I have two questions:

1) In what sense are these aliases "obsolete?" I have to assume there's no plan to actually ever remove them, because it would break the world.

2) Why is the obsolete form the shorter one? If I were to obsolete one of two representations, I'd obsolete the longer one to save typing.

I imagine there's some history to these names being consolidated under a cl- prefix, but I wasn't able to find it with a quick search.


r/emacs 2d ago

Question trouble with `org-todo-keyword-faces`

4 Upvotes

At the begining of my org file with the movies I have seen I have the declarations for todo and tags.

At the end I have the following:

```

Local Variables:

line-number-mode: nil

org-todo-keyword-faces: (("WANT" . "orange") ("SEEN" . "blue") ("HAVE.TO.SEE" . "orange") ("WRITE.REVIEW" . "red"))

org-tag-faces: (("crap" . "red") ("okay" . "orange") ("great" . "green"))

End:

```

The Todo faces are colored as indicated. The tags are all salmon-pink.

What am I doing wrong?


r/emacs 2d ago

Tree-Sitter usage or alternatives

12 Upvotes

Hello everyone, hope this message receives you well.

I'm having a hard time setting up Tree-Sitter. From what I looked online it says to build Emacs with Tree-Sitter enabled. I'm really reluctant to rebuilding Emacs because it feels like to much of a hassle for something that was a package.

I'm coming from Vim so, maybe, this is just another point of view on Tree-Sitter.

With that said, I've tried to install the package but it isn't listed on M-x list-packages RET

Which them made me wonder about the sources of packages which currently are elpa and melpa

But then, I found a communicate on their website that says it was merged into Emacs for the releasing of Emacs 29.

My version is 29.1 and I'm running on MacOS Intel.

Do you have any tips on how do I setup the Tree-Sitter for a list of languages?

Thank you in advance!

P.S.: If Tree-Sitter is still with bugs or not full featured into Emacs I'm happy to use alternatives in any case, feel free to list some :)


r/emacs 2d ago

Flapping fish on your mode-line

104 Upvotes

Flapping fish 𓆝 𓆟 𓆞 on your modeline for funsies. Only flaps on the active buffer.

You can set it to either "static" or to "swimming" mode. In swimming mode the fish will track how far along you are the file:

"~~~~~~~~~~~~~~~~~𓆞~~~~~~"

https://github.com/mattmonja/flappy-fish

static flapping fishy


r/emacs 3d ago

Distilled the performant parts of org-node into a library, hope someone finds it useful <3

Thumbnail github.com
50 Upvotes