From acc8cd98bad3a9039001a7a6fb3031beb8987607 Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Tue, 2 Jul 2024 22:58:28 -0700 Subject: [PATCH] Minor changes to C-a And M-j/k move up the function lists. --- ha-config.org | 15 ++++++++++++++- ha-evil.org | 2 +- ha-programming.org | 8 ++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ha-config.org b/ha-config.org index c2f1d42..07f224f 100644 --- a/ha-config.org +++ b/ha-config.org @@ -376,7 +376,6 @@ For this feature, I may want to pull it out into its own file, so as to keep all ("w" Info-goto-node-web "View on Web"))))) #+end_src - ** Text Expanders and Completion The following defines my use of the Emacs completion system. I’ve decided my /rules/ will be: - Nothing should automatically appear; that is annoying and distracting. @@ -626,6 +625,20 @@ The built-in =isearch= is fantastically simple and useful, but the [[https://git #+end_src The idea, is that you can start a search with ~C-s~ (or even ~s-f~ … er, ~Command-f~ on the Mac), and type some letters. Hitting ~C-s~ goes to the next occurrence of what you’ve typed, but if you hit ~Command-g~, a menu appears allowing you to pull in the rest of the word or symbol you are looking at, or edit it completely. +** Minor Keybinding Annoys +I like ~C-a~ to go to the beginning of the line, but what about getting to the beginning of text on that line? In Evil, you have ~^~ for beginning of line, and ~0~ for first text. Why not have ~C-a~ toggle between them both: + +#+begin_src emacs-lisp + (defun ha-beginning-of-line (&optional n) + "Toggles between the beginning of line and first of text." + (interactive "^p") + (if (= (point) (line-beginning-position)) + (beginning-of-line-text n) + (beginning-of-line n))) + + (global-set-key (kbd "C-a") 'ha-beginning-of-line) +#+end_src + * Working Layout While editing any file on disk is easy enough, I like the mental context switch associated with a full-screen window frame showing all the buffers of a /project task/ (often a direct link to a repository project, but not always). ** Projects diff --git a/ha-evil.org b/ha-evil.org index ad8ea21..2e71cfb 100644 --- a/ha-evil.org +++ b/ha-evil.org @@ -161,7 +161,7 @@ I am not a long term VI user, and don’t have much need for any of its control (use-package evil :config (evil-define-key '(normal visual motion operator) 'global - (kbd "C-a") 'move-beginning-of-line + (kbd "C-a") 'ha-beginning-of-line (kbd "C-e") 'move-end-of-line ;; Since C-y scrolls the window down, Shifted Y goes up: diff --git a/ha-programming.org b/ha-programming.org index d7780b1..b3f2325 100644 --- a/ha-programming.org +++ b/ha-programming.org @@ -258,13 +258,13 @@ We need to make sure we keep the [[https://github.com/Fuco1/smartparens][smartpa *** Move by Functions The =mark-paragraph= and =downcase-word= isn’t very useful in a programming context, and makes more sense to use them to jump around function-by-function: #+begin_src emacs-lisp - (global-set-key (kbd "M-h") 'beginning-of-defun) - (global-set-key (kbd "M-l") 'beginning-of-next-defun) + ; (global-set-key (kbd "M-k") 'beginning-of-defun) + ; (global-set-key (kbd "M-j") 'beginning-of-next-defun) (when (fboundp 'evil-define-key) (evil-define-key '(normal insert emacs) prog-mode-map - (kbd "M-h") 'beginning-of-defun - (kbd "M-l") 'beginning-of-next-defun)) + (kbd "M-k") 'beginning-of-defun + (kbd "M-j") 'beginning-of-next-defun)) #+end_src But one of those functions doesn’t exist: #+begin_src emacs-lisp