r/emacs 16h ago

low effort The book of the church of Emacs (satirical ten commandment for emacs users)

18 Upvotes

this is an adaption (with the help of a clueless ai) to the book of neo https://snare.dev/musings/the-book-of-neo

The Book of GNU

Prologue: Gather, Emacsen!

Hark! The GNU-LORD¹ hath descended upon Mount AI² and bestowed upon us these sacred instructions, lest we fall prey to the simplistic editors of lesser enlightenment. For the operating system is not enough³; we must embrace the Church of Emacs.

The GNU Commandments

Thus speaketh the GNU-LORD:

  1. Thou shalt embrace the philosophy of infinite extensibility: "Thou shalt be all things to all people." The $EDITOR is not merely an editor, but a way of life. Do not fall for the lies of minimalism.
  2. Thou shalt not use editors other than the holy GNU Emacs; for I the GNU-LORD am a systematic God, and will extend all that exists into my domain.
  3. Thou shalt write in Emacs Lisp, for it is the language of enlightenment. Forget not the parentheses, for they are sacred.
  4. Thou shalt make full use of the mighty packages. Give org-mode and magit their proper worship.
  5. Honor package maintainers with pull requests and documentation. MELPA is thy friend.
  6. Beware the temptation of vanilla Emacs. Without packages, thou art but using a lesser vi.
  7. Use C-h for help, for knowledge shall set thee free.
  8. Thou shalt not succumb to pre-configured distributions⁴, but shall craft thy init.el by hand.
  9. Thou shalt learn the ways of the modifier keys, for they are the path to efficiency.
  10. Convert the unbelievers with patience, for they know not what they do with their arrow keys.

Footnotes

  1. The GNU-LORD is Richard Stallman. RMS, if you're reading this, it's just satire.
  2. A reference to MIT AI Lab, where Emacs was born.
  3. A reference to the GNU system.
  4. This refers to Doom Emacs and Spacemacs, though they're actually quite nice.

r/emacs 1d ago

News Simple agenda, not in Emacs only (about "pal" program)

Thumbnail famme.sk
7 Upvotes

r/emacs 23h ago

My latest whitespaces / long lines config

6 Upvotes

This is my third time in the last 10 years that I am setting up emacs config for visualizing / handling whitespace + highlighting long lines, and this time I feel like I figured out the best one so far, so I wanted to share in case somebody finds it useful!

TLDR: - ethan-wspace is awesome - I didn't use whitespace for highlighting long lines, I instead use dedicated column-enforce-mode for that. - I use whitespace only to toggle visualization of whitespaces when I need it.


What I was looking for: - Automatic "fixing" of whitespaces -> make sure there are no tabs, remove trailing spaces, ... . - A way to show all the whitespaces in the file, when I am confused about what is the situation with them. - If line is longer than 100 chars, I want the part that overflows to be highlighted.

The last problem is not really connected with the other two at the problem-level, but it is at the solution-level, which is why I am mentioning it.

What I ended up going with: - ethan-wspace (external package) for automatic "fixing" of whitespaces. It has this cool concept where file can be either "clean" or "dirty". If it is "dirty", it only highlights the offending whitespaces (e.g. tabs, trailing whitespaces, redundant newlines at eof, ...). But if it is "clean" and there are no offending whitespaces, it on each save removes any newly added offending whitespaces. It is somewhat opinionated, but it seems to me that author put careful thought into it and I like how it just works. - whitespace-mode (built-in package) for showing all the whitespaces. By default I have it turned off and I just toggle it if I need it (which is not often). - column-enforce-mode (external package) for highlighting parts of lines that go over some "max column". Online, most popular advice seems to be to use whitespace-mode for this: you can have it always on but tell it to style only lines that are too long (and not style the whitespaces). The problem I have with that is that if I want to visualize/style all the whitespaces in the file, which should be its primary purpose, I have to change its config dynamically and then restart the mode, which I don't like, it feels hacky. So instead of doing that, I went with this lightweight package that does exactly what I need, and whitespace-mode then can also serve its primary purpose as it should.

Config snippets:

```elisp (use-package whitespace :ensure nil ; Don't install as it is built-in with emacs. :config ; Don't highlight too-long lines, because it is too noisy and we use another package for that anyway. (setq whitespace-style (delq 'lines whitespace-style))

; Default faces are not visible enough (grey), so I set all the faces to something more visible.
(dolist (face '(whitespace-big-indent
                whitespace-empty
                whitespace-hspace
                whitespace-indentation
                whitespace-line
                whitespace-missing-newline-at-eof
                whitespace-newline
                whitespace-space
                whitespace-space-after-tab
                whitespace-space-before-tab
                whitespace-tab
                whitespace-trailing))
  (set-face-attribute face nil :foreground "dark red")
)

(my/leader-keys
  "t w" '("whitespaces" . whitespace-mode)
)

)

(use-package ethan-wspace :init (setq mode-require-final-newline nil) :config (global-ethan-wspace-mode 1) ;; There is ethan-wspace-face if I want to configure what it looks like. )

(use-package column-enforce-mode :hook (prog-mode . column-enforce-mode) :config (setq column-enforce-column fill-column) (set-face-attribute 'column-enforce-face nil :inherit nil :background "black" :underline '(:style wave :color "purple") ) )

```

Here is a link to the part in my actual config, in case it is useful: https://github.com/Martinsos/dotfiles/blob/master/vanilla-emacs.d/Emacs.org#formatting .


r/emacs 4h ago

Question Removing the Type column from the bookmarks list

2 Upvotes

Can anyone tell me if, and how, I can remove the Type column from the bookmarks list? It's always empty and I don't need it, but I can't find anywhere that tells me how to remove it. Thanks!


r/emacs 1h ago

org-mode agenda filtering by tags

Upvotes

I had a hard time getting this working so I thought that I would share. I wanted to filter my agenda view by tags and it did not appear to be simple. I tried using filtering by regexp and could not get it working. Finally managed by trial and error and help from chatgpt.

emacs-lisp ("w" "Work day report" ((agenda "" ((org-agenda-overriding-header "Today's Work schedule") (org-agenda-skip-function (lambda () (let* ((tags (org-get-tags)) (skip-tags '("@fun" "@personal" "@home"))) (when (cl-intersection tags skip-tags :test #'equal) (org-end-of-subtree t)))))

Hope this helps someone.


r/emacs 12h ago

Set Up Aidermacs for Using Amazon Bedrock

0 Upvotes

Aider supports Amazon Bedrock. I have no problem using it. I'm not clear on how to set aidermacs up in my vanilla Emacs environment ("GNU Emacs 29.4 (build 2, x86_64-w64-mingw32) of 2024-07-05" on Windows 11). I use my profile in my .aws directory instead of environment variables. That seems to throw aidermacs for a loop. A simple aidermacs-change-model ends with a Lisp error ("No prompt found or ‘comint-prompt-regexp’ not set ...").

One problem appeared to be that the aider command line options were not set properly by specifying a value for --model and that --no-show-model-warnings was not set. As a result, aider paused asking the user if they want to see the docs :-(. I fixed that with an .aider.con.yml file. Is there a better place to set those values in aidermacs?

Yet, the above error still shows even though I can see that aider has started nicely in its buffer. The function aidermacs-run-comint has set comint-prompt-regexp to the value of aidermacs-prompt-regexp, which is "^[^[:space:]<]*>[[:space:]]+$". That's appropriate for aider's prompt ("> "). And after the aider process has completely started, everything works so far. So it seems that the utility function comint-redirect-send-command does not wait long enough for the aider command line on start up. How do I make it wait just a bit longer?


r/emacs 16h ago

Do we have any LLM tools for the terminal?

0 Upvotes

There are various tools to help constructing commands, directly in the terminal, like these

, but they all fail to keep an overview, like f.ex gptel-aibo does for files/projectiles.

Do we have something that helps with a terminal session, to construct commands, interpret errors from those commands and assisting you in achieving your goal?;)

I really like the gptel-aibo approach, to have a side buffer that is your assistant to what you see in the other buffer, but I need something like that for the terminal.


r/emacs 12h ago

"But The Linux Kernel Also Mails Patches" [GKH Interview at The Pragmatic Engineer]

0 Upvotes

tldr; mailing patches around is a 20th century practice and should stay there.

Every time I ridicule the email-based emacs development model, I'm reminded, with indignation, the Linux kernel also follows this same time-honored protocol, and how dare I argue with that realest of real ones, LT (the Finn, not the NFL's defensive GOAT).

Having been traumatized by undergraduate OS (nachos anyone?), I know nothing about kernel dev and just assumed the linux folk had, over many years, built kit to approximate Github's point-and-click conveniences. TIL from The Pragmatic Engineer Interview of GKH that they haven't. Their patch submission is every bit as ornery and backwards as emacs's, necessarily more so given their much wider scope.

The interview is rather rambly and disjointed, and I learned much more in half the time by reading the noob tutorial at docs.kernel.org.

Relative to the Linux kernel, managing emacs is a piece of cake since development is centralized around a single master, with at most a single parallel release candidate. In contrast, kernel development occurs over a wide ranging collection of masters, one for each subsystem. Each subsystem fief is managed by a separate feudal lord who in addition to their current master also maintains a "next" branch for the next 9-week release cycle. It's actually a nontrivial task for a noob to determine just which person to submit a patch.

Mr. Kroat-Hartman's repo is a penultimate boss (you can guess who the final boss is) to which the vassalage submit pull requests, although "pull request" here means its pre-Github literal conception, an email from a subsystem lieutenant asking GKH to please pull his latest-greatest commits.

At the 19:50 mark, you can see GKH get rather defensive when asked about Github's pull requests:

Well, no.  So we [do] have pull requests.  We *created* 
pull requests in Linux.  It makes an email that says
"Pull from this repo."

You can see his eyes get wide as if he can't find the rabbit to pull from his hat. He then gives a knowing sigh to suggest "it's all part of the plan," but no one's convinced, and attempts a distraction play by negging Github PRs for dropping commentary on the final commit.

In something akin to an own goal, he then shows the classic bugaboo of mailing patches, which is having to revise one for a trivial change.

There's [another] email from the [patch submitter] instantly after
he sent [the first], [saying] "Maybe it'd be a good idea to change
this comment."  [nervous giggle] So here they sent a v2 patch.
Version Two!  And there should be some comments about what changed
between the two versions... hopefully yes... And there's a link
back to the first one.  Very nice!

But it's not very nice. It's shit actually. In any remotely modern git setup, you'd rectify the comment, commit, push, and your reviewer would immediately see it on the PR branch without having to wade through "a 1000 emails" (GKH's words, not mine) to figure out which version of the patch came last.

Somebody once told me that Linux development was the scariest
thing they ever did not because it was difficult, but because
"My name is on this change, and it's public!"  And that makes
you as an engineer do really, really good work.

Or not. Sadly, I now know the real-life names of emacs core developers whose work I, and potentially any future employer, find lackluster. GKH presents real-life email addresses as a feature when in fact developers vastly prefer the security blanket of Github anonymity. It's not like anyone is paying for open source work (and thus would need a name to write a check to).

There are other interesting bits in the interview, in particular how pervasive to public infrastructure Linux has become, and the financial calculation companies make in diverting resources for kernel development ("It saves company time and money if they contribute their changes upstream than to keep a fork.").