/r/emacs
The extensible, customizable, self-documenting real-time display editor.
A sub-reddit for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!
Get Emacs
Rules
Emacs Resources
Emacs Tutorials
Related Subreddits
Useful Emacs configuration files and distributions
Quick pain-saver tip
/r/emacs
I have this org-capture template:
(setq org-capture-templates
'(("t" "Todo"
entry (file+headline "/my/path/notes.org" "Heading")
"* TODO %^{Heading}"
:prepend t)
))
When I use it and hits finish, this:
* Heading [1/2]
** TODO Old entry 1
** DONE Old entry 2
Ends up looking like this:
* Heading [0/0]
** TODO New enty
** TODO Old entry 1
** DONE Old entry 2
That is, the statistics cookie is being reset. This only happens when the :prepend
property is true. Is this a bug or am I doing something wrong?
EDIT: It persists after upgrading to org-mode 9.7.16
EDIT 2: Adding this to the org-capture-template fixed it::before-finalize org-update-parent-todo-statistics
This is a thread for smaller, miscellaneous items that might not warrant a full post on their own.
See this search for previous "Weekly Tips, Tricks, &c." Threads.
Don't feel constrained in regards to what you post, just keep your post vaguely, generally on the topic of emacs.
For <reasons> I have been looking at setting up Emacs as my mail reader again, using it with my Gmail account. rmail is my all-time favorite mail reader, but I could live with Gnus as well.
But it looks to me like Gmail has made it so difficult to set things up now, with oauth2 and whatever else -- I just want to weep thinking of losing another week of my life trying to figure it all out.
So, I'm wondering, are there any email providers -- free would be nice, cheap would be ok -- that still work relatively easily with Emacs that people could recommend? I gather Microsoft's Outlook email has gone the same route as Gmail, so not that. It could be IMAP or heck, even POP3, if that still exists.
I installed doom emacs on my windows machine, but the emojis arent showing up. How can I fix this?
I was thinking there are a few functions for managing backup files that would be nice to have, such as opening a backup file corresponding to the file you're visiting, switching a file to numbered backups, and saving a backup file at intervals (rather than only the first save since that file was visited). I don't think this is built in. Is there a package that provides this sort of thing?
Why does the following block of code not work?
(require 'async)
(async-start
(lambda ()
(global-auto-revert-mode 1))
'ignore)
Hello!
I just finished the work on `js-pkg-mode`. It is a fork of npm-mode with added support for all modern javascript package managers and runtimes:
Project page: https://github.com/ovistoica/js-pkg-mode
Functionality:
Hope you find it useful!
I am wondering if it is safe to use packages like magit or lab.el which operate on confidential data of my company. Any comments?
(I'll admit, I'm an emacs newbie!)
I set up doom emacs last night and added the wallabag.el package as well as:
emacs-request and emacsql.
For Wallabag, I think I've added the username, password, and API info correctly, in the use-package.el file.
But when I try to load wallabag, I get the following response:
symbol's function definition is void: emacsql-sqlite
I'm too green with emacs to properly troubleshoot this! And the github for the package isn't very active, so I'm hoping for some tips or ideas here!
(The github of the package in question: https://github.com/chenyanming/wallabag.el)
When you start a long running process like long-running-process.sh &
in terminal packages liketerm
, vterm
and eat
will they continue to run when the terminal is exited (which they should) and/or Emacs is shutdown?
If they do will that because that is inherent in the shell system?
I am using a themed doom emacs but the color of the inactive line numbers is too dim for me. Where could I change that ?
We have recently started to migrate from Jenkins to GitHub Actions. I'm in the process of learning GH Actions and testing things out. I would very much like to view job logs in Emacs, so I tried to find a package for this, but did not succeed. Using the gh
command line tool is not really an alternative either. I also looked through the Magit Forge documentation to see if Magit Forge had any tools for this, but I didn't find anything there either.
Does anyone work with GH Actions from within Emacs?
Hey all!
I'm having a bit of trouble getting syntax highlighting working for graphql string literals in a `tsx-ts-mode` buffer.
I want to get string like const gqlString = gql\
query Foobar(....) {....}`` with graphql syntax.
I've been hacking on this for a while, and so far have:
(defun me/add-typescript-font-lock ()
(setq-local treesit-font-lock-feature-list
'((comment declaration definition)
(keyword string escape-sequence type variable)
(constant expression identifier number pattern property)
(operator function bracket delimiter)))
(setq-local treesit-range-settings (treesit-range-rules
:embed 'graphql
:host 'tsx
:local t
;;:offset '(1 . -1)
"((call_expression function: (identifier) @_fn arguments: (template_string) u/capture) (#equal @_fn \"gql\"))"))
(setq-local treesit-language-at-point-function #'me/treesit-language-at-point-tsx))
(add-hook 'tsx-ts-mode-hook 'me/add-typescript-font-lock)
Treesitter seems to be parsing the buffer and treesit-node-at
seems to be giving me the what I expect, but I still don't have the syntax highlighting. Does anybody have any example of something similar I can learn from?
Cheers!
Hello I have the following code I am trying to get working
(use-package back-button
:bind (("C-M-<" . back-button-global-backward)
("C-M->" . back-button-global-forward)
("C-<" . back-button-local-backward)
("C->" . back-button-local-forward)))
But the only keybind not working in this list is C-M->. Even if I press describe-key (C-h k) and then try to type "Ctrl + Alt + Shift + ." nothing happens so it's like Emacs doesn't detect it.
Note pressing "Ctrl + Alt + Shift + ," does successfully call back-button-global-backward.
EDIT: Not an emacs issue, turns out that key combination is being eaten by some higher process than emacs, not sure what though
Has anyone successfully tried to map this key sequence?
https://emacsconf.org/2024/talks/
Which things are you excited about and what's your take on why we should pay attention?
I'll jump into the comments to avoid measuring my own biases :D
If any presenters need my video making packages, dslide
and Master of Ceremonies (mc
) are both up to date now on my Github! Dslide is on both MELPA and Non-GNU MELPA and is reasonably stable.
I am trying to write code that would help me automatically narrow to the subtree when I visit a heading using Tab
in org-agenda.
As a tentative approach, my thinking is that it would involve adding a hook to the org-agenda-goto function. So I wrote the following code:
(add-hook 'org-agenda-goto 'org-narrow-to-subtree 90 nil)
However, it does not work, and I think I might be doing something wrong: When I visit a heading using Tab in the org agenda, it still shows me the whole file instead of just the subtree.
Would be grateful for any suggestions. Thank you!
Whenever I invoke magit
, I get the following error.
Turning on magit-auto-revert-mode...done
require: Symbol’s value as variable is void: git-commit-filename-regexp
The error goes away if I re-install the package, but re-appears if I restart emacs.
The following is my use-package configuration for magit.
(use-package magit
:config
(add-to-list 'display-buffer-alist
'("magit-diff.*"
(display-buffer-below-selected)
(window-height . 0.5)
(dedicated . t)))
:ensure t)
I would appreciate any help to resolve this issue.
Strangely, the error goes away if I load the files git-commit.el
and magit-status.el
!
hello! i'm looking for something rather specific, and wanted to ask you guys if you knew of any packages or ways of doing this that would help me
first, i'm gonna try and define a workspace. i talk about the workspaces commonly used in stuff like XFCE, i3 and so on, where certain apps are tied to certain workspaces, or are only accessible from this workspace. say you have firefox on workspace A, and a music player on workspace B. you only have access to and can use firefox in workspace A, and same for the music player in workspace B, but you can very easily switch between the workspaces by using a keybind, for example.
i note that my use of workspaces is to isolate apps depending on what the use case is. for example, i will separate apps in a "Working" workspace where i need to be productive, and a "Fun" workspace where i moreso have stuff like Steam, a chat app and so on.
i would like to be able to replicate this workspace feature, inside of a single Emacs frame (as working with multiple frames will quickly overwhelm me and it'll be hard to know which frame is tied to which use case).
i would also like those workspaces to have rather specific behaviors with buffers and windows :
like with the example of firefox and the music player, i would like to be able to isolate buffers to a specific workspace. this way, instead of having about 25 buffers i can auto-complete from when trying to switch buffers in workspace A, i can have, say, 10 for workspace A that are relevant for the workspace's purpose, 10 for the other workspace, and etc...
easily add buffers from one workspace to another
automatically send specific buffers to a pre-defined workspace, and still being able to move those buffers if i need to. for example, i'd like to send music-related buffers, like those that bango.el will create, into an "Utilities" workspace
as a bonus, maybe make it so whenever i open emacs for the first time in a session, specific buffers are already opened for specific workspaces, and would even have a pre-configured window configuration? such as the Utilities workspace already having the Bango Library buffer opened as a master stack, and two other windows open on the right side stacked on one another
do you guys know of any packages and set-ups that would let me do this?
thank you for reading, and have a great day :]
TL;DR : looking for an Emacs package/config that lets me simulate workspaces in a single frame. with it, i would hopefully send specific buffers to workspaces of my choosing, automate this process for specific buffers through my init.el, and possibly have specific buffers and window configurations, for different pre-made workspaces, already opened and ready whenever Emacs is launched
Well I think I banged this into shape pretty well as a first Elisp project. It certainly does what I want it to do so far though it's kind of ugly. I got a lot of good advice from this thread particularly from /u/arthurno1 for details on Elisp memory, strings, garbage collection, and coding patterns.
I absolutely welcome any sort of expert commentary in style, substance, and aesthetics. I was kind of winging this, one window open on the elisp.pdf reference manual banging things out in the other window.
So without further to-do: hexl-inspect
This package implements a minor mode named hexl-inspect-mode
to be used in conjunction with a buffer set to hexl-mode
. When activated, the minor mode will create a data inspection buffer, window, and display to the side of the hexl-mode
buffer. As the point moves around in the parent buffer, the contents will update to reflect the point’s position.
The mode depends on the variable state of hexl-inspect--big-endian-p
which determines how the data under the point is to be interpreted.
The automated update structure and the mode structure was patterned after the explore mode in treesit-explore-mode
in treesit.el
as that was the closest analog to what I was attempting to accomplish.
EDIT: Fixed the keymap bug. I was using defvar
and I was sure that was working before, but clearly not. The define-minor-mode
macro for :keymap
worked when I found a good example, so that's sorted.
I was trying to setup yasnippet with company-mode. I tried installing them separately and using :with company-yasnippet
in company backends. It actually works this way, but it has an issue after expansion. Usually, after expansion, some part of the snippets are selected by default which can be replaced by only typing any charecter or word. But in my case, instead of replacing that selected portion, it is prepending the characters I am pressing to already existing characters. Below is an example with python file where the pass
keyword is selected after expanding a snippet. when I press a
it prepends a
to pass
making it apass
instead of replacing pass
with a
. Could anyone help me with this?
`pass` is selected after snippet expansion
Have been using Dired more lately, but I find it inconvenient that it creates all these buffers when I browse around my file system.
I checked dired-single
, but that doesn't seem to work. I also use dired-subtree
and dired-preview
.
Is there a way to:
Lists directory trees associated with the current revision allowing subdirectories to be descended or ascended and file blobs to be viewed.
Like the tree view of Tig [1]?
I do wonder what will happen to Emacs over time as things like Codeium's Windsurf proliferate. If you think coding assistants aren't going anywhere, download that one and try it out.
These tools generate entire project structures and populate the code from a single prompt. They then, if you want, refactor multiple files to accomplish a next prompt. The performance of several hours of work in less than a minute do mean that employers, for one, will require the use of these tools. And so will most hobbyists.
What is on the horizon (or already here) for Emacs in this area?
I'm getting nervous. I want to keep using Emacs, but I am unsure that I will be able to.
I've gone through the basic materials (EINTR, manual) for developing with emacs lisp. I understand the basics. I can do basic hacks here and there. But I'm disappointed in the ratio of code I write to the functionality I can add. Most packages I use aren't built on bare emacs lisp: consul, vertico, hydra, projectile, ivy, helm, transient.
Are there write-ups or other resources on how to start emacs lisp projects to develop a lot more effectively? Sorry if this is vague -- I'm having trouble starting to penetrate how more complex emacs projects can be built.
No matter their differences, one thing that unites Vim and Emacs is that both have their most-used key in an awkward position on modern keyboards 😂
Back when I was first trying out Doom, I remapped caps lock to be esc
; later on, when I switched to vanilla keybinds, I remapped it to C-
instead. Now, I'm giving meow a spin, and really enjoying it! Beacon is awesome, and the god-mode-like keypad offers a lot of what I liked about Doom's keymaps, but requiring essentially zero configuration.
One thing I am curious about is how other meow users are remapping their keyboards, or changing the example qwerty bindings. I'd like to keep capslock as C-
; one of the things I like about meow is that the vanilla keybinds are always there for you, and so there are still a lot of things that I want to use C-
for--C-s
/C-r
come to mind, of course, as well as C-u
.
However, when you're editing with meow, it has a vim-like reliance on escape again, which has been kicked out of the prime real estate on the capslock key and relegated once again to the corner of my keyboard. This means that I can either put esc
on capslock so I can exit insert mode while I'm editing, but need to reach awkwardly any time I want to use a default keybind with C-
, or I can put C-
on capslock and use vanilla keybinds just fine, but reach awkwardly every time I want to exit insert mode.
I'm especially surprised that discussions like this don't seem to mention this double-reliance on C- and escape and what people are doing to mitigate it. Anyone got any cool, ergonomic strategies in order to that are viable on normal qwerty keyboards?
The intersection of Emacs and Readeck users might be small, but I'd like to share some code I put together.
Readel: import Readeck annotations into Emacs. https://github.com/EFLS/readel/
Readeck is a self-hosted read it later service (see https://readeck.org), similar to Wallabag, Pocket, or (the now discontinued) Omnivore.
I wanted to more easily import my highlights (called annotations in Readeck) into Emacs, in Org-mode in particular, so I used request.el
and the Readeck API to automate this process.
It's the first time I use a REST API, and the first time I use request
but I'm glad to have something that works (and in Emacs Lisp at a level I can understand). The code is very basic, but I'm happy to share it here with others who might be interested.