Emacs

311 readers
3 users here now

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

Get Emacs

Rules

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

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
351
352
 
 

I hope every completion done inside minibuffer is repeatable by vertico-repeat, including commands invoked by M-x. Vertico, however, didn't include execute-extended-command as a repeatable session by default. You can be seen it by examining vertico-repeat-filter variable. So I have to customize it like this in Doom Emacs:


(after! vertico-repeat
  (setq vertico-repeat-filter (remove 'execute-extended-command vertico-repeat-filter)))

The question is execute-extended-command seems to be a reasonable default completing session, why does vertico excludes it?

353
354
 
 

I've made a journalctl-mode package for viewing and monitoring typical Linux Journald service logs to get a richer experience than basic journalctl execution in async shell buffers.

It's in a bare-bones state, but I've been finding it very useful for almost a year now. I keep wanting to fix/enhance a few more things before I publicise, but ... I think others could find it as useful as I do already. It's not yet published on ELPA etc., but I intend to soon.

The stand out features are:

  • Multiple simultaneous journalctl processes may run simultaneously with the output interleaved. E.g.:
    • simultaneously view a broad query, say at '--priority warning' along with a more narrowly focused '--priority debug' query.
    • Dig into the output within or near a region by requesting additional log records. To facilitate this, if the region is active when you add an additional command, the kill ring is augmented with a --since=... --until=... string generated from the region's timestamps.
  • The complete JSON log record is processed facilitating richer features
  • The full JSON record for a given log line under point may be summoned and examined
  • Where the record includes file name and line number, you can jump from a message record line to the generating source file/line

Further details and key bindings are included in the Commentary section of journalctl-mode.el and docstrings of the entry functions.

Its usage is somewhat rudimentary, with minimal UI and no cool command-construction GUI like magit or anything, though with bash-completion set up that's not a big hardship. It also currently is not flexible in output format, but that may come!

If you habitually monitor journald please let me know what you think and give it a try, and let me know what you think should be fixed or enhanced most urgently in the GitHub Issues.

There exists another journalctl-mode package that looks nearly abandoned and more quick-and-dirty, but does look to be aimed at other usage patterns. So I'm creating a naming clash here and possibly a downgrade for some use-cases(?) - let me know what you think about that in the comments.

355
 
 

Hey, folks.

I've been digging around to see if there's a package for this but the closest I've found is expand-region and that's not quite it...

Take the indent level and block at the line where the point currently sits and set the mark region to the end of the current block + indent level. I hope that explanation is clear.

This seems very much in the wheelhouse of Emacs and I'm guessing it exists -- maybe even in core as opposed to a package -- and I'm just not looking in the right place.

thx

356
 
 

I'm having trouble with theme color of my emacs config when it's daemonize and not in daemon, any clue to solve this? here's my config
https://pastebin.com/bsH6b1e2

thanks!

without daemon

with daemon

357
 
 

I'm considering switching from Gmail to Fastmail, not necessarily due to privacy concerns but because I'm bothered by the fact that I need extra hacks and additional settings on both the Gmail and Emacs side to use their service properly with mbsync and mu4e. Also, I have the impression that Google will complicate access to IMAP in the future. They're already starting with things like passkey. I might be talking nonsense, but that's how I see things. Not long ago, they started detecting ad blockers in the browser while browsing YouTube, so as a company, they can change whatever they want overnight.

I want to emphasize that I don't have a lot of money to spare, and I'm taking this step more for my peace of mind, to make sure I won't have any issues in the future. However, I would still like to ask for your advice, are you satisfied with Fastmail, have you had any problems with their service while using Mu4e and Emacs?

I've noticed that they also support a feature called 'masked mail' and an option to add additional emails. If, for example, I want to display an email address on my CV that isn't my primary address and I'd like to deactivate it at some point, would it be better to use the option to add a new address or the "masked mail" option instead? Also, this separate mail or masked mail need a separate Mu4e context?

I would be grateful for any suggestions. Thank you.

358
 
 

Since x-toolkit=no, Xresources has no effect on the font size of context menu. Is there a way to increase this font size? Thanks for any help.

I tried setting consolefonts, but it does not seem to work..

359
360
 
 

I tried gnuplot and amazed by its performance. It allows you to directly plot mathematical formulas into graphs with just one single line of math equation.

#+BEGIN_SRC gnuplot :file images/trigon01.png
plot [-10:10] sin(x),atan(x),cos(atan(x))
#+END_SRC

https://preview.redd.it/bmp9izl57kvb1.png?width=640&format=png&auto=webp&s=3c13ffc06a7f3b196b2a71067b9aa8d6d048b2e0

when set arguments, it might requires one more line:

#+BEGIN_SRC gnuplot :file images/sd01.png
g(x) = exp(-0.5*(x/s)**2)/s
plot s=1 g(x), s=2 g(x), s=3 g(x)
#+END_SRC

https://preview.redd.it/efjvennd7kvb1.png?width=640&format=png&auto=webp&s=50cbd91d566721af5a95cd9737c2ee9ac79786e2

I feel frustrated, how I wish could acquainted with such a tool a decade ago while grappling with the challenges of visualizing mathematical formulas.

361
 
 

What is your workflow of maintaining logs of literate scripts? I converted most of my scripts to org-mode and tangle them out to scripts for running them. I want to be able to run them within org-babel itself. I use mostly python and bash. I have two laptops one personal and one for work and a desktop. Mostly I want my laptop and desktop in sync so that I can work in either of them depending upon the need. When I want to install or update any of the tools I use in one system I want that to be replicated in the other, not automatically.

I also need to version the literate scripts, in the sense with history visible in the org file itself. I want the org file to capture my thought flow and the evolution of the code so that I can understand it later by just looking through the file not by meddling with git.

Does any have similar need and a workflow I can copy?

362
 
 

Hello Emacs Community!,

As everyone on this community, I'm an Emacs power user and have several niceties configured, gnus for Email, Doom Emacs, and I heavily use org mode, I recently used it for a 'Incident Playbook' which was basically making an incident and responding to it following certain steps, more of a Digital Forensics and Incident Response (DFIR) work.

So, I made a server in Ansible, made a test malware that will be ran in this server (delete a log file idk), and proceeded to do everything directly in org-mode, running every command via tramp to the server, getting any info from the disk and getting a dd and such. Finally I made a whole document with full details on the server in that point in time, which was pretty interesting as I could have this as a template for future incidents and have certain commands saved for this.

And I got the idea, wouldn't it be interesting to have org mode files like these but for testing specific vulnerabilities?, even using a tool like NixOS or Guix to make commands that will get the old version x.x.x of nginx and I could test a vulnerability there, so it is also reproducible and everyone can use the org file and test this vulnerability?, basically more of a study and proof of concept rather than something more 'heavy' as in business related.

Does anyone have a similar use case?, I would love to hear for them as I want to go into the DFIR route.

TLDR. Not specific to an emacs programming or library question, but much more of a broader question about a cybersecurity workflow.

363
 
 

Hi.

Still learning Emacs but happy with it so far. One thing i'm trying to find out is this. I'm OK with Emacs creating recovery files from which i can, well, recover my work after emacs is closed. However, if I save my files, I have no need for these #filename# or filename~ files that populate my folders. Is there a way to make emacs keep creating these recovery files, but deleting them if I *save* my actual files?

364
 
 

I want to convert the timestamps in a .zsh_history file to their readable equivalents.

Is there some search and replace I can do in emacs that will replace the time with something like (format-time-string unixtime)?

: 1568128379:0;cp -a ~/.zshrc.pre-oh-my-zsh ~/.zshrc
: 1568128381:0;exit
365
 
 

Hi there,

I use orgmode links extensively. In particular, I have hundreds (our thousands) of links to emails (in notmuch). I would very much like to add a tag to any email that is being referenced from org.

So, what I need to do first is be able to find all matches of a regular expression in all my org files. Non-interactively.

I have been playing around with xref-matches-in-directory but that would not cover when multiple emails are mentioned in the same line...

I have been looking and looking but everything I find missed the non-interactive part.

So: What is the function to "search for this REGEX in FILES in DIR and return the first capture group"? (the regex has a capture group for the msgid)

The regex:

  (rx-to-string
   (rx "notmuch:id:"
       (group (1+ (not "]")))))
366
 
 

hi everyone, I am working in IT support, and occur (and even more multi-occur-in-matching-buffer) ist my tool of choice.

But I would like it to do more (because why not?) I would like to be able to ignore matches, if terms (let's name them excludees) are found in the next 5 lines from the search string match or within a number of lines defined by a variable.

It would allow to save excludees as a list, and ignore certain matches when for instance the "ERROR" relates to a known bug, and we do not want to see it in occur searches any longer.

Ideally, this could be triggered by a keymap in occur-mode-map, (toggle-ignore-excludees), so that it is up to the user to activate it or not.

is there already a similar function that does it? How would you proceed to achieve this?

thanks for your feedback

367
 
 

hello, when executing M-x in emacs 29.1 vanilla, looking for ~apropos~ related commands, I see that this error message is shown instead of the usual description in the minibuffer.

I assume this error only happens with emacs native functions, not with the most of the commands coming from other packages.

How can I fix this? thanks for your help.

368
 
 

https://github.com/svaante/dape#

Given that eglot has been part of the core emacs, I believe this is a long lasting wish for a lot of emacsers that has finally been fulfilled. (a stand alone DAP implementation that does not rely on LSP-mode)

369
 
 

We all read (???) the Steve Yegge post where he says he as "hundreds" of info manuals installed in his computer.
The thing is, after quite a bit of web searching, I only managed to get git, gitman, Python, Common Lisp, and SICP.

Is there any repository/FTP/storage that has a treasure trove of info manuals ready to add to Emacs?

Thank you!

370
371
 
 

Ever since DistroTube finished his Configuring Emacs series a couple of months ago, I moved from using (the somewhat monolithic and impenetrable in my opinion) Doom Emacs every now and then, to seriously using Emacs with his config about a month ago, and I've fallen in love. So much so that I clearly wanted to start using Emacs as my window manager.

I really like having a statusbar, so since I had been using dwm (also, if you want dwm-like window management, Edwina is the package for you), I figured it was finally time to set Polybar up. I did, but as many people experienced, Polybar had the issue of workspaces being off by one with the standard EMWH module. I looked around, and wasn't able to find the solution anywhere else, so I'll post my solution.

The crux of the problem lies in an assumption made in the code for switching workspaces, provided by the EXWM developers, namely the following code: I'm not even going to begin to fight Reddit's markdown on this one. The workspaces created are zero-indexed, which is all well and good for Polybar, but the bindings are where the problems come up. The code assigns workspace 0 to s-0, workspace 1 to s-1, etc. (and I don't claim to be any kind of Elisp guru, since as mentioned, I've only been seriously using Emacs for about a month or so). The problem is that the EWMH plugin counts workspace 0 as 1, workspace 1 as 2, etc., and also because of the way the bindings work, you end up with 10 total workspaces at the end.

The (mostly satisfying) solution I found is to change the last two lines of the mapping.... whatever you wanna call it. This maps workspace 0 to s-1, workspace 1 to s-2, etc. Naturally, this requires configuring exwm-workspace-number. (exwm-workspace-switch-create ,(- i 1)))))

(number-sequence 1 exwm-workspace-number))

There is a resulting issue with this solution though: the ninth workspace. The mapping thingamabob gets a bit upset if 10 gets passed into it, so you need to map s-9 manually, but that's easy enough to do with a short helper function. Something like (defun exwm-workspace-switch-to-9 () (interactive) (exwm-workspace-switch-create 8)) and then bind as you would any other global key. This allows the EWMH module to work just fine, without any need for any hooks or anything like that. Outside of having to define another function, this is about the most satisfying solution I've been able to come up with. Naturally, if anyone has any even-more-elegant solution, I'd love to hear it, but I'm plenty happy with this. This way, polybar is able to show what workspaces EXWM buffers are open on, alerts, etc.

372
 
 

I have been experimenting with PlantUML in Org Babel recently, and it has greatly enhanced my ability to visualize concepts mentally. During post-meal walks, I often engage in mental planning exercises, such as sketching Gantt charts. However, my deficient drawing abilities consistently impede my progress, particularly when it comes to mentally manipulating lines, arrows, and objects. Since discovering PlantUML, the visualization skills have steadily improved, thanks to its intuitive text-to-graph syntax.

When reading "Marcovaldo: Or, The Seasons in the City" before bedtime for sleep aid, I spend a significant amount of time immersed in its pleasing pages, sometimes without a clear sense of progress. In such instances, I draw a Gantt chart to gain a visual representation of the slow progress.

@startgantt
Project starts 2023-10-02
[Reading Marcovaldo] lasts 2 weeks and 4 days and is 30% completed
@endgantt

https://preview.redd.it/gqhuh7g9f6vb1.png?width=587&format=png&auto=webp&s=74df6808ae7e6b5baa53ded20991d72552f41b5f

This chart illustrates that the book is being read slowly, and at the current pace, it will take another three weeks to complete.

PlantUML's Gantt chart is expressive, it mimic task bars as [ ] , specify durations with the "lasts" keyword, and "complete" to indicate progress with percentages. This helps to construct mental diagrams and translate thoughts or words into visual representations effortlessly, eliminating the need for manual drawing of lines, arrows, and objects. This feature is particularly beneficial for individuals with limited drawing skills.

PlantUML's Gantt chart functionality goes beyond planning in days, months, and other timeframes. It can also be adapted to manage a single day effectively. Although the smallest unit in PlantUML is a day, it can be flexibly adjusted to represent hours within a day. This means that a Gantt chart spanning 24 days can be used to represent 24 hours each.

@startgantt
!theme mono
[Sleeping] starts on D+0 and lasts 5 days

then [Wakeup@05:45] as [Wake] happens on D+5
then [Breakfast] lasts 1 day and is displayed on the same row as [Sleeping]
then [Morning-Tasks] starts D+8 and lasts 3 days
then [Lunch] starts on D+11 and lasts 1 day and is displayed on the same row as [Breakfast]
then [Afternoon-Tasks] as [Afternoon] lasts 5 days and is 50% completed
then [Dinner] starts on D+17 and lasts 1 day and is displayed on the same row as [Lunch]
then [Evening-Tasks] lasts 4 days
then [Bedtime@22:45] happens on D+21 and is displayed on the same row as [Wake]
then [Sleep] lasts 1 day and is displayed on the same row as [Sleeping]

Separator just at [Sleeping]'s end
'Separator just at [Dinner]'s end
Separator just at [Evening-Tasks]'s end
printscale daily zoom 1.8
'highlight today
today is 14 days after start and is colored in lightgray
'Label on the first column and right-aligned

hide footbox
@endgantt

https://preview.redd.it/duh8uv1jf6vb1.png?width=758&format=png&auto=webp&s=59d72d860bb96048c3a7eaea9140df1828f51681

Just like a wizard casting spells in PlantUML, you can conjure a vivid visualization of the complete panorama of a day in mind. Whether during walks, bedtime, or while commuting on the subway, by consistently practicing and leveraging the unique features of PlantUML, you will unlock the untapped mental prowess for visualization and creativity.

373
 
 

I had a very great setup using app-specific password till now. But now want to move to oauth2 because app-specific passwords will not work any more. So I changed my settings as follows,

;; older setting
;; ...
     (nnimap "gmail"
             (nnimap-address "imap.gmail.com")
             (nnimap-inbox "INBOX")
             (nnimap-expunge immediately)
             (nnimap-stream ssl))
;; ...

I looked for a solution, or rather asked ChatGPT about the oauth2.el thing. And it suggested the following,

;; new settings
;; ...
     (nnimap "gml"
             (nnimap-address "imap.gmail.com")
             (nnimap-inbox "INBOX")
             (nnimap-expunge immediately)
             (nnimap-stream ssl)
             (nnimap-authenticator oauth2)
             (nnimap-oauth2-client-id "client-id")
             (nnimap-oauth2-client-secret "client-secret")
             (nnimap-oauth2-credentials "~/.emacs.d/.gmail.oauth2-token"))
;; ...

I created a new project in Google Cloud Console, enabled Gmail API and generated client-id and client-secret for the above. But this doesn't seem to be working. When I launch Gnus (M-x gnus), it is stuck at "Openning connection to imap.gmail.com via tls...". Default browser is not launched for the oauth2 workflow.

I have tested the following code. It launches the default browser and works just fine,

(require 'oauth2)
(defvar my-oauth2-token 
  (oauth2-auth-and-store "https://accounts.google.com/o/oauth2/auth"
                         "https://accounts.google.com/o/oauth2/token"
                         "https://www.googleapis.com/auth/userinfo.email"
                         "client-id"
			 "client-secret"))

Has anyone here done this kind of configuration - gnus+gmail+oauth2?

374
 
 

I just uploaded the latest version of Emacs Writing Studio, a configuration and manual for authors seeking to use Emacs.

Next step: convert the webpage into a book with enhanced content.

375
 
 

Hi, I wanted to come into the Emacs Reddit server for the best advice I could possibly get to learning Emacs. I switched recently from a normal code editor and as of right now, Emacs is kind of hard to get the hang of. All I need is for someone to give me advice on where I might find help, Including YouTube, forums, etc.

view more: ‹ prev next ›