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

Introducing LEmacs ( a config not a distro ;) )

Hello there!

It's been a while since I've wanted to share my personal Emacs configuration. Either because I managed to configure something and someone needed help (like typescript on a React environment) or I needed help doing something and I was "afraid" of sharing it.

Unfortunately my dotfile (yes, it was a \~/.emacs file) was ugly, old, slow and full of personal stuff.

I managed to make it faster (0.6 seconds loadtime with \~95 packages on Linux), somewhat organized and (I hope) free of personal stuff.

This config focuses on having the SAME (or close) user experience on both TUI and GUI.

Nowadays you can do things on tmux, for example, and you want to use Emacs as a sole editor with `emacs -nw` (the same fashion Neovim users do), others times you may want Emacs also as your terminal emulator and project organizer, you may want to start several instances of Emacs for gnus, ERC or other stuff, on either TUI or GUI. This config aims this situations, so nothing should be missing from GUI to TUI. You can even start it as a daemon and use at the same time on terminal and GUI without breaking anything.

On this screenshot we have TUI (left) and GUI (right):

https://preview.redd.it/esot9k1zw89c1.png?width=2880&format=png&auto=webp&s=c338016527f3c76f235c6e848d6db63759f5202f

It is made in a single file, using as much of default Emacs as possible, so you can fork it, customize or get inspired. It is not, by any means an "Emacs Distro".

I'd love some nice feedbacks (preferably on Github issues so we can track and reuse issues).

Github: https://github.com/LionyxML/lemacs

Install instructions on Readme.org

​

https://redd.it/18toziz
@r_emacs

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

/r/emacs

Example](https://preview.redd.it/jja4pxxg799c1.png?width=638&format=png&auto=webp&s=94b85ac0fbcc47c5a50279325668d8d121566eb1)

You can now see on the calendar when `TODO` was `DOING` (purple), when it was `DONE` (green), when it was `SKIP` (yellow) and when it was `FAIL` (red).

This is particularly useful to me for `TODOs` that I would treat as habits. I know that there is a habit package but I didn't like the way it was presented visually to me.

Here is an example of my habit TODO:

[TODO Gym \(habit\)](https://preview.redd.it/31z7imot799c1.png?width=638&format=png&auto=webp&s=6c844eacfcf518bc72583c898c5975fd32e6c987)

[Calendar Gym \(habit\)](https://preview.redd.it/otaabw1v799c1.png?width=638&format=png&auto=webp&s=06765a1534f5c5f37d1fd4032c4be2280e8eec0e)

Seeing them like this helps me maintain my strikes even though the example doesn't show it.

# Org Roam - Inserting Nodes with/without Tags

I often write notes about various things and tag them with a lot of tags. For example, I often create various nodes related to programming, like `c++` notes, `python` notes etc. When preparing for an interview, I like to have one node which will contain all my nodes with a tag `c++`. For this pupose I have created a function which will go through your nodes (and also subnodes inside a node) and insert them according to your needs. You can choose which tags the nodes should have but also which tags the nodes should not have.

Here is a small example:

[Inserting all nodes with \\"fitness\\" tag](https://preview.redd.it/tuagzkyj899c1.png?width=399&format=png&auto=webp&s=ae0eec3a213383cdec420879850cecd39e42235a)

[Inserting all nodes with \\"fitness\\" but without \\"cardio\\" tag](https://preview.redd.it/lwzle23m899c1.png?width=399&format=png&auto=webp&s=84a071dda296bd1bac8574386a4a2b28f44ec388)

In the above example, the nodes that have `->` are the nodes that are a part of some other node. This helps to differentiate which nodes are standalone.

# Chatgpt-shell - Prepending Variables

The `chatgpt-shell` package is a fun one. I intended to use it in my `org` files in the `org-babel` block in order to interractively ask question about the stuff I was studying.

I am not sure whether the support for this already exists but I wanted the following:

I wanted to, when I learn something new, to create an `org-babel` code block to parse the heading I was writing and output it as a result. I wanted to have `chatgpt-shell` `org-babel` code block which would then take that result and add it to my question I was asking.

In essence, I wanted to avoid manually copying content to the `chatgpt-shell` and have it be automated for me. I resorted to creating a function which will prepend any variable I give to the `org-babel` `chatgpt-shell` and send it.

Here is a small example:

[Chatgpt-shell prepend variables](https://preview.redd.it/4mcf1abr999c1.png?width=664&format=png&auto=webp&s=dbb6dbc3c385e09e3775b4e11d2affc9aca5ccd2)

# Bookmarks - Seamless Opening on Android/Linux

I have created a function which advises `bookmark-jump` function in order to be able to open bookmarks across platforms. This makes the bookmarks you create on Linux also open-able on your Android, as this advice function will change the `home` folder to the appropriate one depending on you system. It does this automatically, so no need to change anything about it.

The ony thing that would be good to have is the same folder names on your systems. I usually keep everything in `Documents/Bookmarks` and my nodes in `Notes/` folder.

# Final Thoughts

All of the above has been tested and found to be working on both Linux and Android. The same configuration file is used.

For some things to work properly, you need to do certain things, like setting up GPG keys on both Android and Linux if you wish to use the `auth-source` configuration and stuff like that.

Also important is that nothing was done to change the source of the packages used, only standalone functions or advice functions have been created to modify the functionality.

Hope some of this sparks an interest

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

/r/emacs

(org-media-note--seconds-to-timestamp time-b)) (if (numberp time-a) (format "Set B of A-B loop (%s - )" (org-media-note--seconds-to-timestamp time-a)) "Set A of A-B loop"))) 46) #("-" 0 1 (face hydra-face-red)) #("a" 0 1 (face hydra-face-red)) #("I n" 0 3 (face hydra-face-red)) #("t c" 0 3 (face hydra-face-red)) (pretty-hydra-toggle "Use ref key instead of absolute path" (bound-and-true-p org-media-note-use-refcite-first)) #("T" 0 1 (face hydra-face-red)) #("g" 0 1 (face hydra-face-red)) #("0" 0 1 (face hydra-face-red)) #("S" 0 1 (face hydra-face-red)) #("I t" 0 3 (face hydra-face-red)) #("t p" 0 3 (face hydra-face-red)) (pretty-hydra-toggle "Pause media after insert link" (bound-and-true-p org-media-note-pause-after-insert-link)) #("c" 0 1 (face hydra-face-red)) #("<left>" 0 6 (face hydra-face-red)) #("m" 0 1 (face hydra-face-red)) #("s" 0 1 (face hydra-face-red)) #("I s" 0 3 (face hydra-face-red)) #("t s" 0 3 (face hydra-face-red)) (pretty-hydra-toggle "Auto save screenshot" (bound-and-true-p org-media-note-save-screenshot-p)) #("x" 0 1 (face hydra-face-red)) #("<right>" 0 7 (face hydra-face-red)) #("H-m" 0 3 (face hydra-face-red)) #("t S" 0 3 (face hydra-face-red)) (pretty-hydra-toggle "Screenshot with subtitles" (bound-and-true-p org-media-note-screenshot-with-sub)) #("z" 0 1 (face hydra-face-red)) #("C-<left>" 0 8 (face hydra-face-red)) #("t t" 0 3 (face hydra-face-red)) (pretty-hydra--pad-or-trunc-hint (format "Timestamp format: %s" (cond ((eq org-media-note-timestamp-pattern 'hms) "hh:mm:ss") ((eq org-media-note-timestamp-pattern 'hmsf) "hh:mm:ss.fff"))) 41) #("C-<right>" 0 9 (face hydra-face-red)) #("t M" 0 3 (face hydra-face-red)) (pretty-hydra--pad-or-trunc-hint (format "Separator when merge: %s" org-media-note-separator-when-merge) 41)) org-media-note-hydra)
org-media-note-hydra/org-media-note-mpv-smart-play()
funcall-interactively(org-media-note-hydra/org-media-note-mpv-smart-play)
command-execute(org-media-note-hydra/org-media-note-mpv-smart-play)


&#x200B;

https://redd.it/18u96w4
@r_emacs

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

/r/emacs

5 ways to get text from an Emacs buffer
https://dev.to/rajasegar/5-ways-to-get-text-from-an-emacs-buffer-4c3l

https://redd.it/18wftzw
@r_emacs

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

/r/emacs

Making emacs use the Wolfram lsp server.

Wolfram Mathematica can apparently function as an lsp server now https://github.com/WolframResearch/LSPServer and the official notebook editor gives the user a dexterity of code manipulation on par with notepad, so I put 2 and 2 together and attempted to make emacs use the lsp server with mixed results.

I simply took the command to start the lsp server from the wolfram plugin of vscode and added it to eglot like

(add-to-list 'eglot-server-programs
'('xah-wolfram-mode "/usr/local/Wolfram/Mathematica/13.3/Executables/WolframKernel" "`kernel`" "-noinit" "-noprompt" "-nopaclet" "-noicon" "nostartuppaclets" "-run" "Needs[\"LSPServer`\"];LSPServer`StartServer[]"))

With this, the eldoc and the flymake integration part of eglot works, but I'm not getting most of the rest of the functionality, in particular 'completion-at-point'.

I also tried adding the same lsp server command to lsp-mode instead of eglot, but that just didn't work at all.

(add-to-list 'lsp-language-id-configuration
'(xah-wolfram-mode . "wolfram"))
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection '("/usr/local/Wolfram/Mathematica/13.3/Executables/WolframKernel" " `kernel` "" -noinit" "-noprompt " "-nopaclet" "-noicon" "-nostartuppaclets" "-run Needs[\"LSPServer`\"];LSPServer`StartServer[]"))
:activation-fn (lsp-activate-on "wolfram")
:server-id 'wolfram)

Does someone have any idea how to troubleshoot this? I'm really more interested in the eglot route because that is what I use otherwise. I do completion with corfu and it works in the languages that eglot supports by default. The problem is that I'm not really getting any error messages even with everything in 'eglot-strict-mode' turned on, so I have no idea what else to try.

https://redd.it/18u68u4
@r_emacs

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

/r/emacs

"progn: Beginning of buffer" with eglot + markdown-mode

I'm currently using eglot for LSP and markdown-mode to render markdown in eldoc buffer.

When I click on a link in an eldoc buffer for a rust project, it stops, flashes and then prints progn: Beginning of buffer in the *Message*.

So, I figured maybe if I turn on toggle-debug-on-error I can find out where the error is happening. But, clicking the link does not trigger the error for debugging.

So, I decided to put a message call at the beginning and end of the markdown-follow-thing-at-point (which is executed when you click on a link) like this:

(defun markdown-follow-thing-at-point (arg)
"Follow thing at point if possible, such as a reference link or wiki link.
Opens inline and reference links in a browser. Opens wiki links
to other files in the current window, or the another window if
ARG is non-nil.
See `markdown-follow-link-at-point' and
`markdown-follow-wiki-link-at-point'."
(interactive "P")
(message "markdown-follow-thing-at-point sos")
(cond ((markdown-link-p)
(markdown-follow-link-at-point))
((markdown-wiki-link-p)
(markdown-follow-wiki-link-at-point arg))
(t
(let* ((values (markdown-link-at-pos (point)))
(url (nth 3 values)))
(unless url
(user-error "Nothing to follow at point"))
(markdown--browse-url url))))
(message "markdown-follow-thing-at-point sis"))


When I evaluate the defun and then click on the link again, it only prints the "markdown-follow-thing-at-point sos" which might imply that the function broke at some point, but I can't see why with toggle-debug-on-error.

To make matters worse, debug-on-message with "progn: Beginning of buffer" does not work!

I ideally would like it if it at least open the url in a web browser :(

Update 1:

Alright so I found where the markdown-mode fails to open the link.

It fails inside function markdown-backward-to-link-start specifically where (forward-char -1) is called.

In terms of backtrace, it translates to: markdown-follow-thing-at-point -> markdown-link-p -> markdown-backward-to-link-start

https://redd.it/18ui2ko
@r_emacs

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

/r/emacs

Should I learn elisp if I want to be a power user?

I've mainly been using Vim and Jetbrains for the past several months. My favorite programming streamers are using emacs and I like the potential of emacs being an all around editor for any kind of usage, as well as its customizability. I've started learning the keybinds through the built in emacs tutorial. But I'm just wondering, if I'm wanting to be a true power user, do I need to become proficient at elisp?

https://redd.it/18u9pah
@r_emacs

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

/r/emacs

Doom Emacs Treemacs UI Help

https://redd.it/18upcqp
@r_emacs

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

/r/emacs

Better toolkit scrollbars

I always had the scrollbars disabled in Emacs because they kind of stand out in an ugly way and they are visible on every window even if not needed (even in the minibuffer window). As the toolkit scrollbars in Emacs are nevertheless handy, I tinkered a bit to solve both problems:
1: `on-demand-scroll-bar-mode` is an alternative to `scroll-bar-mode` that shows vertical scroll bars only when needed
https://github.com/florommel/on-demand-scroll-bar
2: custom-css allows to load arbitrary CSS snippets to style Emacs's GTK widgets.
It comes with a dedicated mode to change the scrollbar visuals, as this requires special care. However, you can also adapt all other GTK widgets inside Emacs (menu bar, tool bar, context menus).
The package requires a C module to be built and loaded and works only with GTK builds of Emacs.
https://github.com/florommel/custom-css

Both packages are experimental. Of course, they can be used independently from each other.

https://redd.it/18uuz6z
@r_emacs

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

/r/emacs

Getting DAP to work with lsp-java

I'm trying to get DAP debugging working for the first time and I'm getting class not found exceptions for the class I'm trying out. I can also see from the log buffer that DAP is being started only with the junit classpath env variable and without the class path to the test class. Note: flymake and lsp-java-build-project are successful.

Where/how do I set things up so the correct class path is passed onto DAP?

https://redd.it/18wa02u
@r_emacs

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

/r/emacs

Time in Elisp. NYE setup for Champagne at the end
https://youtu.be/bMKxS-M9nYM

https://redd.it/18v7m6c
@r_emacs

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

/r/emacs

Creating a custom treesit major mode

CUDA is a language that, by default is unsupported by treesit in emacs.

It has a grammar defined in https://github.com/theHamsta/tree-sitter-cuda.

I have followed https://www.gnu.org/software/emacs/manual/html\_node/elisp/Tree\_002dsitter-Major-Modes.html and https://github.com/renzmann/treesit-auto to come up with the following:

(use-package treesit-auto
:custom
(treesit-auto-install t)
:config
(add-to-list 'treesit-auto-recipe-list
(make-treesit-auto-recipe
:lang 'cuda
:ts-mode 'cuda-ts-mode
:url "https://github.com/theHamsta/tree-sitter-cuda"
:ext "\\.cu\\'"))
(treesit-auto-add-to-auto-mode-alist 'all)
(global-treesit-auto-mode 1))

(define-derived-mode cuda-ts-mode prog-mode "CUDAts"
"Major mode for editing CUDA with tree-sitter."
(when (treesit-ready-p 'cuda)
(treesit-major-mode-setup)))

Unfortunately, I have problems with the code:

1. When I open a .cu file, it is opened in Fundamental mode
2. When I manually M-x cuda-ts-mode, it is enabled but I do not get syntax highlighting
3. The CUDA parser is not automatically installed; I had to install it via M-x treesit-install-language-grammar and build the recipe interactively because it didn't find my provided recipe

What is wrong about the code?

Thanks and I wish you all a happy new year!

EDIT: I was able to get syntax highlighting working by calling (treesit-parser-create 'cuda) before (treesit-major-mode-setup) and by deriving from c-mode instead of prog-mode. Is this the correct solution?

https://redd.it/18v846o
@r_emacs

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

/r/emacs

fancy tab-bar with svg

I found that svg-tag-mode can be used with tab-bar with a little hack, and the result seems pretty good:

&#x200B;

https://i.redd.it/x2f4rj7mck9c1.gif

The code is as follows:

(defface tab-bar-svg-active
'((t (:foreground "#a1aeb5")))
"Tab bar face for selected tab.")

(defface tab-bar-svg-inactive
'((t (:foreground "#a1aeb5")))
"Tab bar face for inactive tabs.")

(defun eli/tab-bar-svg-padding (width string)
(let* ((style svg-lib-style-default)
(margin (plist-get style :margin))
(txt-char-width (window-font-width nil 'fixed-pitch))
(tag-width (- width (* margin txt-char-width)))
(padding (- (/ tag-width txt-char-width) (length string))))
padding))

(defun eli/tab-bar-tab-name-with-svg (tab i)
(let* ((current-p (eq (car tab) 'current-tab))
(name (concat (if tab-bar-tab-hints (format "%d " i) "")
(alist-get 'name tab)
(or (and tab-bar-close-button-show
(not (eq tab-bar-close-button-show
(if current-p 'non-selected 'selected)))
tab-bar-close-button)
"")))
(padding (plist-get svg-lib-style-default :padding))
(width)
(image-scaling-factor 1.0))
(when tab-bar-auto-width
(setq width (/ (frame-inner-width)
(length (funcall tab-bar-tabs-function))))
(when tab-bar-auto-width-min
(setq width (max width (if (window-system)
(nth 0 tab-bar-auto-width-min)
(nth 1 tab-bar-auto-width-min)))))
(when tab-bar-auto-width-max
(setq width (min width (if (window-system)
(nth 0 tab-bar-auto-width-max)
(nth 1 tab-bar-auto-width-max)))))
(setq padding (eli/tab-bar-svg-padding width name)))
(propertize
name
'display
(svg-tag-make
name
:face (if (eq (car tab) 'current-tab) 'tab-bar-svg-active 'tab-bar-svg-inactive)
:inverse (eq (car tab) 'current-tab) :margin 0 :radius 6 :padding padding
:height 1.1))))
(setq tab-bar-tab-name-format-function #'eli/tab-bar-tab-name-with-svg)

&#x200B;

https://redd.it/18v02tc
@r_emacs

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

/r/emacs

A dedicated compose buffer on top of chatgpt-shell
https://redd.it/18vzlml
@r_emacs

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

/r/emacs

GPG in emacs
http://yitang.uk/2023/12/28/gpg-in-emacs-first-step-towards-data-security/

https://redd.it/18vllnw
@r_emacs

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

/r/emacs

and finds its way in someone's workflow!

https://redd.it/18tqpfb
@r_emacs

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

/r/emacs

Sharing my Emacs Workflow and Dotfiles

Hi all,

First, a little backstory.

I have started getting interested in note-taking and knowledge bases about a year and a half ago. I first stumbled upon `Notion`, but quickly abandoned it due to its online-only nature. Then I started looking at alternatives like `Obsidian` and `Logseq`. `Logseq` caught my attention since it provided some nice features like daily journaling and *"Everything is a node"* strategy. I liked it. Then I learned that it was a watered down version of Emacs's `org-mode`. That is when I started looking into Emacs. This was a year ago.

I fell in love instantly. It was mind boggling to me that you could change anything and nothing was off limits. This was a year ago and I still change things on a daily basis. I think I may have fallen into the rabbit hole of endless customization to be honest... But anyhow, the one thing that was missing was the Android client. I like having my notes and my `TODOs` with my all the time. This came at the beginning of this year when Emacs was ported to Android. Now it was perfect. So I decided to make my configuration work on both my phone and my laptop.

This is a small appreciation post to the Emacs community as I have on numerous occasions found solutions to some of my problems on this subreddit that I probably wouldn't have figured out on my own. I would like to share with you my dotfiles and showcase some of the things I made for myself, which might be interesting to you as well.

Here is the link to my dotfiles [https://github.com/danijelcamdzic/dotemacs/](https://github.com/danijelcamdzic/dotemacs/). In the `README` section I have written a small tutorial on how to use these dotfiles and the goal is to be able to use this configuration without any major changes on both Android and Linux. I intended for it to be user friendly so that first-timers can also follow. I have also described some of the features I have added to make some things easier to view/see/log.

I will add a couple to this post as well so you can skim and see if any seem interesting to you.

# Note on Syncing

I use [https://syncthing.net/](https://syncthing.net/) app to sync my folders from the `home` directory. I name the folders the same on my Android and Linux to make it easier to maintain and I take care to let my configuration know which system is currently running (automatically done by checking the system type). I use git to version-control my dotfiles and I simply push/pull on my Android/Linux to have the latest version.

# Overview

[Emacs on Linux](https://preview.redd.it/lumcsxtd699c1.png?width=1922&amp;format=png&amp;auto=webp&amp;s=3076c858aad29151a90214c9bbbc0a66ce5d5998)

[Emacs on Android](https://preview.redd.it/6yo94p6f699c1.png?width=1080&amp;format=png&amp;auto=webp&amp;s=43605cec6b3775b815a588b9774b41d97a7d4947)

# Dashboard - Relative Dates

I like to see my `org-agenda` items on the dashboard. For this I use the `dashboard` package. In the original version, the agenda items would appear and be shown with their scheduled dates. I didn’t like seeing the dates as they are, and preffered to see them written in a more personal manner by using the relative date terms like today, tomorrow and yesterday as opposed to absolute dates.

[The Original](https://preview.redd.it/ycer7bsv699c1.png?width=807&amp;format=png&amp;auto=webp&amp;s=9cd4b46bad52f4968b5025be2abebd6fa833f1af)

[The \\"Relative\\" Dashboard](https://preview.redd.it/1lkkz6qx699c1.png?width=807&amp;format=png&amp;auto=webp&amp;s=42ccccacc1200d5d361d2e3f1c8021dc17219bed)

# Org-Mode - TODOs Displayed on a Calendar

I wanted to have a way to visualize how my `TODO` (or any heading) changed throughout its existance. I wanted to see when I marked it as `DONE`, when as `FAIL` and when I was `DOING` it. I wanted to see this visually on my calendar.

For this I created several functions which serve the purpose to parse the logbook and display a TODO’s history.

[TODO Algorithm Example](https://preview.redd.it/29649aee799c1.png?width=628&amp;format=png&amp;auto=webp&amp;s=876966f8702ab727a3e4889cd7bbae3bd0ffc6ff)

[Calendar Algorithm

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

/r/emacs

org-media-note (error "‘get_property’ failed: property unavailable")

When opening a youtube url from hydra menu.

Debugger entered--Lisp error: (error "‘get_property’ failed: property unavailable")
error("`%s' failed: %s" "get_property" "property unavailable")
mpv-run-command("get_property" "path")
mpv-get-property("path")
org-media-note--hydra-title()
(format "\n %s\n\n File Playback Volume No..." (org-media-note--hydra-title) #("o" 0 1 (face hydra-face-red)) (pretty-hydra--pad-or-trunc-hint (if (org-media-note-ref-cite-p) (format "Open %s" (org-media-note--current-org-ref-key)) "Open file") 21) #("<SPC>" 0 5 (face hydra-face-red)) #("+" 0 1 (face hydra-face-red)) #("i" 0 1 (face hydra-face-red)) #("I p" 0 3 (face hydra-face-red)) #("t m" 0 3 (face hydra-face-red)) (pretty-hydra-toggle "Auto insert media item" (bound-and-true-p org-media-note-auto-insert-item)) #("j" 0 1 (face hydra-face-red)) #("l" 0 1 (face hydra-face-red)) (pretty-hydra--pad-or-trunc-hint (let ((time-a (mpv-get-property "ab-loop-a")) (time-b (mpv-get-property "ab-loop-b"))) (if (org-media-note--ab-loop-p) (format "Clear A-B loop (%s - %s)" (org-media-note--seconds-to-timestamp time-a) (org-media-note--seconds-to-timestamp time-b)) (if (numberp time-a) (format "Set B of A-B loop (%s - )" (org-media-note--seconds-to-timestamp time-a)) "Set A of A-B loop"))) 46) #("-" 0 1 (face hydra-face-red)) #("a" 0 1 (face hydra-face-red)) #("I n" 0 3 (face hydra-face-red)) #("t c" 0 3 (face hydra-face-red)) (pretty-hydra-toggle "Use ref key instead of absolute path" (bound-and-true-p org-media-note-use-refcite-first)) #("T" 0 1 (face hydra-face-red)) #("g" 0 1 (face hydra-face-red)) #("0" 0 1 (face hydra-face-red)) #("S" 0 1 (face hydra-face-red)) #("I t" 0 3 (face hydra-face-red)) #("t p" 0 3 (face hydra-face-red)) (pretty-hydra-toggle "Pause media after insert link" (bound-and-true-p org-media-note-pause-after-insert-link)) #("c" 0 1 (face hydra-face-red)) #("<left>" 0 6 (face hydra-face-red)) #("m" 0 1 (face hydra-face-red)) #("s" 0 1 (face hydra-face-red)) #("I s" 0 3 (face hydra-face-red)) #("t s" 0 3 (face hydra-face-red)) (pretty-hydra-toggle "Auto save screenshot" (bound-and-true-p org-media-note-save-screenshot-p)) #("x" 0 1 (face hydra-face-red)) #("<right>" 0 7 (face hydra-face-red)) #("H-m" 0 3 (face hydra-face-red)) #("t S" 0 3 (face hydra-face-red)) (pretty-hydra-toggle "Screenshot with subtitles" (bound-and-true-p org-media-note-screenshot-with-sub)) #("z" 0 1 (face hydra-face-red)) #("C-<left>" 0 8 (face hydra-face-red)) #("t t" 0 3 (face hydra-face-red)) (pretty-hydra--pad-or-trunc-hint (format "Timestamp format: %s" (cond ((eq org-media-note-timestamp-pattern 'hms) "hh:mm:ss") ((eq org-media-note-timestamp-pattern 'hmsf) "hh:mm:ss.fff"))) 41) #("C-<right>" 0 9 (face hydra-face-red)) #("t M" 0 3 (face hydra-face-red)) (pretty-hydra--pad-or-trunc-hint (format "Separator when merge: %s" org-media-note-separator-when-merge) 41))
hydra-show-hint((format "\n %s\n\n File Playback Volume Note Import Toggle \n───..." (org-media-note--hydra-title) #("o" 0 1 (face hydra-face-red)) (pretty-hydra--pad-or-trunc-hint (if (org-media-note-ref-cite-p) (format "Open %s" (org-media-note--current-org-ref-key)) "Open file") 21) #("<SPC>" 0 5 (face hydra-face-red)) #("+" 0 1 (face hydra-face-red)) #("i" 0 1 (face hydra-face-red)) #("I p" 0 3 (face hydra-face-red)) #("t m" 0 3 (face hydra-face-red)) (pretty-hydra-toggle "Auto insert media item" (bound-and-true-p org-media-note-auto-insert-item)) #("j" 0 1 (face hydra-face-red)) #("l" 0 1 (face hydra-face-red)) (pretty-hydra--pad-or-trunc-hint (let ((time-a (mpv-get-property "ab-loop-a")) (time-b (mpv-get-property "ab-loop-b"))) (if (org-media-note--ab-loop-p) (format "Clear A-B loop (%s - %s)" (org-media-note--seconds-to-timestamp time-a)

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

/r/emacs

svg-lib 0.3, now with interactive buttons
https://redd.it/18tkeuu
@r_emacs

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

/r/emacs

Can noweb references apply to header blocks alone?

I find myself constantly repeating a block to access a database:

#+name: common-sql-header
#+header: :engine postgresql
#+header: :dbhost 127.0.0.1
#+header: :dbport 5432
#+header: :dbuser dbadmin
#+header: :dbpassword: :
#+header: :database orgsqltables

Is it possible to create blocks like this:

<<common-sql-header>>
#+begin_src sql
select * from information_schema.tables where table_schema='public' order by table_name
#+end_src

It has become more important as I now have to use a password and I can't have the password appearing in the file.

https://redd.it/18udqyc
@r_emacs

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

/r/emacs

Is it impossible that I am a vim user but I like emacs more?

(EDIT: I'm not literally looking for sympathy (reddit doesn't let me tweak the title to steer the thread in the intended direction)! My reason for posting is that I wanted to understand if the vim/emacs dichotomy really is black and white the way IT folklore depicts it)

I loved XEmacs at my first job but after that:

1) I found only vim was available on some severs so just being young and open minded I learned that too

2) I started using Mac os and never found aquamacs or x11 XEmacs seamless enough (I've tried and failed more than once).

3) most significantly, emacs pinky crippled me, and MacBooks only have one Ctrl key so I couldn't even alternate to give my left pinky a break. EDIT: remapping capslock still works your left pinky; using an external keyboard is fine during work hours but I do coding or note taking anywhere and everywhere (maybe the real response is "get another hobby")

EDIT: regarding evil, I'm not particularly looking to recreate vim modes in emacs. What I really love about xemacs is how easy and natural it is to call functions with M-x. Also highlighting with visual mode in vim is a bit sophisticated and too much of a departure from traditional text editors (losing your selection as you try to accomplish something on a highlighted region)



https://redd.it/18uktbm
@r_emacs

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

/r/emacs

Literate config tips?

I would like to rewrite my Emacs config file. Since I started using Emacs, the org file from which I generate the init has become too large and difficult to navigate. Looking at popular configurations, I came to the conclusion that one of the first things I should do is split it into several files. I wonder if people here have any other advice or special know-how they have come across? What do you think are the best practices that lead to a nice tidy config that gets out of the way?

https://redd.it/18wgslm
@r_emacs

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

/r/emacs

lsp-mode without yasnippet

I have recently started using lsp-mode but noticed it forces one to install (and use?) yasnippet. I switched from yasnippet to templ a long time ago, and I don't want to go back to the former.

Can this be done?

https://redd.it/18uexo3
@r_emacs

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

/r/emacs

Does emacs support structural editing for non lisps?

Intellij supports structural selection/editing for every supported language: https://www.jetbrains.com/guide/java/tips/extend-selection/

It allows you to code in every language as if it was a lisp and the single feature that is keeping me hooked to intellij. Is there something close/similar in the emacs ecosystem?

https://redd.it/18uyn23
@r_emacs

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

/r/emacs

Magit diff with font-lock-mode disabled

Is it possible to have Magit diffs still be highlighted/colored with font-lock-mode disabled? I prefer no syntax highlighting, but still want to be able to easily read diffs.

I know it is possible to override faces individually to achieve the same result, but this requires adding new faces consistently.

https://redd.it/18w9ai0
@r_emacs

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

/r/emacs

NANO agenda rewrite (WIP)
https://redd.it/18umexf
@r_emacs

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

/r/emacs

Help with setting up c++-ts-mode correctly

I want to switch to the built in tree-sitter package (treesit) from the third party one. I followed the instructions and verified that my emacs is compiled with tree-sitter flag (I downloaded emacs binary from fedroa repos). I have libtree-sitter and libtree-sitter-devel installed from system package manager. Following is my configuration of tree-sitter

(use-package treesit
:ensure nil
:custom
(treesit-language-source-alist '((c++ "https://github.com/tree-sitter/tree-sitter-cpp")
(python "https://github.com/tree-sitter/tree-sitter-python")
(c "https://github.com/tree-sitter/tree-sitter-c")))
(major-mode-remap-alist '((c++-mode . c++-ts-mode)
(python-mode . python-ts-mode)
(c-mode . c-ts-mode)))
(treesit-font-lock-level 4))

Though I cannot pin point exactly what I did but for some reason while before I simply got a nil for

(treesit-language-available-p 'c++)

but now I am getting this for some reason

Eval error Wrong type argument: stringp, nil

What is even more confusing that c-ts-mode and python-ts-mode are working fine.

Here are my contents of \~/.config/emacs/tree-sitter

.
├── libtree-sitter-c++.so
├── libtree-sitter-c.so
└── libtree-sitter-python.so

Any help would be appreciated : )

https://redd.it/18w2nod
@r_emacs

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

/r/emacs

Medical Physics Dissertation with Emacs and Orgmode
https://github.com/reconmaster/thesis

https://redd.it/18v3u9h
@r_emacs

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

/r/emacs

How does Emacs handle HDPI display across platforms/versions?

Over the past decade, pixel density of displays has increased significantly. On Mac, the "Retina" display concept represents a doubling of display density, from \~100 to \~200ppi. On HDPI Retina displays, applications are presented with and work in "virtual" pixels of 2x2 physical screen pixels, so that font sizes, icons, etc. remain "normal". Then raster, vector and font drawing can make use of all the tiny pixels, for higher quality. My question is, how does Emacs on different systems handle HDPI display?

My build (emacs-mac) provides some limited support for varying DPI. You can provide parallel high-res versions of image files named like file@2x.ext which are substituted for low-DPI images (without the @2x) automatically. You can similarly embed the text property :data-2x in generated image data. But standalone high density images (like Retina screenshots) must be scaled appropriately (often by 0.5x) to "light all the pixels" and not appear overly large.

What do other ports do to accommodate high-DPI? Nothing? Do you just select very large font sizes? What if you have multiple displays with significantly different pixel density connected? How is image display handled? This seems like an area where some coherent treatment and documentation would be very helpful. But perhaps the underlying OS/display systems vary so greatly in their treatment of HDPI it limits this kind of progress?

https://redd.it/18vxzpk
@r_emacs

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

/r/emacs

GNU Emacs as a Shopping App

&#x200B;

https://preview.redd.it/povwhyjv1k9c1.png?width=762&amp;format=png&amp;auto=webp&amp;s=4837e4693d3a93ca1e0c9d1f5ed2ce3ca873e9de

How do you find the best price for items while shopping online? You can go to each website and compare yourself manually. Or let Emacs do the hard work for you!!

My monthly grocery shopping workflow https://lifeofpenguin.blogspot.com/2023/12/gnu-emacs-as-shopping-app.html

https://redd.it/18uyxty
@r_emacs

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