April 24, 2025
Emacs
Much Ado About Emacs 009
Moving away from Evil
Conceptually it reminds me of fog. When I am in Emacs, trying to write, there seems to be an invisible curtain keeping me detached from the program. That is the effect evil-mode has on me. Yes, I love the space-bar leader key. But the actual writing and editing is foggy. Part of it is due to my limited knowledge of VIM keybindings but a part of it is the fact that I am putting a layer of complexity between Emacs and me. It feels like a stream of worry. Anxiety. Uncomfortable.
I decided to move back to god-mode and do away with evil-mode. VIM keybindings are fantastic and they are useful but I am not in VIM, I am in Emacs. I decided to not introduce this layer of discomfort into the process and deal with pure, vanilla Emacs.
So, it is back to vanilla Emacs. To the Emacs tutorial.
I decided to try to replicate the space-bar configuration through general.el and used the leader-key M-o
.
#+begin_src emacs-lisp
(general-create-definer my-leader-def
:prefix "M-o"
:non-normal-prefix "M-o")
(my-leader-def
;; Top level functions
"." '(find-file :which-key "find file")
";" '(consult-recent-file :which-key "recent files")
"/" '(bufferfile-rename :which-key "rename file")
"TAB" '(switch-to-prev-buffer :which-key "previous buffer")
"p" '(org-capture :which-key "org-capture")
"x" '(execute-extended-command :which-key "execute command")
;; Applications
"a" '(nil :which-key "applications")
"ao" '(org-agenda :which-key "org-agenda")
"ac" '(org-capture :which-key "org-capture")
"ab" '(nil :which-key "browse url")
"abc" '(browse-url-chrome :which-key "chrome")
"abg" '(my/er-google :which-key "google search")
"av" '(nil :which-key "avy")
"avc" '(avy-goto-char-timer :which-key "avy goto char")
"avp" '(avy-goto-parens :which-key "avy goto parens")
"ad" '(dired :which-key "dired")
;; Buffers
"b" '(nil :which-key "buffer")
"bb" '(switch-to-buffer :which-key "switch-to-buffer")
"bc" '(consult-buffer :which-key "consult-buffer")
"bd" '(kill-buffer :which-key "kill-buffer")
"bi" '(ibuffer :which-key "ibuffer")
"bn" '(next-buffer :which-key "next-buffer")
"bp" '(previous-buffer :which-key "previous-buffer")
"bR" '(revert-buffer :which-key "revert-buffer")
"br" '(bufferfile-rename :which-key "rename buffer")
"bs" '(scratch :which-key "scratch buffer")
;;Consult
"c" '(nil :which-key "consult")
"cb" '(nil :which-key "bookmark/buffer")
"cd" '(consult-dir :which-key "con dir")
"cg" '(consult-grep :which-key "con grep")
"ch" 'consult-org-heading :which-key "con org heading"
"cl" '(consult-line :which-key "con line")
"cn" '(consult-notes :which-key "con notes")
"co" '(consult-outline :which-key "con outline")
"cy" '(consult-yasnippet :which-key "con yasnippet")
"cb" '(nil :which-key "bookmark/buffer")
"cbo" '(consult-bookmark :which-key "con bookmark")
"cbu" '(consult-buffer :which-key "con buffer")
;;Consult-register
"cr" '(nil :which-key "consult-register")
"crr" '(consult-register :which-key "con register")
"crs" '(consult-register-store :which-key "con reg store")
;; Denote
"d" '(nil :which-key "denote")
"dl" '(denote-link :which-key "denote-link")
"dL" '(denote-add-links :which-key "denote-add-links")
"dn" '(denote :which-key "denote")
"db" '(denote-backlinks :which-key "denote-backlinks")
"dr" '(denote-rename-file :which-key "denote-rename-file")
"dR" '(denote-rename-file-using-front-matter :which-key "denote-rename-file-using-front-matter")
;;Elfeed
"e" '(nil :which-key "elfeed")
"ee" '(elfeed :which-key "elfeed")
"eu" '(elfeed-update :which-key "elfeed-update")
;; Files
"f" '(nil :which-key "files")
"ff" '(find-file :which-key "find file")
"fs" '(save-buffer :which-key "save buffer")
"fS" '(write-file :which-key "write file")
"fd" '(dired :which-key "dired")
"fo" '(reveal-in-osx-finder :which-key "reveal in finder")
"fR" '(consult-recent-file :which-key "recent files")
"fr" '(bufferfile-rename :which-key "rename buffer")
;; Help/emacs
"h" '(nil :which-key "help/emacs")
"hv" '(consult-describe-variable :which-key "des. variable")
"hb" '(describe-bindings :which-key "des. bindings")
"hM" '(describe-mode :which-key "des. mode")
"hf" '(consult-describe-function :which-key "des. func")
"hF" '(describe-face :which-key "des. face")
"hk" '(describe-key :which-key "des. key")
;;set-mode
"hm" '(nil :which-key "which-mode")
"hme" '(emacs-lisp-mode :which-key "elisp mode")
"hmo" '(org-mode :which-key "org mode")
"hmm" '(markdown-mode :which-key "markdown mode")
"hmt" '(text-mode :which-key "text mode")
;; Jumps
"j" '(nil :which-key "jumps")
"jr" '(jump-to-register :which-key "registers")
"jb" '(bookmark-jump :which-key "bookmark jump")
;;package
"hp" '(nil :which-key "package")
"hpr" '(package-refresh-contents)
"hpi" '(package-install)
"hpd" '(package-delete)
;; Search
"s" '(nil :which-key "search")
"sa" '(avy-goto-char-2 :which-key "avy-goto-char-2")
"ss" '(isearch-forward :which-key "isearch-forward")
"sr" '(isearch-backward :which-key "isearch-backward")
"sp" '(project-search)
"si" '(consult-imenu :which-key "consult-imenu")
"sm" '(consult-mark :which-key "jump to marker")
"sl" '(consult-goto-line :which-key "Go to line")
;;System
"m" '(nil :which-key "system")
"m1" '(restart-emacs :which-key "restart emacs")
"m+" '(tab-bar-new-tab :which-key "tab new")
"m-" '(tab-close :which-key "tab close")
"mf" '(my/resources-visit :which-key "visit resources")'
"mr" '(nil :which-key "region")
"mre" '(er/expand-region :which-key "expand region")
"mrc" '(er/contract-region :which-key "contract region")
"mp" '(nil :which-key "palimpsest")
"mpb" '(palimpsest-move-region-to-bottom :which-key "pal move bottom")
"mpt" '(palimpsest-move-region-to-top :which-key "pal move top")
"mm" '(nil :which-key "mark")
"mml" '(my/mark-line :which-key "mark line")
"mmb" '(my/mark-block :which-key "mark block")
;; Newsticker
"n" '(nil :which-key "newsticker")
"ng" '(newsticker-get-all-news :which-key "get news")
"ns" '(newsticker-show-news :which-key "show news")
"no" '(newsticker-treeview-mark-list-items-old :which-key "mark as old")
"nq" '(newsticker-treeview-quit :which-key "newsticker quit")
"nu" '(newsticker-treeview-update :which-key "treeview-update")
;; Org-mode
"o" '(nil :which-key "org-mode")
"oa" '(org-agenda :which-key "org-agenda")
"oc" '(org-capture :which-key "org-capture")
"on" '(recursive-narrow-or-widen-dwim :which-key "narrow")
"or" '(org-refile :which-key "refile")
"ot" '(org-todo :which-key "DONE")
"ou" '(my/org-jump-to-heading-beginning :which-key "jump to heading")
;; More Org
"ol" '(nil :which-key "line/link")
"olb" '(org-beginning-of-line :which-key "begin of line")
"ole" '(org-end-of-line :which-key "end of line")
"oli" '(my/org-insert-link-dwim :which-key "org insert link")
"ols" '(org-store-link :which-key "org store link")
;; Yet More org
"," '(nil :which-key "more-org")
",c" '(org-cycle :which-key "org-cycle")
",n" '(outline-next-visible-heading :which-key "next-heading")
",p" '(outline-previous-visible-heading :which-key "previous-heading")
",t" '(org-set-tags-command :which-key "set-tags")
",u" '(outline-up-heading :which-key "up-heading")
;; text and tab
"t" '(nil :which-key "text")
"tn" '(tab-next :which-key "tab next")
"tp" '(tab-previous :which-key "tab previous")
"tr" '(isearch-query-replace :which-key "find and replace")
"ts" '(yas-insert-snippet :which-key "insert yasnippet")
"tR" '(replace-regexp :which-key "replace-regexp")
"tt" '(titlecase-dwim :which-key "titlecase")
"t/" '(my/comment-or-uncomment :which-key "comment")
;; date/time
"td" '(nil :which-key "stamp date/time")
"tdd" '(my/time-stamp-short :which-key "time-stamp-short")
"tds" '(my/date-stamp :which-key "date-stamp")
;; word
"tw" '(nil :which-key "word")
"twc" '(my/copy-whole-word :which-key "copy whole word")
"twk" '(my/kill-inner-word :which-key "kill inner word")
"two" '(copy-as-format-org-mode :which-key "copy as org mode")
"twm" '(copy-as-format-markdown :which-key "copy as markdown mode")
"twi" '(org-web-tools-insert-web-page-as-entry :which-key "insert web page as entry")
"tww" '(org-web-tools-insert-link-for-url :which-key "insert link for url")
"twl" '(dictionary-lookup-definition :which-key "dictionary lookup")
"twp" '(my/lookup-word-at-point :which-key "lookup word at point")
;; Windows
"w" '(nil :which-key "window")
"wl" '(windmove-right :which-key "windmove-right")
"wh" '(windmove-left :which-key "windmove-left")
"wk" '(windmove-up :which-key "windmove-up")
"wj" '(windmove-down :which-key "windmove-down")
"wd" '(delete-window :which-key "delete-window")
"wr" '(hsplit-last-buffer :which-key "split-window-right")
"wb" '(vsplit-last-buffer :which-key "split-window-below")
;; Visual
"v" '(nil :which-key "visual")
"vt" '(consult-theme :which-key "load theme")
"vR" '(read-only-mode :which-key "read only mode"))
#+end_src
This is a work in progress. I tweak it from time to time depending on my usage.
defalias
I got exposed to this through
Defalias a quick guide to making an alias in Emacs coding - YouTube
Thank you, Raoul Comninos.
There are commands I run in Emacs only sporadically. They might or might not be bound to keyboard commands. I have to remember what the commands are and I find myself searching for them. I have assigned them an alias. I can go into command mode (M-x
), and type the alias and hit enter. The command executes. Reminds me of aliases I use in the shell.
#+begin_src emacs-lisp
(defalias 'brf 'bufferfile-rename-file)
(defalias 'pde 'package-delete)
(defalias 'pud 'auto-package-update-now)
(defalias 'rem 'restart-emacs)
#+end_src
I am going to add to this list as I go along and find more commands that are not used often but are good to alias.
recursive-narrow
Another thing I learned from Raoul. The Emacs recursive narrow package coding programming - YouTube.
Thank you Raoul.
Using recursive-narrow - MELPA. Lets me concentrate on portions of a document.
I have set it up with Raoul’s help.
#+begin_src emacs-lisp
(use-package recursive-narrow)
(defun recursive-narrow-or-widen-dwim ()
"If the region is active, narrow to that region.
Otherwise, narrow to the current function. If this has no effect,
widen the buffer. You can add more functions to
`recursive-narrow-dwim-functions'."
(interactive)
(recursive-narrow-save-position
(cond ((region-active-p) (narrow-to-region (region-beginning) (region-end)))
((run-hook-with-args-until-success 'recursive-narrow-dwim-functions))
((derived-mode-p 'prog-mode) (narrow-to-defun))
((derived-mode-p 'org-mode) (org-narrow-to-subtree)))
;; If we don't narrow
(progn
(message "Recursive settings: %d" (length recursive-narrow-settings))
(recursive-widen))))
#+end_src
It is assigned a keybinding, (C-x n n
). I have also configured it in general.el to M-o o n
. Works like a charm.
bufferfile.el
jameschertibufferfile.el Emacs helper functions to delete and rename buffer files. This is a package which provides helper functions to delete and rename buffer files:
bufferfile-rename
: Renames the file visited by the current buffer and updates the buffer name for all associated buffers, including clones/indirect buffers. It also ensures that buffer-local features referencing the file, such as Eglot, are correctly updated to reflect the new file name.
bufferfile-delete
: Delete the file associated with a buffer and kill all buffers visiting the file, including clones/indirect buffers.
bufferfile-copy
: Copies the file visited by the current buffer to a new file.
I use the bufferfile-rename
command multiple times a day. It might help to explain the workflow.
- I read the Letters from an American Heather Cox Richardson Substack everyday and then using a Chrome extension copy the markdown link to the entry and download the content of the entry to a Markdown file in my Downloads folder.
- I open the file in Emacs. Add the markdown link to the top of the page. Add a heading 1 item above the link. The heading is of the form “HCR - (the date of the entry)”.
- I want the file-name to be this new heading 1 entry. So, I copy it and then proceed to change the name of the file,
buffer-file-rename
and then select the name of the file and paste in the new name of the file.
- Then I proceed to re-read the entry and add my comments and observations to the file.
- After I am done with it, I move it to an EagleFiler document.
This package makes the process of renaming my Emacs buffer easier. I use the following coinfiguration:
#+begin_src emacs-lisp
(use-package bufferfile
:ensure t
:vc (:url "https://github.com/jamescherti/bufferfile.el"
:rev :newest))
#+end_src
That is all I have for you today.
macosxguru at the gmail thingie.
emacs
March 12, 2025
Trash
Gruber Calls It
Gruber wrote Daring Fireball Something Is Rotten in the State of Cupertino.
I am not going to rewrite the article for you. Go read it.
This is a quote from the article.
When mediocrity, excuses, and bullshit take root, they take over. A culture of excellence, accountability, and integrity cannot abide the acceptance of any of those things, and will quickly collapse upon itself with the acceptance of all three.
Reminded me of what Guy Kawasaki called “bozosity.” I think Apple is afflicted with that.
macosxguru at the gmail thingie.
Note: Thanks to Photo by Lisa from Pexels: https://www.pexels.com/photo/stainless-steel-can-with-fire-2456828/
macOS
Apple
March 9, 2025
Emacs
Much Ado About Emacs 008
Going Over to the Dark Side
Started reading the Emacs manual and discovered something that bugged me.
My knowledge of Emacs is bipolar. There are some advanced things that I am comfortable with and there are some basic things which I have no clue about. I know keybindings and how to set them, but I don’t know how to move around a document, the Emacs way.
Move to beginning of a line: C-a.
I knew that.
Move to the beginning of a sentence: M-a.
I did not.
Move to the end of a sentence: M-e.
Did not know this either.
I realized that the gaps in my knowledge requires me to learn a new way to engage with Emacs. This would obviously require practice. If I was going to reinvent the learning curve, why not go whole-hog? That thought lead me to evil-mode.
I have heard a lot about VIM keybindings. I don’t know them to any great extent. I am going to learn them and use them in Emacs. You can reasonably ask at this stage: “Why the fuck would you do that?”
The answer is probably:
- I like pain. (said in jest, but might be unnervingly accurate)
- I am curious. A whole host of people I respect swear by VIM keybindings. They want it everywhere. Every editor I know of has customers who want or use VIM keybindings. Hell there is a program called kindaVim which lets you use VIM keybindings almost everywhere in macOS. What is the magic that all of these folks are clamoring for? I am curious.
So, I installed evil-mode. Turned off god-mode. And a journey begins.
The learning curve just got longer/steeper.
If you break it down, keybindings in Emacs can be grouped into two categories:
- The actual editing of text.
- Dealing with Emacs.
In evil-mode, the dealing with Emacs activities are improved by using general.el. Thanks to the modal nature of evil-mode, you can have different keybindings assigned to different modes. Also spacebar as the leader key is simply fantastic.
This is my general.el configuration to deal with Emacs. None of this originated from me. I looked at a whole host of config files and came up with this for my use. It is also not set in stone, over time, I intend to customize this to fit my needs better.
* Preamble
#+BEGIN_SRC emacs-lisp
(general-define-key
:states '(normal motion visual)
:keymaps 'override
:prefix "SPC"
;; Top level functions
"." '(find-file :which-key "find file")
"," '(consult-recent-file :which-key "recent files")
"TAB" '(switch-to-prev-buffer :which-key "previous buffer")
;;"r" '(jump-to-register :which-key "registers")
"c" '(org-capture :which-key "org-capture")
#+END_SRC
** Applications
#+BEGIN_SRC emacs-lisp
;; "Applications"
"a" '(nil :which-key "applications")
"ao" '(org-agenda :which-key "org-agenda")
"ac" '(org-capture :which-key "org-capture")
"ab" '(nil :which-key "browse url")
"abc" '(browse-url-chrome :which-key "chrome")
"abg" '(my/er-google :which-key "google search")
"av" '(nil :which-key "avy")
"avc" '(avy-goto-char-timer :which-key "avy goto char")
"avp" '(avy-goto-parens :which-key "avy goto parens")
"ad" '(dired :which-key "dired")
#+END_SRC
** Buffers
#+BEGIN_SRC emacs-lisp
;; Buffers
"b" '(nil :which-key "buffer")
"bb" '(evil-switch-to-windows-last-buffer :which-key "switch buffers")
"bc" '(consult-buffer :which-key "consult-buffer")
"bd" '(evil-delete-buffer :which-key "delete buffer")
"bi" '(ibuffer :which-key "ibuffer")
"bl" '(clone-indirect-buffer :which-key "indirect buffer")
"bm" '(my/kill-other-buffers :which-key "kill other buffers")
"br" '(revert-buffer :which-key "revert buffer")
"bs" '(scratch :which-key "scratch buffer")
#+END_SRC
** Consult
#+begin_src emacs-lisp
"c" '(nil :which-key "consult")
"cd" '(consult-dir :which-key "con dir")
"cg" '(consult-grep :which-key "con grep")
"ch" 'consult-org-heading :which-key "con org heading"
"cl" '(consult-line :which-key "con line")
"cn" '(consult-notes :which-key "con notes")
"co" '(consult-outline :which-key "con outline")
"cy" '(consult-yasnippet :which-key "con yasnippet")
"cb" '(nil :which-key "bookmark/buffer")
"cbo" '(consult-bookmark :which-key "con bookmark")
"cbu" '(consult-buffer :which-key "con buffer")
;;Consult-register
"cr" '(nil :which-key "consult-register")
"crr" '(consult-register :which-key "con register")
"crs" '(consult-register-store :which-key "con reg store")
#+end_src
** Denote
#+begin_src emacs-lisp
"d" '(nil :which-key "denote")
"dl" '(denote-link :which-key "denote-link")
"dL" '(denote-add-links :which-key "denote-add-links")
"dn" '(denote :which-key "denote")
"db" '(denote-backlinks :which-key "denote-backlinks")
"dr" '(denote-rename-file :which-key "denote-rename-file")
"dR" '(denote-rename-file-using-front-matter :which-key "denote-rename-file-using-front-matter")
;; Key bindings specifically for Dired.
:map dired-mode-map
"dd" '(nil :which-key "denote-dired")
"ddl" '(denote-dired-link-marked-notes :which-key "denote-dired-link-marked-notes")
"ddr" '(denote-dired-rename-files :which-key "denote-dired-rename-files")
"ddk" '(denote-dired-rename-marked-files-with-keywords :which-key "denote rename keywords")
"ddR" '(denote-dired-rename-marked-files-using-front-matter :which-key "denote rename front matter")
#+end_src
** Elfeed
#+begin_src emacs-lisp
"e" '(nil :which-key "elfeed")
"ee" '(elfeed :which-key "elfeed")
"eu" '(elfeed-update :which-key "elfeed-update")
#+end_src
** Files
#+BEGIN_SRC emacs-lisp
;; Files
"f" '(nil :which-key "files")
"fb" '(consult-bookmark :which-key "bookmarks")
"ff" '(consult-find :which-key "find file")
"fo" '(reveal-in-osx-finder :which-key "reveal in finder")
"fO" '(my/open-buffer-file-mac :which-key "open buffer file")
"fr" '(consult-recent-file :which-key "recent files")
"fR" '(rename-file :which-key "rename file")
"fs" '(save-buffer :which-key "save buffer")
"fS" '(evil-write-all :which-key "save all buffers")
#+END_SRC
** Help/Emacs
#+BEGIN_SRC emacs-lisp
"h" '(nil :which-key "help/emacs")
"hv" '(describe-variable :which-key "des. variable")
"hb" '(describe-bindings :which-key "des. bindings")
"hM" '(describe-mode :which-key "des. mode")
"hf" '(describe-function :which-key "des. func")
"hF" '(describe-face :which-key "des. face")
"hk" '(describe-key :which-key "des. key")
"hm" '(nil :which-key "switch mode")
"hme" '(emacs-lisp-mode :which-key "elisp mode")
"hmo" '(org-mode :which-key "org mode")
"hmm" '(markdown-mode :which-key "markdown mode")
"hmt" '(text-mode :which-key "text mode")
"hp" '(nil :which-key "packages")
"hpr" '(package-refresh-contents :which-key "package-refresh")
"hpi" '(package-install :which-key "package-install")
"hpd" '(package-delete :which-key "package-delete")
#+END_SRC
** Jumps
#+begin_src emacs-lisp
;; Jumps
"j" '(nil :which-key "jumps")
"jr" '(jump-to-register :which-key "registers")
"jb" '(bookmark-jump :which-key "bookmark jump")
#+end_src
** System
#+begin_src emacs-lisp
;;System
"m" '(nil :which-key "system")
"m1" '(restart-emacs :which-key "restart emacs")
"m+" '(tab-bar-new-tab :which-key "tab new")
"m-" '(tab-close :which-key "tab close")
"mf" '(my/resources-visit :which-key "visit resources")'
"mr" '(nil :which-key "region")
"mre" '(er/expand-region :which-key "expand region")
"mrc" '(er/contract-region :which-key "contract region")
"mp" '(nil :which-key "palimpsest")
"mpb" '(palimpsest-move-region-to-bottom :which-key "pal move bottom")
"mpt" '(palimpsest-move-region-to-top :which-key "pal move top")
"mm" '(nil :which-key "mark")
"mml" '(my/mark-line :which-key "mark line")
"mmb" '(my/mark-block :which-key "mark block")
#+end_src
** Org mode
#+begin_src emacs-lisp
;; Org-mode
"mo" '(nil :which-key "org-mode")
"moa" '(org-agenda :which-key "org-agenda")
"moc" '(org-capture :which-key "org-capture")
"mot" '(org-todo :which-key "DONE")
"mou" '(my/org-jump-to-heading-beginning :which-key "jump to heading")
;; More Org
"mol" '(nil :which-key "line/link")
"molb" '(org-beginning-of-line :which-key "begin of line")
"mole" '(org-end-of-line :which-key "end of line")
"moli" '(my/org-insert-link-dwim :which-key "org insert link")
"mols" '(org-store-link :which-key "org store link")
;; Yet More org
"mo," '(nil :which-key "more-org")
"mo,c" '(org-cycle :which-key "org-cycle")
"mo,n" '(outline-next-visible-heading :which-key "next-heading")
"mo,p" '(outline-previous-visible-heading :which-key "previous-heading")
"mo,t" '(org-set-tags-command :which-key "set-tags")
"mo,u" '(outline-up-heading :which-key "up-heading")
#+end_src
** Registers/bookmarks
#+begin_src emacs-lisp
"r" '(nil :which-key "registers/marks")
"rr" '(consult-register :which-key "registers")
"rm" '(consult-mark :which-key "marks")
"rb" '(consult-bookmark :which-key "bookmarks")
"rs" '(bookmark-set :which-key "set bookmark")
#+end_src
** Text
#+BEGIN_SRC emacs-lisp
"x" '(nil :which-key "text")
"xC" '(my/copy-whole-buffer-to-clipboard :which-key "copy whole buffer to clipboard")
"xr" '(isearch-query-replace :which-key "find and replace")
"xs" '(yas-insert-snippet :which-key "insert yasnippet")
;;"xf" '(flush-lines :which-key "flush-lines")
"xR" '(replace-regexp :which-key "replace-regexp")
#+END_SRC
** Toggles/Visuals
#+BEGIN_SRC emacs-lisp
;; Toggles
"t" '(nil :which-key "toggles")
"tt" '(toggle-truncate-lines :which-key "truncate lines")
"tv" '(visual-line-mode :which-key "visual line mode")
"tn" '(display-line-numbers-mode :which-key "display line numbers")
"ta" '(mixed-pitch-mode :which-key "variable pitch mode")
"ty" '(consult-theme :which-key "load theme")
"tR" '(read-only-mode :which-key "read only mode")
#+END_SRC
** Windows
#+BEGIN_SRC emacs-lisp
;; Windows
"w" '(nil :which-key "window")
"wN" '(make-frame :which-key "make frame")
"wd" '(evil-window-delete :which-key "delete window")
"wb" '(vsplit-last-buffer :which-key "split below")
"wr" '(hsplit-last-buffer :which-key "split right")
"wl" '(evil-window-right :which-key "evil-window-right")
"wh" '(evil-window-left :which-key "evil-window-left")
"wj" '(evil-window-down :which-key "evil-window-down")
"wk" '(evil-window-up :which-key "evil-window-up")
"wz" '(text-scale-adjust :which-key "text zoom")
"wq" '(my/quick-window-jump :which-key "quick window jump"))
;; End SPC prefix block
#+END_SRC
** All-mode keybindings
Below are general keybindings for the various Evil modes.
#+BEGIN_SRC emacs-lisp
;; All-mode keymaps
(general-def
:keymaps 'override
;; Emacs --------
"ß" '(evil-window-next :which-key "evil-window-next") ;; option-s
"Í" '(other-frame :which-key "other-frame") ;; option-shift-s
"C-S-B" '(switch-to-buffer :which-key "switch-to-buffer")
"∫" '(switch-to-next-buffer :which-key "switch-to-next-buffer") ;; option-b
"s-b" '(switch-to-prev-buffer :which-key "switch-to-previous-buffer") ;; super-b
;; Remapping normal help features to use helpful version
"C-h v" '(helpful-variable :which-key "helpful-variable")
"C-h x" '(helpful-command :which-key "helpful-command")
"C-h f" '(helpful-function :which-key "helpful-function")
"C-h k" '(helpful-key :which-key "helpful-key")
;; Editing ------
"M-v" '(simpleclip-paste :which-key "sc-paste")
"M-V" '(evil-paste-after :which-key "evil-paste-after") ;; shift-paste uses the internal clipboard
"M-c" '(simpleclip-copy :which-key "sc-copy")
;;"M-u" '(capitalize-dwim :which-key "capitalize-dwim") ;; Default is upcase-dwim
;;"M-U" '(upcase-dwim :which-key "upcase-dwim") ;; M-S-u (switch upcase and capitalize)
;; Utility ------
"C-c c" '(org-capture :which-key "org-capture")
"C-c a" '(org-agenda :which-key "org-agenda")
"M-=" '(count-words :which-key "count-words")
"C-'" '(avy-goto-char-2 :which-key "avy-goto-char"))
#+END_SRC
#+begin_src emacs-lisp
(general-def
:states '(normal visual motion)
"gc" '(comment-dwim :which-key "comment-dwim")
"gC" '(comment-line :which-key "comment-line")
"u" '(undo-fu-only-undo :which-key "undo-fu-only-undo")
"U" '(undo-fu-only-redo :which-key "undo-fu-only-redo")
"j" '(evil-next-visual-line :which-key "evil-next-visual-line") ;; I prefer visual line navigation
"k" '(evil-previous-visual-line :which-key "evil-previous-line")
"f" '(evil-avy-goto-char-in-line :which-key "evil-avy-goto-char-in-line"))
#+end_src
** Insert mode keymaps
#+BEGIN_SRC emacs-lisp
;; Insert keymaps
;; Many of these are emulating standard Emacs bindings in Evil insert mode, such as C-a, or C-e.
(general-def
:states '(insert)
"C-a" '(evil-beginning-of-visual-line)
"C-e" '(evil-end-of-visual-line)
"C-S-a" '(evil-beginning-of-line)
"C-S-e" '(evil-end-of-line)
"C-n" '(evil-next-visual-line)
"C-p" '(evil-previous-visual-line)
)
#+END_SRC
** Emacs mode keymaps
#+BEGIN_SRC emacs-lisp
(general-def
:keymaps 'emacs
"C-w C-q" '(kill-this-buffer))
#+END_SRC
Phew. That is a lot. But it is something that I am working on fusing into my muscle memory. Wish me luck.
Speed Dial
I came across this Speed Dialing Your Favorite Files. I remembered that I used to use a similar system in iA Writer and Sublime Text. Glad to have this in Emacs.
I noticed that the Reddit comments on the post included suggestions to use registers or bookmarks instead of this abomination. I am sure that registers and bookmarks are great, but I like this better for getting to a list of ten files which get used a lot on my machine.
#+begin_src emacs-lisp
;;
;; Speed Dialing Favorite Files
;;
(defvar /speed-dial-list
'(("⓵-Emacs" . "~/.emacs.d/Emacs.org")
("⓶-todo" . "~/Dropbox/org/todo.org")
("⓷-cheat-sheet" . "~/Dropbox/org/emacs_cheat_sheet.org")
("⓸-em-man" . "~/Dropbox/org/20250118T230705--emacs-mini-manual-part-1__emacs.org")
("⓹-omguide" . "~/Dropbox/org/20250214T005052--emacs-org-mode-guide__emacs.org")
("⓺-diary" . "~/Dropbox/org/diary2025.org")
("⓻-init" . "~/.emacs.d/init.el")
("⓼-me" . "~/Dropbox/org/mastering_emacs_2024.org")
("⓽-CD" . "~/.emacs.d/Config Deletions.org")
("⓾-CB" . "~/Dropbox/org/emacs-config bits.org"))
"List of speed-dial entries as (LABEL . FILENAME).")
;; Global keybindings for speed dialing using '<Super>' + digit
(let ((i 1))
(dolist (entry /speed-dial-list)
(keymap-global-set (format "s-%d" (mod i 10))
`(lambda() (interactive) (find-file-existing ,(cdr entry))))
(setq i (1+ i))))
#+end_src
This makes accessing some of my files easier. I am sure that there are other ways of achieving this in Emacs. I like this one because I am used to it.
Emojis
I don’t use emojis much in my writing. But this makes it easy to use them on macOS if I feel so inclined. macOS Native Emoji Picking in Emacs from the Edit Menu
#+begin_src emacs-lisp
(easy-menu-add-item global-map '(menu-bar edit)
["Emoji & Symbols"
ns-do-show-character-palette
:help "Show macOS Character Palette."
:visible (eq window-system 'ns)])
#+end_src
Assorted Bits
I loved reading this My 10 Years with Emacs Plain DrOps. I wish to write about my experiences with Emacs ten years from now.
macosxguru at the gmail thingie.
emacs
February 17, 2025
tools
Three Goodies
I am going to cover three little apps I have been using. First on the list is Moves for macOS.
Moves
Moves is a little application which sits on the menubar and lets you move and resize windows. No more trying to hit the right spot on the window to move/resize it. Hold the modifier keys that you set up and move/resize the window with your mouse/trackpad. You will get used to it and this is going to become second nature.
Setup Moves
It is easy to setup. I love it. Moves is free.
The second one is a little utility called Yoink.
Yoink
Once in a while I have to move a whole bunch of files to different folders on the hard drive. Instead of moving them sequentially I can drag them to the Yoink shelf and then drag them to the folder I want. This is a great way to move files quickly and efficiently. I was initially skeptical, but after using it for a while, I find myself using it all the time. It is now an essential addition to my toolset. I think Pathfinder had a similar feature. Yoink is something I have gotten used to.
Yoink is a deep application which does more than just move files. It does something with the clipboard history which I have not explored. Alfred manages my clipboard history. It deals with plain text and that is what I am comfortable with. I use Yoink for moving files and folders around.
Extensions
Yoink has some extensions which improve the product. Quick Actions, A PDF service and Alfred integration are all designed to improve your interaction with Yoink. I love it.
The third application is a group of applications which do similar things on macOS. They are designed to help you ignore your mouse/trackpad and use the keyboard to select and navigate around the macOS interface.
shortcat
Shortcat is the first application, in this group, I am going to talk about.
You assign Shortcat a keyboard command to activate and then press the shortcut to get this:
shortcat selection
You type the letter/s on the selection you want to make and the OS selects your chosen option. Takes some getting used to but it is magic. Shortcat works in most applications and is an absolute joy to use.
shortcat preferences
Shortcat’s implementation of the scrolling function is a little wonky. Doesn’t work reliably and the keyboard commands are set for you. Space + (hjkl), is not the best solution for this. Using the spacebar key has definite functions in most programs and that doesn’t work as a modifier. A Meh key (⇧⌃⌥) and (hjkl) or some variant of that would work better. Scrolling, thanks to the keys chosen doesn’t work most of the time. The feature needs to be worked on and user selected keyboard commands would be an improvement.
Shortcat is not ready for release and the developer is not charging a price for it. A licensing scheme is being worked on and there is no indication of the price that the developer will charge. At this stage, it is a free utility.
homerow icon
Homerow is a commercial application. It costs $49.99.
Homerow is similar to Shortcat in that it is designed to help you ignore the mouse/trackpad and use the keyboard to select and navigate the macOS interface and the applications you run. It is more polished than Shortcat and lets you do more with the keyboard.
homerow screen
Homerow is similar to Shortcat in that you invoke it with your assigned keyboard command and it layers the interface with letters to show you what you can type to select the item you are interested in. Works a charm.
The settings for Homerow are more extensive than Shortcat.
clicking
You choose the short cut key you want.
scrolling
You get to choose the key to scroll and the scroll speed. Makes the feature usable and nice.
ignore
This is where Homerow still needs more work. You can choose apps to ignore and the program doesn’t respect that choice. For instance, I have setup Homerow to ignore Emacs. But it doesn’t respect that choice. If I press the keyboard command for Homerow it activates in Emacs and that is not the desired behavior.
Homerow is a well-designed solution which lets you ignore the mouse/trackpad. I love using it.
mouseless icon
Mouseless is a commercial application and it costs $9.99.
Mouseless is an application which wants you to ditch the mouse/trackpad but has a different approach to achieving that goal.
grid
Instead of selecting particular interface elements it provides a grid of letters for your whole screen. You get to choose the letters from the grid which overlays the item you want to select. Type them in, hit spacebar and you are off.
config
You can config various elements of Mouseless and its grid.
It works as expected however the experience of using Mouseless is a little too fidgety. It makes you do more work than Shortcat or Homerow. It doesn’t attempt to provide support for scrolling. You will have to mouse around for that.
Of the three, I prefer Homerow. Shortcat shows promise, but it is not ready yet.
macosxguru at the gmail thingie.
Thanks to: Photo by icon0 com: https://www.pexels.com/photo/grayscale-photo-of-combination-wrenches-220639/
macOS
February 10, 2025
KM Icon
Leader Key in Keyboard Maestro
LeaderKey.app is a good application. I loved trying it out.
I was wondering whether I could replicate its functionality with the tools I have already available on my machine. The obvious candidate was Keyboard Maestro. I found inspiration from Leader Launcher - Macro Library - Keyboard Maestro Discourse.
This was the result of the exercise.
Making a Launcher Group
I made a macro group, called Launcher. Assigned it a keyboard command of Hyper-O. The Hyper key is all of the modifier keys held together (⌃⇧⌥⌘). Difficult to do on a normal keyboard but my Moonlander has a custom key assigned to Hyper key.
Leader Key
Making Individual Launchers
I made a whole series of macros designed to launch particular programs. This is the one for Acorn.
Acorn Launch
I put the letter that was going to invoke the macro from the palette in front of the name. So this one was called a Acorn. Followed that with a whole slew of application launchers.
Problem With Multiple Applications With the Same Starting Letter
Very soon I ran into the need to have launchers for Emacs and EagleFiler. They share a common first letter. I solved this problem by assigning them both the same letter but naming them differently. So it was e1 Emacs and e2 EagleFiler
For Emacs:
Emacs
For EagleFiler:
EagleFiler
Now when I press ‘e’ I get the following palette:
Dupes
I can just press the relevant number and it launches the application assigned to that number.
Work Spaces
While working I notice that I have groups of applications open for particular tasks. For instance, first thing in the morning I have to open Mail and Chrome. Catch up on email and catch up on news. So I made a launcher which launched both of these.
Workspace
I have a similar one for when I am writing. Emacs, Dictionary and Chrome. That is assigned to a different Workspace.
This is how the Keyboard Maestro pallette looks when invoked with Hyper+O.
Launcher Palette
Conclusion
This was an interesting exercise, replicating most of the features of an application in Keyboard Maestro. I am amazed by what this little macro program is capable of. I have barely scratched the surface of its abilities. It makes my experience in macOS better.
macosxguru at the gmail thingie.
keyboardmaestro
macOS