December 4, 2024

EmacsEmacs

Much Ado about Emacs 003

I am enjoying living in Emacs. Getting to know it better.

These are some of the changes I have made since the last time I wrote about Emacs:

  • Moved from Consult-notes to Org-roam. Not sure that this move is permanent. I am trying out Org-roam to find out what it adds.
  • I am sticking to god-mode. I tried out evil The extensible vi layer for Emacs. The problem is that I am still learning Emacs and everything gets more complicated with the introduction of Vim keybindings. Better off sticking to vanilla Emacs. Learn how that works and then I might consider evil-mode.
  • Trying out hydra make Emacs bindings that stick around. Not sure that I like it all that much but I am overwhelmed with all the keyboard commands I am trying to learn. Hydra helps with that.
  • I use NewsBlur for my RSS feeds. But I am reading Emacs related news in Emacs through elfeed An Emacs web feeds client. I can feel Emacs slowly taking over all of my computer tasks. Which leads me to the next addition.

Atomic-Chrome

From Mike Zamansky Using Emacs 40 - atomic-chrome - YouTube. Installed the Chrome extension, Chrome Emacs, and the following package. I can use Emacs to fill in text frames in Chrome.

#+begin_src emacs-lisp
  (use-package atomic-chrome
    :demand t
    :straight (atomic-chrome
               :repo "KarimAziev/atomic-chrome"
               :type git
               :flavor nil
               :host github)
    :commands (atomic-chrome-start-server)
    :config (atomic-chrome-start-server)
    (setq-default atomic-chrome-buffer-open-style 'frame)
    (setq atomic-chrome-default-major-mode 'markdown-mode)
    (setq atomic-chrome-extension-type-list '(atomic-chrome))
  (setq-default atomic-chrome-auto-remove-file t))
#+end_src

Killing a word at point

This is from: Some Excerpts From My Emacs Config - 2: Functions - The Emacs Cat

#+begin_src emacs-lisp
(defun kill-whole-word ()
  "Kill the current word at point."
  (interactive)
  (backward-word)
  (kill-word 1))
(define-key global-map (kbd "<M-DEL>") #'kill-whole-word)
#+end_src

Nuke all buffers

This is useful sometimes. From: Some Excerpts From My Emacs Config - 2: Functions - The Emacs Cat

#+begin_src emacs-lisp
(defun nuke-all-buffers ()
  "Kill all buffers, leaving *scratch* only."
  (interactive)
  (mapc
   (lambda (buffer)
     (kill-buffer buffer))
   (buffer-list))
  (delete-other-windows))
#+end_src

Multiple-cursors

I am trying out multiple-cursors. magnars/multiple-cursors.el: Multiple cursors for emacs.

#+begin_src emacs-lisp
(use-package multiple-cursors)
    (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
    (global-set-key (kbd "C-S-l C-S-l") 'mc/edit-beginnings-of-lines)
    (global-set-key (kbd "C->") 'mc/mark-next-like-this)
    (global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
    (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)
#+end_src

Make C-g a little more useful

Protesilaos is a fantastic resource for Emacs users. Emacs a basic and capable configuration Protesilaos Stavrou has some nice additions. This is one of them.

This is the explanation from Protesilaos:

“Do-What-I-Mean behaviour for a general keyboard-quit. The generic keyboard-quit does not do the expected thing when the minibuffer is open. Whereas we want it to close the minibuffer, even without explicitly focusing it. The DWIM behaviour of this command is as follows:

  • When the region is active, disable it.
  • When a minibuffer is open, but not focused, close the minibuffer.
  • When the Completions buffer is selected, close it.
  • In every other case use the regular keyboard-quit.”
#+begin_src emacs-lisp
(defun prot/keyboard-quit-dwim ()
  (interactive)
  (cond
   ((region-active-p)
    (keyboard-quit))
   ((derived-mode-p 'completion-list-mode)
    (delete-completion-window))
   ((> (minibuffer-depth) 0)
    (abort-recursive-edit))
   (t
    (keyboard-quit))))

(define-key global-map (kbd "C-g") #'prot/keyboard-quit-dwim)
#+end_src

Do not show warnings

I needed this. The warnings were scaring me. From Emacs a basic and capable configuration Protesilaos Stavrou.

#+begin_src emacs-lisp
(add-to-list 'display-buffer-alist
             '("\\`\\*\\(Warnings\\|Compile-Log\\)\\*\\'"
               (display-buffer-no-window)
               (allow-no-window . t)))
#+end_src

That is all I want to talk about today. See you next time.

macosxguru at the gmail thingie.


emacs


Previous post
Much Ado About Emacs 002 It is overwhelming, what you need to learn to be able to use Emacs well. The operative word here is “well.” I can use Emacs badly. In the sense,
Next post
Much Ado About Emacs 004 When I started building my Emacs configuration, I copied bits and pieces of code from a whole host of other people’s configurations. It made it