r_emacs | Unsorted

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

70

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

Subscribe to a channel

/r/emacs

Dired drag files, trival but remarkable effective

In Emacs' Dired, You could conveniently move files from outside into Emacs by simply dragging them there.

Drag files in dired

This is effective.

Emacs has been my faithful companion for over 5 years, and I just stumbled upon this remarkable feature minutes ago.

Typically, I rely on async-shell-commands to open the current buffer directory in Windows 10's File Manager, then move files from folder to folder.

But, now, this seeming-trival discovery has greatly enhanced my workflow, instill in me a strong sence that Emacs not only coexists within the operating system, but rather embodies the operating system itself.

While it is true that Windows does not support dragging files to external locations, I seldom encounter such a requirement in my day-to-day workflows.

Have you ever had such an experience? Discovered an amazing feature after a long time using Emacs?

​

https://redd.it/17f4xtp
@r_emacs

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

/r/emacs

Magit: cloning for worktrees

I love git worktrees. It took me a while to change my workflow and get used to doing things differently, but it is so much better. I never have to think "oh my repo is in inconsistent state, I can't switch my focus and start reviewing this PR, I need to first stash/commit/stage/etc. my stuff..."

I also love how Magit lets me create a worktree from a PR or an Issue (some of that is built-in, some I extended to fit my workflow). One thing is still missing though.

Cloning or starting a new repo in a practical way to be used with worktrees, for me, always requires some manual process.

First, I need to follow the recommendation I borrowed from this blogpost: How to use git worktree and in a clean way. It boils down to:

mkdir my-awesome-project
$ cd my-awesome-project
$ git clone --bare git@github.com:myname:my-awesome-project.git .bare
$ echo "gitdir: ./.bare" > .git

But when I do that, git doesn't see remote branches anymore. So some stuff won't work as normally expected. For that, I have to follow this advice from SO, basically adding to ./bare/config:

remote "origin"
fetch = +refs/heads/:refs/remotes/origin/

And now I'm thinking, before I try to automate this. Maybe Magit already does the right thing and I just never knew about it? Or maybe it's much simpler than that and all that manual hocus-pocus is not needed?

How do you use worktrees with Magit? And if you don't use worktreees, why is that? Is there even a better way?

https://redd.it/17ewu0j
@r_emacs

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

/r/emacs

python-mode has strong opinions about outline-minor-mode. Where are they documented?

I'm finding that defining outline-regexp does not do for me in python-mode what it does for me in other language modes. Someone else on Stack Exchange ran into the same problem, and a suggested answer to their question makes it clear that python-mode preconfigures some definitions for outline-minor-mode. But what those preconfigurations are, and more importantly how to use them, is not documented anywhere I can find.

https://redd.it/17eoxc3
@r_emacs

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

/r/emacs

Doom Emacs & columnview: How to ensure fixed fontsize in columnview?

Hi,

I'm quite new to emacs. Using doom-emacs I have the following lines in my config.el:

(after! org
(custom-set-faces!
'(org-document-title :height 2.0)
'(org-level-1 :inherit outline-1 :weight extra-bold :height 1.75)
'(org-level-2 :inherit outline-2 :weight bold :height 1.5)
'(org-level-3 :inherit outline-3 :weight bold :height 1.25)
'(org-level-4 :inherit outline-4 :weight bold :height 1.1)
'(org-level-5 :inherit outline-5 :weight semi-bold :height 1.06)
'(org-level-6 :inherit outline-6 :weight semi-bold :height 1.03)
'(org-level-7 :inherit outline-7 :weight semi-bold)
'(org-level-8 :inherit outline-8 :weight semi-bold)
;; Ensure that anything that should be fixed-pitch in org buffers appears that
;; way
'(org-block nil :foreground nil :inherit 'fixed-pitch)
'(org-code nil :inherit '(shadow fixed-pitch))
'(org-table nil :inherit '(shadow fixed-pitch))
'(org-verbatim nil :inherit '(shadow fixed-pitch))
'(org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
'(org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
'(org-checkbox nil :inherit 'fixed-pitch)))

This works fine, but gives me a strange-looking columnview (because many todo-items do have different fontsizes now).

How can I ensure, that - when using columnview - a monospace font with a fixed fontsize is used?

https://redd.it/17ejwut
@r_emacs

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

/r/emacs

Magit: How do you do "git pull --no-rebase"?

When local repository moved ahead and remote also moved ahead, the remote doesn't allow Push. You have to first Pull. But sometimes pull doesn't work straight forward, you have to specify the merge strategy. This happens when `--ff-only` doesn't work for some reason.

In such a scenario, I normally use `--no-rebase` option. It creates a new commit with the merge. I can use `--rebase` also. But that is my personal preference. I want to keep the history of changes as is.

I couldn't find `--no-rebase` option in the Magit interface. Any idea, how to do that using Magit?

ChatGPT suggests that instead of direct Pull i.e. `F u`, I should first fetch and then merge i.e. `f u` followed by merging aka `m m`. Although, I haven't tried it yet. But just wanted to ask, if there is a direct way to achieve `--no-rebase` in Pull.

https://redd.it/17eanqo
@r_emacs

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

/r/emacs

Smallest device which could run comfortably emacs

Half out of curiosity and half out of real interest I'd like to know what is the smallest (portable) device with a reasonable quality keyboard that could run an appropriate Linux distro and emacs and people have tested for actual long-term usability.

I'm looking at UMPCs and various 7-inch mini laptops you see on eBay.

Thanks!

https://redd.it/17e7rrk
@r_emacs

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

/r/emacs

Emacs on XQuartz

Can somebody please help me solve this. i tired everything i can. i am runnin xQuartz 2.85, Emacs 28.2, Server is linux based. i get this over ssh. Emacs works fine without ssh.

libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
Connection lost to X server 'localhost:10.0'
When compiled with GTK, Emacs cannot recover from X disconnects.
This is a GTK bug: https://gitlab.gnome.org/GNOME/gtk/issues/221
For details, see etc/PROBLEMS.
Fatal error 6: Aborted
Backtrace:
emacs[0x5194a2]
emacs[0x4febb1]
emacs[0x519559]
emacs[0x4cab03]
emacs[0x4cac1c]
/usr/lib/x86_64-linux-gnu/libX11.so.6(_XIOError+0x52)[0x7f6dc1716492]
/usr/lib/x86_64-linux-gnu/libX11.so.6(_XEventsQueued+0x7d)[0x7f6dc1713b4d]
/usr/lib/x86_64-linux-gnu/libX11.so.6(XPending+0x61)[0x7f6dc1705341]
/usr/lib/x86_64-linux-gnu/libgdk-3.so.0(+0x701ff)[0x7f6dc1db21ff]
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_prepare+0x19f)[0x7f6dc188c8ef]
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x5229b)[0x7f6dc188d29b]
/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_pending+0x2c)[0x7f6dc188d43c]
/usr/lib/x86_64-linux-gnu/libgtk-3.so.0(gtk_events_pending+0x12)[0x7f6dc20971b2]
emacs[0x4cb38d]
emacs[0x505f82]
emacs[0x506625]
emacs[0x5be02d]
emacs[0x428ca1]
emacs[0x50ad97]
emacs[0x50c440]
emacs[0x50db54]
emacs[0x576c46]
emacs[0x4fef74]
emacs[0x576bb5]
emacs[0x4fef13]
emacs[0x504127]
emacs[0x504488]
emacs[0x41ef32]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x7f6dbfa5f083]
emacs[0x41fc0e]
Aborted (core dumped)

https://redd.it/17e5ozo
@r_emacs

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

/r/emacs

Emacs 29, native-comp, why jit compiling same files on every start?

With every start of Emacs 29, native comp starts compiling the files `cl-loaddefs.el` and `tramp-loaddefs.el`, but I can't find corresponding `*.eln` files in (all) `native-lisp` directories. (Native compiling other (internal & extra) packages works, it is not an issue with access rights.)

What is the use of that behavior?

I could disable that native jit compiling, by putting following line in my `early-init.el`

(setq native-comp-jit-compilation-deny-list '(".*-loaddefs.el.gz"))

Would that break some facilities within Emacs, if I do so?

https://redd.it/17e1e5i
@r_emacs

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

/r/emacs

my pain points with Emacs code search and how I fixed them
https://sepi.me/emacs-ripgrep-workaround/

https://redd.it/17dwj1h
@r_emacs

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

/r/emacs

Trouble launching Flatpak Firefox from Emacs

Since installing Firefox on Debian via flatpak, so that I can keep up with the latest version instead of the apt realease, Emacs is erroring whenever I try to open org links for example, with 'Searching for program: No such file or directory, firefox'.

Thanks to a helpful answer on StackExchange I've got both my shell and eshell aliases set up so that I can simply run firefox at the prompt, as an alias for flatpak run org.mozilla.firefox

I guess the answer to my question probably likes somewhere in modifying the variables browse-url-firefox-program , or browse-url-generic-programme ?

https://redd.it/16zjajo
@r_emacs

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

/r/emacs

Automatically adjust font size to fit fill-column

I have a laptop, work laptop, and monitor all of different resolutions. The two laptops have different default font sizes in my init, and when they're plugged into the monitor, I need to manually adjust each frame for the font to be readable. Is there any way to make Emacs automatically adjust the font-size so that it increases until it can fit fill-column within the frame?

https://redd.it/16zq62o
@r_emacs

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

/r/emacs

smtpmail-smtp-service resets to 25

In my config, I have set:

(require 'smtpmail)
(setq send-mail-function 'smtpmail-send-it
smtpmail-smtp-server "smtp.gmail.com"
smtpmail-stream-type 'ssl
smtpmail-smtp-service 465)

But the port is always 25. If I manually run this code from the scratch buffer, it changes fine, and I can send mail correctly. Happens when using both mail and compose-mail.

Anyone knows what might cause this?

https://redd.it/16zkkry
@r_emacs

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

/r/emacs

New package: git-cliff.el to generate and update changelog with git-cliff

git-cliff.el

- Built with transient interface
- Provide offical configs and templates to choose
- Easy to use.

Welcome to try it, guys!

https://redd.it/16zlegj
@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/16zhgrd
@r_emacs

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

/r/emacs

Release 0.4 of ekg: drafts, "magic tags", llms and file notes!

Hi everyone! Last week I released version 0.4 of ekg, which is an extensible tag-based, sqlite-backed note taking application for emacs.

This version has been in the works for months, and has notable improvements:

Drafts! You can now save (with C-x C-s) long notes and they will be tagged with "draft" and not show in other places until you commit the note.

Magic tags! You can now have tags that automatically execute some elisp, useful for special notes that need some different editing. The standard example is setting your input method for notes with a tag indicating it's in a different language.

LLM integration! Now you can have LLMs response to your notes inline, with prompts configured based on your tags. We use the new GNU ELPA llm package, so we support whatever it supports (right now Open AI and Google Cloud Vertex's APIs)

File notes! Just like you can have notes on URLS, can you now have notes on files! It's basically a way to annotate any file. And because of how our prompt, template, and prefixing rules work, the directory structure can control the templates and prompts for any LLM integration you have.

Also, here's a video demonstrating these features!

Thanks to everyone who contributed to this release, notably Jay Rajput, Umar Ahmad and Qingshui Zheng!

​

https://redd.it/16z9css
@r_emacs

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

/r/emacs

Release v0.7.3 · alphapapa/org-ql
https://github.com/alphapapa/org-ql/releases/tag/v0.7.3

https://redd.it/17ez5en
@r_emacs

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

/r/emacs

save-excursion: Wrong type argument: integer-or-marker-p, nil in template definition

Hi everyone,

u/daviwil had released an excellent video in his System Crafters channel, where he showed how to hack org-roam:

https://systemcrafters.net/build-a-second-brain-in-emacs/5-org-roam-hacks/

I have copied his code into my config (the function that allows to create a TODO in a project file that we select (or create if not existing) is very useful.

I want to create a similar one: I want to create an event in a select customer file and to create this customer file if it does not exist.

The filter of the nodes with the tags "customer" works, but I am stuck with the definition of the content to insert as the event:

\- I want the events to be inserted as subheadings of the heading "History" of the customer file (easy)

\- I want the events to be saved as a tree structure:

Year
Month
day
Event 1
Event 2....

I am trying to modify his code, but I always have errors

\- I have replaced `plain` with `entry` in order to get the content as a heading

\- I have replaced `file+head+olp` in the template definition by `file+olp+datetree`

(org-roam-capture- :node (org-roam-node-read
nil
(my/org-roam-filter-by-tag "customer"))
:templates '(("p" "project" entry "
%<%u>%?/n%i\n%a"
:if-new (file+olp+datetree "%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}\n#+category: ${title}\n#+filetags: project"
("History"))))))

But still I get the error save-excursion: Wrong type argument: integer-or-marker-p, nil"

What do I get wrong??

https://redd.it/17etbx8
@r_emacs

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

/r/emacs

Emma the Emacs Unicorn

This is Emma the Unicorn! Her design is based off of Emacs. She's featured in thumbnails on librephoenix">LibrePheonix's Youtube Channel for his Doom Emacs videos.

Emma the Emacs Unicorn

Emma the Emacs Unicorn with glasses

https://redd.it/17eqmtq
@r_emacs

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

/r/emacs

Do functions like replace-regexp have the ability to replace groups independently?

When you search for a string like \(a\)xxx\(b\)yy\(c\) is there some way to create a replacement string where each group can be replaced separately?

If that is not possible the only way I see round it will be to replace better off replacing the whole line with a string splicing the replacements where the groups are.

https://redd.it/17ei8p3
@r_emacs

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

/r/emacs

Can Projectile run command when entering a project ?

I know it is possible to set local variables for a mode through dir-locals.el. But what could I do if I want to run a command such as:

(shell-command "sass --watch style.sass "static/css/style.css")

or activating a virtual env using:

(pyvenv-activate "env/")

&#x200B;

https://redd.it/17e93dg
@r_emacs

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

/r/emacs

ISEARCH tips, settings, options and uses (Advanced Topic)
https://youtube.com/watch?v=NcyR1JhAUHQ&amp;si=aKpWb_HNAy5kkaSs

https://redd.it/17e5awi
@r_emacs

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

/r/emacs

GPT4All mode in Emacs

Hi,

I was using my search engine to look for available Emacs integrations for the open (and local) https://gpt4all.io/ when I realized that I could not find a single one.

Is there somebody who's using GPT4All with Emacs already and did not publish his/her integration?

https://redd.it/17dvpej
@r_emacs

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

/r/emacs

Fixing Lsp-Mode's Hover Signatures
https://tony-zorman.com/posts/fixing-lsp-mode.html

https://redd.it/17dudh3
@r_emacs

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

/r/emacs

Eshell tab completion while doing "cd /ssh:" and sudo

Looking for a comfortable way to use emacs for ssh-ing to the servers of our company, but still having issues. Non solution is ideal. I have to use a proxy command to login as a user and after logged in can use sudo to get root.

My preferred solution in emacs would be eshells cd /ssh: way. With this I also have the default directory synchronized and can easily use C-x C-f to edit files. Tab completion works too, as long I do not sudo -i .

If I do - completions will break, which is not ideal because I have several scripts in the root path which I need to complete.

If I leave the eshell way and use mx-shell oder eat-shell etc. I will have tab completion everywhere but the directory is not synched.

I know I can just type C-x C-f /ssh:user@host|sudo::/file

But the hostnames we are using are quite long and generic. So this would be a bit of a hazzle.

Does anyone has a hint for me how I could come around this?

My last idea would be a small function which gets the hostname from the eat buffer and triggers find-files with the correct path. But maybe there is something better and yes - I would prefer eshell for the whole thing.

https://redd.it/16zwig0
@r_emacs

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

/r/emacs

Org Jupyter is not working

Hi,

I started using Emacs (Version 29.1) with Doom recently and today I tried to get Jupyter working in org mode but the kernel does not launch.

&#x200B;

Executing Jupyter-Python unknown at position 84...

Launching python3 kernel...

jupyter--start-kernel-process: Kernel process exited:

Traceback (most recent call last):

File "<frozen runpy>", line 198, in _run_module_as_main

File "<frozen runpy>", line 88, in _run_code

File "/usr/lib/python3.11/site-packages/ipykernel_launcher.py", line 17, in <module>

app.launch_new_instance()

File "/usr/lib/python3.11/site-packages/traitlets/config/application.py", line 1042, in launch_instance

app.initialize(argv)

File "/usr/lib/python3.11/site-packages/traitlets/config/application.py", line 113, in inner

return method(app, *args, **kwargs)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/lib/python3.11/site-packages/ipykernel/kernelapp.py", line 689, in initialize

self.init_sockets()

File "/usr/lib/python3.11/site-packages/ipykernel/kernelapp.py", line 328, in init_sockets

self.shell_port = self._bind_socket(self.shell_socket, self.shell_port)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/lib/python3.11/site-packages/ipykernel/kernelapp.py", line 252, in _bind_socket

return self._try_bind_socket(s, port)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/usr/lib/python3.11/site-packages/ipykernel/kernelapp.py", line 228, in _try_bind_socket

s.bind("tcp://%s:%i" % (self.ip, port))

File "/usr/lib/python3.11/site-packages/zmq/sugar/socket.py", line 302, in bind

super().bind(addr)

File "zmq/backend/cython/socket.pyx", line 564, in zmq.backend.cython.socket.Socket.bind

File "zmq/backend/cython/checkrc.pxd", line 28, in zmq.backend.cython.checkrc._check_rc

zmq.error.ZMQError: Address already in use (addr='tcp://127.0.0.1:37559')

&#x200B;

It exits with this error. I basically followed the instructions on the doom docs website to install it.

The code block looks like this:

&#x200B;

#+BEGIN_SRC jupyter-python :session py :async yes :kernel python3

a = 1

#+END_SRC

&#x200B;

Any help is really appreciated, thanks in advance.

https://redd.it/16ztzev
@r_emacs

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

/r/emacs

Company 0.10.0 is out

https://github.com/company-mode/company-mode/blob/master/NEWS.md#2023-10-04-0100

This is mostly to put a stable tag on a bunch of changes that have been in master for a while (and to justify some riskier changes next). But hopefully some will find this list useful anyway.

https://redd.it/16zpk4h
@r_emacs

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

/r/emacs

How much support for old versions of Emacs should I provide?

I am writing a simple major mode for syntax highlighting for a query language. I have been supporting versions 23 and greater, however I have found myself wanting to use rx-define, which was introduced in version 27.

How much support for older versions of Emacs should I provide? Is it unreasonable to require version 27 or newer of Emacs for this simple mode?

https://redd.it/16zi0ud
@r_emacs

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

/r/emacs

Implementation of the TimeTimer in Emacs

Hej fellows,

through work, I have discovered TimeTimers some years ago. I have found it easy to work with, which is why I've bought one for myself. However, I've been meaning to have something like this in emacs, because I've noticed that no matter the package (be it built-in or tmr), I am missing the convenience that a TimeTimer provides.

First off, I'd like to know if any of you know a package that does this or something like this: conveniently display (in the modeline, maybe?) a bar or clock that shows the passage of time in a continuous fashion, i.e. showing a graphic representation (like a bar going from full to empty or a pie chart going from full to empty) instead of changing numbers (the customary form of representing a timer in my experience).

If that's not a thing -- and I'd be flabbergasted about that to be frank --, I'd love to get some tips on how to implement this. If I were to choose, I'd preferably have a timetimer implemented as a decreasing progress bar in the mode line. The width would be depending upon the "available space" (dunno if there is a way to find that out for different configurations of modelines), the progress bar would be recalculated in regular intervals and the (pseudo-)continuous steps would be calculated depending on the time input when setting the timer. Maybe, the progress bar could "blink" (i.e. disappear and reappear) an amount of times to be set by a variable. For graphical representation, I am eyeing the SVG-LIB by Nicolas Rougier.

I am grateful for tips and pointers, I am a bit at a loss as to where to start.

Have a good day!

https://redd.it/16zgxme
@r_emacs

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

/r/emacs

org-mode: how to keep whitespace around headings consistent?

Often times I find doing various commands in org-mode adds/removes whitespace around headings. This can lead to inconsistent whitespace throughout the file. Kind of annoying.

Are there any tools to manage this? Like an auto formatter or something?

https://redd.it/16zbbs7
@r_emacs

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

/r/emacs

Using 'M-x compile' for a Python Venv

Lots of people use python interactively through M-x run-python and send code to it with things like C-c C-c and C-c C-r. That's fair enough, but it has it's problems. When an imported library changes the only sensible way to deal with it is to stop the python process and start another one. (That's because in Python the built in "import" statement doesn't reload the file. You could reload each library with reload, but that would be tricky.)

For that reason, I would like to use M-x compile. It's suitable for that kind of thing and I've used it for running programs written in other languages. (I think this is a fairly well known Emacs trick).

The problem is Venvs. My projects use venv. If I just start a fresh python using M-x compile then it won't be in the right venv. I've thought about writing a batch file to solve this problem. I expect though, someone has already written a package to solve this?

Is there such a package?

https://redd.it/16ywzl7
@r_emacs

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