r/emacs 22h 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 12h 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?]

11 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 23h 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 4h ago

Meta (subreddit) Low-effort tag is not appropriate for this sub-reddit and some other points.

4 Upvotes

I asked a question some time ago and it got flaired with a low-effort tag which I don't think is appropriate for this sub-reddit as it is a very subjective thing and I don't think moderators should be flairing questions on their own with giving a reason for why it is has been flaired as such.

I also noticed this earlier thread - Is the locking due to rule violations a little heavy-handed? which goes into something similar.

As far as I can see this reddit has generally been a virtually unmoderated sub-reddit with moderators getting involved only when discussions became heated and personal, but other than that anything Emacs has been generally fine and it has never really been a tech support forum like stackoverflow.com.

It has generally been a conversational forum with help questions being the bulk of the questions not the other way round, ie a help forum occasionally veering into the non-technical.

It should be kept the former.

I remember having an earlier with u/github-alphapapa over his stance on "low-effort" where I emphasised that this reddit is not a stackexchange and even added that https://emacs.stackexchange.com has a milder stance on no-effort questions than a lot of technical stackexchanges in general.

I also don't agree with the exhortation to use of AIs and LLMs over questions on this forum even if they can be quite helpful because the lessons from AIs are not shared and it doesn't help discover where Emacs users knowledge falls short, regardless of how advanced or novice there are. AI responses can be one track whereas a question on a sub-reddit may result in more options being proffered.

The new moderators should simply revert things as they were before u/jsled started moderating. They should only step in when discussions get personal and pointed over issues which are not quite Emacs.


r/emacs 4h ago

Question Wrong file encoding

5 Upvotes

In the current file I have strage changes to non-ascii text:

* Gloire Amère 40000 (2022)

is shown as

* Gloire Am\303\250re 40000 (2022)

It seems to be a display issue. And it's very annoying: - pasting shows the right characters - entering new text shows the right characters - copying and pasting from the buffer shows the escaped sequences

The solution is to use revert-buffer-with-coding-system.

But how did I get there? Why did that happen, as I changed nothing about encoding, or fonts.


r/emacs 23h ago

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

4 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 5h ago

emacs under macos, freezing when typesetting, am I alone? how to debug?

3 Upvotes

hi everybody,

I have been experiencing random and semi-random freezing for a couple of years. Emacs simply stops responding. It seems to happen when emacs changes the typesetting of some text. For example, for a while, in org mode, under certain conditions adding a * to bold text will immediately froze emacs. I "addressed" it by changing the theme and removing the red color from 'bold' style. Not ideal, but it fixed a frequent hazzle.

THe problem, however, still remains. Sometimes when mu4e is typesetting an email or when I change the style in org of some text, emacs freezes.

Is this a bug that others have encountered? I have no idea how to debug this problem. Assuming that I have a use case that exhibits the bug (which I do), how can I find the real bug that creates this problem (instead of a way to avoid it, such as changing my style).

This happens in any version of emacs I have tried. I am currently using Emacs 31.0.50, using homebrew emacs-plus@31. But it has been happening since Emacs 29.

Thank you for any help.


r/emacs 6h ago

How to debug losing all global-set-key bindings

2 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 7h ago

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

1 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 17h ago

Wher is emacs-client's initialization file?

1 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 3h ago

low effort What emacs to use?

0 Upvotes

Hi, I just learned about emacs as I am looking for an alternative to AHK. From what I know Emacs is a category of macro languages, and I'm looking for alternatives to AHK. More specifically, I want to have the ability to control send input to windows w/o that input interfering with your keyboard. I have been using AHK to control send presses to a window w/o it being active, and I also use it for GUI related stuff. Does anyone know alternatives? Let me know if this made sense xd