Fixed some Org bugs, including local prefix.

This commit is contained in:
Howard Abrams 2021-11-05 17:07:33 -07:00
parent d3f14de2ee
commit 6d33305992
2 changed files with 116 additions and 88 deletions

View file

@ -53,11 +53,28 @@ More settings:
auto-save-default t) auto-save-default t)
#+END_SRC #+END_SRC
And some Mac-specific settings:
#+BEGIN_SRC emacs-lisp
(when (equal system-type 'darwin)
(setq mac-option-modifier 'meta)
(setq mac-command-modifier 'super)
(add-to-list 'default-frame-alist '(ns-transparent-titlebar . t))
(add-to-list 'default-frame-alist '(ns-appearance . dark)))
#+END_SRC
Finally, we need to make sure that the =/usr/local/bin= path is available to Emacs. Normally, we get this value from =PATH= environment variable, but I have one Emacs installation that refuses to, so... here we are. Finally, we need to make sure that the =/usr/local/bin= path is available to Emacs. Normally, we get this value from =PATH= environment variable, but I have one Emacs installation that refuses to, so... here we are.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(add-to-list 'exec-path "/usr/local/bin/") (add-to-list 'exec-path "/usr/local/bin/")
#+END_SRC #+END_SRC
** Customization Section
While I would rather program my configurations, sometimes the Emacs menu system is “good enough”, but I want it in its own file:
#+BEGIN_SRC emacs-lisp
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (file-exists-p custom-file)
(load custom-file))
#+END_SRC
* Support Packages * Support Packages
** Piper ** Piper
@ -155,7 +172,7 @@ My only issue with using Vertico with =find-file= is that I really like having t
;; More convenient directory navigation commands ;; More convenient directory navigation commands
:bind (:map vertico-map :bind (:map vertico-map
("RET" . vertico-directory-enter) ("RET" . vertico-directory-enter)
("DEL" . vertico-directory-delete-word) ; ("DEL" . vertico-directory-delete-word)
("M-RET" . minibuffer-force-complete-and-exit) ("M-RET" . minibuffer-force-complete-and-exit)
("M-TAB" . minibuffer-complete)) ("M-TAB" . minibuffer-complete))
;; Tidy shadowed file names ;; Tidy shadowed file names
@ -290,14 +307,10 @@ I'm not trying an experiment where specially-placed function keys on my fancy er
:config :config
(general-evil-setup t) (general-evil-setup t)
(general-create-definer ha-leader (general-create-definer ha-leader
:keymaps '(normal insert visual emacs) :keymaps 'normal
:prefix "SPC" :prefix "SPC"
:global-prefix "<f13>") :non-normal-prefix "M-SPC"
:global-prefix "<f13>"))
(general-create-definer ha-local-leader
:keymaps '(normal insert visual emacs)
:prefix "SPC m"
:global-prefix "<f12>"))
#+END_SRC #+END_SRC
*** Top-Level Operations *** Top-Level Operations
Let's try this out with Let's try this out with
@ -307,7 +320,8 @@ Let's try this out with
"." '("repeat" . repeat) "." '("repeat" . repeat)
"X" 'org-capture "X" 'org-capture
"L" 'org-store-link "L" 'org-store-link
"RET" 'bookmark-jump) "RET" 'bookmark-jump
"m" '(:ignore t :which-key "mode"))
#+END_SRC #+END_SRC
And ways to stop the system: And ways to stop the system:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -771,6 +785,10 @@ Granted, this list is essentially a list of projects that I'm currently developi
Given a list of information about project-workspaces, can we just create them all? Given a list of information about project-workspaces, can we just create them all?
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun ha-persp-exists? (name)
"Return non-nill is a perspective of NAME has been created."
(seq-contains (hash-table-keys (perspectives-hash)) name))
(defun ha-workspace-initialize (&optional projects) (defun ha-workspace-initialize (&optional projects)
"Precreate workspace projects from a PROJECTS list. "Precreate workspace projects from a PROJECTS list.
Each entry in the list is a list containing: Each entry in the list is a list containing:
@ -783,8 +801,9 @@ Each entry in the list is a list containing:
(dolist (project projects) (dolist (project projects)
(-let (((name root files) project)) (-let (((name root files) project))
(unless (ha-persp-exists? name)
(message "Creating workspace: %s (from %s)" name root) (message "Creating workspace: %s (from %s)" name root)
(ha-project-persp root name files)))) (ha-project-persp root name files)))))
#+END_SRC #+END_SRC
Often, but not always, I want a perspective based on an actual Git repository, e.g. a project. Projectile keeps state of a "project" based on the current file loaded, so we /combine/ the two projects by first choosing from a list of /known projects/ and then creating a perspective based on the name. To pin the perspective to a project, we just need to load a file from it, e.g. Like a README or something. Often, but not always, I want a perspective based on an actual Git repository, e.g. a project. Projectile keeps state of a "project" based on the current file loaded, so we /combine/ the two projects by first choosing from a list of /known projects/ and then creating a perspective based on the name. To pin the perspective to a project, we just need to load a file from it, e.g. Like a README or something.
@ -803,7 +822,8 @@ README. Otherwise, pull up a dired."
;; Unclear if the following is actually necessary. ;; Unclear if the following is actually necessary.
(ignore-errors (ignore-errors
(projectile-add-known-project root) (projectile-add-known-project root)
(projectile-switch-project-by-name root)) (let ((projectile-switch-project-action nil))
(projectile-switch-project-by-name root)))
;; To pin a project in projectile to the perspective, we need to load a file ;; To pin a project in projectile to the perspective, we need to load a file
;; from that project. The README will do, or at least, the dired of it. ;; from that project. The README will do, or at least, the dired of it.
@ -904,7 +924,7 @@ The [[https://github.com/emacsmirror/git-timemachine][git-timemachine]] project
(ha-leader "g t" '("git timemachine" . git-timemachine))) (ha-leader "g t" '("git timemachine" . git-timemachine)))
#+END_SRC #+END_SRC
Using the [[https://github.com/emacsmirror/gist][gist package]] to write code snippets on either [[https://gist.github.com/][Github]]: Using the [[https://github.com/emacsmirror/gist][gist package]] to write code snippets on [[https://gist.github.com/][Github]] seems like it can be useful, but I'm not sure how often.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package gist (use-package gist
:config :config

View file

@ -48,7 +48,9 @@ Org is an important part of my Emacs world, and with a lot of customization (eve
org-outline-path-complete-in-steps nil org-outline-path-complete-in-steps nil
org-src-tab-acts-natively t org-src-tab-acts-natively t
org-agenda-span 'day ; Default is 'week org-agenda-span 'day ; Default is 'week
org-confirm-babel-evaluate nil) org-confirm-babel-evaluate nil
org-src-fontify-natively t
org-src-tab-acts-natively t)
#+END_SRC #+END_SRC
Overcoming a bug: Overcoming a bug:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -287,6 +289,12 @@ To make the snippets more context aware, this predicate
(equal "plantuml" (equal "plantuml"
(plist-get (cadr (org-element-at-point)) :language))) (plist-get (cadr (org-element-at-point)) :language)))
#+END_SRC #+END_SRC
** Keybindings
Ugh
#+BEGIN_SRC emacs-lisp
(ha-leader :keymaps 'org-mode-map
"m l" 'org-insert-link)
#+END_SRC
* Supporting Packages * Supporting Packages
At this point, we assume that the =use-package= for org is complete, so we can close it and allow other projects to be loaded: At this point, we assume that the =use-package= for org is complete, so we can close it and allow other projects to be loaded:
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp