From 205067137bbc16534e0a2d6feddbfa8d2925195f Mon Sep 17 00:00:00 2001 From: Howard Abrams Date: Wed, 27 Apr 2022 22:14:17 -0700 Subject: [PATCH] Switch the sync and project save keybindings oh, and let's confirm before I quit Emacs. That's a bad fat finger. --- ha-config.org | 16 +++++++++++++++- ha-remoting.org | 23 ++++++++++++----------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/ha-config.org b/ha-config.org index 293f75f..e4a9b0c 100644 --- a/ha-config.org +++ b/ha-config.org @@ -25,6 +25,11 @@ A literate programming file for configuring Emacs. ;;; Code: #+END_SRC * Basic Configuration +I hate a fat-finger that stop Emacs: +#+BEGIN_SRC emacs-lisp + (setq confirm-kill-emacs 'yes-or-no-p) +#+END_SRC + New way to display line-numbers. I set mine to =relative= so that I can easily jump up and down by that value. Set this to =nil= to turn off, or =t= to be absolute. #+BEGIN_SRC emacs-lisp @@ -1005,7 +1010,7 @@ While I really don't /need/ all the features that [[https://github.com/bbatsov/p "p p" '("switch project" . projectile-switch-project) "p r" '("find recent project files" . projectile-recentf) "p R" '("run project" . projectile-run-project) - "p s" '("save project files" . projectile-save-project-buffers) + "p S" '("save project files" . projectile-save-project-buffers) "p T" '("test project" . projectile-test-project))) #+END_SRC ** Workspaces @@ -1073,6 +1078,7 @@ Build the hydra as well as configure the =perspective= project. ("K" persp-kill-buffer) ("s" persp-state-save) ("l" persp-state-load) + ("w" ha-switch-to-special) ; The most special perspective ("q" nil) ("C-g" nil)) @@ -1083,6 +1089,14 @@ I have no idea why this binding doesn’t work /within/ the =use-package= declar #+BEGIN_SRC emacs-lisp (ha-leader "TAB" '("workspaces" . hydra-workspace-leader/body)) #+END_SRC + +The /special/ perspective is a nice shortcut to the one I use the most: +#+BEGIN_SRC emacs-lisp +(defun ha-switch-to-special () + "Change to the projects perspective." + (interactive) + (persp-switch "projects")) +#+END_SRC *** Predefined Workspaces Let's describe a list of startup project workspaces. This way, I don't need the clutter of the recent state, but also get back to a state of mental normality. Granted, this list is essentially a list of projects that I'm currently developing, so I expect this to change often. diff --git a/ha-remoting.org b/ha-remoting.org index f6cce6a..fa47f81 100644 --- a/ha-remoting.org +++ b/ha-remoting.org @@ -397,20 +397,21 @@ We'll do the work of getting the /server list/ with this function: #+BEGIN_SRC emacs-lisp (defun ha-ssh-overcloud-cache-populate (cluster) + "Given an `os-cloud' entry, stores all available hostnames. + Calls `ha-ssh-add-favorite-host' for each host found." (interactive (list (completing-read "Cluster: " '(devprod1 devprod501 devprod502)))) (message "Calling the `openstack' command...this will take a while. Grab a coffee, eh?") (let* ((command (format "openstack --os-cloud %s server list --no-name-lookup --insecure -f json" cluster)) - (json-data (shell-command-to-string command))) - (message "Call to openstack returned: %s" json-data) - (setq ha-ssh-overcloud-cache-data (json-read-from-string json-data)) - (cl-flet* ((ssh-tuple (entry) (cons (alist-get 'Name entry) - (aref (thread-last entry - (alist-get 'Networks) - (alist-get 'cedev13)) - 0)))) - (setq ha-ssh-favorite-hostnames - (mapcar #'ssh-tuple ha-ssh-overcloud-cache-data)))) - (message "Call to =openstack= complete. Found %d hosts." (length ha-ssh-overcloud-cache-data))) + (json-data (thread-last command + (shell-command-to-string) + (json-read-from-string)))) + (dolist (entry (seq--into-list json-data)) + (ha-ssh-add-favorite-host (alist-get 'Name entry) + (thread-last entry + (alist-get 'Networks) + (alist-get 'cedev13) + (seq-first)))) + (message "Call to `openstack' complete. Found %d hosts." (length json-data)))) #+END_SRC In case I change my virtual machines, I can repopulate that cache: