{"id":22901279,"url":"https://github.com/mooerslab/emacs-simple-init-org","last_synced_at":"2026-03-19T23:57:27.676Z","repository":{"id":255881868,"uuid":"853810292","full_name":"MooersLab/emacs-simple-init-org","owner":"MooersLab","description":"A simple approach to the configuration of Emacs via a org file that is easy to navigate.","archived":false,"fork":false,"pushed_at":"2024-09-30T02:09:36.000Z","size":572,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-07T03:42:00.383Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MooersLab.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-07T15:47:03.000Z","updated_at":"2024-09-30T02:09:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"5f2516ea-e672-435c-aa8e-b8758386b133","html_url":"https://github.com/MooersLab/emacs-simple-init-org","commit_stats":null,"previous_names":["mooerslab/emacs-simple-init-org"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MooersLab%2Femacs-simple-init-org","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MooersLab%2Femacs-simple-init-org/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MooersLab%2Femacs-simple-init-org/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MooersLab%2Femacs-simple-init-org/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MooersLab","download_url":"https://codeload.github.com/MooersLab/emacs-simple-init-org/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246591782,"owners_count":20801984,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-14T01:32:40.924Z","updated_at":"2026-01-08T18:48:38.878Z","avatar_url":"https://github.com/MooersLab.png","language":"Emacs Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"* Emacs 29 configuration from a README.org file.\n\n* Preface\n** Status\nThis is my current working version in mid-2024.\nI have yet to add headlines for all packages.\nThis configuration is skewed toward supporting academic research tasks like bibliographic management, writing papers, and assembling grant applications in org-mode or LaTeX.\n\n** Why use an org file to manage your Emacs configuration?\n\nThe main reason is to ease the navigation of the configuration file once it becomes longer than the length of the screen in Emacs.\nMine tend to be several thousand lines long.\nScrolling up and down is a pain.\nYou can collapse the file tree in org to ease navigation significantly. Enter Meta-Shift repeatedly with the cursor on the top-level headline to cycle through the folding of the headlines.\nYou can also set up a table of contents with links to specific sites further down in the file.\nYou could even add a backlink to the TOC.\n\nA secondary reason is to ease adding notes about using the packages and functions.\nThese notes can include links, equations, plots, and tables.\n\n** Why post this GitHub?\n- One way to render the org file into HTML.\n- Others can copy the code blocks of interest for their *init.el* files.\n- I will have a backup if my computer dies or is stolen.\n\n\n** A simple approach\n\nI found a simple approach to using an org file to configure Emacs.\nThis approach is possible now because org-mode is built into GNU Emacs.\nThis approach was impossible several years ago when I last used an org file to manage my Emacs configuration.\n\n#+BEGIN_EXAMPLE\n(require 'org)\n(org-babel-load-file (expand-file-name \"init.org\" user-emacs-directory))\n#+END_EXAMPLE\n\n1. You place the above two lines of code in a *init.el* file after you have moved your existing *init.el* file to a safe place. Include nothing else. Emacs will write some lines of customization during the first boot up of Emacs.\n\n2. Build your init.org file.\n  - Place elisp code in org-mode source blocks. Use my elisp  ~wrap-region-with-org-src-block~ function to warp marked regions of elisp in org-mode source blocks\n  - Add org-style headlines\n  - Move comments outside of the source blocks and uncomment them.\n\n3. Install the *toc-org* package from MELPA.\n   Place a TOC tag on a TOC headline.\n   This will indicate  where the headline is to go.\n   A GitHub-compatible TOC will be generated as internal links when you reload the *init.org* file.\n   You will not have to manually edit the TOC as you make additions or deletions.\n\n4. If you want to post your *init.org* file on GitHub, rename it *README.org*, and it will be rendered nicely on GitHub.\n   Bugs that prevent the rendering by Github might not prevent its use by Emacs.\n   Some org-mode features prevent rendering on [[https://github.com/novoid/github-orgmode-tests][GitHub]].\n\n- The ~#+TOC~ is not supported.\n- TODO items are not supported.\n- Drawers do not work.\n- Line breaks are often disregarded, which can affect the formatting of your text.\n- Features like custom LaTeX fragments, certain HTML tags, and complex table structures may not render as expected.\n- Elements such as ~#+BEGIN_SRC~ and ~#+BEGIN_EXAMPLE~ might not display correctly.\n- Code blocks with specific language syntax highlighting may not be supported.\n- Checkboxes, radio buttons, and interactive elements are not supported.\n\n\n\n* Table of Contents :TOC:\n- [[#emacs-29-configuration-from-a-readmeorg-file][Emacs 29 configuration from a README.org file.]]\n- [[#preface][Preface]]\n  - [[#status][Status]]\n  - [[#why-use-an-org-file-to-manage-your-emacs-configuration][Why use an org file to manage your Emacs configuration?]]\n  - [[#why-post-this-github][Why post this GitHub?]]\n  - [[#a-simple-approach][A simple approach]]\n- [[#package-management][Package management]]\n- [[#customizations][Customizations]]\n  - [[#garbage-collection][garbage collection]]\n  - [[#settings][Settings]]\n  - [[#elisp-functions-by-me-and-others][Elisp functions by me and others]]\n  - [[#shell-configuration][Shell configuration]]\n  - [[#faked-full-screen][Faked full screen]]\n  - [[#backups][Backups]]\n  - [[#default-and-per-save-backups-go-here][Default and per-save backups go here:]]\n  - [[#disable-lockfiles][Disable lockfiles.]]\n  - [[#column-number-mode][Column number mode]]\n  - [[#show-stray-whitespace][Show stray whitespace.]]\n  - [[#fontlocking][Fontlocking]]\n  - [[#show-current-time-in-modeline][Show current time in modeline]]\n  - [[#delete-trailing-whitespaces][Delete trailing whitespaces]]\n  - [[#display-line-numbers-need-with-s-l][Display line numbers. Need with s-l.]]\n  - [[#hippie-expand-m-][hippie-expand M-/.]]\n  - [[#gui-related-settings][GUI related settings]]\n  - [[#cua-keybindings][CUA keybindings]]\n  - [[#disable-the-c-z-sleepsuspend-key][Disable the C-z sleep/suspend key]]\n  - [[#make-copy-and-paste-use-the-same-clipboard-as-emacs][Make copy and paste use the same clipboard as emacs.]]\n  - [[#display-time-of-day][Display time of day]]\n  - [[#customize-powerline][Customize powerline]]\n  - [[#highlight-current-line][Highlight current line]]\n  - [[#list-recently-opened-files][List recently opened files.]]\n  - [[#utf-8][UTF-8]]\n  - [[#quickly-access-configuration-file][Quickly access configuration file]]\n  - [[#gui-settings][GUI settings]]\n  - [[#global-keys][Global keys]]\n  - [[#case-fold-search][case fold search]]\n  - [[#show-file-path-in-title-of-buffer][Show file path in title of buffer]]\n  - [[#browse-urls-in-text-mode][Browse URLS in text mode]]\n  - [[#revert-buffers-when-the-underlying-file-has-changed][Revert buffers when the underlying file has changed.]]\n  - [[#save-history-going-back-25-commands][Save history going back 25 commands.]]\n  - [[#save-place-in-a-file][Save place in a file.]]\n  - [[#monday-as-first-day-of-week][Monday as first day of week]]\n  - [[#have-emacs-backups-in-a-different-directory][Have emacs backups in a different directory]]\n  - [[#show-paren-mode][show-paren-mode]]\n  - [[#use-y-or-n-instead-of-yes-or-no][Use y or n instead of yes or no]]\n  - [[#system-detection][System detection]]\n  - [[#set-keys-for-mac-os][Set keys for Mac OS]]\n  - [[#save-the-buffer][Save the buffer.]]\n  - [[#switch-to-previous-buffer][Switch to previous buffer]]\n  - [[#minibuffer-history-keybindings][Minibuffer history keybindings]]\n  - [[#bibtex-configuration][Bibtex configuration]]\n  - [[#retina-display-of-pdfs][Retina display of PDFs]]\n  - [[#pdf-default-page-width-behavior][PDF default page width behavior]]\n  - [[#set-delay-in-the-matching-parenthesis-to-zero][Set delay in the matching parenthesis to zero.]]\n  - [[#window-management][Window management]]\n  - [[#zoom-text-in-and-out-very-sweet][Zoom text in and out. Very Sweet!]]\n  - [[#aliases][Aliases]]\n- [[#a][A]]\n  - [[#ace-window][ace-window]]\n  - [[#auctex][auctex]]\n- [[#b][B]]\n- [[#c][C]]\n  - [[#citar][citar]]\n  - [[#corfu][corfu]]\n  - [[#cape-configuration][Cape Configuration]]\n  - [[#company-box][company-box]]\n  - [[#company-configuration][Company Configuration]]\n  - [[#consult][consult]]\n- [[#d][D]]\n  - [[#dashboard][dashboard]]\n  - [[#dashboard-refresh][Dashboard refresh]]\n- [[#e][E]]\n  - [[#ekg][ekg]]\n  - [[#embark][Embark]]\n- [[#f][F]]\n  - [[#flycheck][flycheck]]\n- [[#g][G]]\n- [[#h][H]]\n  - [[#hydra][hydra]]\n  - [[#helpful][helpful]]\n- [[#i][I]]\n  - [[#ivy][ivy]]\n  - [[#ivy-rich][ivy-rich]]\n  - [[#ivy-bibtex][ivy-bibtex]]\n- [[#j][J]]\n- [[#k][K]]\n  - [[#kind-icon][kind-icon]]\n- [[#l][L]]\n  - [[#lsp-mode][lsp-mode]]\n- [[#m][M]]\n  - [[#marginalia-configuration][Marginalia Configuration]]\n  - [[#math-preview][Math-Preview]]\n- [[#n][N]]\n  - [[#orderless][orderless]]\n  - [[#org-agenda][org-agenda]]\n  - [[#customized-agenda-views][customized agenda views]]\n  - [[#org-ask-location][org-ask-location]]\n  - [[#org-capture-templates][org-capture-templates]]\n  - [[#org-ai][org-ai]]\n  - [[#org-babel][org-babel]]\n  - [[#org-cc][org-cc]]\n  - [[#org-gtd][org-gtd]]\n  - [[#org-noter][org-noter]]\n  - [[#org-pdftools][org-pdftools]]\n  - [[#org-noter-pdftools][org-noter-pdftools]]\n  - [[#org-pomodoro][org-pomodoro]]\n  - [[#org-ref][org-ref]]\n  - [[#org-cite-insert][org-cite-insert]]\n  - [[#basic-org-roam-config][Basic org-roam config]]\n  - [[#org-roam-capture-templates][org-roam-capture-templates]]\n  - [[#toc-org][toc-org]]\n- [[#p][P]]\n  - [[#s][S]]\n- [[#q][Q]]\n- [[#r][R]]\n- [[#s-1][S]]\n- [[#t][T]]\n  - [[#treemacs][treemacs]]\n- [[#u][U]]\n- [[#v][V]]\n  - [[#vertico-configuration][Vertico Configuration]]\n- [[#x][X]]\n- [[#w][W]]\n- [[#y][Y]]\n- [[#z][Z]]\n\n* Package management\n\n#+BEGIN_SRC emacs-lisp\n(require 'package)\n  (setq package-enable-at-startup nil)\n  (setq package-archives '((\"org\"  . \"http://orgmode.org/elpa/\")\n                          (\"gnu\"   . \"http://elpa.gnu.org/packages/\")\n                          (\"melpa\" . \"http://melpa.org/packages/\")))\n  (package-initialize)\n\n  (unless (package-installed-p 'use-package)\n    (package-refresh-contents)\n    (package-install 'use-package))\n  (require 'use-package)\n  (setq use-package-always-ensure t)\n\n\n(unless (package-installed-p 'quelpa)\n    (with-temp-buffer\n      (url-insert-file-contents \"https://raw.githubusercontent.com/quelpa/quelpa/master/quelpa.el\")\n      (eval-buffer)\n      (quelpa-self-upgrade)))\n\n(message \"Finished package manger configuration.\")\n\n#+END_SRC\n\n* Customizations\n\n** garbage collection\n\n#+BEGIN_SRC emacs-lisp\n(use-package gcmh\n  :diminish gcmh-mode\n  :config\n  (setq gcmh-idle-delay 5\n        gcmh-high-cons-threshold (* 16 1024 1024))  ; 16mb\n  (gcmh-mode 1))\n\n(add-hook 'emacs-startup-hook\n          (lambda ()\n            (setq gc-cons-percentage 0.1))) ;; Default value for `gc-cons-percentage'\n\n(add-hook 'emacs-startup-hook\n          (lambda ()\n            (message \"Emacs ready in %s with %d garbage collections.\"\n                     (format \"%.2f seconds\"\n                             (float-time\n                              (time-subtract after-init-time before-init-time)))\n                     gcs-done)))\n\n(message \"Finished garbage collection.\")\n#+END_SRC\n\n** Settings\n\n#+BEGIN_SRC emacs-lisp\n  (message \"Start settings section.\")\n  ;;;# save current init.el to ~/.saves\n  ;; source https://www.reddit.com/r/emacs/comments/11ap924/the_most_important_snippet_in_my_emacs_init_file/\n  (setq\n  backup-by-copying t ; don't clobber symlinks\n  backup-directory-alist\n  '((\".\" . \"~/.e29orgInitSaves\")) ; don't litter my fs tree\n  delete-old-versions t\n  kept-new-versions 6\n  kept-old-versions 2\n  version-control t)\n\n\n  ;; Export from org to latex\n  (setq org-latex-pdf-process\n    '(\"latexmk -pdflatex='pdflatex -interaction nonstopmode -shell-escape' -pdf -bibtex -f %f\"))\n\n\n\n\n  ;;; Basics Configuration\n  ;;(setq openai-key \"[]\")\n  ;;(setq openai-api-key \"\")\n\n\n  (setq inhibit-startup-message t) ;; hide the startup message\n  ;; (load-theme 'material t) ;; load material theme\n  ;; (global-linum-mode t) ;; enable line numbers globally\n  (set-default 'truncate-lines t) ;; do not wrap\n  (prefer-coding-system 'utf-8) ;; use UTF-8\n\n  ;;load prefers the newest version of a file.\n  ;; This applies when a filename suffix is not explicitly specified and load is trying various possible suffixes (see load-suffixes and load-file-rep-suffixes). Normally, it stops at the first file that exists unless you explicitly specify one or the other. If this option is non-nil, it checks all suffixes and uses whichever file is newest.\n  ;; (setq load-prefer-newer t) --\u003e causes RECURSIVE LOAD error\n\n  ;;;# Zoom\n  (set-face-attribute 'default nil :height 128)\n\n  ;;;# Save History\n  (savehist-mode +1)\n  (setq savehist-additional-variables '(kill-ring search-ring regexp-search-ring))\n\n\n  ;;;# Size of the starting Window\n  (setq initial-frame-alist '((top . 1)\n                  (left . 450)\n                  (width . 101)\n                  (height . 90)))\n\n  ;;;# Line wrap\n  (global-visual-line-mode +1)\n  (delete-selection-mode +1)\n  (save-place-mode +1)\n\n\n  ;;;# set browser to open url in new tab\n  (custom-set-variables\n    '(browse-url-browser-function (quote browse-url-firefox))\n    '(browse-url-firefox-new-window-is-tab t))\n\n  (global-set-key (kbd \"C-h D\") 'devdocs-lookup)\n  (message \"End settings section.\")\n#+END_SRC\n\n\n\n\n\n\n** Elisp functions by me and others\n\n*** description list for LaTeX from markdown list\n\n#+BEGIN_SRC emacs-lisp\n    (message \"Begin custom elisp functions section.\")\n    ;;;### M-x description\n    ;; Converts a selected list into a description list.\n    ;; The elements of the list must begin with a dash.\n    ;; The terms to be inserted into the square brackets\n    ;; have to be added after running the function.\n    (defun description (beg end)\n      \"wrap the active region in an 'itemize' environment,\n      converting hyphens at the beginning of a line to \\item\"\n      (interactive \"r\")\n      (save-restriction\n\t(narrow-to-region beg end)\n\t(beginning-of-buffer)\n\t(insert \"\\\\begin{description}\\n\")\n\t(while (re-search-forward \"^- \" nil t)\n\t  (replace-match \"\\\\\\\\item[ ]\"))\n\t(end-of-buffer)\n\t(insert \"\\\\end{description}\\n\")))\n\n  (message \"End description function.\")\n#+END_SRC\n\n\n\n*** enumerate list for LaTeX from markdown list\n\n#+BEGIN_SRC emacs-lisp\n  ;;;### M-x enumerate\n  ;; Converts a selected list into an enumerated list.\n  ;; The elements of the list must begin with a dash.\n  (defun enumerate (beg end)\n    \"wrap the active region in an 'itemize' environment,\n    converting hyphens at the beginning of a line to \\item\"\n    (interactive \"r\")\n    (save-restriction\n      (narrow-to-region beg end)\n      (beginning-of-buffer)\n      (insert \"\\\\begin{enumerate}\\n\")\n      (while (re-search-forward \"^- \" nil t)\n\t(replace-match \"\\\\\\\\item \"))\n      (end-of-buffer)\n      (insert \"\\\\end{enumerate}\\n\")))\n\n  (message \"End enumerate function.\")\n#+END_SRC\n\n\n*** itemized list for LateX from markdown list\n\nConverts a selected markdown list into an itemized list.\nThe elements of the list must begin with a dash.\n\n#+BEGIN_SRC emacs-lisp\n  (message \"Begin itemize.\")\n  (defun itemize (beg end)\n     \"wrap the active region in an itemize environment,\n      converting hyphens at the beginning of a line to blackslash item\"\n      (interactive \"r\")\n      (save-restriction\n\t(narrow-to-region beg end)\n\t(beginning-of-buffer)\n\t(insert \"\\\\begin{itemize}\\n\")\n\t(while (re-search-forward \"^- \" nil t)\n\t  (replace-match \"\\\\\\\\item \"))\n\t(end-of-buffer)\n\t(insert \"\\\\end{itemize}\\n\")))\n    (message \"End itemize function.\")\n#+END_SRC\n\n\n*** Checkmark, insert\n\n#+BEGIN_SRC emacs-lisp\n  (defun ichmk ()\n    \"Inserts a checkmark.\"\n    (interactive)\n    (insert \"\\\\\\item \\\\checkmark \"))\n  (message \"End checkmark function.\")\n#+END_SRC\n\n\n*** Convert org headlines to beamer slides\n#+BEGIN_SRC emacs-lisp\n    (defun org-to-beamer-slides-in-region (start end)\n      \"Convert an Org-mode outline as a list of headlines into Beamer slides flanked by unnumbered subsections and notes. The output can be pasted into a beam slideshow on Overleaf.\"\n      (interactive \"r\")\n      (save-restriction\n\t(narrow-to-region start end)\n\t(goto-char (point-min))\n\t(while (re-search-forward \"^\\\\*+ \\\\(.*\\\\)$\" nil t)\n\t  (let ((title (match-string 1)))\n\t    (replace-match (concat \"\\\\\\\\subsection*{\" title \"}\\n\\\\\\\\begin{frame}\\n\\\\\\\\frametitle{\" title \"}\\n\") nil nil)\n\t    (end-of-line)\n\t    (insert \"\\n\\\\end{frame}\\n\\\\note{Your note here}\\n\\n\"))))\n    (message \"Conversion to Beamer slides complete!\"))\n#+END_SRC\n\n\n*** Unwrap paragraphs into one sentence per line\n\nhttps://stackoverflow.com/questions/539984/how-do-i-get-emacs-to-fill-sentences-but-not-paragraphs/6103404\\#6103404\nUnwrap paragraphs into one sentence per line.\n#+BEGIN_SRC emacs-lisp\n    (defun fill-sentences-in-paragraph ()\n      \"Put a newline at the end of each sentence in paragraph.\"\n      (interactive)\n      (save-excursion\n\t(mark-paragraph)\n\t(call-interactively 'fill-sentences-in-region)))\n#+END_SRC\n\n\n*** One line per sentence\n\n#+BEGIN_SRC emacs-lisp\n    (defun fill-sentences-in-region (start end)\n      \"Put a newline at the end of each sentence in region.\"\n      (interactive \"*r\")\n      (call-interactively 'unfill-region)\n      (save-excursion\n\t(goto-char start)\n\t(while (re-search-forward \"[.?!][]\\\"')}]*\\\\( \\\\)\" end t)\n\t  (newline-and-indent))))\n#+END_SRC\n\n\n*** Read my-openai-api-key\n\n#+BEGIN_SRC emacs-lisp\n    (defun my-openai-api-key ()\n     \"Read api key from disk.\"\n     (with-temp-buffer\n       (insert-file-contents \"~/openaikey.txt\")\n       (string-trim (buffer-string))))\n#+END_SRC\n\n\n*** Unfill region\n\n#+BEGIN_SRC emacs-lisp\n(defun unfill-region (beg end)\n\t  \"Unfill the region, joining text paragraphs into a\n\t   single logical line.  This is useful, e.g., for use\n\t   with 'visual-line-mode'.\"\n\t  (interactive \"*r\")\n\t  (let ((fill-column (point-max)))\n\t    (fill-region beg end)))\n\n(global-set-key \"\\M-q\" 'fill-sentences-in-paragraph)\n#+END_SRC\n\n*** reload-init\nInspried https://sachachua.com/dotemacs/index.html#org4dd39d0\n\n#+BEGIN_SRC emacs-lisp\n(defun reload-init-e29org ()\n    \"Reload my init.el file. Edit the path to suite your needs.\"\n    (interactive)\n    (load-file \"~/e29org/init.el\"))\n#+END_SRC\n\n\n*** reload-hydras\n\n#+BEGIN_SRC emacs-lisp\n  (message \"Begin the hydra reload commands.\")\n  (defun reload-hydras ()\n    \"Reload my-hydras.el. Edit the path to suite your needs.\"\n    (interactive)\n    (load-file \"~/emacs29.3/my-hydras/my-hydras.el\"))\n#+END_SRC\n\n\n*** reload-learning-spiral-hydras\n\n#+BEGIN_SRC emacs-lisp\n  (defun reload-learning-spiral-hydras ()\n    \"Reload learning-spiral-hydras.el. Edit the path to suite your needs.\"\n    (interactive)\n    (load-file \"~/emacs29.3/my-hydras/learning-spiral-hydras.el\"))\n#+END_SRC\n\n\n*** reload-writing-projects-hydra\n\n#+BEGIN_SRC emacs-lisp\n  (defun reload-writing-projects-hydra ()\n    \"Reload lwriting-projects-hdyra.el. Edit the path to suite your needs.\"\n    (interactive)\n    (load-file \"~/emacs29.3/my-hydras/writing-projects-hydra.el\"))\n#+END_SRC\n\n\n*** reload-talon-quiz-hydras\n\n#+BEGIN_SRC emacs-lisp\n(defun reload-talon-quiz-hydras ()\n   \"Reload learning-spiral-hydras.el. Edit the path to suite your needs.\"\n  (interactive)\n  (load-file \"~/emacs29.3/my-hydras/talon-quiz-hydras.el\"))\n#+END_SRC\n\n\n*** reload-uniteai\n\n#+BEGIN_SRC emacs-lisp\n  (defun reload-uniteai ()\n    \"Reload my-uniteai.el. Edit the path to suite your needs.\"\n    (interactive)\n    (load-file \"~/e29org/my-uniteai.el\"))\n#+END_SRC\n\n*** Clean and sort list of items in region\n\n#+BEGIN_SRC emacs-lisp\n  (defun clean-sort-list-in-region (beg end)\n    \"Clean and sort the lines in the selected region.\n     Removes duplicate lines, blank lines, and sort alphabetically.\n     Built by Copilot\"\n    (interactive \"r\")\n    (let ((lines (split-string (buffer-substring-no-properties beg end) \"\\n\" t))\n\t  (cleaned-lines nil))\n      ;; Remove duplicates and blank lines\n      (dolist (line lines)\n\t(when (and (not (string-blank-p line))\n\t\t   (not (member line cleaned-lines)))\n\t  (push line cleaned-lines)))\n      ;; Sort alphabetically\n      (setq cleaned-lines (sort cleaned-lines #'string\u003c))\n      ;; Replace the region with the cleaned and sorted lines\n      (delete-region beg end)\n      (insert (mapconcat #'identity cleaned-lines \"\\n\"))))\n  (global-set-key (kbd \"C-c s\") 'clean-sort-list-in-region)\n#+END_SRC\n\n*** Word counts on regions\n\nSource https://emacs.stackexchange.com/questions/12938/how-can-i-evaluate-elisp-in-an-orgmode-file-when-it-is-opened\nI use this to invoke wc-mode in manuscript documents.\n\n#+BEGIN_SRC emacs-lisp\n  (defun tdh/eval-startblock ()\n    (if (member \"startblock\" (org-babel-src-block-names))\n      (save-excursion\n\t(org-babel-goto-named-src-block \"startblock\")\n\t(org-babel-execute-src-block))\n      nil\n      )\n    )\n  (add-hook 'org-mode-hook 'tdh/eval-startblock)\n\n  ;; source https://irreal.org/blog/?p=5722\n  ;; works on regions well\n  (defun my/count-words-in-subtree-or-region ()\n  ;; Bind this to a key in org-mode, e.g. C-=\n  (interactive)\n  (call-interactively (if (region-active-p)\n  'count-words-region\n  'my/count-words-in-subtree)))\n\n  (defun my/count-words-in-subtree ()\n  \"Count words in current node and child nodes, excluding heading text.\"\n  (interactive)\n  (org-with-wide-buffer\n  (message \"%s words in subtree\"\n  (-sum (org-map-entries\n  (lambda ()\n  (outline-back-to-heading)\n  (forward-line 1)\n  (while (or (looking-at org-keyword-time-regexp)\n  (org-in-drawer-p))\n  (forward-line 1))\n  (count-words (point)\n  (progn\n  (outline-end-of-subtree)\n  (point))))\n  nil 'tree)))))\n#+END_SRC\n\n\n\n*** open PDFs with default system viewer (usually Preview on a Mac)\nSource: http://stackoverflow.com/a/1253761/1325477https://emacs.stackexchange.com/questions/3105/how-to-use-an-external-program-as-the-default-way-to-open-pdfs-from-emacs\nRemove \"\\\\.pdf\" to enable use of PDF tools\n\n#+BEGIN_SRC emacs-lisp\n  (defun mac-open (filename)\n    (interactive \"fFilename: \")\n    (let ((process-connection-type))\n      (start-process \"\" nil \"open\" (expand-file-name filename))))\n\n  (defun find-file-auto (orig-fun \u0026rest args)\n    (let ((filename (car args)))\n      (if (cl-find-if\n\t   (lambda (regexp) (string-match regexp filename))\n\t   '( \"\\\\.doc\\\\'\" \"\\\\.docx?\\\\'\" \"\\\\.xlsx?\\\\'\" \"\\\\.xlsm?\\\\'\" \"\\\\.pptx?\\\\'\" \"\\\\.itmz\\\\'\"  \"\\\\.png\\\\'\"))\n\t  (mac-open filename)\n\t(apply orig-fun args))))\n\n  (advice-add 'find-file :around 'find-file-auto)\n#+END_SRC\n\n\n*** orglog\n\nCopy template writing log, rename the file with the project ID included in the filename, and open the file in a new buffer.\nTranslated the corresponding bash function with copilot.\n\n#+BEGIN_SRC emacs-lisp\n  (defun orglog (projectID)\n    \"Copy template writing log in org with project number in title and open the file.\"\n    (interactive \"sProject ID: \")\n    (if (or (string= projectID \"\")\n\t    (string-match-p \" \" projectID))\n\t(progn\n\t  (message \"Usage: orglog projectID\")\n\t  (error \"Invalid number of arguments\"))\n      (let ((template \"~/6112MooersLabGitHubLabRepos/writingLogTemplateInOrg/writingLogTemplateVer7.org\")\n\t    (destination (concat \"log\" projectID \".org\")))\n\t(copy-file template destination t)\n\t(find-file destination)\n\t(message \"Write writing log to %s file and open in a new buffer.\" destination))))\n#+END_SRC\n\n\n*** TOC generation for org-file\n\nRun this function to generate a TOC for an org-file.\nThe items in the TOC will be hyperlinked to the headlines in the body of the org file.\n\n#+BEGIN_SRC emacs-lisp\n(defun org-generate-toc ()\n  \"Generate a table of contents for the current Org-mode buffer.\"\n  (interactive)\n  (let ((toc-buffer (get-buffer-create \"*Org TOC*\"))\n        (toc-entries '()))\n    (save-excursion\n      (goto-char (point-min))\n      (while (re-search-forward org-heading-regexp nil t)\n        (let ((level (org-current-level))\n              (headline (match-string-no-properties 0))\n              (link (org-make-link-string (concat \"\" (org-get-heading t t t t)))))\n          (push (concat (make-string level ?*) \" \" link) toc-entries))))\n    (with-current-buffer toc-buffer\n      (erase-buffer)\n      (insert \"#+TOC: headlines\\n\")\n      (dolist (entry (nreverse toc-entries))\n        (insert entry \"\\n\")))\n    (switch-to-buffer-other-window toc-buffer)\n    (org-mode)))\n\n(global-set-key (kbd \"C-c t\") 'org-generate-toc)\n#+END_SRC\n\n\n*** Wrap code blocks in org-mode source block\n\nWrap a marked block of elisp code with a org-mode source block.\nI need to make a varient for LaTeX minted code environment.\n\n#+BEGIN_SRC emacs-lisp\n  (defun wrap-region-with-org-src-block ()\n    \"Wrap the selected region with an elisp source block.\"\n    (interactive)\n    (let ((begin (region-beginning))\n\t  (end (region-end)))\n      (goto-char end)\n      (insert \"\\n#+END_SRC\")\n      (goto-char begin)\n      (insert \"#+BEGIN_SRC emacs-lisp\\n\")))\n\n  (global-set-key (kbd \"C-c w\") 'wrap-region-with-org-src-block)\n#+END_SRC\n\n** create-latex-table-with-caption \n\nThis interactive function prompts the user for the number of rows, columns, caption, and label. \nThen this function generates a table that has a top Rule and a rule below the column labels. \nIt also has a bottom rule. It does not contain any vertical rules.\nThis function required five rounds of iteration with Copilot.\nIt was developed after developing the function below: create-org-table-with-caption.\nThat code was used as a template for Copilot.\nIt in turn had been developed after four or five rounds of iteration.\n\n\n#+BEGIN_SRC emacs-lisp\n(defun create-latex-table-with-caption ()\n  (interactive)\n  (let ((rows (read-number \"Enter the number of rows: \"))\n        (cols (read-number \"Enter the number of columns: \"))\n        (caption (read-string \"Enter the table's caption: \"))\n        (label (read-string \"Enter the table's label: \")))\n    (insert (format \"\\\\begin{table}[h]\\n\\\\centering\\n\\\\caption{%s \\\\label{%s}}\\n\\\\begin{tabular}{%s}\\n\\\\hline\\n\"\n                    caption label (make-string cols ?c)))\n    ;; Insert column labels\n    (dotimes (col cols)\n      (insert (format \" %c \" (+ ?A col)))\n      (if (\u003c col (1- cols))\n          (insert \"\u0026\")))\n    (insert \" \\\\\\\\\\n\\\\hline\\n\")\n    ;; Insert table rows\n    (dotimes (_ rows)\n      (dotimes (col cols)\n        (insert (format \" Cell %d-%d \" (1+ col) (1+ _)))\n        (if (\u003c col (1- cols))\n            (insert \"\u0026\")))\n      (insert \" \\\\\\\\\\n\"))\n    (insert \"\\\\hline\\n\\\\end{tabular}\\n\\\\end{table}\\n\")))\n#+END_SRC\n\n\n\n\n** create-org-table-with-caption\n\nThis interactive function prompts the user for the number of rows. columns, and the caption of the table.\n\n\n#+BEGIN_SRC emacs-lisp\n(defun create-org-table-with-caption ()\n\"This interactive function prompts the user for the number of rows. columns, and the caption of the table.\"\n  (interactive)\n  (let ((rows (read-number \"Enter the number of rows: \"))\n        (cols (read-number \"Enter the number of columns: \"))\n        (label (read-string \"Enter the table label: \"))\n        (caption (read-string \"Enter the table's caption: \")))\n    (insert (format \"#+CAPTION: %s \\\\label{%s}\\n\" caption label))\n    (insert (format \"#+NAME: %s\\n\" label))\n    (insert \"|\")\n    (dotimes (_ cols)\n      (insert \"----+\"))\n    (insert \"\\n|\")\n    ;;(insert \"|\")\n    (dotimes (col cols)\n      (insert (format \" %c |\" (+ ?A col))))\n    (insert \"\\n|\")\n    (dotimes (_ cols)\n      (insert \"----+\"))\n    (insert \"\\n\")\n    (dotimes (_ rows)\n      (insert \"|\")\n      (dotimes (_ cols)\n        (insert \"     |\"))\n      (insert \"\\n\"))\n    (insert \"|\")\n    (dotimes (_ cols)\n      (insert \"----+\"))))\n#+END_SRC\n\n*** insert-org-captioned-figure\n\nThe function prompts the user for the image file path and name, the label, and the caption.\n\n#+BEGIN_SRC emacs-lisp\n(defun insert-org-captioned-figure ()\n  \"Insert a captioned figure in Org-mode.\"\n  (interactive)\n  (let ((image-name (read-string \"Enter the image file path: \"))\n        (label (read-string \"Enter the figure label: \"))\n        (caption (read-string \"Enter the figure caption: \")))\n    (insert (format \"#+CAPTION: %s \\\\label{%s}\\n\" caption label))\n    (insert (format \"#+NAME: %s\\n\" label))\n    (insert (format \"[[file:%s]]\\n\" image-name))))\n#+END_SRC\n\n\n#+BEGIN_SRC emacs-lisp\n(message \"End of the custom elisp functions section.\")\n#+END_SRC\n\n\n\n\n** Shell configuration\n\n#+BEGIN_SRC emacs-lisp\n(use-package exec-path-from-shell\n  :init\n  (setenv \"SHELL\" \"/opt/local/bin/bash\")\n  :if (memq window-system '(mac ns x))\n  :config\n  (setq exec-path-from-shell-variables '(\"PATH\" \"GOPATH\" \"PYTHONPATH\"))\n  (exec-path-from-shell-initialize))\n(message \"Finished shell configuration. Line 480.\")\n\n\n;;;# Size of the starting Window\n(setq initial-frame-alist '((top . 1)\n                (left . 450)\n                (width . 101)\n                (height . 90)))\n#+END_SRC\n\n\n** Faked full screen\n#+BEGIN_SRC emacs-lisp\n(use-package maxframe)\n(defvar my-fullscreen-p t \"Check if fullscreen is on or off\")\n(defun my-toggle-fullscreen ()\n  (interactive)\n  (setq my-fullscreen-p (not my-fullscreen-p))\n  (if my-fullscreen-p\n    (restore-frame)\n    (maximize-frame)))\n(global-set-key (kbd \"M-S\") 'toggle-frame-fullscreen) ;; conflicts with an auctex command to insert an \\item in a list.\n(message \"Finished frame configuration.\")\n#+END_SRC\n\n** Backups\n#+BEGIN_SRC emacs-lisp\n(setq vc-make-backup-files t)\n\n(setq version-control t ;; Use version numbers for backups.\n        kept-new-versions 10 ;; Number of newest versions to keep.\n        kept-old-versions 0 ;; Number of oldest versions to keep.\n        delete-old-versions t ;; Don't ask to delete excess backup versions.\n        backup-by-copying t) ;; Copy all files, don't rename them.\n\n#+END_SRC\n\nIf you want to avoid 'backup-by-copying', you can instead use ~(setq backup-by-copying-when-linked t)~.\n\nbut that makes the second, \"per save\" backup below not run, since\nbuffers with no backing file on disk are not backed up, and\nrenaming removes the backing file.  The \"per session\" backup will\nhappen in any case, you'll just have less consistent numbering of\nper-save backups (i.e. only the second and subsequent save will\nresult in per-save backups).\n\nIf you want to avoid backing up some files, e.g. large files,\nthen try setting 'backup-enable-predicate'.  You'll want to\nextend 'normal-backup-enable-predicate', which already avoids\nthings like backing up files in '/tmp'.\n\n** Default and per-save backups go here:\n\n#+BEGIN_SRC emacs-lisp\n(setq backup-directory-alist '((\"\" . \"~/e29org/backup/per-save\")))\n\n(defun force-backup-of-buffer ()\n   ;; Make a special \"per session\" backup at the first save of each\n   ;; emacs session.\n   (when (not buffer-backed-up)\n     ;; Override the default parameters for per-session backups.\n     (let ((backup-directory-alist '((\"\" . \"~/e29org/backup/per-session\")))\n           (kept-new-versions 3))\n       (backup-buffer)))\n   ;; Make a \"per save\" backup on each save.  The first save results in\n   ;; both a per-session and a per-save backup, to keep the numbering\n   ;; of per-save backups consistent.\n   (let ((buffer-backed-up nil))\n     (backup-buffer)))\n(add-hook 'before-save-hook  'force-backup-of-buffer)\n(message \"Finished force-backup-of-buffer configuration. Line 537.\")\n\n;;;# Do not move the current file while creating backup.\n(setq backup-by-copying t)\n(message \"Backup configuration finished. Line 541.\")\n#+END_SRC\n\n** Disable lockfiles.\n\n#+BEGIN_SRC emacs-lisp\n(setq create-lockfiles nil)\n#+END_SRC\n\n** Column number mode\n\n#+BEGIN_SRC emacs-lisp\n(column-number-mode)\n#+END_SRC\n\n\n** Show stray whitespace.\n#+BEGIN_SRC emacs-lisp\n(setq-default show-trailing-whitespace t)\n(setq-default indicate-empty-lines t)\n(setq-default indicate-buffer-boundaries 'left)\n\n;;; Add a newline automatically at the end of a file while saving.\n(setq-default require-final-newline t)\n\n;;; A single space follows the end of sentence.\n(setq sentence-end-double-space nil)\n#+END_SRC\n\n** Fontlocking\nThis is the term of syntax highlighting in Emacs.\n\n#+BEGIN_SRC emacs-lisp\n;; (global-set-key (kbd \"C-c p\") 'dpkg-menpdf\n\n;;;# Turn on font-locking or syntax highlighting\n(global-font-lock-mode t)\n\n;;;# font size in the modeline\n(set-face-attribute 'mode-line nil  :height 140)\n\n\n;;;# set default coding of buffers\n(setq default-buffer-file-coding-system 'utf-8-unix)\n\n;; Switch from tabs to spaces for indentation\n;; Set the indentation level to 4.\n(setq-default indent-tabs-mode nil)\n(setq-default tab-width 4)\n\n;;;# Indentation setting for various languages.\n(setq c-basic-offset 4)\n(setq js-indent-level 2)\n(setq css-indent-offset 2)\n(setq python-basic-offset 4)\n\n(setq user-init-file \"/Users/blaine/e29org/init.el\")\n(setq user-emacs-directory \"/Users/blaine/e29org/\")\n;; (setq default-directory \"/Users/blaine\")\n;; the directory that you start Emacs in should be the default for the current buffer\n(setenv \"HOME\" \"/Users/blaine\")\n;; (load user-init-file)\n\n\n(advice-add 'describe-function-1 :after #'elisp-demos-advice-describe-function-1)\n\n(advice-add 'helpful-update :after #'elisp-demos-advice-helpful-update)\n\n;;;# Write customizations to a separate file instead of this file.\n(setq custom-file (expand-file-name \"custom.el\" user-emacs-directory))\n(load custom-file t)\n#+END_SRC\n\n\n\n\n** Show current time in modeline\n#+BEGIN_SRC emacs-lisp\n(defun show-current-time ()\n  \"Show current time.\"\n  (interactive)\n  (message (current-time-string)))\n#+END_SRC\n\n** Delete trailing whitespaces\n#+BEGIN_SRC emacs-lisp\n(global-set-key (kbd \"C-c d\") 'delete-trailing-whitespace)\n#+END_SRC\n\n\n** Display line numbers. Need with s-l.\n#+BEGIN_SRC emacs-lisp\n(global-display-line-numbers-mode)\n#+END_SRC\n\n** hippie-expand M-/.\nSeems to be comflicting with Corfu, Cape, and dabrrev.\n\n#+BEGIN_SRC emacs-lisp\n;; (global-set-key [remap dabbrev-expand]  'hippie-expand)\n#+END_SRC\n\n\n** GUI related settings\n#+BEGIN_SRC emacs-lisp\n(if (display-graphic-p)\n    (progn\n      ;; Removed some UI elements\n      ;; (menu-bar-mode -1)\n      (tool-bar-mode -1)\n      (scroll-bar-mode -1)\n      ;; Show battery status\n      (display-battery-mode 1)))\n#+END_SRC\n\n\n** CUA keybindings\n\n#+BEGIN_SRC emacs-lisp\n;; Hey, stop being a whimp and learn the Emacs keybindings!\n;; ;; Set copy+paste\n;;  (cua-mode t)\n;;     (setq cua-auto-tabify-rectangles nil) ;; Don't tabify after rectangle commands\n;;     (transient-mark-mode 1) ;; No region when it is not highlighted\n;;     (setq cua-keep-region-after-copy t) ;; Standard Windows behaviour\n\n;; REMOVE THE SCRATCH BUFFER AT STARTUP\n;; Makes *scratch* empty.\n;; (setq initial-scratch-message \"\")\n;; Removes *scratch* from buffer after the mode has been set.\n;; (defun remove-scratch-buffer ()\n;;   (if (get-buffer \"*scratch*\")\n;;       (kill-buffer \"*scratch*\")))\n;; (add-hook 'after-change-major-mode-hook 'remove-scratch-buffer)\n#+END_SRC\n\n\n** Disable the C-z sleep/suspend key\nSee http://stackoverflow.com/questions/28202546/hitting-ctrl-z-in-emacs-freezes-everything\n\n#+BEGIN_SRC emacs-lisp\n(global-unset-key (kbd \"C-z\"))\n#+END_SRC\n\n\n\n** Make copy and paste use the same clipboard as emacs.\n\n#+BEGIN_SRC emacs-lisp\n(setq select-enable-primary t\n      select-enable-clipboard t)\n#+END_SRC\n\n** Display time of day\n\n#+BEGIN_SRC emacs-lisp\n(setq display-time-default-load-average nil)\n(setq display-time-day-and-date t display-time-24hr-format t)\n(display-time-mode t)\n#+END_SRC\n\n\n;;;# dired-icon-mode\n(use-package dired-icon\n  :ensure t\n  :config\n  (add-hook 'dired-mode-hook 'dired-icon-mode))\n\n\n;; Revert Dired and other buffers after changes to files in directories on disk.\n;; Source: [[https://www.youtube.com/watch?v=51eSeqcaikM\u0026list=PLEoMzSkcN8oNmd98m_6FoaJseUsa6QGm2\u0026index=2][Dave Wilson]]\n(setq global-auto-revert-non-file-buffers t)\n\n\n** Customize powerline\n\nThe line above the command line at the bottom of the screen.\n#+BEGIN_SRC emacs-lisp\n(use-package powerline)\n(powerline-default-theme)\n#+END_SRC\n\n\n** Highlight current line\n#+BEGIN_SRC emacs-lisp\n(global-hl-line-mode +1)\n(set-face-background hl-line-face \"wheat1\")\n(set-face-attribute 'mode-line nil  :height 180)\n#+END_SRC\n\n** List recently opened files.\n\n#+BEGIN_SRC emacs-lisp\n(recentf-mode 1)\n(global-set-key \"\\C-x\\ \\C-r\" 'recentf-open-files)\n#+END_SRC\n\n** UTF-8\n\n#+BEGIN_SRC emacs-lisp\n(set-language-environment \"UTF-8\")\n(set-default-coding-systems 'utf-8)\n(set-keyboard-coding-system 'utf-8-unix)\n(set-terminal-coding-system 'utf-8-unix)\n#+END_SRC\n\n\n\n** Quickly access configuration file\n#+BEGIN_SRC emacs-lisp\n(global-set-key (kbd \"C-c e\")\n    (lambda()\n      (interactive)\n      (find-file \"~/e29org/README.org\")))\n#+END_SRC\n\n\n** GUI settings\n\n#+BEGIN_SRC emacs-lisp\n(set-face-attribute 'default nil :height 140)\n\n(set-frame-parameter (selected-frame) 'buffer-predicate\n                     (lambda (buf)\n                       (let ((name (buffer-name buf)))\n                         (not (or (string-prefix-p \"*\" name)\n                                  (eq 'dired-mode (buffer-local-value 'major-mode buf)))))))\n#+END_SRC\n\n** Global keys\nIf you use a window manager be careful of possible key binding clashes\n\n#+BEGIN_SRC emacs-lisp\n(setq recenter-positions '(top middle bottom))\n(global-set-key (kbd \"C-1\") 'kill-this-buffer)\n(global-set-key (kbd \"C-\u003cdown\u003e\") (kbd \"C-u 1 C-v\"))\n(global-set-key (kbd \"C-\u003cup\u003e\") (kbd \"C-u 1 M-v\"))\n(global-set-key [C-tab] 'other-window)\n(global-set-key (kbd \"C-c c\") 'calendar)\n(global-set-key (kbd \"C-x C-b\") 'ibuffer)\n(global-set-key (kbd \"C-`\") 'mode-line-other-buffer)\n;; (global-set-key (kbd \"M-/\") #'hippie-expand)\n(global-set-key (kbd \"C-x C-j\") 'dired-jump)\n(global-set-key (kbd \"C-c r\") 'remember)\n#+END_SRC\n\n\n** case fold search\n\n#+BEGIN_SRC emacs-lisp\n(setq case-fold-search t)\n#+END_SRC\n\n\n** Show file path in title of buffer\n\nShow the file path in the title of the frame.\nSource https://stackoverflow.com/questions/2903426/display-path-of-file-in-status-bar See entry by mortnene\nThis is much more useful than just showing the file name or buffer name in the frame title.\n\n\n#+BEGIN_SRC emacs-lisp\n(setq frame-title-format\n      '(:eval\n        (if buffer-file-name\n            (replace-regexp-in-string\n             \"\\\\\\\\\" \"/\"\n             (replace-regexp-in-string\n              (regexp-quote (getenv \"HOME\")) \"e30: ~\"\n              (convert-standard-filename buffer-file-name)))\n          (buffer-name))))\n\n; ;; Source https://stackoverflow.com/questions/50222656/setting-emacs-frame-title-in-emacs\n; (setq frame-title-format\n;   (concat \"%b - emacs@\" (system-name)))\n; (setq-default frame-title-format '(\"%f [%m]\"))\n; (setq frame-title-format \"Main emacs29.3 config - %b \" )\n#+END_SRC\n\n\n\n** Browse URLS in text mode\n#+BEGIN_SRC emacs-lisp\n(global-goto-address-mode +1)\n#+END_SRC\n\n\n** Revert buffers when the underlying file has changed.\n#+BEGIN_SRC emacs-lisp\n(global-auto-revert-mode 1)\n#+END_SRC\n\n\n** Save history going back 25 commands.\nUse M-p to get previous command used in the minibuffer.\nUse M-n to move to next command.\n\n#+BEGIN_SRC emacs-lisp\n(setq history-length 25)\n(savehist-mode 1)\n#+END_SRC\n\n\n** Save place in a file.\n#+BEGIN_SRC emacs-lisp\n(save-place-mode 1)\n#+END_SRC\n\n\n** Monday as first day of week\nSets monday to be the first day of the week in calendar\n#+BEGIN_SRC emacs-lisp\n(setq calendar-week-start-day 1)\n#+END_SRC\n\n** Have emacs backups in a different directory\n#+BEGIN_SRC emacs-lisp\n;; (some build-systems build automatically all files with a prefix, and .#something.someending breakes that)\n(setq backup-directory-alist '((\".\" . \"~/.emacsbackups\")))\n#+END_SRC\n\n\n** show-paren-mode\nEnable show-paren-mode to visualize paranthesis and make it possible to delete things we have marked.\n\n#+BEGIN_SRC emacs-lisp\n(show-paren-mode 1)\n(delete-selection-mode 1)\n#+END_SRC\n\n\n** Use y or n instead of yes or no\n\n#+BEGIN_SRC emacs-lisp\n(defalias 'yes-or-no-p 'y-or-n-p)\n#+END_SRC\n\n** System detection\n\nThese settings enables using the same configuration file on multiple platforms.\nNote that windows-nt includes [[https://www.gnu.org/software/emacs/manual/html_node/elisp/System-Environment.html][windows 10]].\n\n#+BEGIN_SRC emacs-lisp\n(defconst *is-a-mac* (eq system-type 'darwin))\n(defconst *is-a-linux* (eq system-type 'gnu/linux))\n(defconst *is-windows* (eq system-type 'windows-nt))\n(defconst *is-cygwin* (eq system-type 'cygwin))\n(defconst *is-unix* (not *is-windows*))\n#+END_SRC\n\n\n** Set keys for Mac OS\nSee this [[http://ergoemacs.org/emacs/emacs_hyper_super_keys.html][ for more information.]]\nSet keys for Apple keyboard, for emacs in OS X.\nSource http://xahlee.info/emacs/emacs/emacs_hyper_super_keys.html.\n\n#+BEGIN_SRC emacs-lisp\n(setq mac-command-modifier 'meta) ; make cmd key do Meta\n(setq mac-option-modifier 'super) ; make option key do Super.\n(setq mac-control-modifier 'control) ; make Control key do Control\n(setq mac-function-modifier 'hyper)  ; make Fn key do Hyper. Only works on Apple produced keyboards.\n(setq mac-right-command-modifier 'hyper)\n#+END_SRC\n\n\n\n** Save the buffer.\nShould use C-x C-s\n#+BEGIN_SRC emacs-lisp\n(define-key global-map (kbd \"s-s\") 'save-buffer)\n#+END_SRC\n\n** Switch to previous buffer\n\n#+BEGIN_SRC emacs-lisp\n(define-key global-map (kbd \"H-\u003cleft\u003e\") 'previous-buffer)\n;;;# Switch to next buffer\n(define-key global-map (kbd \"H-\u003cright\u003e\") 'next-buffer)\n#+END_SRC\n\n** Minibuffer history keybindings\nThe calling up of a previously issued command in the minibuffer with ~M-p~ saves times.\n\n#+BEGIN_SRC emacs-lisp\n(autoload 'edit-server-maybe-dehtmlize-buffer \"edit-server-htmlize\" \"edit-server-htmlize\" t)\n(autoload 'edit-server-maybe-htmlize-buffer \"edit-server-htmlize\" \"edit-server-htmlize\" t)\n(add-hook 'edit-server-start-hook 'edit-server-maybe-dehtmlize-buffer)\n(add-hook 'edit-server-done-hook  'edit-server-maybe-htmlize-buffer)\n(define-key minibuffer-local-map (kbd \"M-p\") 'previous-complete-history-element)\n(define-key minibuffer-local-map (kbd \"M-n\") 'next-complete-history-element)\n(define-key minibuffer-local-map (kbd \"\u003cup\u003e\") 'previous-complete-history-element)\n(define-key minibuffer-local-map (kbd \"\u003cdown\u003e\") 'next-complete-history-element)\n\n;;;# switch-to-minibuffer\n(defun switch-to-minibuffer ()\n  \"Switch to minibuffer window.\"\n  (interactive)\n  (if (active-minibuffer-window)\n      (select-window (active-minibuffer-window))\n    (error \"Minibuffer is not active\")))\n\n(global-set-key \"\\C-cm\" 'switch-to-minibuffer) ;; Bind to `C-c m' for minibuffer.\n#+END_SRC\n\n\n** Bibtex configuration\n#+BEGIN_SRC emacs-lisp\n(defconst blaine/bib-libraries (list \"/Users/blaine/Documents/global.bib\"))\n#+END_SRC\n\n** Retina display of PDFs\nCombined with emacs-mac, this gives good PDF quality for [[https://www.aidanscannell.com/post/setting-up-an-emacs-playground-on-mac/][retina display]].\n#+BEGIN_SRC emacs-lisp\n(setq pdf-view-use-scaling t)\n#+END_SRC\n\n\n** PDF default page width behavior\n#+BEGIN_SRC emacs-lisp\n(setq-default pdf-view-display-size 'fit-page)\n#+END_SRC\n\n\n** Set delay in the matching parenthesis to zero.\n#+BEGIN_SRC emacs-lisp\n(setq show-paren-delay 0)\n(show-paren-mode t)\n#+END_SRC\n\n\n** Window management\nwinner-mode C-c \u003crigth\u003e undo change C-c \u003cleft\u003e redo change\n\n#+BEGIN_SRC emacs-lisp\n(winner-mode 1)\n\n(defun split-vertical-evenly ()\n  (interactive)\n  (command-execute 'split-window-vertically)\n  (command-execute 'balance-windows))\n(global-set-key (kbd \"C-x 2\") 'split-vertical-evenly)\n\n(defun split-horizontal-evenly ()\n  (interactive)\n  (command-execute 'split-window-horizontally)\n  (command-execute 'balance-windows))\n(global-set-key (kbd \"C-x 3\") 'split-horizontal-evenly)\n#+END_SRC\n\n\n** Zoom text in and out. Very Sweet!\n\n#+BEGIN_SRC emacs-lisp\n;;;#  Zoom in and out via C-scroll wheel\n;; (global-set-key [C-wheel-up] 'text-scale-increase)\n;; (global-set-key [C-wheel-down] 'text-scale-decrease)\n  (global-set-key [C-mouse-4] 'text-scale-increase)\n  (global-set-key [C-mouse-5] 'text-scale-decrease)\n#+END_SRC\n\n\n** Aliases\nSource: https://www.youtube.com/watch?v=ufVldIrUOBg\nDefalias: a quick guide to making an alias in Emacs.\nUsage: M-x ct\n\n#+BEGIN_SRC emacs-lisp\n(defalias 'ct 'customize-themes)\n(defalias 'cz 'customize)\n(defalias 'ddl 'delete-duplicate-lines)\n(defalias 'dga 'define-global-abbrev)\n(defalias 'dma 'define-mode-abbrev)\n(defalias 'ea 'edit-abbrevs)\n(defalias 'ff 'flip-frame)\n(defalias 'fl 'flush-lines)\n(defalias 'fnd 'find-name-dired)\n(defalias 'klm 'kill-matching-lines)\n(defalias 'lc 'langtool-check)\n(defalias 'lcu 'langtool-check-buffer)\n(defalias 'lp 'list-packages)\n(defalias 'pcr 'package-refresh-contents)\n(defalias 'pi 'package-install)\n(defalias 'pua 'package-upgrade-all)\n(defalias 'qr 'query-replace)\n(defalias 'rg 'rgrep)\n(defalias 'rsv 'replace-smart-quotes)\n(defalias 'sl 'sort-lines)\n(defalias 'slo 'single-lines-only)\n(defalias 'spe 'ispell-region)\n(defalias 'udd 'package-upgrade-all)\n(defalias 'ugg 'package-upgrade-all)\n(defalias 'wr 'write-region)\n#+END_SRC\n\n#+BEGIN_SRC emacs-lisp\n(message \"Finished global settings section.\")\n#+END_SRC\n\n\n* A\n#+BEGIN_SRC emacs-lisp\n(message \"Start package configurations A\")\n#+END_SRC\n\n\n** ace-window\n\nThis is a window management package that allows you to switch between windows.\n\n#+BEGIN_SRC emacs-lisp\n(global-set-key (kbd \"M-o\") 'ace-window)\n;; the list of initial characters used in window labels:\n(setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))\n;; default settings\n(defvar aw-dispatch-alist\n  '((?x aw-delete-window \"Delete Window\")\n\t(?m aw-swap-window \"Swap Windows\")\n\t(?M aw-move-window \"Move Window\")\n\t(?c aw-copy-window \"Copy Window\")\n\t(?j aw-switch-buffer-in-window \"Select Buffer\")\n\t(?n aw-flip-window)\n\t(?u aw-switch-buffer-other-window \"Switch Buffer Other Window\")\n\t(?c aw-split-window-fair \"Split Fair Window\")\n\t(?v aw-split-window-vert \"Split Vert Window\")\n\t(?b aw-split-window-horz \"Split Horz Window\")\n\t(?o delete-other-windows \"Delete Other Windows\")\n\t(?? aw-show-dispatch-help))\n  \"List of actions for `aw-dispatch-default'.\")\n#+END_SRC\n\n\n** auctex\n#+BEGIN_SRC emacs-lisp\n(use-package auctex\n  :ensure t\n  :defer t\n  :hook (LaTeX-mode . (lambda ()\n\t\t\t(push (list 'output-pdf \"Skim\")\n\t\t\t      TeX-view-program-selection))))\n#+END_SRC\n\n#+BEGIN_SRC emacs-lisp\n(message \"Finished A package configuraitons.\")\n#+END_SRC\n\n\n* B\n\n\n* C\n\n#+BEGIN_SRC emacs-lisp\n(message \"Start package configurations C\")\n#+END_SRC\n\n** citar\n\n#+BEGIN_SRC emacs-lisp\n(use-package citar\n    :bind ((\"C-c b\" . citar-insert-citation)\n           :map minibuffer-local-map\n           (\"M-b\" . citar-insert-preset))\n    :custom\n      (citar-bibliography '(\"/Users/blaine/Documents/global.bib\"))\n      (citar-library-paths '(\"/Users/blaine/0papersLabeled\") '(\"/Users/blaine/0booksUnlabeled\"))\n      (citar-library-file-extensions '(\"pdf\" \"epub\"))\n    :hook\n    ;; enable autocompletion in buffer of citekeys\n      (LaTeX-mode . citar-capf-setup)\n      (org-mode . citar-capf-setup))\n\n  (setenv \"PATH\" (concat \"/usr/local/bin/:/opt/local/bin/\" (getenv \"PATH\")))\n  (add-to-list 'exec-path \"/usr/local/bin:/opt/local/bin/\")\n#+END_SRC\n\n *** citar-org\n \nUse after org-cite. It is not loaded.\n\n#+BEGIN_SRC emacs-lisp\n ; (use-package citar-org\n  ;   :after oc\n  ;   :custom\n  ;   (org-cite-insert-processor 'citar)\n  ;   (org-cite-follow-processor 'citar)\n  ;   (org-cite-activate-processor 'citar)\n  ;   :general\n  ;   (:keymaps 'org-mode-map\n  ;    :prefix \"C-c b\"\n  ;    \"b\" '(citar-insert-citation :wk \"Insert citation\")\n  ;    \"r\" '(citar-insert-reference :wk \"Insert reference\")\n  ;    \"o\" '(citar-open-notes :wk \"Open note\"))\n  ;   :custom\n  ;   (citar-notes-paths '(\"/Users/blaine/org-roam/citar-org-roam\")) ; List of directories for reference nodes\n  ;   (citar-open-note-function 'orb-citar-edit-note) ; Open notes in `org-roam'\n  ;   (citar-at-point-function 'embark-act)           ; Use `embark'\n  ;   )\n#+END_SRC\n\n*** cite-embark\n#+BEGIN_SRC emacs-lisp\n(use-package citar-embark\n  ;; get a table of options including opening related files and the entry in global.bib.\n      :after citar embark\n      :no-require\n      :config (citar-embark-mode))\n#+END_SRC\n\n\n*** citar-org-roam\n\n\n#+BEGIN_SRC emacs-lisp\n(use-package citar-org-roam\n      :after (citar org-roam)\n      :no-require\n      :config (citar-org-roam-mode))\n#+END_SRC\n\n\n#+BEGIN_SRC emacs-lisp\n(message \"Finished citar package configuration.\")\n#+END_SRC\n\n\n#+BEGIN_SRC emacs-lisp\n  (use-package codeium\n     :load-path \"/Users/blaine/e29org/manual-install/codeium.el/\"\n     :init\n     ;; use globally\n     (add-to-list 'completion-at-point-functions #'codeium-completion-at-point)\n     ;; or on a hook\n     ;; (add-hook 'python-mode-hook\n     ;;     (lambda ()\n     ;;         (setq-local completion-at-point-functions '(codeium-completion-at-point))))\n\n     ;; if you want multiple completion backends, use cape (https://github.com/minad/cape):\n     ;; (add-hook 'python-mode-hook\n     ;;     (lambda ()\n     ;;         (setq-local completion-at-point-functions\n     ;;             (list (cape-super-capf #'codeium-completion-at-point #'lsp-completion-at-point)))))\n     ;; an async company-backend is coming soon!\n\n     ;; codeium-completion-at-point is autoloaded, but you can\n     ;; optionally set a timer, which might speed up things as the\n     ;; codeium local language server takes ~0.2s to start up\n     ;; (add-hook 'emacs-startup-hook\n     ;;  (lambda () (run-with-timer 0.1 nil #'codeium-init)))\n\n     ;; :defer t ;; lazy loading, if you want\n\n     :config\n     (setq use-dialog-box nil) ;; do not use popup boxes\n\n     ;; if you don't want to use customize to save the api-key\n     ;; (setq codeium/metadata/api_key \"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\")\n\n     ;; get codeium status in the modeline\n     (setq codeium-mode-line-enable\n         (lambda (api) (not (memq api '(CancelRequest Heartbeat AcceptCompletion)))))\n     (add-to-list 'mode-line-format '(:eval (car-safe codeium-mode-line)) t)\n     ;; alternatively for a more extensive mode-line\n     ;; (add-to-list 'mode-line-format '(-50 \"\" codeium-mode-line) t)\n\n     ;; use M-x codeium-diagnose to see apis/fields that would be sent to the local language server\n     (setq codeium-api-enabled\n         (lambda (api)\n             (memq api '(GetCompletions Heartbeat CancelRequest GetAuthToken RegisterUser auth-redirect AcceptCompletion))))\n     ;; you can also set a config for a single buffer like this:\n     ;; (add-hook 'python-mode-hook\n     ;;     (lambda ()\n     ;;         (setq-local codeium/editor_options/tab_size 4)))\n\n     ;; You can overwrite all the codeium configs!\n     ;; for example, we recommend limiting the string sent to codeium for better performance\n     (defun my-codeium/document/text ()\n         (buffer-substring-no-properties (max (- (point) 3000) (point-min)) (min (+ (point) 1000) (point-max))))\n     ;; if you change the text, you should also change the cursor_offset\n     ;; warning: this is measured by UTF-8 encoded bytes\n     (defun my-codeium/document/cursor_offset ()\n         (codeium-utf8-byte-length\n             (buffer-substring-no-properties (max (- (point) 3000) (point-min)) (point))))\n     (setq codeium/document/text 'my-codeium/document/text)\n     (setq codeium/document/cursor_offset 'my-codeium/document/cursor_offset)\n     )\n  (message \"Finished codeium package configuration\")\n#+END_SRC\n\n\n** corfu\n#+BEGIN_SRC emacs-lisp\n  (message \"Started corfu package configuration\")\n  ;;;## Corfu configuration\n  (use-package corfu\n    :ensure t\n    :init\n    (setq tab-always-indent 'complete)\n    (global-corfu-mode)\n    :config\n    (setq corfu-auto t\n          corfu-echo-documentation t\n          corfu-scroll-margin 0\n          corfu-count 8\n          corfu-max-width 50\n          corfu-min-width corfu-max-width\n          corfu-auto-prefix 2)\n\n    (corfu-history-mode 1)\n    (savehist-mode 1)\n    (add-to-list 'savehist-additional-variables 'corfu-history)\n\n    (defun corfu-enable-always-in-minibuffer ()\n      (setq-local corfu-auto nil)\n      (corfu-mode 1))\n    (add-hook 'minibuffer-setup-hook #'corfu-enable-always-in-minibuffer 1)\n  )\n  (message \"Finished corfu package configuration\")\n#+END_SRC\n\n\n** Cape Configuration\n\n#+BEGIN_SRC emacs-lisp\n  (use-package cape\n    :ensure t\n    :init\n    (add-to-list 'completion-at-point-functions #'cape-file)\n    (add-to-list 'completion-at-point-functions #'cape-keyword)\n    ;; kinda confusing re length, WIP/TODO\n    ;; :hook (org-mode . (lambda () (add-to-list 'completion-at-point-functions #'cape-dabbrev)))\n    ;; :config\n    ;; (setq dabbrev-check-other-buffers nil\n    ;;       dabbrev-check-all-buffers nil\n    ;;       cape-dabbrev-min-length 6)\n    )\n#+END_SRC\n\n\n** company-box\n\n#+BEGIN_SRC emacs-lisp\n(use-package company-box\n      :ensure t\n      :config\n      (setq company-box-max-candidates 50\n            company-frontends '(company-tng-frontend company-box-frontend)\n            company-box-icons-alist 'company-box-icons-all-the-icons))\n\n  (with-eval-after-load 'company\n    (define-key company-active-map\n                (kbd \"TAB\")\n                #'company-complete-common-or-cycle)\n    (define-key company-active-map\n                (kbd \"\u003cbacktab\u003e\")\n                (lambda ()\n                  (interactive)\n                  (company-complete-common-or-cycle -1))))\n\n  (with-eval-after-load 'company\n    (define-key company-active-map (kbd \"M-.\") #'company-show-location)\n    (define-key company-active-map (kbd \"RET\") nil))\n#+END_SRC\n\n\n** Company Configuration\nSource: https://github.com/Exafunction/codeium.el\n\n#+BEGIN_SRC emacs-lisp\n(use-package company\n    :ensure t\n    :defer 0.1\n    :hook ((emacs-lisp-mode . (lambda ()\n                                (setq-local company-backends '(company-elisp))))\n           (emacs-lisp-mode . company-mode))\n\n    :config\n    (global-company-mode t)\n    (company-tng-configure-default) ; restore old tab behavior\n    (setq-default\n     company-idle-delay 0.05\n     company-require-match nil\n     company-minimum-prefix-length 1\n     ;; get only preview\n     ;; company-frontends '(company-preview-frontend)\n     ;; also get a drop down\n     company-frontends '(company-pseudo-tooltip-frontend company-preview-frontend)\n     ))\n#+END_SRC\n\n\n** consult\nExtra Completion Functions\n#+BEGIN_SRC emacs-lisp\n  (use-package consult\n   :ensure t\n   :after vertico\n   :bind ((\"C-x b\"       . consult-buffer)\n          (\"C-x C-k C-k\" . consult-kmacro)\n          (\"C-x C-o\"     . consult-outline)\n          (\"M-y\"         . consult-yank-pop)\n          (\"M-g g\"       . consult-goto-line)\n          (\"M-g M-g\"     . consult-goto-line)\n          (\"M-g f\"       . consult-flymake)\n          (\"M-g i\"       . consult-imenu)\n          (\"M-s l\"       . consult-line)\n          (\"M-s L\"       . consult-line-multi)\n          (\"M-s u\"       . consult-focus-lines)\n          (\"M-s g\"       . consult-ripgrep)\n          (\"M-s M-g\"     . consult-ripgrep)\n          (\"C-x C-SPC\"   . consult-global-mark)\n          (\"C-x M-:\"     . consult-complex-command)\n  ;        (\"C-c n\"       . consult-org-agenda)\n          (\"C-c m\"       . my/notegrep)\n          :map help-map\n          (\"a\" . consult-apropos)\n          :map minibuffer-local-map\n          (\"M-r\" . consult-history))\n   :custom\n   (completion-in-region-function #'consult-completion-in-region)\n   :config\n   (defun my/notegrep ()\n     \"Use interactive grepping to search my notes\"\n     (interactive)\n     (consult-ripgrep org-directory))\n   (recentf-mode t))\n  (use-package consult-dir\n   :ensure t\n   :bind ((\"C-x C-j\" . consult-dir)\n          ;; :map minibuffer-local-completion-map\n          :map vertico-map\n          (\"C-x C-j\" . consult-dir)))\n\n  (use-package consult-recoll\n   :bind ((\"M-s r\" . counsel-recoll)\n          (\"C-c I\" . recoll-index))\n   :init\n   (setq consult-recoll-inline-snippets t)\n   :config\n   (defun recoll-index (\u0026optional arg) (interactive)\n     (start-process-shell-command \"recollindex\"\n                                  \"*recoll-index-process*\"\n                                    \"recollindex\")))\n#+END_SRC\n\n#+BEGIN_SRC\n  (message \"Finished package configurations C\")\n#+END_SRC\n\n\n\n* D\n\n#+BEGIN_SRC emacs-lisp\n(message \"Start package configurations D\")\n#+END_SRC\n\n\n** dashboard\n\n#+BEGIN_SRC emacs-lisp\n(use-package dashboard\n  :ensure t\n  :config\n  (dashboard-setup-startup-hook))\n(setq dashboard-center-content t)\n(setq dashboard--ascii-banner-centered t)\n(setq dashboard-banner-logo-title \"Loxo or selpercatinib. FDA-approved RET kinase inhibitor to treat non-small cell lung cancer in 2020.\")\n(use-package all-the-icons)\n;;(insert (all-the-icons-icon-for-buffer))\n(setq dashboard-center-content t)\n(setq dashboard-image-banner-max-width 120)\n(setq dashboard-image-banner-max-height 150)\n(use-package page-break-lines)\n(setq dashboard-set-heading-icons t)\n(setq dashboard-set-file-icons t)\n(setq dashboard-startup-banner \"/Users/blaine/images/loxoSmall.png\")\n(setq dashboard-items '((recents  . 20)\n                        (bookmarks . 50)\n                        (projects . 250)\n                        (registers . 5)))\n\n;; (agenda . 15)\n;; Set the title\n;;(setq dashboard-banner-logo-title \"Dashboard of Blaine Mooers\")\n;; Set the banner\n;;(setq dashboard-startup-banner 'official)\n;;(setq dashboard-startup-banner \"/Users/blaine/Images/jmjd4alphaFOld1Aug30.png\")\n;; Value can be\n;; 'official which displays the official emacs logo\n;; 'logo which displays an alternative emacs logo\n;; 1, 2 or 3 which displays one of the text banners\n;; \"path/to/your/image.gif\", \"path/to/your/image.png\" or \"path/to/your/text.txt\" which displays whatever gif/image/text you would prefer\n\n;; Content is not centered by default. To center, set\n;;(setq dashboard-center-content t)\n\n;; To disable shortcut \"jump\" indicators for each section, set\n(setq dashboard-show-shortcuts nil)\n\n; To show info about the packages loaded and the init time:\n(setq dashboard-set-init-info t)\n\n; To use it with counsel-projectile or persp-projectile\n(setq dashboard-projects-switch-function 'projectile-persp-switch-project)\n\n; To display today’s agenda items on the dashboard, add agenda to dashboard-items:\n(add-to-list 'dashboard-items '(agenda) t)\n\n; To show agenda for the upcoming seven days set the variable dashboard-week-agenda to t.\n(setq dashboard-week-agenda t)\n#+END_SRC\n\n\n\n** Dashboard refresh\n\nFunction to refresh dashboard and open in the current window.\nThis function is useful for accessing bookmarks and recent files created in the current session.\nThe last line in the code bloack defines a global key binding to F1.\n\nSource of function by Jackson Benete Ferreira: the issues section of the [[https://github.com/emacs-dashboard/emacs-dashboard/issues/236][dashboard]] GitHub page.\nI edited the documentation line to fix the grammar and add the final phrase.\n\n\n#+BEGIN_SRC emacs-lisp\n(defun new-dashboard ()\n  \"Jump to the dashboard buffer. If it doesn't exist, create one. Refresh while at it.\"\n  (interactive)\n  (switch-to-buffer dashboard-buffer-name)\n  (dashboard-mode)\n  (dashboard-insert-startupify-lists)\n  (dashboard-refresh-buffer))\n(global-set-key (kbd \"\u003cf1\u003e\") 'new-dashboard)\n#+END_SRC\n\n\n#+BEGIN_SRC\n(message \"Finished package configurations D\")\n#+END_SRC\n\n\n* E\n\n\n#+BEGIN_SRC emacs-lisp\n(message \"Start package configurations E\")\n#+END_SRC\n\n** ekg\n\nhttps://github.com/ahyatt/ekg?tab=readme-ov-file\nhttps://github.com/ahyatt/ekg/blob/develop/doc/ekg.org\nhttps://github.com/ahyatt/llm\nhttps://ollama.com/search?q=\u0026c=embedding\nhttps://ollama.com/library\n#+BEGIN_SRC emacs-lisp\n(use-package ekg\n  :bind ((\"C-c C-k\" . ekg-capture))\n  :init\n  (require 'ekg-embedding)\n  (ekg-embedding-generate-on-save)\n  (require 'ekg-llm)\n  (require 'llm-ollama)\n  :config\n  (require 'ekg-auto-save)\n  (add-hook 'ekg-capture-mode-hook #'ekg-auto-save-mode)\n  (add-hook 'ekg-edit-mode-hook #'ekg-auto-save-mode)\n)\n  ; (require 'llm-openai)  ;; The specific provider you are using must be loaded.\n  ; (let ((my-provider (make-llm-openai :key \"my-openai-api-key\")))\n  ;   (setq ekg-llm-provider my-provider\n  ;         ekg-embedding-provider my-provider)))\n#+END_SRC\n\n\n** Embark\n#+BEGIN_SRC emacs-lisp\n  (use-package embark\n    :ensure t\n    :bind\n    ((\"C-.\" . embark-act)         ;; pick some comfortable binding\n     (\"M-.\" . embark-dwim)        ;; good alternative: M-.\n     (\"C-h B\" . embark-bindings)) ;; alternative for `describe-bindings'\n\n    :init\n\n    ;; Optionally replace the key help with a completing-read interface\n    (setq prefix-help-command #'embark-prefix-help-command)\n\n    ;; Show the Embark target at point via Eldoc.  You may adjust the Eldoc\n    ;; strategy, if you want to see the documentation from multiple providers.\n    (add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target)\n    ;; (setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly)\n\n    :config\n\n    ;; Hide the mode line of the Embark live/completions buffers\n    (add-to-list 'display-buffer-alist\n                 '(\"\\\\`\\\\*Embark Collect \\\\(Live\\\\|Completions\\\\)\\\\*\"\n                   nil\n                   (window-parameters (mode-line-format . none)))))\n\n  ;; Consult users will also want the embark-consult package.\n  (use-package embark-consult\n    :ensure t ; only need to install it, embark loads it after consult if found\n    :hook\n    (embark-collect-mode . consult-preview-at-point-mode))\n#+END_SRC\n\n#+BEGIN_SRC\n  (message \"Finished package configurations E\")\n#+END_SRC\n\n* F\n\n#+BEGIN_SRC emacs-lisp\n    (message \"Started package configurations F\")\n#+END_SRC\n\n\n** flycheck\n\n#+BEGIN_SRC emacs-lisp\n  (use-package flycheck\n      :ensure t)\n#+END_SRC\n\n#+BEGIN_SRC emacs-lisp\n(message \"Finished package configurations F\")\n#+END_SRC\n\n* G\n\n#+BEGIN_SRC emacs-lisp\n(message \"Started package configurations G\")\n#+END_SRC\n\n#+BEGIN_SRC emacs-lisp\n(use-package general)\n#+END_SRC\n\n#+BEGIN_SRC emacs-lisp\n(message \"Finished package configurations G\")\n#+END_SRC\n\n\n* H\n\n\n#+BEGIN_SRC emacs-lisp\n   (message \"Start H packages configurations\")\n#+END_SRC\n\n** hydra\n\nSource: https://github.com/jerrypnz/major-mode-hydra.el\n\n#+BEGIN_SRC emacs-lisp\n   (use-package major-mode-hydra\n     :bind\n     (\"s-SPC\" . major-mode-hydra))\n\n   (major-mode-hydra-define emacs-lisp-mode nil\n     (\"Eval\"\n      ((\"b\" eval-buffer \"buffer\")\n       (\"e\" eval-defun \"defun\")\n       (\"r\" eval-region \"region\"))\n      \"REPL\"\n      ((\"I\" ielm \"ielm\"))\n      \"Test\"\n      ((\"t\" ert \"prompt\")\n       (\"T\" (ert t) \"all\")\n       (\"F\" (ert :failed) \"failed\"))\n      \"Doc\"\n      ((\"d\" describe-foo-at-point \"thing-at-pt\")\n       (\"f\" describe-function \"function\")\n       (\"v\" describe-variable \"variable\")\n       (\"i\" info-lookup-symbol \"info lookup\"))))\n\n   (message \"Finished hydra package configurations\")\n#+END_SRC\n\n\n\n** helpful\n\n#+BEGIN_SRC emacs-lisp\n    (use-package helpful)\n\n    ;; Note that the built-in `describe-function' includes both functions\n    ;; and macros. `helpful-function' is functions only, so we provide\n    ;; `helpful-callable' as a drop-in replacement.\n    (global-set-key (kbd \"C-h f\") #'helpful-callable)\n\n    (global-set-key (kbd \"C-h v\") #'helpful-variable)\n    (global-set-key (kbd \"C-h k\") #'helpful-key)\n    (global-set-key (kbd \"C-h x\") #'helpful-command)\n\n    ;; Lookup the current symbol at point. C-c C-d is a common keybinding\n    ;; for this in lisp modes.\n    (global-set-key (kbd \"C-c C-d\") #'helpful-at-point)\n\n    ;; Look up *F*unctions (excludes macros).\n    ;;\n    ;; By default, C-h F is bound to `Info-goto-emacs-command-node'. Helpful\n    ;; already links to the manual, if a function is referenced there.\n    (global-set-key (kbd \"C-h F\") #'helpful-function)\n\n    (setq counsel-describe-function-function #'helpful-callable)\n    (setq counsel-describe-variable-function #'helpful-variable)\n#+END_SRC\n\n\n\n#+BEGIN_SRC emacs-lisp\n  (message \"Finished package configurations H\")\n#+END_SRC\n\n\n\n\n* I\n\n#+BEGIN_SRC emacs-lisp\n(message \"Start I packages configurations\")\n#+END_SRC\n\n** ivy\n#+BEGIN_SRC emacs-lisp\n(use-package counsel)\n(use-package ivy\n  :diminish ivy-mode\n  :config\n  (setq ivy-extra-directories nil) ;; Hides . and .. directories\n  (setq ivy-initial-inputs-alist nil) ;; Removes the ^ in ivy searches\n  ; (if (eq jib/computer 'laptop)\n  ;     (setq-default ivy-height 10)\n  ;   (setq-default ivy-height 11))\n  (setq ivy-fixed-height-minibuffer t)\n  (add-to-list 'ivy-height-alist '(counsel-M-x . 7)) ;; Don't need so many lines for M-x, I usually know what command I want\n\n  ;;(ivy-mode 1)\n\n  ;; Shows a preview of the face in counsel-describe-face\n  (add-to-list 'ivy-format-functions-alist '(counsel-describe-face . counsel--faces-format-function))\n\n  :general\n  (general-define-key\n   ;; Also put in ivy-switch-buffer-map b/c otherwise switch buffer map overrides and C-k kills buffers\n   :keymaps '(ivy-minibuffer-map ivy-switch-buffer-map)\n   \"S-SPC\" 'nil\n   \"C-SPC\" 'ivy-restrict-to-matches ;; Default is S-SPC, changed this b/c sometimes I accidentally hit S-SPC\n   ;; C-j and C-k to move up/down in Ivy\n   \"C-k\" 'ivy-previous-line\n   \"C-j\" 'ivy-next-line)\n  )\n\n\n;;;; Nice icons in Ivy. Replaces all-the-icons-ivy.\n;;(use-package all-the-icons-ivy-rich\n;;  :init (all-the-icons-ivy-rich-mode 1)\n;;  :config\n;;  (setq all-the-icons-ivy-rich-icon-size 1.0))\n#+END_SRC\n\n\n** ivy-rich\n#+BEGIN_SRC emacs-lisp\n(use-package ivy-rich\n  :after ivy\n  :init\n  (setq ivy-rich-path-style 'abbrev)\n  (setcdr (assq t ivy-format-functions-alist) #'ivy-format-function-line)\n  :config\n  (ivy-rich-mode 1))\n#+END_SRC\n\n** ivy-bibtex\n\n#+BEGIN_SRC emacs-lisp\n    (use-package ivy-bibtex\n        :init\n        (setq bibtex-completion-notes-path \"/Users/blaine/org-roam/references/notes/\"\n              bibtex-completion-library-path '(\"/Users/blaine/0papersLabeled/\" \"/Users/blaine/0booksLabeled/\")\n              bibtex-completion-notes-path \"/Users/blaine/org-roam/references/notes/\"\n            bibtex-completion-notes-template-multiple-files \"* ${author-or-editor}, ${title}, ${journal}, (${year}) :${=type=}: \\n\\nSee [[cite:\u0026${=key=}]]\\n\"\n            bibtex-completion-additional-search-fields '(keywords)\n            bibtex-completion-display-formats\n            '((article       . \"${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${journal:40}\")\n              (inbook        . \"${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} Chapter ${chapter:32}\")\n              (incollection  . \"${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${booktitle:40}\")\n              (inproceedings . \"${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${booktitle:40}\")\n              (t             . \"${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*}\"))\n            bibtex-completion-pdf-open-function\n            (lambda (fpath)\n              (call-process \"open\" nil 0 nil fpath))))\n#+END_SRC\n\n\n#+BEGIN_SRC emacs-lisp\n    (message \"Finished I packages configurations\")\n#+END_SRC\n\n\n\n* J\n* K\n#+BEGIN_SRC emacs-lisp\n(message \"Started K packages configurations\")\n#+END_SRC\n\n** Kind-Icon Configuration\n\n#+BEGIN_SRC emacs-lisp\n  (use-package kind-icon\n    :config\n    (setq kind-icon-default-face 'corfu-default)\n    (setq kind-icon-default-style '(:padding 0 :stroke 0 :margin 0 :radius 0 :height 0.9 :scale 1))\n    (setq kind-icon-blend-frac 0.08)\n    (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter)\n    (add-hook 'counsel-load-theme #'(lambda () (interactive) (kind-icon-reset-cache)))\n    (add-hook 'load-theme         #'(lambda () (interactive) (kind-icon-reset-cache))))\n#+END_SRC\n\n#+BEGIN_SRC emacs-lisp\n(message \"Finished K packages configurations\")\n#+END_SRC\n\n\n* L\n\n#+BEGIN_SRC emacs-lisp\n(message \"Started L packages configurations\")\n#+END_SRC\n\n\n\n** lsp-mode\n\n#+BEGIN_SRC emacs-lisp\n  (message \"Started L packages configurations\")\n  (use-package llm\n       :load-path \"/Users/blaine/e29org/manual-install/llm.git/\"\n       :init\n  )\n#+END_SRC\n\n** lsp-mode\n\n\n\n\n** org-ai\n\n#+BEGIN_SRC emacs-lisp\n; (use-package org-ai\n;   :load-path \"/Users/blaine/emacs29.3/manual-packages/org-ai/\"\n;   :commands (org-ai-mode\n;              org-ai-global-mode)\n;   :init\n;   (add-hook 'org-mode-hook #'org-ai-mode) ; enable org-ai in org-mode\n;   (org-ai-global-mode) ; installs global keybindings on C-c M-a\n;   :config\n;   (setq org-ai-default-chat-model \"gpt-4\") ; if you are on the gpt-4 beta:\n;   (org-ai-install-yasnippets)) ; if you are using yasnippet and want `ai` snippets\n#+END_SRC\n\n** org-babel\n\nOrg-babel supports literate programming in org in many programming languages.\nThe coolest /language/ is /jupyter/.\nThis means that you can access any of the jupyter kernels from within org-mode.\nThis includes the PyMOL kernel.\nThis is super powerful.\n\n#+BEGIN_SRC emacs-lisp\n  (message \"Started org-babel configuration.\")\n  (org-babel-do-load-languages\n   'org-babel-load-languages\n   '((emacs-lisp . t)\n     (shell . t)\n     (c . nil)\n     (cpp . nil)\n     (clojure . t)\n     (F90 . nil)\n     (gnuplot . t)\n     (js . nil)\n     (ditaa . nil)\n     (java . t)\n     (mathematica . nil)\n     (plantuml . nil)\n     (lisp . t)\n     (org . t)\n     (julia . t)\n     (python . t)\n     (R . t)\n     (jupyter . t))\n  )\n  ;; Removed  ~(jupyter . t)~ on May 14 due to an error message.\n  ;; By default, you need to specify julia-vterm as the language name for source blocks.\n  ;; To use julia as the language name, define the following aliases.\n  ;; (defalias 'org-babel-execute:julia 'org-babel-execute:julia-vterm)\n  ;; (defalias 'org-babel-variable-assignments:julia 'org-babel-variable-assignments:julia-vterm)\n  (message \"Finished org-babel configuration.\")\n#+END_SRC\n\n** org-cc\n\n#+BEGIN_SRC emacs-lisp\n;; Context clues\n;; source  https://github.com/durableOne/org-cc\n(add-to-list 'load-path \"/Users/blaine/emacs29.3/manual-packages/org-cc\")\n(use-package org-cc\n  :ensure nil\n  :after org\n  :custom\n  (org-cc-directory (concat org-directory \"org-cc\")) ;; subdirectory of the heading's attachment directory\n  (org-cc-days 14)\n  :init\n  (add-hook 'org-clock-in-hook #'org-cc-display-notes)\n)\n(global-set-key (kbd \"C-c k\") 'org-cc-edit-cc-file)\n(global-set-key (kbd \"C-c x\") 'org-cc-display-notes)\n\n(message \"Finished org-cc. Line 15--.\")\n;; org-caputre templates\n\n(setq org-capture-templates\n     '((\"r\" \"Record\"\n plain\n (file \"/Users/blaine/org/notes.org\")\n \"* %^{Title}  :%^{Tags}:\\n%U%i\\n%?\\n\")))\n\n(global-set-key (kbd \"C-c t\") 'org-tags-view)\n\n(message \"Finished org-capture configuration.\")\n#+END_SRC\n\n\n** org-gtd\n\n# #+BEGIN_SRC emacs-lisp\n#   (setq org-gtd-update-ack \"3.0.0\")\n#   (use-package quelpa)\n#   (use-package quelpa-use-package)\n#\n#   (use-package org-gtd\n#     ; :ensure t\n#     :after org\n#     :quelpa (org-gtd :fetcher github :repo \"trevoke/org-gtd.el\"\n#                       :commit \"3.0.0\" :upgrade t)\n#     :demand t\n#     :custom\n#     (org-gtd-directory \"~/org-gtd\")\n#     (org-edna-use-inheritance t)\n#     (org-gtd-organize-hooks '(org-gtd-set-area-of-focus org-set-tags-command))\n#     :config\n#     (org-edna-mode)\n#     :bind\n#     ((\"C-c d c\" . org-gtd-capture)\n#      (\"C-c d e\" . org-gtd-engage)\n#      (\"C-c d p\" . org-gtd-process-inbox)\n#      :map org-gtd-clarify-map\n#      (\"C-c c\" . org-gtd-organize)))\n#      (message \"Finished org-gtd configuration.\")\n# #+END_SRC\n\n\n** org-noter\n\n#+BEGIN_SRC emacs-lisp\n(message \"Started org-noter configuration. Line 1530.\")\n(use-package org-noter)\n;;*** Org-pdf-noter\n;; This commented out config sort of worked.\n(use-package org-noter\n  :after org\n  :config\n  ;; Your org-noter config ........\n  :config\n  (setq\n    org_notes (concat (getenv \"HOME\") \"/org-roam/\")\n    zot_bib (concat (getenv \"HOME\") \"/Documents/global.bib\")\n    org-directory org_notes\n    deft-directory org_notes\n    org-roam-directory org_notes\n    ;; keep an empty line between headings and content in Org file\n    org-noter-separate-notes-from-heading t)\n  (require 'org-noter-pdftools))\n#+END_SRC\n\n\n** org-pdftools\n\n#+BEGIN_SRC emacs-lisp\n(use-package org-pdftools\n  :hook (org-mode . org-pdftools-setup-link))\n#+END_SRC\n\n\n** org-noter-pdftools\n\n#+BEGIN_SRC emacs-lisp\n(use-package org-noter-pdftools\n  :after org-noter\n  :config\n  ;; Add a function to ensure precise note is inserted\n  (defun org-noter-pdftools-insert-precise-note (\u0026optional toggle-no-questions)\n    (interactive \"P\")\n    (org-noter--with-valid-session\n     (let ((org-noter-insert-note-no-questions (if toggle-no-questions\n                                                   (not org-noter-insert-note-no-questions)\n                                                 org-noter-insert-note-no-questions))\n           (org-pdftools-use-isearch-link t)\n           (org-pdftools-use-freepointer-annot t))\n       (org-noter-insert-note (org-noter--get-precise-info)))))\n\n  ;; fix https://github.com/weirdNox/org-noter/pull/93/commits/f8349ae7575e599f375de1be6be2d0d5de4e6cbf\n  (defun org-noter-set-start-location (\u0026optional arg)\n    \"When opening a session with this document, go to the current location.\nWith a prefix ARG, remove start location.\"\n    (interactive \"P\")\n    (org-noter--with-valid-session\n     (let ((inhibit-read-only t)\n           (ast (org-noter--parse-root))\n           (location (org-noter--doc-approx-location (when (called-interactively-p 'any) 'interactive))))\n       (with-current-buffer (org-noter--session-notes-buffer session)\n         (org-with-wide-buffer\n          (goto-char (org-element-property :begin ast))\n          (if arg\n              (org-entry-delete nil org-noter-property-note-location)\n            (org-entry-put nil org-noter-property-note-location\n                           (org-noter--pretty-print-location location))))))))\n  (with-eval-after-load 'pdf-annot\n    (add-hook 'pdf-annot-activate-handler-functions #'org-noter-pdftools-jump-to-note)))\n\n(use-package pdf-tools-org-noter-helpers\n  :pin manual\n  :load-path \"/Users/blaine/emacs29.3/manual-packages/pdf-tools-org-noter-helpers/\")\n#+END_SRC\n\n\n** org-pomodoro\n\n#+BEGIN_SRC emacs-lisp\n;; (shell-command-to-string \"open -a tomighty.app\")\n(use-package org-pomodoro\n    :commands  (org-pomodoro)\n    :config\n    (setq alert-user-configuration (quote ((((:category . \"org-pomodoro\")) libnotify nil)))))\n\n;; add hook to enable automated start of the next pom after a break.\n;; Source: https://github.com/marcinkoziej/org-pomodoro/issues/32\n;; (add-hook 'org-pomodoro-break-finished-hook\n;;           (lambda ()\n;;             (interactive)\n;;             (point-to-register 1)\n;;             (org-clock-goto)\n;;             (org-pomodoro '(25))\n;;             (register-to-point 1)\n;;             (shell-command-to-string \"open -a tomighty.app\")\n;;             ))\n\n(use-package sound-wav)\n(setq org-pomodoro-ticking-sound-p nil)\n(setq org-pomodoro-ticking-sound-states '(:pomodoro :short-break :long-break))\n(setq org-pomodoro-ticking-sound-states '(:pomodoro))\n(setq org-pomodoro-ticking-frequency 1)\n(setq org-pomodoro-audio-player \"mplayer\")\n(setq org-pomodoro-finished-sound-args \"-volume 0.9\")\n(setq org-pomodoro-long-break-sound-args \"-volume 0.9\")\n(setq org-pomodoro-short-break-sound-args \"-volume 0.9\")\n(setq org-pomodoro-ticking-sound-args \"-volume 0.3\")\n\n(global-set-key (kbd \"C-c o\") 'org-pomodoro)\n(message \"Finished org-pomodoros configuration. Line 1607.\")\n#+END_SRC\n\n\n\n# #+BEGIN_SRC emacs-lisp\n# ; (message \"Start org-ref configuration. Line 1610.\")\n# ; ;; John Kitchin's config on YouTube https://www.youtube.com/watch?v=3u6eTSzHT6s\n# ; ; (use-package ivy-bibtex\n# ; ;     :init\n# ; ;     (setq bibtex-completion-notes-path \"/Users/blaine/org-roam/references/notes/\"\n# ; ;         bibtex-completion-notes-template-multiple-files \"* ${author-or-editor}, ${title}, ${journal}, (${year}) :${=type=}: \\n\\nSee [[cite:\u0026${=key=}]]\\n\"\n# ; ;         bibtex-completion-additional-search-fields '(keywords)\n# ; ;         bibtex-completion-display-formats\n# ; ;         '((article       . \"${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${journal:40}\")\n# ; ;           (inbook        . \"${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} Chapter ${chapter:32}\")\n# ; ;           (incollection  . \"${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${booktitle:40}\")\n# ; ;           (inproceedings . \"${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${booktitle:40}\")\n# ; ;           (t             . \"${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*}\"))\n# ; ;         bibtex-completion-pdf-open-function\n# ; ;         (lambda (fpath)\n# ; ;           (call-process \"open\" nil 0 nil fpath)))\n# ; ; )\n# #+END_SRC\n\n** org-ref\nSet the case of the Author and Title to Capitalize with customize.\n\n#+BEGIN_SRC emacs-lisp\n(message \"Start org-ref configuration.\")\n   (use-package org-ref\n        :init\n       (use-package bibtex)\n       (setq bibtex-autokey-year-length 4\n             bibtex-autokey-name-year-separator \"\"\n             bibtex-autokey-year-title-separator \"\"\n             bibtex-autokey-titleword-separator \"\"\n             bibtex-autokey-titlewords 9\n             bibtex-autokey-titlewords-stretch 9\n             bibtex-autokey-titleword-length 15)\n       ;; H is the hyper key. I have bound H to Fn. For the MacAlly keyboard, it is bound to right-command.\n       (define-key bibtex-mode-map (kbd \"H-b\") 'org-ref-bibtex-hydra/body)\n       ;; (use-package org-ref-ivy)\n       (setq org-ref-insert-link-function 'org-ref-insert-link-hydra/body\n                   org-ref-insert-cite-function 'org-ref-cite-insert-ivy\n                   org-ref-insert-label-function 'org-ref-insert-label-link\n                   org-ref-insert-ref-function 'org-ref-insert-ref-link\n                   org-ref-cite-onclick-function (lambda (_) (org-ref-citation-hydra/body)))\n       ; (use-package org-ref-arxiv)\n       ; (use-package org-ref-pubmed)\n       ; (use-package org-ref-wos)\n   )\n#+END_SRC\n\n\n#+BEGIN_SRC emacs-lisp\n(message \"Start bibtex-completion-bibliography configuration of org-ref.\")\n(setq bibtex-completion-bibliography '(\"/Users/blaine/Documents/global.bib\")\n    bibtex-completion-library-path '(\"/Users/blaine/0papersLabeled/\" \"/Users/blaine/0booksLabeled/\")\n    bibtex-completion-notes-path \"/Users/blaine/org-roam/references/notes/\"\n    bibtex-completion-notes-template-multiple-files \"* ${author-or-editor}, ${title}, ${journal}, (${year}) :${=type=}: \\n\\nSee [[cite:\u0026${=key=}]]\\n\"\n    bibtex-completion-additional-search-fields '(keywords)\n    bibtex-completion-display-formats\n    '((article       . \"${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${journal:40}\")\n      (inbook        . \"${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} Chapter ${chapter:32}\")\n      (incollection  . \"${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${booktitle:40}\")\n      (inproceedings . \"${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*} ${booktitle:40}\")\n      (t             . \"${=has-pdf=:1}${=has-note=:1} ${year:4} ${author:36} ${title:*}\"))\n    bibtex-completion-pdf-open-function\n    (lambda (fpath)\n      (call-process \"open\" nil 0 nil fpath)))\n\n(setq bibtex-autokey-year-length 4\n      bibtex-autokey-name-year-separator \"-\"\n      bibtex-autokey-year-title-separator \"-\"\n      bibtex-autokey-titleword-separator \"-\"\n      bibtex-autokey-titlewords 2\n      bibtex-autokey-titlewords-stretch 1\n      bibtex-autokey-titleword-length 5)\n(message \"Finished bibtex-completion-bibliography configuration of org-ref. Line 1691.\")\n;; H is the hyper key. I have bound H to Fn. For the MacAlly keyboard, it is bound to right-command.\n(define-key bibtex-mode-map (kbd \"s-b\") 'org-ref-bibtex-hydra/body)\n(define-key org-mode-map (kbd \"s-i\") org-ref-insert-cite-function)\n(define-key org-mode-map (kbd \"s-r\") org-ref-insert-ref-function)\n(define-key org-mode-map (kbd \"H-l\") org-ref-insert-label-function)\n(define-key org-mode-map (kbd \"H-d\") 'doi-add-bibtex-entry)\n#+END_SRC\n\n\n** org-cite-insert\n\n#+BEGIN_SRC emacs-lisp\n(setq org-ref-insert-cite-function\n      (lambda ()\n     (org-cite-insert nil)))\n(message \"Finished org-cite configurations\")\n#+END_SRC\n\n\n** org-roam\n\n#+BEGIN_SRC emacs-lisp\n(message \"Start org-roam configurations\")\n(use-package org-roam\n   :custom\n   (org-roam-directory (file-truename \"/Users/blaine/org-roam/\"))\n   :bind ((\"C-c n l\" . org-roam-buffer-toggle)\n          (\"C-c n f\" . org-roam-node-find)\n          (\"C-c n g\" . org-roam-graph)\n          (\"C-c n i\" . org-roam-node-insert)\n          (\"C-c n c\" . #'org-id-get-create)\n          ;; Dailies\n          (\"C-c n j\" . org-roam-dailies-capture-today))\n   :config\n   ;; If you're using a vertical completion framework, you might want a more informative completion interface\n   (setq org-roam-node-display-template (concat \"${title:*} \" (propertize \"${tags:10}\" 'face 'org-tag)))\n   (org-roam-db-autosync-mode))\n   ;;(org-roam-ui-mode))\n   ;; If using org-roam-protocol\n   ;;(use-package org-roam-protocol))\n\n\n;; Following https://jethrokuan.github.io/org-roam-guide/\n(message \"Start org-roam-capture template configurations.\")\n#+END_SRC\n\n** org-roam-capture-templates\n\n#+BEGIN_SRC emacs-lisp\n(setq org-roam-capture-templates\n      '((\"p\" \"permanent\" plain\n         \"%?\"\n         :if-new (file+head \"main/${slug}.org\" \"#+title: ${title}\\n\\n* Note type: permanent\\n\\n* References\\n\\n* Backlinks\\n\\n#+created_at: %U\\n#+last_modified: %U\\n\")\n         :immediate-finish t\n         :unnarrowed t)\n         ;; citar literature note\n        ; (\"n\" \"literature note\" plain\n        ;  \"%?\"\n        ;  :target (file+head \"%(expand-file-name (or citar-org-roam-subdir \\\"\\\") org-roam-directory)/${citar-citekey}.org\"\n        ;             \"#+title: ${citar-citekey}.\\n Article title: ${note-title}.\\n Year: ${citar-year} \\n  Keywords: ${citar-keywords} \\n Note type: literature\\n\\n\\n#+created: %U\\n#+last_modified: %U\\n\\n\")\n        ;           :unnarrowed t)\n        (\"r\" \"reference\" plain \"%?\"\n         :if-new\n         (file+head \"reference/${title}.org\" \"#+title: ${title}\\n\\n\\n\\n\\n* References\\n\\n* Backlinks\\n\\n#+created_at: %U\\n#+last_modified: %U\\n\")\n         :immediate-finish t\n         :unnarrowed t)\n         (\"l\" \"clipboard\" plain #'org-roam-capture--get-point \"%i%a\"\n         :file-name \"%\u003c%Y%m%d%H%M%S\u003e-${slug}\"\n         :head \"#+title: ${title}\\n#+created: %u\\n#+last_modified: %U\\n#+ROAM_TAGS: %?\"\n         :unnarrowed t\n         :prepend t\n         :jump-to-captured t)\n         ;; Vidianos G's config with ivy-bibtex\n         (\"v\" \"bibliography reference\" plain\n             \"%?\"\n             : if-new\n             (file+head \"ref/${citekey}.org\" \"#+title: ${title}\\n\n              ,#+filetags: ${entry-type}\n         - keywords :: ${keywords}\n         - tags ::\n\n         ,* Analysis of ${entry-type} by ${author}\n\n\n\n         * References\\n\\n* Backlinks\\n\\n#+created_at: %U\\n#+last_modified: %U\\n\n         :PROPERTIES:\n         :URL: ${Url}\n         :NOTER_DOCUMENT: ${file}\n         :NOTER_PAGE:\n         :END:\")\n             :unnarrowed t\n             :jump-to-captured t)\n        (\"b\" \"bibliography notes\" plain             ; Org-noter integration\n          (file \"~/org-roam/references/notes/notes-template.org\")\n                 :target (file+head \"references/notes/${citekey}.org\"\n                 \"#+title: ${title}\\n :article:\\n\\n\\n\\n\\n* References\\n\\n* Backlinks\\n\\n#+created_at: %U\\n#+last_modified: %U\\n\")\n                  :empty-lines 1)\n        (\"a\" \"article\" plain \"%?\"\n         :if-new\n         (file+head \"articles/${title}.org\" \"#+title: ${title}\\n :article:\\n\\n\\n\\n\\n* References\\n\\n* Backlinks\\n\\n#+created_at: %U\\n#+last_modified: %U\\n\")\n         :immediate-finish t\n         :unnarrowed t)))\n\n(setq org-roam-node-display-template\n    (concat \"${type:15} ${title:*} \" (propertize \"${tags:10}\" 'face 'org-tag)))\n#+END_SRC\n\nWriting technical documents requires us to write in paragraphs,\nwhereas org mode by default is intended to be used as an outliner,\nto get around this problem, setting up org-export to preserve line breaks is useful\n\n#+BEGIN_SRC emacs-lisp\n;; (setq org-export-preserve-breaks t)\n#+END_SRC\n\n\nPlace point on link to image. Left-click to display image in another buffer. Enter C-c t to display the code of the link for easy editing.\nPlace point on equation. Enter C-c t to render it with MathJax. Left click on the rendered equation to switch back to the code.\nPut multiline code from mathpix between double dollar signs and treat as being on one line.\nThis trick does not work with the equation environment compressed to one line. You have to use M-x math-preview-region.\nI modified this from https://emacs.stackexchange.com/questions/59151/how-can-i-switch-a-preview-image-in-an-org-mode-buffer-to-its-source-block\n\nI ran out of time to time out how to render an active region. I need to find the analog of the latex-fragment:\n\n#+BEGIN_SRC emacs-lisp\n;; ('latex-???? (math-preview-region))\n;; ???? has to be some kind of an org-element-type. org-latex-section does not work.\n;; This would enable using this application of the math-preview-region to render equation environments.\n#+END_SRC\n\n\n#+BEGIN_SRC emacs-lisp\n  (defun bhmm/toggle-state-at-point ()\n    (interactive)\n    (let ((ctx (org-element-context)))\n      (pcase (org-element-type ctx)\n        ('link           (org-toggle-link-display))\n        ('latex-fragment (math-preview-at-point)))))\n\n  (define-key org-mode-map (kbd \"C-c t\") #'bhmm/toggle-state-at-point)\n    (message \"End toggle-state-at-point for use with images and equations.\")\n#+END_SRC\n\n\n** toc-org\n\nPlace a ~:TOC:~ at the top of a file by a headline like table of contents, and it will be automatically inserted into the table of contents.\n\n# +BEGIN_SRC emacs-lisp\n# (if (require 'toc-org nil t)\n#     (progn\n#       (add-hook 'org-mode-hook 'toc-org-mode)\n#\n#       ;; enable in markdown, too\n#       (add-hook 'markdown-mode-hook 'toc-org-mode)\n#       (define-key markdown-mode-map (kbd \"\\C-c\\C-o\") 'toc-org-markdown-follow-thing-at-point))\n#   (warn \"toc-org not found\"))\n# +END_SRC\n\n#+BEGIN_SRC emacs-lisp\n(message \"End package configurations O\")\n#+END_SRC\n\n\n* P\n\n#+BEGIN_SRC emacs-lisp\n(message \"Start package configurations O\")\n#+END_SRC\n\n** pdf-tools\n#+BEGIN_SRC emacs-lisp\n(use-package pdf-tools\n :pin manual ;; manually update\n :config\n ;; initialise\n (pdf-tools-install)\n ;; open pdfs scaled to fit width\n (setq-default pdf-view-display-size 'fit-width)\n ;; use normal isearch\n (define-key pdf-view-mode-map (kbd \"C-s\") 'isearch-forward)\n :custom\n (pdf-annot-activate-created-annotations t \"automatically annotate highlights\"))\n#+END_SRC\n\n** perspective\n#+BEGIN_SRC emacs-lisp\n ;; per frame workspaces like on the Macs spaces\n(use-package perspective\n  :ensure t\n  :bind\n  (\"C-x C-b\" . persp-list-buffers)         ; or use a nicer switcher, see below\n  :custom\n  (persp-mode-prefix-key (kbd \"C-c M-p\"))  ; pick your own prefix key here\n  :init\n  (persp-mode))\n#+END_SRC\n\n#+BEGIN_SRC emacs-lisp\n(message \"End package configurations P\")\n#+END_SRC\n\n* Q\n\n* R\n\n* S\n\n#+BEGIN_SRC emacs-lisp\nmessage \"Start package configurations S\")\n#+END_SRC\n\n\n#+BEGIN_SRC emacs-lisp\n;;*** serenade (source: https://github.com/justin-roche/serenade-mode)\n(use-package serenade-mode\n  :load-path \"/Users/blaine/e29org/manual-install/serenade-mode/\")\n\n(setq serenade-completion-frontend 'helm)\n(setq serenade-helm-M-x t)\n(setq serenade-snippet-engine 'yasnippet)\n#+END_SRC\n\n#+BEGIN_SRC emacs-lisp\n(message \"End package configurations S\")                                                                                                                                                                                    #+END_SRC\n\n\n* T\n#+BEGIN_SRC emacs-lisp\n(message \"Start package configurations T\")\n#+END_SRC\n\n** treemacs\n\nC-x t t to launch treemacs\nSupport dragging files from the treemacs directory to a buffer to open them.\nDefault configuration for treemacs minus the treemacs-evil pacakge.\n\n#+BEGIN_SRC emacs-lisp\n(use-package treemacs\n  :ensure t\n  :defer t\n  :init\n  (with-eval-after-load 'winum\n    (define-key winum-keymap (kbd \"M-0\") #'treemacs-select-window))\n  :config\n  (progn\n    (setq treemacs-collapse-dirs                   (if treemacs-python-executable 3 0)\n          treemacs-deferred-git-apply-delay        0.5\n          treemacs-directory-name-transformer      #'identity\n          treemacs-display-in-side-window          t\n          treemacs-eldoc-display                   'simple\n          treemacs-file-event-delay                2000\n          treemacs-file-extension-regex            treemacs-last-period-regex-value\n          treemacs-file-follow-delay               0.2\n          treemacs-file-name-transformer           #'identity\n          treemacs-follow-after-init               t\n          treemacs-expand-after-init               t\n          treemacs-find-workspace-method           'find-for-file-or-pick-first\n          treemacs-git-command-pipe                \"\"\n          treemacs-goto-tag-strategy               'refetch-index\n          treemacs-header-scroll-indicators        '(nil . \"^^^^^^\")\n          treemacs-hide-dot-git-directory          t\n          treemacs-indentation                     2\n          treemacs-indentation-string              \" \"\n          treemacs-is-never-other-window           nil\n          treemacs-max-git-entries                 5000\n          treemacs-missing-project-action          'ask\n          treemacs-move-files-by-mouse-dragging    t\n          treemacs-move-forward-on-expand          nil\n          treemacs-no-png-images                   nil\n          treemacs-no-delete-other-windows         t\n          treemacs-project-follow-cleanup          nil\n          treemacs-persist-file                    (expand-file-name \".cache/treemacs-persist\" user-emacs-directory)\n          treemacs-position                        'left\n          treemacs-read-string-input               'from-child-frame\n          treemacs-recenter-distance               0.1\n          treemacs-recenter-after-file-follow      nil\n          treemacs-recenter-after-tag-follow       nil\n          treemacs-recenter-after-project-jump     'always\n          treemacs-recenter-after-project-expand   'on-distance\n          treemacs-litter-directories              '(\"/node_modules\" \"/.venv\" \"/.cask\")\n          treemacs-project-follow-into-home        nil\n          treemacs-show-cursor                     nil\n          treemacs-show-hidden-files               t\n          treemacs-silent-filewatch                nil\n          treemacs-silent-refresh                  nil\n          treemacs-sorting                         'alphabetic-asc\n          treemacs-select-when-already-in-treemacs 'move-back\n          treemacs-space-between-root-nodes        t\n          treemacs-tag-follow-cleanup              t\n          treemacs-tag-follow-delay                1.5\n          treemacs-text-scale                      nil\n          treemacs-user-mode-line-format           nil\n          treemacs-user-header-line-format         nil\n          treemacs-wide-toggle-width               70\n          treemacs-width                           35\n          treemacs-width-increment                 1\n          treemacs-width-is-initially-locked       t\n          treemacs-workspace-switch-cleanup        nil)\n\n    ;; The default width and height of the icons is 22 pixels. If you are\n    ;; using a Hi-DPI display, uncomment this to double the icon size.\n    ;;(treemacs-resize-icons 44)\n\n    (treemacs-follow-mode t)\n    (treemacs-filewatch-mode t)\n    (treemacs-fringe-indicator-mode 'always)\n    (when treemacs-python-executable\n      (treemacs-git-commit-diff-mode t))\n\n    (pcase (cons (not (null (executable-find \"git\")))\n                 (not (null treemacs-python-executable)))\n      (`(t . t)\n       (treemacs-git-mode 'deferred))\n      (`(t . _)\n       (treemacs-git-mode 'simple)))\n\n    (treemacs-hide-gitignored-files-mode nil))\n  :bind\n  (:map global-map\n        (\"M-0\"       . treemacs-select-window)\n        (\"C-x t 1\"   . treemacs-delete-other-windows)\n        (\"C-x t t\"   . treemacs)\n        (\"C-x t d\"   . treemacs-select-directory)\n        (\"C-x t B\"   . treemacs-bookmark)\n        (\"C-x t C-t\" . treemacs-find-file)\n        (\"C-x t M-t\" . treemacs-find-tag)))\n#+END_SRC\n\n\n** treemacs-projectile\n\n#+BEGIN_SRC emacs-lisp\n(use-package treemacs-projectile\n  :after (treemacs projectile)\n  :ensure t)\n#+END_SRC\n\n\n** treemacs-icons-dired\n\n#+BEGIN_SRC emacs-lisp\n(use-package treemacs-icons-dired\n  :hook (dired-mode . treemacs-icons-dired-enable-once)\n  :ensure t)\n#+END_SRC\n\n# #+BEGIN_SRC emacs-lisp\n# ; (use-package treemacs-magit\n# ;   :after (treemacs magit)\n# ;   :ensure t)\n# #+END_SRC\n\n** treemacs-persp\n#+BEGIN_SRC emacs-lisp\n(use-package treemacs-persp ;;treemacs-perspective if you use perspective.el vs. persp-mode\n  :after (treemacs persp-mode) ;;or perspective vs. persp-mode\n  :ensure t\n  :config (treemacs-set-scope-type 'Perspectives))\n(treemacs-start-on-boot)\n#+END_SRC\n\n\n** triples\n\n#+BEGIN_SRC emacs-lisp\n(use-package triples\n  :load-path \"/Users/blaine/e29org/manual-install/triples/\")\n#+END_SRC\n\n#+BEGIN_SRC emacs-lisp\n(message \"End package configurations T\")\n#+END_SRC\n\n\n\n* U\n\n#+BEGIN_SRC emacs-lisp\n(message \"Start package configurations U\")\n#+END_SRC\n\n** undo-tree\n\n#+BEGIN_SRC emacs-lisp\n(use-package undo-tree\n  :ensure t\n  :config\n  (global-undo-tree-mode 1))\n#+END_SRC\n\n#+BEGIN_SRC emacs-lisp\n(message \"End package configurations U\")\n#+END_SRC\n\n\n* V\n#+BEGIN_SRC emacs-lisp\n(message \"Start package configurations V\")\n#+END_SRC\n\n\n** Vertico Configuration\n\n#+BEGIN_SRC emacs-lisp\n(use-package vertico\n  :ensure t\n  :init\n  (vertico-mode)\n\n  ;; Different scroll margin\n  ;; (setq vertico-scroll-margin 0)\n\n  ;; Show more candidates\n  (setq vertico-count 20)\n\n  ;; Grow and shrink the Vertico minibuffer\n  (setq vertico-resize t)\n\n  ;; Optionally enable cycling for `vertico-next' and `vertico-previous'.\n  (setq vertico-cycle t)\n  )\n#+END_SRC\n\n** savehist\n\n#+BEGIN_SRC emacs-lisp\n;; Persist history over Emacs restarts. Vertico sorts by history position.\n(use-package savehist\n  :ensure t\n  :init\n  (savehist-mode))\n#+END_SRC\n\n\n** emacs\n\n#+BEGIN_SRC emacs-lisp\n;; A few more useful configurations...\n(use-package emacs\n  :ensure t\n  :init\n  ;; Add prompt indicator to `completing-read-multiple'.\n  ;; We display [CRM\u003cseparator\u003e], e.g., [CRM,] if the separator is a comma.\n  (defun crm-indicator (args)\n    (cons (format \"[CRM%s] %s\"\n                  (replace-regexp-in-string\n                   \"\\\\`\\\\[.*?]\\\\*\\\\|\\\\[.*?]\\\\*\\\\'\" \"\"\n                   crm-separator)\n                  (car args))\n          (cdr args)))\n  (advice-add #'completing-read-multiple :filter-args #'crm-indicator)\n\n  ;; Do not allow the cursor in the minibuffer prompt\n  (setq minibuffer-prompt-properties\n        '(read-only t cursor-intangible t face minibuffer-prompt))\n  (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)\n\n  ;; Emacs 28: Hide commands in M-x which do not work in the current mode.\n  ;; Vertico commands are hidden in normal buffers.\n  ;; (setq read-extended-command-predicate\n  ;;       #'command-completion-default-include-p)\n\n  ;; Enable recursive minibuffers\n  (setq enable-recursive-minibuffers t))\n#+END_SRC\n\n#+BEGIN_SRC emacs-lisp\n(message \"Ended package configurations V\")\n#+END_SRC\n\n\n* X\n* W\n#+BEGIN_SRC emacs-lisp\n(message \"Started package configurations W\")\n#+END_SRC\n\n\n** which-key\n#+BEGIN_SRC emacs-lisp\n(use-package which-key\n  :ensure t\n  :init\n  :defer 0\n  :diminish which-key-mode\n  :config\n  (which-key-mode)\n  (setq which-key-idle-delay 0.3))\n;;   (add-hook 'c-mode-hook 'lsp)\n;; (add-hook 'c++-mode-hook 'lsp)\n(add-hook 'clojure-mode-hook 'lsp)\n;; (add-hook 'julia-mode-hook 'lsp)\n(add-hook 'latex-mode-hook 'lsp)\n(add-hook 'python-mode-hook 'lsp)\n;; (add-hook 'R-mode-hook 'lsp)\n(which-key-setup-side-window-right-bottom)\n(message \"End package configurations W\")\n#+END_SRC\n\n#+BEGIN_SRC emacs-lisp\n(message \"Finished package configurations W\")\n#+END_SRC\n\n\n* Y\n\n#+BEGIN_SRC emacs-lisp\n(message \"Start package configurations Y.\")\n#+END_SRC\n\n** yasnippet\n\n#+BEGIN_SRC emacs-lisp\n(use-package yasnippet\n  :config\n  (yas-global-mode 1))\n(global-set-key \"\\C-o\" 'yas-expand)\n(global-set-key \"\\C-c y i\" 'yas-insert-snippet)\n(global-set-key \"\\C-c y n\" 'yas-new-snippet)\n#+END_SRC\n\n** my-hydras\n\n*** writing-projects-hydra\n\n#+BEGIN_SRC emacs-lisp\n(use-package writing-projects-hydra\n  :load-path \"~/emacs29.3/my-hydras/\")\n(global-set-key (kbd \"C-c 9\") 'writing-projects-hydra/body)\n#+END_SRC\n\n\n*** learning-packages-and-modes-hydras\n\n#+BEGIN_SRC emacs-lisp\n(use-package learning-packages-and-modes-hydras\n  :load-path \"~/emacs29.3/my-hydras/\")\n(global-set-key (kbd \"C-c 2\") 'learning-packages-and-modes-hydras/body)\n#+END_SRC\n\n\n*** learning-spiral-hydras\n\n#+BEGIN_SRC emacs-lisp\n(use-package learning-spiral-hydras\n  :load-path \"~/emacs29.3/my-hydras/\")\n(global-set-key (kbd \"C-c 1\") 'hydra-of-learning-spiral/body)\n#+END_SRC\n\n\n*** my-hydras\n\n#+BEGIN_SRC emacs-lisp\n(use-package my-hydras\n  :load-path \"~/emacs29.3/my-hydras/\")\n(global-set-key (kbd \"C-c 0\") 'hydra-of-hydras/body)\n#+END_SRC\n\n\n*** hydra\n\nA cool hydra for finding snippets at point. \nInvoke with C-c y.\n#+BEGIN_SRC emacs-lisp\n(use-package hydra\n  :defer 2\n  :bind (\"C-c y\" . hydra-yasnippet/body))\n#+END_SRC\n\n\n\n** popup\n\n#+BEGIN_SRC emacs-lisp\n(use-package popup)\n;; add some shotcuts in popup menu mode\n(define-key popup-menu-keymap (kbd \"M-n\") 'popup-next)\n(define-key popup-menu-keymap (kbd \"TAB\") 'popup-next)\n(define-key popup-menu-keymap (kbd \"\u003ctab\u003e\") 'popup-next)\n(define-key popup-menu-keymap (kbd \"\u003cbacktab\u003e\") 'popup-previous)\n(define-key popup-menu-keymap (kbd \"M-p\") 'popup-previous)\n\n(defun yas/popup-isearch-prompt (prompt choices \u0026optional display-fn)\n  (when (featurep 'popup)\n    (popup-menu*\n     (mapcar\n      (lambda (choice)\n        (popup-make-item\n         (or (and display-fn (funcall display-fn choice))\n             choice)\n         :value choice))\n      choices)\n     :prompt prompt\n     ;; start isearch mode immediately\n     :isearch t\n     )))\n(setq yas/prompt-functions '(yas/popup-isearch-prompt yas/no-prompt))\n#+END_SRC\n\n#+BEGIN_SRC emacs-lisp\n(use-package license-snippets\n    :load-path \"/Users/blaine/emacs29.3/manual-packages/license-snippets\")\n(license-snippets-init)\n#+END_SRC\n\n#+BEGIN_SRC emacs-lisp\n(message \"Fnished Y package configurations!!\")\n#+END_SRC\n\n\n* Z\n\n#+BEGIN_SRC emacs-lisp\n(message \"Finished package configurations!!\")\n#+END_SRC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmooerslab%2Femacs-simple-init-org","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmooerslab%2Femacs-simple-init-org","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmooerslab%2Femacs-simple-init-org/lists"}