Emacs

313 readers
2 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
176
177
 
 

I'd love to just be able to forward a message to a specific email address or apply a tag to have a todo item automatically added to my org agenda. Does anyone have a workflow or toolkit set up that does this?

178
 
 

i'm pretty sure i'm overthinking this but why does doom emacs have

SPC-c c for compiling

and SPC-c C for recompiling

i thought it should've been other way round as i generally put the command for compiling and then just keep recompiling repeatedly and i believe doing SPC-c c is faster than pressing SPC-c C

when so you either have four keys to press by doing SPC-c c to recompile

or you have to press four keys by doing SPC-c c assuming you press shift for C

what i prefer doing is using SPC-c c for recompiling only three keys to press

and SPC-c c for compiling normally

it's just a little thing annoying me whenever i go from one config of doom emacs to another

every person i've seen doesn't reconfigure this. but they do seem to be bothered by this they do realize how annoying it is but don't want to go through the hassle to remap that

what do you guys think am i too paranoid about this is my OCD kicking in or do you feel the same ?

179
 
 

I just installed emacs for Android from the fdroid store. I do not see a way for me to grant storage access to my local device. Without that permission, I don't see how I can edit files, particularly org files, on my local device

I will put a screenshot of my apps permissions in a comment.

180
181
 
 

The container is running but TRAMP is not able to connect to it, not sure why.

/lxc:aws-t2-nano-neo4j:/neo4j-community-3.1.1/conf/neo4j.conf

Debugger entered--Lisp error: (file-error "Tramp failed to connect.  If this happens repeated...")
  signal(file-error ("Tramp failed to connect.  If this happens repeated..."))
  tramp-error(nil file-error "Tramp failed to connect.  If this happens repeated...")
  tramp-signal-hook-function(file-error ("Tramp failed to connect.  If this happens repeated..."))
  signal(file-error ("Tramp failed to connect.  If this happens repeated..."))
  tramp-maybe-open-connection((tramp-file-name "lxc" nil nil "aws-t2-nano-neo4j" nil "/neo4j-community-3.1.1/conf/neo4j.conf" nil))
  tramp-send-command((tramp-file-name "lxc" nil nil "aws-t2-nano-neo4j" nil "/neo4j-community-3.1.1/conf/neo4j.conf" nil) "test 0 2>/dev/null; echo tramp_exit_status $?")
  tramp-send-command-and-check((tramp-file-name "lxc" nil nil "aws-t2-nano-neo4j" nil "/neo4j-community-3.1.1/conf/neo4j.conf" nil) "test 0")
  tramp-get-test-command((tramp-file-name "lxc" nil nil "aws-t2-nano-neo4j" nil "/neo4j-community-3.1.1/conf/neo4j.conf" nil))
  tramp-run-test("-d" "/lxc:aws-t2-nano-neo4j:/neo4j-community-3.1.1/conf...")
  tramp-sh-handle-file-directory-p("/lxc:aws-t2-nano-neo4j:/neo4j-community-3.1.1/conf...")
  tramp-sh-file-name-handler(file-directory-p "/lxc:aws-t2-nano-neo4j:/neo4j-community-3.1.1/conf...")
  apply(tramp-sh-file-name-handler file-directory-p "/lxc:aws-t2-nano-neo4j:/neo4j-community-3.1.1/conf...")
  tramp-file-name-handler(file-directory-p "/lxc:aws-t2-nano-neo4j:/neo4j-community-3.1.1/conf...")
  file-directory-p("/lxc:aws-t2-nano-neo4j:/neo4j-community-3.1.1/conf...")
  find-file-noselect("/lxc:aws-t2-nano-neo4j:/neo4j-community-3.1.1/conf..." nil nil nil)
  find-file("/lxc:aws-t2-nano-neo4j:/neo4j-community-3.1.1/conf...")
  counsel-find-file-action("/lxc:aws-t2-nano-neo4j:/neo4j-community-3.1.1/conf...")
  ivy-call()
  ivy-read("Find file: " read-file-name-internal :matcher counsel--find-file-matcher :initial-input nil :action counsel-find-file-action :preselect nil :require-match confirm-after-completion :history file-name-history :keymap (keymap (remap keymap (undo . counsel-find-file-undo)) (67108960 lambda (&optional arg) "nil (`nil')" (interactive "p") (if (string= "" ivy-text) (execute-kbd-macro (kbd "M-o b")) (self-insert-command arg))) (96 . counsel-file-jump-from-find) (C-backspace . counsel-up-directory) (67108991 . counsel-up-directory)) :caller counsel-find-file)
  counsel--find-file-1("Find file: " nil counsel-find-file-action counsel-find-file)
  counsel-find-file()
  funcall-interactively(counsel-find-file)
  command-execute(counsel-find-file)

182
 
 
⛔ Warning (with-editor): Cannot determine a suitable Emacsclient

Determining an Emacsclient executable suitable for the
current Emacs instance failed.  For more information
please see https://github.com/magit/magit/wiki/Emacsclient.

I switched to guix as the package manager following system-crafters tutorial. I have correct setup the PATH variable so that binaries from guix are accessible, but still magit is not able find emacsclient even though it is there and I can launch it from shell. No changes to the configure has been made. Used to work this morning but after removing apt emacs and installing emacs via guix I get this issue.

Config:

  (use-package magit
    :bind (("C-c g" . #'magit-status)))

183
 
 

I'm putting the output of M-x grep in an org src block, so I can save it and come back to it later. I want to be able to click on a line and jump to the match, but I get the error "No org-babel-execute function for grep!". I can't find anything like ob-grep. Any ideas?

184
185
186
187
 
 

emacs noob here.

I'm rewriting my init.el file from scratch using use-package macro. In my existing init file I use require to configure MELPA package archive.

(require 'package)

(add-to-list 'package-archives '("MELPA" . "http://melpa.org/packages/"))

(package-initialize)

Can I rewrite this using use-package macro?

188
 
 

I tried the async-shell-command and start-process functions to get the output from the very verbose app. Logs still arrive even 2-3 minutes after the process has ended. Is there any way to speed buffer up?

189
 
 

I just wanted to share this because it looks sooo good! Also keep in mind this is emacs on TERMINAL.

190
191
1
Note taking (alien.top)
submitted 1 year ago by grom358@alien.top to c/emacs
 
 

I looking to migrate to emacs (running under WSL) for note taking. Currently I am using notepad++ as it lets me have multiple scratch buffers that will persist. That is I wanting buffers that I don't have to name or explicitly save that will still be there if emacs (or computer itself) are restarted.

192
 
 
193
 
 

I have been exploring the use of imenu in Emacs as a way to navigate functions within buffers. I would like to make imenu automatically select the function currently under the cursor as the default choice when invoked.

Is there any method or configuration that allows imenu to select the function currently under the cursor as the default choice?

(FYI: I am using consult-imenu)

194
 
 
195
 
 

Context:

I've used Emacs off and on for many years at this point. Throughout that time there have been periods where I really leaned in to it and tried to use it for everything, and there have been periods where I only used it for org and/or magit, etc. I've learned lots of things about it and I've forgotten lots of things about it, but I've never been what I would call an "expert" or even a "power user". So, when I feel like something isn't working well in Emacs, I almost always default to the assumption that I'm doing something wrong or misunderstanding something, etc.

So, it very well may be that I'm wrong/crazy in my recent conclusion that use-package might not be the ideal abstraction for managing Emacs packages.

With that out of the way, I'll say that when I first saw use-package, I thought it was amazing. But, in the years that I've been using use-package, I never feel like my init file is "right". Now, I'm starting to think that maybe it's use-package that's wrong and not me (insert Simpsons principal Skinner meme).

I don't know how best to articulate what I mean by use-package being a "wrong abstraction", but I'll try by listing some examples and thoughts.

Autoloads

First of all, I feel like the way autoloads are handled with use-package is too mistake-prone. Libraries/packages typically define their own autoloads, but the use-package default is to eagerly load the package. I understand that installing a library via package.el, etc will process the autoloads for us and that manually/locally installed packages get no such benefit.

But, if we're using use-package to also manage installing the packages for us (:ensure t), then why shouldn't it know about the autoloads already and automagically imply a :defer t by default?

So, by default, we have to remember to either add :defer t or we have to remember that setting our own hooks, bindings, or commands will create autoloads for us.

I know that you can configure use-package to behave as though :defer t is set by default, but that's just broken for packages that don't have any autoloads.

It feels like maybe use-package is doing too many things. Maybe it was actually more correct in the old days to separate the installation, configuration, and actual loading of packages, rather than trying to do all three in one API.

Configuration that depends on multiple packages is ugly/inconsistent

Many packages are fairly standalone, so you can just do,

(use-package foo
    :defer t
    :config
    (setq foo-variable t))

and it's clean and beautiful. But, sometimes we have configuration that is across multiple packages. A real-world example for me is magit and project.el. Magit actually provides project.el integration, wherein it adds magit commands to the project-switch-commands and the project-prefix-map. That's great, but it will only run if/when the magit package is loaded.

So, my first guess at using use-package with magit was this,

(use-package magit
    :ensure t
    :defer t
    :config
    (setq magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))

which seems reasonable since I know that magit defines its own autoloads. However, I was confused when I'd be using Emacs and the project.el switch choices showed a magit option sometimes.

I eventually realized what was going on and realized that the solution was to immediately load magit,

(use-package magit
    :ensure t
    :config
    (setq magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))

but that kind of sucks because there's no reason to load magit before I actually want to use it for anything. So, what we can do instead is to implement the project.el integration ourselves. It's really just two commands:

(define-key project-prefix-map "m" #'magit-project-status)
(add-to-list 'project-switch-commands '(magit-project-status "Magit") t)

But, the question is: Where do we put these, and when should they be evaluated? I think that just referring to a function symbol doesn't trigger autoloading, so I believe these configurations should happen after project.el is loaded, and that it doesn't matter if magit is loaded or not yet.

Since, project.el is built-in to Emacs, it's probably most reasonable to do that config in the magit use-package form, but what if project.el were another third-party package that had its own use-package form? Would we add the config in the project use-package form, or in the magit use-package form? Or, we could do something clever/hacky,

(use-package emacs
    :after project
    :requires magit
    :config
    (define-key project-prefix-map "m" #'magit-project-status)
    (add-to-list 'project-switch-commands '(magit-project-status "Magit") t))

But, if we do this a lot, then it feels like our init.el is getting just as disorganized as it was before use-package.

Conclusion

This is too rambly already. I think the point is that I'm becoming less convinced that installing/updating packages, loading them, and configuring them at the same time is the right way to think about it.

Obviously, if you know what you're doing, you can use use-package to great success. But, I think my contention is that I've been familiar with Emacs for a long time, I'm a professional software developer, and I still make mistakes when editing my init file. Either I'm a little dim or the tooling here is hard to use correctly.

Am I the only one?

196
 
 

Good morning,

I recently have become enamored of Typst for document creation. It's fast, it's approachable, it's cross platform, and it's extremely capable even in preview beta. I never really got the swing of LaTeX with all the backslash/curlybrace mayhem.

In any event, I find myself actually working on a long technical document in Typst in Emacs. There does exist typst-ts-mode so thanks tree-sitter and all those people who manage the grammar libraries for it. However I'm finding myself in need of a better way of navigating the huge document to get to sections I want to do.

I looked into the baked-in bookmarks and I could probably use that capability, though I was hoping for more of an customizeable outline mode. Manually setting the bookmarks for an entire document seems tedious. I mainly just want to navigate by headings and that would be sufficient.

What do people use for this sort of thing (possibly in the LaTeX world?) Just bookmarks with some sort of automated way of populating the bookmarks? I did check the typst-ts-mode and while there are some functions there for compiling, there don't seem to be any functions for navigating by semantic structures. Perhaps that's baked into tree-sitter itself?

Anyhow, any help greatly appreciated here.

197
 
 

So after my struggles getting this setup going I'm really enjoying this setup.

Thought I'd post here as there is quite a bit of intersectionality between the emacs, Arch, Steamdeck, Nix and Mechboards communities.

Spec as follows:

  1. Steamdeck (LCD);
  2. SteamOS 3.5 Preview (Arch based and compatible with Nix packages);
  3. Emacs 29 (via Nix package);
  4. DooM config + some tweaks of my own; and
  5. Corne Light v2 with random DSA caps.

Ambitions for this setup are:

  1. Better emacs-fu (thanks to everyone here with their help so far);
  2. RGB underglow on the keyboard for 90s vibes;
  3. Printed keycaps in jazzy colours;
  4. Better keymap (maybe Miryoku or something with homerow mods)
198
1
Better cua-mode (alien.top)
submitted 1 year ago by zsome@alien.top to c/emacs
 
 

Hi,

I was thinking how we can solve the ctrl+c "problem", I found that the ctrl+c with cua-mode is working as copy when a region is selected and it is working az prefix when there is no region selected.
I would like to ask that is possible to change the ctrl+c in the "c" codebase easily or I don't know where ?
It can be a patch and create a custom build to myself ...
Or I just live with it and there is no way to put this "user prefix" to an other key combination ?

thanks for the answers!

199
 
 

Hello, emacs fellas.
I'm trying to set up emacs for webdev and I cannot get good completions for html and css. I have installed lsp-mode and html-ls along with css-ls, but completions are still rather poor compared to VSCode.

Is there a way to get better autocomplete?

200
 
 

A few days ago I asked if there was a Vim port of Denote. Well, I went ahead and had ChatGPT help me make one.

Here it is: https://git.sr.ht/~ashton314/vim-denote

Why make this? So my Vim-using friends (what can I say—I'm a tolerant guy) can work with me on some shared Denote-formatted notes.

Is the package awful? Yes. Am I gonna fix it? No. I've written enough Vim script to last a long time. I'll go back to the nice land of Emacs Lisp now. (In spite of all its warts, it's still a Lisp and therefore beautiful.)

view more: ‹ prev next ›