Meta: are there more low-effort/quality posts these days?
Is it just me, but are there more low-quality posts on this sub these days? Now, the last thing I want is for this sub to be an "experts only" place—but is there something we can do to help newcomers whilst cutting down on the junk questions that could have been Googled or ChatGPT'd? Perhaps point people to How to Ask Questions the Smart Way in the rules or posting guidelines?
https://redd.it/1ay3ygt
@r_emacs
org-ql dynamic block error
I'm currently trying to generate a list of all times backups on my various servers are scheduled. There is a property "BCKSCHED" assigned to each server heading with the time as string. Like
:PROPERTIES:
:BCKSCHED: 01:00
:END:
I tried to use org-ql to generate a dynamic block that shows all times as a table. My dynamic block looks like this:
#+BEGIN: org-ql :query "property: BCKSCHED" :columns (heading property)
#+END:
When I run it with C-c C-c I get the error
Symbol's function definition is void: org-dblock-write:org-ql
So I tried a minimal example like this
#+BEGIN: org-ql :query "todo: " :columns (heading property)
#+END:
And also the example from the repository
#+BEGIN: org-ql :query "todo: priority:A,B" :columns (todo (priority "P") ((property "agenda-group") "Group") deadline heading) :sort (deadline priority) :take 7 :ts-format "%Y-%m-%d %H:%M"
#+END:
But both have the same error as a result. What am I doing wrong here?
https://redd.it/1axw0fg
@r_emacs
folding everywhere - literate programming (almost) without the tangle
I [posted](https://www.reddit.com/r/emacs/comments/a6tu8y/outlineminormode_for_emacs_maybe_useful/) about using outline-mode for elisp about 5 years ago and I've gone a bit potty since then on folding most everything I work with - to the extent that I've even dropped most org-mode usage to outline-mode as I never really used the funky stuff (like agenda, todo etc).
The motivation is that it makes viewing, organising and editing these files so much easier without the need to maintain +BEGIN/END SRC blocks and the tangling that comes with using org mode.
I've also implemented the imenu index stuff so that I can have an alphabetic index to my headings.
So far, I've converted elisp mode, org mode, sway, i3wm and waybar configurations to be folding with outline mode. The dotfiles are in [my gitlab repo](https://gitlab.com/wef/dotfiles/-/tree/master/.emacs.d.minimal).
Pictures tell a thousand words so ...
**elisp**
[elisp](https://preview.redd.it/svifqz3it7kc1.png?width=984&format=png&auto=webp&s=4855043ec5b88514a530959045a98434bca0eae0)
;; Local Variables:
;; mode: elisp
;; outline-minor-mode-highlight: append
;; outline-regexp: ";;\s[*]+\s"
;; eval: (outline-minor-mode 1)
;; outline-level: (lambda() (- (outline-level) 4))
;; eval: (outline-hide-sublevels 1)
;; imenu-auto-rescan: nil
;; eval: (imenu-add-menubar-index)
;; End:
**org**
[org files - I keep the .org suffix so that orgzly still works](https://preview.redd.it/0ieb82tkt7kc1.png?width=728&format=png&auto=webp&s=c8e9bac05ec138f729be9d500b07e092027482de)
Local Variables:
truncate-lines: t
mode: text
eval: (add-hook (make-local-variable 'after-save-hook) 'bh/ensure-in-vc-or-check-in t)
outline-regexp: "[*\^L]+")
outline-minor-mode-highlight: append
eval: (outline-minor-mode 1)
eval: (outline-hide-sublevels 1)
eval: (auto-fill-mode -1)
imenu-generic-expression: ((nil "^\\* \\(.*\\)$" 1))
imenu-sort-function: imenu--sort-by-name
imenu-auto-rescan: nil
eval: (imenu-add-menubar-index)
End:
**sway**
[sway\/i3wm](https://preview.redd.it/eru5456pt7kc1.png?width=986&format=png&auto=webp&s=413522c418d75d36376a1041f5c8eaa3ab17bc5e)
# Local Variables:
# mode: text
# outline-regexp: "###+ "
# eval: (auto-fill-mode -1)
# outline-regexp: "###+ "
# outline-level: (lambda() (- (outline-level) 3))
# eval: (progn (outline-minor-mode 1)(outline-minor-mode 0)(outline-minor-mode 1))
# eval: (outline-hide-sublevels 1)
# imenu-generic-expression: ((nil "^### \\(.*\\)$" 1)("Global" "^#### _Global\\(#[0-9]+\\)*\\( \\|/\\)\\(.*\\)$" 3)("Output" "^#### Outpu_t\\(#[0-9]+\\)*\\( \\|/\\)\\(.*\\)$" 3)("Floater" "^#### _Floater\\(#[0-9]+\\)*\\( \\|/\\)\\(.*\\)$" 3)("Workspace" "^#### W_orkspace\\(#[0-9]+\\)*\\( \\|/\\)\\(.*\\)$" 3)("Window" "^#### _Window\\(#[0-9]+\\)*\\( \\|/\\)\\(.*\\)$" 3)("Run" "^#### _Run\\(#[0-9]+\\)*\\( \\|/\\)\\(.*\\)$" 3)))
# imenu-sort-function: imenu--sort-by-name
# imenu-auto-rescan: nil
# eval: (imenu-add-menubar-index)
# End:
**waybar**
[waybar](https://preview.redd.it/ghvlkxgtt7kc1.png?width=711&format=png&auto=webp&s=9385c373734fdac8cfaf164f6f01e662865e9a3a)
// for emacs:
// Local Variables:
// mode: text
// outline-regexp: " \""
// eval: (auto-fill-mode -1)
// eval: (outline-minor-mode 1)
// eval: (outline-show-only-headings)
// outline-level: (lambda() (- (outline-level) 4))
// imenu-generic-expression: ((nil "^ \"\\(.*\\)$" 1))
// imenu-sort-function: imenu--sort-by-name
// imenu-auto-rescan: nil
// eval: (imenu-add-menubar-index)
// End:
​
https://redd.it/1axkgx4
@r_emacs
Set eat terminal buffer name using the current patheat
is a great terminal inside emacs. I'm curious if there is a way to make the buffer's name show the current path. In vterm
, we can set vterm-buffer-name-string
to make this, but it seems there is no similar option for eat.
​
Thanks.
https://redd.it/1axgaag
@r_emacs
Is it an issue org-roam using a database?
I see some people mention the fact org-roam uses a database as a disadvantage, in particular compared to denote packge which doesn't require db.
Can someone explain me the possible drawbacks of using db for this flow?
https://redd.it/1ax1g9o
@r_emacs
"end of file during parsing" when trying to tangle: is there a function that helps testing the syntax within src blocks in org files?
Hi everyone,
I have a huge org file, and I get this error "end of file during parsing".
This usually means I have parenthesis not matching somewhere, I started removing the chapters of my files one by one, and retried to tangle: no change, I got the same error everytime, this does not make sense to me, I should have been able to tangle at some point!!
I tried with a diff (I have a backup of this file), but I am not good at reading diff buffers (and I only discovered difftastic yesterday... that I can not implement, due to the error...).
It forces me to get better at dealing with changes in my configuration ==> I will better document the changes from now on (Magit)
Now to my question:
Is there an emacs function that checks code blocks only, ignoring the litterate content? Using the #+BEGIN_SRC and #+END_SRC entries to locate the blocks, and only checking the content for syntax errors?
Thanks for your support!!
​
​
https://redd.it/1awzyx4
@r_emacs
Loading custom theme on emacs
I am a noob trying to set up the init.el
file from scratch.
​
I want to load a custom theme (aircon-theme) which is available at list-packages.
I have created a folder called el
inside .emacs.d
In the el
folder I have a core
folder which has a theme.el
file whose content is (use-package aircon-theme :ensure t)
In the init.el ,
I refer to the theme via (load-file (expand-file-name "el/core/theme.el" user-emacs-directory))
I was hoping this would auto-load the theme. However this only downloaded the aircon-theme, which I then selected manually using the drop down menu.
​
Can someone point out why this method was not sucessful and what can be done to autoload the theme?
​
https://redd.it/1awuvj2
@r_emacs
Company/Lsp with Python not Working As Expected
I am using lsp-mode with company to edit some Python files. I noticed though that when I use it to edit C my company completions are much more complete. As an example, if I type in
void main(){
pri
}
#include <stdio.h>
void main(){
printf(const char *, ...)
}
pri
in Python and select print it just completes the word without even adding the parenthesis at the end. As a more complete example, I am working with a postgresql database and I type in connection = psycopg2.con
connection = psycopg2.connect
but without parens and it also doesn't add in the arguments like how C does with printf. Is this an lsp limitation with Python? I am using an up to date company mode and lsp mode with pyright as my python lsp and clangd as my C lsp.FYI: volunteer needed for maintaining centaur-tabs
The centaur-tabs minor mode (which is also one of spacemacs' prerequisites) is looking for maintainers❗️
See the maintenance call: https://github.com/ema2159/centaur-tabs/issues/228#issuecomment-1937500301
(BTW I'm new to r/emacs; let me know if I should have followed a specific convention, w.r.t. the post flair or so…)
https://redd.it/1awj1tl
@r_emacs
Need help with an elisp function to open file under a cursor in a split
Hi Experts
Newbie here, I wanted to open file under cursor in a split ... so wrote this elisp function.
​
Just FYI using DOOM emacs.
(defun rd/evil-find-file-at-point-with-line-split()
"lets extend the evil-find-file-at-point-with-line function to open in a split"
(interactive)
(require 'evil-commands)
(let ((display-buffer-alist '(("" (display-buffer-reuse-window display-buffer-below-selected))))
(parent-file (current-buffer)))
(evil-find-file-at-point-with-line)
(split-window-vertically (- height))
(other-window 1)
(pop-to-buffer (parent-file))
)
)
(define-key evil-normal-state-map (kbd "C-w C-f") 'rd/evil-find-file-at-point-with-line-split)
It works very inconsistently. File does open but sometimes in the same window, sometimes in a vertical split and sometimes in horizontal split(the intended).
​
Can someone please point out what i am doing wrong?
​
TIA
https://redd.it/1awfj60
@r_emacs
Error/Warning signs in emacs -nw
Hi, can't find information about how to setup warning/error signs on the left bar (behind numbers) in terminal mode emacs. No one need this?
https://redd.it/1awacsu
@r_emacs
Weekly Tips, Tricks, &c. Thread
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.
https://redd.it/1aw6xkc
@r_emacs
Is it possible to manually tell which files go in project in project.el?
I want to set-up projects to use with "consult-project-buffer"
Is it possible to manually select which files go into each project? Example:
I have following project strucutre:
myproject/
-----------/.git
-----------/mynotes.org
-----------/scripts/
-----------/tests/
-----------/logs/
-----------/data/
that's the most logical dir set-up and most conveniet way to access file for me most of the time.
However sometimes say i am working on "pull_rss_feeds" part of my project and need to access related files in scripts, tests, logs, data folders. So is there a way to manually create project pull_rss_feeds and tell exactly what files i want to be part of this projects?
Another use case is my emacs config. Part of config is in my emacs folder, part is in .emacs.d folder... I would like to manually create emacs project and tell exactly where files are.
https://redd.it/1avsu4q
@r_emacs
language server protocol(lsp) won't start automatically for my every files.
Hi guys i'm totally new to emacs and here (this is my first post).
Let me describe my problem: i installed typescript-language-server protocol on emacs and via npm (don't know why it's required btw, installing both for my system and emacs).
After 5-6 hours strulling i did it ! I got it working, now i can select any .js file in my react folder, i can activate lsp by "C-x lsp", works totally great until i move on another .js file. The language server works for only one file i'm currently on, i need to enable it for every .js file and that's odd. Can you help me ? Thanks in advance !
https://redd.it/1avokcq
@r_emacs
MacOs installation question
Hi,
Jetbrains Inttelij Idea / NeoVim user here. I'm thinking about installing Emacs (org-mode is the main selling point) and switching (at least from NeoVim) to Emacs/Doom Emacs. While I was reading about how to install it, I found that there are a couple of different emacs releases that can be installed:
1. If I search Homebrew for the "Emacs" term, there is one cask called "emacs", let's call it "standard".
2. But there is also "emacs-plus" which should be first tapped: https://github.com/d12frosted/homebrew-emacs-plus?tab=readme-ov-file
I have a couple of questions:
1. I'm wondering what is the "correct" way to install emacs on MacBook Pro M1 with Sonoma - standard or plus release.
2. If emacs-plus is the correct way should I include those additional flags like "--with-native-comp" and if yes which ones?
3. If emacs-plus is the correct way, what is better to use "emacs-plus@29" or just use the latest version? I guess that if I just use the latest version, then it will be updated whenever I run brew update and upgrade, and I'm not sure how things are going in emacs world with those updates. I used to have problems with NeoVim updates, as well as plugin updates, so at one point in time, I was afraid to run plugin updates :) Hope Emacs is more stable.
Thanks in advance.
https://redd.it/1axypa6
@r_emacs
How to use theme colors in face customization?
I feel like this should be pretty obvious, but i'm pulling my hair out on the order of operations here.
I want to customize some faces with a box. And i want that box to use a color from my current theme. But i don't want to hard code the color value, but for it to use the dark or light color of the modus theme, depending on which is loaded on starting.
So far i have tried using the function modus-themes-get-color-value
but it doesn't seem to be available at the point the tab-line gets activated. Then i tried this at the very end of my init.el:
(custom-set-faces
'(tab-line ((t (:box (:line-width (5 . 5) :color ,(face-background 'tab-line))))))
)
Which seems to be run before the theme is loaded, as i'm getting a white box on the modus-vivendi theme.
I tried setting this up in a use-package statement for the tab-line-mode, for the modus theme and for the emacs pseudo package. I tried adding :after (modus-themes)
to the use-package statement for the tab-line. All without success. I don't even want it to track the theme when i change it after starting emacs. Just, get the background of the tab-line at start, after the modus-theme is loaded and use that for the box color.
I feel like i'm somehow overthinking this. How can i get the tab-line border to look right regardless of the configured theme? Is this a case of having to set up a variable for your theme and then making this into a cond statement with hardcoded Color Values? This should work for now, but would mean i'd have to rewrite the any time i want to change themes.
Just for completeness, here's the entire config, if anyone want's to take a look:
https://gitlab.com/domsch1988/domacs
https://redd.it/1axwl9d
@r_emacs
Need help with diff-hl not staging non-root files
Hello!
I am using diff-hl and having a weird issue - in a repository I am unable to stage hunks of files that are not in the root directory of a git project. I am getting an error message when calling `(diff-hl-stage-diff (current-buffer))` or just calling the `diff-hl-stage-current-hunk` interactive function.
error
Now, as you can see from the screenshot, the `git apply ...` tries a temp file but the path is relative to the root of the project instead of the file that I am in.
I traced it back to vc-git-command but am not proficient in elisp so can't make sense of it.
Has anyone encountered a similar issue?
https://redd.it/1axjiax
@r_emacs
How to generate agenda correclty on startup
I used doom emacs for a while, but over the last couple of weeks wrote my own config, to be a bit more flexible.
I want to use org-agenda, and in doom emacs I just let it check all my files under "\~/org/", so I can create TODOs everywhere and don't have to think about what I should be putting in which todo file - or manage a single one.
To achieve this, I have the following lines in my init.el:
(use-package org
:pin org
:commands (org-capture org-agenda)
:config
;; agenda
(setq org-agenda-start-with-log-mode t)
(setq org-log-done 'time)
(setq org-log-into-drawer t)
(setq org-directory "~/org/")
(setq org-agenda-files
'("~/org/")))
org-agenda
Great recent paper on Elisp's History with Interviews
https://dl.acm.org/doi/pdf/10.1145/3386324
https://redd.it/1axatxf
@r_emacs
From Fill Prefix to TRAMP
https://susam.net/from-fill-prefix-to-tramp.html
https://redd.it/1ax3sfb
@r_emacs
I know I would go back to you~
I loved my emacs exwm environment so much. But I had to let go of her eventually because I needed IDE features easily. I mainly work in python and sometimes in typescript, rust.
Adding language support (Go to function definition, syntax checking) always proved to be difficult for me. Almost never configured one successfully.
So I finally just went with VS code. I want to go back to my emacs EXWM full setup. Any recommendations on how I can handle the language support part?
Note: spacemacs support for EXWM was not so good. Or it might just be my inexperience with it.
https://redd.it/1awxi1b
@r_emacs
LLMs take control of Emacs
Have you ever thought to yourself, why should I give Emacs commands like a plebian, when an LLM can just control Emacs for me? Well the first step is now done, we now have a way to make any elisp command callable by an LLM that does function calling. For example, here is me switching buffers by telling the LLM to switch buffers by just describing the buffer I want switched to. It's not exactly a huge time-saver, but it's cool and shows the potential.
​
https://i.redd.it/fy6jnbp2w1kc1.gif
In my llm
package, I've created a new function calling branch after learning that Ollama will soon support function calling. Right now both Open AI and Gemini do this (but Gemini has some limitations). As part of that, I have a utility to use function calling to create function definitions for elisp functions (which aren't really rich enough in information to be passed to function calls as-is).
I'll be thinking about interesting new interactions that can be built off by having the LLM just control emacs via a few predefined commands. But it's quite useful for certain things where you want the LLM to produce structured information. For example, I created a function that will create an example sentence given a word in a language, and then it can be passed to anki, etc. These things were a bit painful to do previously.
As normal, I'm not planning on creating an actual end-user package here, but I want to encourage people to think about what can be done using function calling and, if there is something you want to put into a package, use the `llm` package to make it easy and portable (somewhat). Ideas and feedback are most welcome!
​
https://redd.it/1awvo2q
@r_emacs
What is the purpose of the underscore character as a function argument?
Reading through the Elisp of alphapapa's immensely useful package burly.el, I came across this function definition:(defun burly--bookmark-window-state-hack (&optional _)
(unwind-protect
(progn
(cl-assert burly--window-state)
(window-state-put burly--window-state (frame-root-window)))
(setf bookmark-after-jump-hook (delete #'burly--bookmark-window-state-hack bookmark-after-jump-hook)
burly--window-state nil)))
I could not figure out the function argument, "_". The function body does not reference it. The argument's name seems to be intentionally non-descriptive.
I Googled for information about Emacs and the underscore character but found nothing helpful. Then I asked ChatGPT, which replied:
​
>In Emacs Lisp, when the underscore _ character is used as an argument to a function, it conventionally indicates that the argument is not used within the function body. This is a way to signal to other programmers that the argument is intentionally ignored or not relevant to the function's operation.
If the argument is intentionally ignored, at it seems to be, why include it in the first place? Especially when the argument is &optional anyway? What does it add to the function?
https://redd.it/1awqcxi
@r_emacs
embark-org-roam: embark export buffer for org roam nodes
Allows to embark-select
org roam nodes of interest, then embark-export
the selected nodes into an org-mode
buffer as a checklist. Great for "harvesting" your org roam knowledge base for a concrete project (e.g., paper).
https://github.com/bramadams/embark-org-roam
https://redd.it/1awezl6
@r_emacs
Release v0.8.5 · alphapapa/org-ql
https://github.com/alphapapa/org-ql/releases/tag/v0.8.5
https://redd.it/1awa6c6
@r_emacs
Jinx turns off AUCTEX
Hi all.
I'm facing strange problem and couldn't figure out.
Whenever I turn on jinx-mode in latex buffer, auctex (e.g. LaTeX-mode) automatically turned off and switched to latex-mode.
Same issue occurs when I turn on jinx-mode globally.
jinx-mode is perfectly working in other major-mode and auctex also works fine if jinx-mode is not turned on.
I tried to reinstall both packages and config them with many different settings
but still no luck.
These are part of my configs. What am I missing?
(use-package auctex
:demand t
:ensure (auctex :pre-build (("./autogen.sh")
("./configure"
"--without-texmf-dir"
"--with-packagelispdir=./"
"--with-packagedatadir=./")
("make"))
:build (:not elpaca--compile-info) ;; Make will take care of this step
:files ("*.el" "doc/*.info*" "etc" "images" "latex" "style")
:version (lambda (_) (require 'tex-site) AUCTeX-version)))
(use-package latex
:ensure nil
:mode ("\\.tex\\'" . LaTeX-mode)
:after auctex
:config
(setq-default TeX-master nil)
(setq-default TeX-command-extra-options "--shell-escape"))
(use-package jinx
:demand t
:bind ([remap ispell-word] . jinx-correct)
:hook (emacs-startup . global-jinx-mode)
:config
(setq jinx-languages "en")
(set-face-attribute 'jinx-misspelled nil :underline '(:color "#ffcc00" :style wave)))
​
​
https://redd.it/1aw7rm5
@r_emacs
listen.el: Audio/music player for Emacs
https://github.com/alphapapa/listen.el
https://redd.it/1aw4ton
@r_emacs
i like projectile but it's tiring to look for a file everytime i want to open a project.
tl;dr: what i want is
fuzzy find my way through my projects, and then after choosing one, all the buffers or terminals get re-opened from last time.
if you don't know projectile. it's basically a package that let's you index all your project directories so that later you can just fuzzy find your way to what you want to work on.
so you look for the project -> tap enter -> then you will be prompted to choose the file from inside that project.
this is great. but if i close emacs and then i open it again (for whatever reason) i have to look for and re-open the same files i was working on.
i guess what i need is a way to fuzzy find through my projects (like in projectile) but instead of prompting with choosing a file (after i pick a project) it will re-open the same buffers that were opened last time.
ps: i sort of asked about this before but i think that i didn't communicate my issue properly.
thanks
https://redd.it/1avq0rw
@r_emacs
missing icons when running in client/server mode
​
client server mode
normal mode
https://redd.it/1avi1en
@r_emacs