r_emacs | Unsorted

Telegram-канал r_emacs - /r/emacs

-

This channel is a feed for r/emacs. @r_channels @reddit2telegram

Subscribe to a channel

/r/emacs

Directory quick Access keybinding

Any suggestions on a package that I can use to quickly access directories with keybinding? The key can take me to the dired buffer. I liked dirvish-quick-access but I wanted something lighter or something within emacs itself. I tried emacs registers but, I wanted something that I can assign nested keys. For example

(key value)

("bf" . "\~/Documents/Books/Fiction/"
"bp" . "\~/Documents/Books/Philosophy/"
"m" . "\~/Documents/Movies")

https://redd.it/1gatqmz
@r_emacs

Читать полностью…

/r/emacs

A fork of restclient with graphql support & graphql explorer/builder
https://youtu.be/TiHo10h_hQg

https://redd.it/1gaqbfh
@r_emacs

Читать полностью…

/r/emacs

How do you find/replace in a project? or current dir/sub-dirs

I'm missing something huge in my Emacs workflow. Find/Replace across an entire project. Or the current directory and sub-directories.

I was editing some html doc files and found myself reaching for VS Code to find/replace stuff across many files. I'd like to move this task into my Emacs workflow. Or maybe a command line powered technique (ripgrep?) I can wrap in an Emacs function.

How do you find/replace?

https://redd.it/1ga944z
@r_emacs

Читать полностью…

/r/emacs

An emacs setup for reading and annotating epub files?

How to setup emacs so that it can seamlessly read and annotate epub files and pdf files?
Does anyone use this kind of setup how did you achieve this? please tell the package(s) name(s) and any additional step you did

https://redd.it/1ga5495
@r_emacs

Читать полностью…

/r/emacs

Eldoc syntax highlighting with Eglot and rust-mode

Hi!

I recently switched to emacs for rust development.

As you can see in the following picture, eldoc which is used by Eglot just writes down the documentation of a function/variable etc. in the window on the right side without any syntax highlighting or colors.

https://preview.redd.it/hbye62r71dwd1.png?width=2786&format=png&auto=webp&s=9bcbf1cf00c10227863b6ec14482730da89f13e0

Is there any option, or plugin I am missing to get the output of eldoc with syntax highlighting? I found nothing In the documentation.

This is the part of my LSP Config in my init.el

(use-package eglot
:ensure nil
:defer t
:bind (:map eglot-mode-map
("C-c a" . eglot-code-actions)
("C-c d" . eldoc)
("C-c f" . eglot-format-buffer)
("C-c r" . eglot-rename))
:hook (rust-mode . eglot-ensure))

(use-package rust-mode
:ensure t
:defer t
:init
(setq rust-mode-treesitter-derive t
rust-format-on-save t))

Thanks for any informations!

https://redd.it/1g9qzun
@r_emacs

Читать полностью…

/r/emacs

A nifty way to use symbol shorthands?

I decided to try using symbol shortands in a new package I'm sketching and I'm enjoying it a lot, so I'd like to share an idea.

In the beginning I did the obvious thing:

;; Local Variables:
;; read-symbol-shorthands: (("mypkg-" . "my-package-"))
;; End:

That I didn't really enjoy. It looks a bit unclean and isn't even that economic.

But now I'm using this:

;; Local Variables:
;; read-symbol-shorthands: (("-" . "my-package--"))
;; End:

which means that public symbols need to be spelled out in full, but private a.k.a. double dashed symbol just need a - as prefix. So for example:

(defun -private-fun (n)
(+ n 42))

(defun my-package-api-function (n)
(when (numberp n) (-private-fun n)))

I know some people had reservations with the notion of symbol shorthands, such as bad grepability. Maybe this approach alleviates some of the potential problems and could even be recommended as a general practice. WDYT?

https://redd.it/1g9pjbs
@r_emacs

Читать полностью…

/r/emacs

Correct font name to setup font with set-face-attribute

Hi,

emacs beginner here

I'm currently try ti build my emacs config, but stuck with correct font naming in init.el

I would like to use Victor Mono font, but don't know what is correct name for this font in this instruction:

(set-face-attribute 'default nil :font "???????" :height 120)

When i put "Fira Code", for example, it's working and set up Fira Code font.

https://redd.it/1g9cf1l
@r_emacs

Читать полностью…

/r/emacs

Blew my coworker's mind

Emacs is a very misunderstood tool. Many people are confident in saying that Emacs can't do anything modern, is very difficult to use, and that young people cannot learn it at all. As far as I understand, these statements are all false.

When a director of software engineering at work said so, I responded, "No. What you're saying is totally wrong." Later that day, he dropped by my desk while I was writing a technical document in org-mode using gptel. As I quickly wrote sections and the first sentence, it immediately completed the rest of the section, including code examples. That blew his mind. He asked, "What is this? Did you copy and paste it from somewhere else?" I replied, "No, I'm writing a document in Emacs with the power of my choice of LLMs." When he asked if it was difficult to even know how to open files or exit the editor, I showed him the pull-down menu: File -> Open and Exit, just like in old MS Word. He then asked if that was new in Emacs. I told him those features had been there for at least 20 years. I also demonstrated how the keybindings can remain consistent across different modes and contexts. After that, he expressed interest in learning Emacs.

Another senior software engineer was even more old-fashioned though he's much younger than me. He was using Vim or NeoVim. When we were talking about AI for software development, I told him that I enjoyed working with AI in Emacs. He mentioned that he couldn’t make full use of AI in his editor, Vim. I explained that it should be possible in NeoVim, but he could simply switch to Emacs without much of a learning curve. He said he didn’t want to learn any new key bindings. I responded by suggesting that he switch to Emacs and use evil mode, which would make him feel right at home.

Later, he stopped by my desk for something else. I showed him how I use Vim key bindings and how he could do everything he remembers from Vim, either in normal mode or with commands like :w to save and :e . to open the file explorer. To his surprise, he was shocked when I opened a browser with EAF. "What?" he exclaimed. I said that NeoVim might also be able to do that. Since I was using Spacemacs, I showed him how easy it was to add layers. I also demonstrated how I quickly reply to emails using LLM within Emacs. That blew his mind again. He then asked if Copilot works in Emacs. "Sure thing!" I showed him immediately.

There was also an intern software engineer who started using Emacs just because I had written instructions for setting up the development environment on our wiki page. I shared my custom Lisp code for our company-specific integration, where instructions for other editors were lacking. He naturally picked up Emacs.

I showed this Emacs usage either on Chrome OS or Samsung DeX.

https://redd.it/1g99nwr
@r_emacs

Читать полностью…

/r/emacs

AUCTeX, cdlatex, and org-export: I am stumped

After starting an instance of vanilla emacs (emacs -Q), calling package-initialize, and then evaluating the following snippet I'm able to generate a LaTeX buffer from an org-mode file, as expected:

(use-package latex
:ensure auctex
:mode ("\\.tex\\'" . LaTeX-mode)
:init
(setq TeX-parse-self t))

But if I then load cdlatex and run turn-on-org-cdlatex, by evaluating e.g. this

(use-package cdlatex
:config
(turn-on-cdlatex))

I get an unexpected error ("Wrong type argument: stringp, nil").

I'm using Emacs 29.4 on macOS; org version 9.6.15. Here's a backtrace:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
expand-file-name(nil)
reftex-TeX-master-file()
reftex-tie-multifile-symbols()
reftex-add-to-label-alist((AMSTeX))
#f(compiled-function () #<bytecode 0xfa10c8cee4fc39f>)()
#<subr F616e6f6e796d6f75732d6c616d626461anonymouslambda105>([TeX-style-hook #f(compiled-function () #<bytecode 0xfa10c8cee4fc39f>) 1])
mapcar(#<subr F616e6f6e796d6f75732d6c616d626461
anonymouslambda105> (TeX-style-hook #f(compiled-function () #<bytecode 0xfa10c8cee4fc39f>) 1))
#<subr F616e6f6e796d6f75732d6c616d626461anonymouslambda106>("amsmath")
TeX-run-style-hooks("latex2e" "article" "art11" "inputenc" "fontenc" "graphicx" "longtable" "wrapfig" "rotating" "ulem" "amsmath" "amssymb" "capt-of" "hyperref")
TeX-auto-apply-entry((styles TeX-auto-file TeX-run-style-hooks))
TeX-auto-apply()
TeX-update-style()
TeX-mode-cleanup()
#<subr F616e6f6e796d6f75732d6c616d626461
anonymouslambda126>()
run-mode-hooks(LaTeX-mode-hook)
LaTeX-mode()
#<subr F616e6f6e796d6f75732d6c616d626461anonymouslambda86>()
org-export-to-buffer(latex "*Org LATEX Export*" nil nil nil nil nil #<subr F616e6f6e796d6f75732d6c616d626461
anonymouslambda86>)
org-latex-export-as-latex(nil nil nil nil)
org-export-dispatch(nil)
funcall-interactively(org-export-dispatch nil)
command-execute(org-export-dispatch)

Any clues?

The problem arises only when I export to a latex buffer, not to a latex file. And this is something new: I've had a working config for a while.

https://redd.it/1g978o7
@r_emacs

Читать полностью…

/r/emacs

Sorting file date using vertico

Hi, all.

I’m using vertico/orderless/marginalia and have been very happy with it so far.

One small thing, though, is the sorting of files using find-file or find-file-other-window. I’d like the sorting to be by reverse date (most recent on top), but it gives it to me in something that looks somewhat random. I love the history of vertico for other commands, but I can’t quite get this to work.

Suggestions?

https://redd.it/1g8yccr
@r_emacs

Читать полностью…

/r/emacs

Toggle hiding dired’s absolute path
https://redd.it/1g8yziv
@r_emacs

Читать полностью…

/r/emacs

Behavior of diff mode in C-x s

When checking which buffers to save with C-x s, the diff output (d option) would be displayed in a different buffer but the prompt would go back to the Save options (y, n, !, etc). Now for whatever reason, the cursor goes to the diff buffer, I have to quit the diff and then I am back to the save prompt in the minibuffer.

Anybody else experience this issue recently?

https://redd.it/1g8lsk0
@r_emacs

Читать полностью…

/r/emacs

Triggering comment commences

Emacs goes against the unix principle; do one thing and do it well.

Emacs does everything and does it well.

Enjoy!

P.S. I do realise most things it can do are seperate projects.

https://redd.it/1g8lsqb
@r_emacs

Читать полностью…

/r/emacs

ccls and LSP Semantic Tokens
https://maskray.me/blog/2024-10-20-ccls-and-lsp-semantic-tokens#emacs-ccls

https://redd.it/1g8jhhw
@r_emacs

Читать полностью…

/r/emacs

EMMS: can I tag songs and create playlists based on tags?

Instead of making a lot of playlists with many repeated songs, like "Rock", "Best Rocks", "Rocks from 80s", "Rocks for workout", I would like to be able to tag songs similar to org tags:

Song 1 - :80s:rock:best:workout:

Song 2 - :anime:rock:best:workout:

Song 3 - :funk:game:mario:cover:

Song 4 - :rock:workout:

And be able to build playlists based on combination of tags, for example :best: should give me songs 1 and 2, :rock:workout:, should give me songs 1, 2, 4, and so on.

Is there some package for that today, or some similar feature in EMMS?

I have a org file for a list of favorite games and some tags to filter games based on wether its for pc or some console, if it supports single player mode, 2P, 4P, offline party, online, coop and/or versus, and I can filter the list to find the best games to play with my friends or by myself, and it works pretty well.

https://redd.it/1g8503p
@r_emacs

Читать полностью…

/r/emacs

I am using Emacs on the terminal on Windows 10 via WSL with Ubuntu installed. Is there any way to seamlessly integrate Emacs kill-ring with the Windows clipboard?

I running Ubuntu 24.04 with Emacs 29.3 under WSL2. I managed to resolve almost everything I need on that install. Neovim is actually integrating fine with the setting set clipboard+=unnamedplus but I have no idea what would be equivalent on Emacs. emacs -Q don't integrate either so I'm guessing that's a setting that is not specific to Doom Emacs.

https://redd.it/1garyj1
@r_emacs

Читать полностью…

/r/emacs

How do I map a macro over a list? or How do I generate several defuns in one go?

As an experiment I'm trying to generate several defuns with one macro.

I've come this far:

;; This works. If I run `(msg 7)` I'll get a `msg-7` 
;; defun that if called prints "7".
(defmacro msg (n)
"Make a `msg-<N>' function that prints N."
(let ((cmd (intern (format "msg-%s" n))))
`(defun ,cmd ()
,(format "Message `%s'." n)
(interactive)
(message "%S" ',n))))

;; Creating many of these at a time like this though
;; just doesn't seem to do anything.
(defmacro msg-many (m)
"Make many (0 .. M - 1) `msg-<N>' functions."
(dotimes (n m)
`(msg n)))


I'm pretty sure I'm missing something fundamental here. But how would I go about "calling" (or perhaps "expanding"?) a macro several times with different in-data?

https://redd.it/1ga8cz9
@r_emacs

Читать полностью…

/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/1ga5eax
@r_emacs

Читать полностью…

/r/emacs

Making windows smaller than a few lines.

I could have sworn I had this working in the past, but I forgot how.

I am currently writing a package to simulate ACME. So far I have gotten mouse button functionality and mouse chording, but the buffer I'm using to display tag commands is 4 lines height. I would like to make it exactly one line.

https://redd.it/1ga4cxp
@r_emacs

Читать полностью…

/r/emacs

hyperdrive-org-transclusion v0.3.0

A new v0.3.0 release of hyperdrive-org-transclusion is now
available on NonGNU ELPA. The main change is that this
org-transclusion extension can now be activated/deactivated with the
new global hyperdrive-org-transclusion-mode.

Setup instructions have changed. In your init.el, please replace

(with-eval-after-load 'org-transclusion
(add-to-list 'org-transclusion-extensions 'hyperdrive-org-transclusion)
(require 'hyperdrive-org-transclusion))

with

(with-eval-after-load 'org-transclusion
(hyperdrive-org-transclusion-mode +1))

Please see the hyperdrive info manual for installation and setup
instructions. hyperdrive-org-transclusion augments the
org-transclusion package by Noboru Ota by allowing you to transclude
hyperdrive content over a network. You can also transclude specific
Org document headings by linking to them.

This package is similar in nature to org-transclusion-http, which also
lets you transclude content over the network (HTTP, not hyper).

Feedback welcome! If you'd like to support USHIN's work financially,
please donate here.

Thank you!

https://redd.it/1g9s317
@r_emacs

Читать полностью…

/r/emacs

Encrypted Notes App Compatible With Org?

Hi r/emacs, I apologize if the title is a bit confusing.
I use org-mode for all of my notes and logseq to view them on phone, but lately I've been maintaining an org journal based journal with encrypted files for every day. I was wondering if there were any apps that could let me read these encrypted org mode files as logseq does not have support for the same.
I'm also open to using an alternate encrypted journaling system as long as (1) it is org-mode or markdown, (2) there is an android application for viewing notes and (3) I can sync files through syncthing.
TIA!

https://redd.it/1g9kdmd
@r_emacs

Читать полностью…

/r/emacs

How to hide SYSTEM/Hidden files from dired when using Emacs from MS Windows?

When navigating the HOME folder on dired using Emacs at MS Windows, it displays all the System files and Hidden files. That bothers me because it makes the HOME directory cluttered from within dired. Is there anyway to make those files also Hidden on dired like the file explorer or the dir command on windows cmd?

https://redd.it/1g9ai34
@r_emacs

Читать полностью…

/r/emacs

Announcing Casual (Redux) and Reorganization
http://yummymelon.com/devnull/announcing-casual-redux-and-reorganization.html

https://redd.it/1g990g9
@r_emacs

Читать полностью…

/r/emacs

Looking for Emacs package/code supporting SELinux policy definition file types.

Has anyone come across Emacs packages or code that supports the various SELinux policy definition languages such as the .te (type enforcement) , .if (interface definition) and several others?

I did find some old (2003) code here: https://marc.info/?l=selinux&amp;m=106451121120495&amp;w=2 . I wonder if something more recent and comprehensive exists.

I'm finding myself having to deal with SELinux and manage policies so any info would help.



https://redd.it/1g92cmt
@r_emacs

Читать полностью…

/r/emacs

What is your current emacs-uptime?

No cheating: what is your current emacs-uptime as of this very moment? Not your longest ever, your up time right now. And, should you feel your Emacs developer cred threatened, you may comment on the longest time you've had Emacs opened without closing it.

View Poll

https://redd.it/1g8umxt
@r_emacs

Читать полностью…

/r/emacs

Building Emacs `make -k check` produces error `FAILED emacs-tests/bwrap/allows-stdout`

I'm trying to compile Emacs 29.4 from source with my own build options, using `makepkg` and a `PKGBUILD` file on my Arch-based system.

In my `PKGBUILD` file I decided to include a `make -k check` to test the build:

check (){
cd "$pkgname-$pkgver"
make -k check
}

Unfortunately, I keep getting an error from `emacs-tests/bwrap/allows-stdout` as mentioned in this post's title:


SUMMARY OF TEST RESULTS
-----------------------
Files examined: 471
Ran 7205 tests, 7036 results as expected, 2 unexpected, 167 skipped
2 files contained unexpected results:
src/emacs-tests.log
lisp/progmodes/flymake-tests.log
make[2]: *** [Makefile:341: check-doit] Error 1
make[2]: Leaving directory '/home/nonreligious/src/emacs-29.4-build/src/emacs-my-build-29.4/test'
make[1]: *** [Makefile:310: check] Error 2
make[1]: Leaving directory '/home/nonreligious/src/emacs-29.4-build/src/emacs-my-build-29.4/test'
make: *** [Makefile:1105: check] Error 2
==> ERROR: A failure occurred in check().
Aborting...

The relevant part of `test/src/emacs-tests.log` is shown below. Is this an actual problem? Should I just skip the `check()` part of `PKBGUILD` (which isn't in the official Arch `PKGBUILD` file)?


Test emacs-tests/bwrap/allows-stdout condition:
Info: Process output:

Potentially relevant Seccomp audit events:
Error opening /var/log/audit/audit.log (No such file or directory)

Potentially useful coredump information:
PID: 48235 (emacs)
UID: 1000 (nonreligious)
GID: 1000 (nonreligious)
Signal: 31 (SYS)
Timestamp: Mon 2024-10-21 16:36:23 +0530 (1s ago)
Command Line: /home/nonreligious/src/emacs-29.4-build/src/emacs-my-build-29.4/src/emacs --quick --batch $'--eval=(message "Hi")'
Executable: /home/nonreligious/src/emacs-29.4-build/src/emacs-my-build-29.4/src/emacs
Control Group: /user.slice/user-1000.slice/session-2.scope
Unit: session-2.scope
Slice: user-1000.slice
Session: 2
Owner UID: 1000 (nonreligious)
Boot ID: cd2804a5f3d94132b7fb3d240bbfc3eb
Machine ID: 9742f467144f4ea29efab98e95cbfc18
Hostname: my-x230
Storage: /var/lib/systemd/coredump/core.emacs.1000.cd2804a5f3d94132b7fb3d240bbfc3eb.48235.1729508783000000.zst (present)
Size on Disk: 2.5M
Message: Process 48235 (emacs) of user 1000 dumped core.

Stack trace of thread 48235:
#0 0x00007f9362f39760 pthread_getaffinity_np (libc.so.6 + 0x95760)
#1 0x00007f936277a8c7 gomp_init_num_threads (libgomp.so.1 + 0x238c7)
#2 0x00007f93627621bc initialize_env (libgomp.so.1 + 0xb1bc)
#3 0x00007f936ea9f5b7 n/a (ld-linux-x86-64.so.2 + 0x45b7)
#4 0x00007f936ea9f6ad n/a (ld-linux-x86-64.so.2 + 0x46ad)
#5 0x00007f936eab7e20 n/a (ld-linux-x86-64.so.2 + 0x1ce20)
ELF object binary architecture: AMD x86-64

(ert-test-failed
((should
(eql status 0))
:form
(eql 159 0)
:value nil))
FAILED 1/7 emacs-tests/bwrap/allows-stdout (0.953175 sec) at src/emacs-tests.el:175

https://redd.it/1g8rjv4
@r_emacs

Читать полностью…

/r/emacs

SSH+eat: open dired in CWD?

A while ago I came up with a function which turns Emacs + eat terminal emulator into really well integrated ssh connection manager, each connection in its own buffer starting with ssh-, it's super handy and comfortable to work with. The one piece I'm missing is being able to quickly open the (remote) CWD in dired.

I really don't want to use tramp + dired to traverse remote directories, it's terribly slow, but I'd appreciate a quick way, being in a directory at the remote host, to open dired right there. I do have a one-liner to build a path Emacs (tramp) can understand, and it even understands if it needs to use sudo:

L=logname; U=whoami; H=hostname -f; if [ ${U} == ${L} ]; then echo \"/ssh:${L}@${H}:${PWD}\"; else echo \"/ssh:${L}@${H}|sudo::/${PWD}\"; fi

I'm looking for a good way to execute it and save the output to an elisp variable, or any kind of hack to do something similar with one keybinding/command.

The 'connection manager' can be found here: https://www.reddit.com/r/emacs/comments/1dab1b0/how\_to\_run\_a\_command\_in\_an\_existing\_eat\_terminal/

https://redd.it/1g8lh0x
@r_emacs

Читать полностью…

/r/emacs

No more drugs, punch-line is here

https://preview.redd.it/5wtboqgnn2wd1.png?width=3624&amp;format=png&amp;auto=webp&amp;s=734fbb19b1ac86e4ec45d4d4bf1a0a8e6d5f25fa

The name was bad, I hope you like punch-line a bit better. I decided to add a ton of new features here to make up for the bad name, they are:

* Evil status
* Evil MC / and multiple cursors
* Macro recording
* Git branch and status
* Battery status
* Weather Information
* Eglot (just a little icon)
* Time
* Flycheck status
* Package updates
* Hidden vterm (and hopefully which command it runs)
* Copilot
* For macOS and Apple Music (song and artist information)

Source code is here:
[https://github.com/konrad1977/punch-line](https://github.com/konrad1977/punch-line)

https://redd.it/1g8ku9d
@r_emacs

Читать полностью…

/r/emacs

Emacs for C/++ projects

For other programming languages, I have packages like slime, cider, clj-kondo, etc. - which majorly augment the elegance of the dev experience, compared to raw-dogging it with eglot, a language server, and a dream.


C++ has complicated builds, multiple build profiles, disparate build tools, etc.


It's a completely foreign dev experience from the languages I'm used to. (Haskell, Clojure, ELisp, CL, etc.), and there's a swath of different dev tools, compilers, static analyzers, debuggers. It's different.


I've seen references to CEDET - I do not know if this is still the way folks are doing things. What hacks have you written yourself to enhance your workflow? Is there a stack of modern, fledgling packages representing the future that ecosystem is moving towards?


How are you folks doing it, in this Year of Our Stallman 2024?

I imagine there are hackers in this beautiful digital landscape that have built a set of modern complementary packages that have evolved with c/pp as they have modernized, as well as make, cmake, gdb, and etc.


Thanks, and much love.

https://redd.it/1g8jg8g
@r_emacs

Читать полностью…

/r/emacs

On Mac, why does opening emacs from command line add persistent icon to middle of dock each time?

On my Mac, when I open Emacs via an "emacs xxxx &" command on the command line, it adds an Emacs icon to the middle of the dock (the part between the left part with icons for launching apps and the right part with icons for minimized windows).

However, when I exit Emacs, that icon remains in the dock (middle section), so if I open Emacs (the same way) again, I get yet another Emacs icon.

Why is Emacs and/or MacOS doing that, especially the multiple icons?

(But also, why is it not "activating" the Emacs icons that's already in the left part of my Dock (that is, displaying the little black "app is running" dot below the icon)?)

Thanks.



https://redd.it/1g832u0
@r_emacs

Читать полностью…
Subscribe to a channel