├── .gitignore
├── DOCUMENTATION.org
├── LICENSE
├── README.org
├── early-init.el
├── init.el
├── lambda-library
├── lambda-logo-black.png
├── lambda-logo-white.png
├── lambda-setup
│ ├── lem-setup-buffers.el
│ ├── lem-setup-citation.el
│ ├── lem-setup-colors.el
│ ├── lem-setup-completion.el
│ ├── lem-setup-dashboard.el
│ ├── lem-setup-debug.el
│ ├── lem-setup-dired.el
│ ├── lem-setup-elfeed.el
│ ├── lem-setup-eshell.el
│ ├── lem-setup-faces.el
│ ├── lem-setup-fonts.el
│ ├── lem-setup-frames.el
│ ├── lem-setup-functions.el
│ ├── lem-setup-help.el
│ ├── lem-setup-icomplete.el
│ ├── lem-setup-keybindings.el
│ ├── lem-setup-libraries.el
│ ├── lem-setup-macos.el
│ ├── lem-setup-macros.el
│ ├── lem-setup-modeline.el
│ ├── lem-setup-navigation.el
│ ├── lem-setup-notes.el
│ ├── lem-setup-org-base.el
│ ├── lem-setup-org-extensions.el
│ ├── lem-setup-org-settings.el
│ ├── lem-setup-pdf.el
│ ├── lem-setup-programming.el
│ ├── lem-setup-projects.el
│ ├── lem-setup-scratch.el
│ ├── lem-setup-search.el
│ ├── lem-setup-server.el
│ ├── lem-setup-settings.el
│ ├── lem-setup-shell.el
│ ├── lem-setup-skeleton.el
│ ├── lem-setup-splash.el
│ ├── lem-setup-tabs.el
│ ├── lem-setup-theme.el
│ ├── lem-setup-vc.el
│ ├── lem-setup-windows.el
│ ├── lem-setup-workspaces.el
│ └── lem-setup-writing.el
├── lambda-splash.txt
└── lem-default-config.el
└── screenshots
├── agenda.png
├── dark-splash.png
├── eshell.png
├── light-splash.png
├── minibuffer.png
└── org.png
/.gitignore:
--------------------------------------------------------------------------------
1 | *.DS_Store
2 |
--------------------------------------------------------------------------------
/DOCUMENTATION.org:
--------------------------------------------------------------------------------
1 | :PROPERTIES:
2 | :ID: 20220623T011222.999171
3 | :END:
4 | #+TITLE: Lambda-Emacs Documentation
5 | #+DATE: May 03, 2022
6 | #+AUTHOR: Colin McLear
7 |
8 | Lambda-Emacs (𝛌-Emacs, or LEM) is intended to serve three goals. First, as a
9 | useful starting point for the user's own custom configuration. Second, and
10 | relatedly, as providing enough commentary on configuring Emacs such that it
11 | might be useful to those new to emacs or even text-editors generally. Third, as
12 | a "starter-kit" for writing and academic work in the humanities.
13 |
14 | * 𝛌-Emacs File-Directory Structure
15 |
16 | The configuration consists of a set of files specific to the user (all stored in
17 | the value of =lem-user-dir= ("lambda-user" by default)) and more general files for
18 | 𝛌-Emacs (init.el and the setup files in the value of =lem-setup-dir=
19 | ("lambda-setup" by default)). The structure is as follows:
20 |
21 | - Directory Structure:
22 | + Emacs directory (.emacs.d)
23 | * Library directory (lambda-library)
24 | - Lambda-Emacs setup files (lambda-setup)
25 | - User directory (lambda-user)
26 | + user =config.el= file
27 | + lambda-/user/ setup-files
28 | + user custom themes directory
29 | * "Variable" directory (var) – contains files that are often changed by the system
30 | - Volatile storage (cache)
31 | - Non-volatile storage (etc)
32 | - External packages or lisp hacking
33 | - File structure:
34 | + early-init.el
35 | + early-config.el (in lambda-user, supplied by user, if any)
36 | + init.el
37 | + config.el (in lambda-user, supplied by user, if any)
38 |
39 | Ideally the user will not need to do anything to the files =early-init.el=,
40 | =init.el=, and those in =lambda-setup=, though they should read the code to get a
41 | sense of what each file/module does. I have tried to annotate the code sufficiently so
42 | that it does not assume deep familiarity with elisp to understand the basics of what
43 | is going on.
44 |
45 | All personal configuration by the user should go in =config.el= in the
46 | =lambda-user= directory. This includes setting all variables, such as theme, font,
47 | and bibliography and notes files.
48 |
49 | * 𝛌-Emacs Customizable Variables
50 | :PROPERTIES:
51 | :ID: 20220720T151238.406634
52 | :END:
53 | | Variable | Purpose |
54 | |----------------------------+--------------------------------------------------------|
55 | | lem-prefix | Prefix for personal keybindings |
56 | | lem-ui-default-font | User default font |
57 | | lem-ui-variable-width-font | Variable width font |
58 | | lem-persistent-scratch | Whether to make scratch buffer persist across sessions |
59 | | lem-scratch-save-dir | Where to save scratch file |
60 | | lem-scratch-default-dir | Default dir for scratch buffer |
61 | | lem-ui-theme | User prefererred theme |
62 | | lem-ui-mac-system-theme | On MacOS match system appearance settings |
63 | | lem-custom-themes-dir | Directory for custom lambda-themes |
64 | | lem-bib-notes | File for reference notes |
65 | | lem-bibliography | User bibliography used in citations |
66 | | lem-notes-dir | Directory for user notes |
67 | | lem-citar-note | Template for citar notes |
68 | | lem-project-dir | Directory for user projects |
69 | | lem-user-elisp-dir | Directory for personal elisp projects |
70 | | lem-splash-footer | Splash footer message |
71 |
72 | =lem-prefix= defaults to =C-c C-SPC= and =lem-ui-theme= defaults to =lambda-themes=. The other variables need to be set by the user in the =config.el= file in the =lem-user-dir=.
73 |
74 | In any case, be sure to set these variables in your =config.el= file *before* loading any specific modules.
75 |
76 |
77 | * Package Management
78 | Lambda-Emacs uses the built-in package.el and package-vc.el to manage "[[https://www.gnu.org/software/emacs/manual/html_node/emacs/Packages.html][packages]]" (i.e. lisp libraries that enhance and extend Emacs' functionality). The new vc features of Emacs 29 easily allow the user to add packages from any source (melpa, elpa, gituhub, gitlab, etc.).
79 |
80 | Otherwise any packages you would like you can install yourself using =M-x package-install=. You "declare" these packages in your =config.el= file like so, integrating with use-package:
81 |
82 | #+begin_src emacs-lisp
83 | (use-package my-package
84 | :config
85 | (setq my-package-setting))
86 | #+end_src
87 |
88 | When updating packages use =package-update-all= to update all packages. See the [[info:emacs#Package Installation][info entry on package installation]] for further details. Before installing a package be sure it isn't already installed and configured in =lem-setup-dir=. To see if a package is already installed use =M-x find-library= and type the package name. By default package.el installs all packages with a ~use-package~ entry. This can be changed by setting =lem-package-ensure-packages= to nil in your user configuration file.
89 |
90 | * Modules
91 | Lambda-Emacs provides a series of "modules" for allowing the user to get up and running with using Emacs productively. Each module configures a package (or set of packages) and provides some reasonable defaults. The modules should be thought of as a starting point for scaffolding the user's configuration. A module only provides such configuration if it is loaded, either in the user's =config.el= file or by default if there is no such file.
92 |
93 | The user can override a module in one of two ways. They can load it and change settings in the user =config.el= file. This is perhaps the best way to make small tweaks to any setting in an =lem-setup-*= file. Alternatively, if the user wants to make more elaborate changes, the best thing to do is copy over any desired setup from the original module to a new user module (which the user creates in the =lem-user-dir=) and to load that module instead. This allows the user to easily keep track of any upstream changes to the Lambda-Emacs setup files while also providing whatever custom configuration the user wants.
94 |
95 | * Code Conventions
96 | - Where appropriate, use =custom-set-variable= rather than =setq= when dealing with
97 | =defcustom= variables. For some discussion see [[https://emacs.stackexchange.com/questions/102/advantages-of-setting-variables-with-setq-instead-of-custom-el][this stack exchange discussion]].
98 | - Please consult the elisp [[https://github.com/bbatsov/emacs-lisp-style-guide][style guide]] for all style conventions with regard to
99 | naming, etc.
100 | + Note that all functions and variables are prefixed with the "lem" namespace.
101 | + Internal functions have their namespace delineated by "-\-" while
102 | user-facing functions have only a single "-".
103 | - Provide =defcustom= variables for things we expect the user to modify and
104 | make sure it is in the appropriate group.
105 | - Prefer =customize-set-variable= instead of =setq= for =defcustom= values. This helps
106 | make sure constructors or setters attached to the variable are run when the
107 | value is set.
108 | - Provide verbose doc-strings for =defvar=, =defcustom=, =defun=, =defmacro=,
109 | etc to clearly document what is going on.
110 | - Make sure to follow doc-string guidelines (see [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Documentation-Tips.html][Documentation Tips]] or [[info:elisp#Documentation Tips][elisp#Documentation Tips]])
111 | - Add comments for blocks of code, especially to describe /why/ the code is
112 | present, or the intention. These comments serve as documentation when reading
113 | the code where a doc-string is not an option.
114 | - Add appropriate headers for sections of code
115 | - Where appropriate, order packages alphabetically, e.g., in a setup file.
116 | - Add or update documentation in the /docs/ folder.
117 | - If your PR addresses an issue, whether it closes or fixes the issue, or is
118 | just related to it, please add the issue number in your commit message or
119 | the description of your PR so they can be linked together.
120 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 mclear-tools
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.org:
--------------------------------------------------------------------------------
1 | #+html:
2 | #+html:
3 | #+html:
4 |
5 | Lambda-Emacs (𝛌-Emacs) is an Emacs configuration aimed at those engaged in writing and academic work in the humanities (for discussion of my view of the use of text editors in the humanities [[https://www.colinmclear.net/posts/texteditor/][see here]]), rather than opposed to, e.g., a programming language emphasis, though I've tried to make it user-friendly for programmers as well. Another goal of 𝛌-Emacs is to provide enough commentary on the configuration such that it might be useful to those new to emacs or even [[https://en.wikipedia.org/wiki/Text_editor][text-editors]] generally. In either case it is intended to serve as a useful starting point for one's own custom configuration. *Note* that Lambda-Emacs is only compatible with Emacs 29+. However, parts of the configuration may easily be backported to older versions of Emacs.
6 |
7 | #+BEGIN_HTML
8 |
9 |

10 |

11 |

12 |

13 |

14 |

15 |
16 | #+END_HTML
17 |
18 | The themes here are from [[https://github.com/Lambda-Emacs/lambda-themes][lambda-themes.]]
19 |
20 | * Why use 𝛌-Emacs?
21 |
22 | There are a great number of amazing Emacs "distros" out there, such as (if you use vim-bindings) [[http://spacemacs.org][spacemacs]], or [[https://github.com/hlissner/doom-emacs][doom-emacs]], or the more traditional configurations of [[Https://github.com/purcell/emacs.d][Purcell]], [[https://github.com/bbatsov/prelude][Batsov (prelude)]], [[https://github.com/seagle0128/.emacs.d][Zhang (Centaur Emacs)]], the [[https://github.com/gilbertw1/bmacs][bmacs]] configuration of Bryan Gilbert (see also his [[https://github.com/gilbertw1/emacs-literate-starter][literate starter kit]]) and [[https://github.com/novoid/dot-emacs][Karl Voit's]] config, John Kitchen's [[https://github.com/jkitchin/scimax][scimax]], Kieran Healy's [[https://github.com/kjhealy/emacs-starter-kit][social sciences starter kit]], and [[https://github.com/caisah/emacs.dz][many others]]. Further helpful starts include [[https://github.com/hrs/sensible-defaults.el][sensible defaults]] or especially [[https://github.com/SystemCrafters/crafted-emacs][Crafted Emacs]]. There are also the recent stylings of [[https://github.com/rougier][Nicolas Rougier's]] [[https://github.com/rougier/elegant-emacs][elegant-emacs]] and [[https://github.com/rougier/nano-emacs][nano-emacs]]. Truly a surfeit of riches. Why choose this configuration over any of these others? Indeed, why did I bother to write another one at all? Here are three reasons. First, much of it already existed as part of my personal Emacs config. 𝛌-Emacs is largely an abstraction from this, which I wanted to make more easily available to others. Second, I also wanted a clean but useful config to which I could point my students. Finally, setting this up is a useful way for me to think about how "best" to configure Emacs.
23 |
24 | * 𝛌-Emacs Features
25 |
26 | 1. Short start up time -- emacs-init-time < 1 sec (though this may vary somewhat
27 | depending on your system)
28 | 2. Uses the built-in package.el and package-vc.el for package management
29 | 3. Comprehensive keybindings using [[https://github.com/jwiegley/use-package/blob/master/bind-key.el][bind-key]]
30 | 4. Sensible defaults
31 | 5. Dired with sensible colors and settings
32 | 6. Completion with [[https://github.com/minad/vertico][Vertico]] and related packages
33 | 7. [[https://github.com/Lambda-Emacs/lambda-themes][Lambda-themes]], with toggles for dark/light mode & various other options
34 | 8. A custom status-line, [[https://github.com/Lambda-Emacs/lambda-line][Lambda-line]]
35 | 9. Extensive MacOS integration
36 | 10. Tab-based project workflow leveraging the built-in project.el
37 | and tab-bar, with [[https://github.com/mclear-tools/tabspaces][buffer-isolated tab/workspaces]]
38 | 11. A configurable splash page
39 | 12. A writing-centric configuration with great citation support, markdown, [[https://github.com/jgm/pandoc][pandoc]],
40 | [[https://github.com/mclear-tools/consult-notes][dedicated functions for notes]] and note-taking (using [[https://github.com/protesilaos/denote][denote]]), and settings for org-mode
41 |
42 | * 𝛌-Emacs Modules
43 |
44 | 𝛌-Emacs is a "modular" distribution of Emacs. It consists of a set of "setup"
45 | elisp files grouped according to the following areas (*NOTE*: these are still works in progress):
46 |
47 | - *Core*: These files load essential libraries, useful functions, macros, and sane
48 | settings.
49 | - *UI*: Primary settings concerning frame, window, and buffer interaction, along
50 | with fonts, faces, themeing, and completion all belong to this group.
51 | - *Navigation & Search*: Useful navigation and search functions, plus setup and
52 | extension of the built-in dired file manager.
53 | - *Writing & Editing*: Settings for spelling, citation (using citar and completion
54 | at point), dictionary, notes (using consult-notes), typesetting (LaTeX) and
55 | writing-specific modes (markdown and org).
56 | - *Org*: Writing, Project management, TODOs, Literate programming. What doesn't
57 | org do? Since many people use Emacs almost exclusively for org-mode, it
58 | warrants its own group. There are three modules. There is =lem-setup-org-base=,
59 | which provides a base configuration. It also loads (optionally) two further
60 | modules, =lem-setup-org-settings= and =lem-setup-org-extensions=. The former
61 | provides configuration for various built-in aspects of org, including the
62 | agenda. The latter provides a variety of useful additional packages, including
63 | styling with =org-modern=. Note that no capture templates, etc., are set here.
64 | The interested user might want to consult my [[https://github.com/mclear-tools/dotemacs/blob/master/cpm-setup-org.el][dotfiles org]] setup as well as the
65 | [[https://systemcrafters.cc/emacs-from-scratch/organize-your-life-with-org-mode/][System Crafters]] tutorial.
66 | - *Programming & Languages*: Editing and Language specific settings.
67 | - *Shell*: Configuration for compilation, shell, and terminal (vterm).
68 | - *Eshell*: Configuration for the Emacs eshell
69 | - *Workspaces*: Version control, tab settings, buffer-isolation, and other
70 | configuration for the built-in project.el and tab-bar.el
71 |
72 | See the [[file:DOCUMENTATION.org][documentation]] (WIP) for further details.
73 |
74 | * Getting Started
75 |
76 | 1. Clone lambda-emacs as a directory named "emacs.d" (NOTE: you should back-up your current emacs
77 | config if you have one!): =git clone https://github.com/Lambda-Emacs/lambda-emacs.git ~/.emacs.d=
78 | 2. Run Emacs -- it will ask at startup if you want to generate a user
79 | configuration file, if you do it will generate that file and start up with
80 | some basic packages (this requires an internet connection and may take a
81 | little while to complete). If you do not create a config file Emacs will
82 | start with all the default packages in Lambda-Emacs (which will take time to
83 | fully download).
84 | 3. Put whatever settings you prefer in your config file. This should include
85 | things like the font you prefer and whatever other variable settings you
86 | might like. For some hints see my [[https://github.com/mclear-tools/dotemacs/blob/master/config.el][configuration file]] and the list of
87 | variables in the [[id:20220623T011222.999171][docs]].
88 | 4. For further questions please look at the [[id:20220623T011222.999171][documentation]] or ask a question on the [[https://discord.gg/NtYcrRtTxg][Lambda-Emacs discord]].
89 |
90 |
--------------------------------------------------------------------------------
/init.el:
--------------------------------------------------------------------------------
1 | ;;; init.el -*- lexical-binding: t; mode: emacs-lisp; coding:utf-8; fill-column: 80 -*-
2 | ;; Author: Colin McLear
3 | ;; Maintainer: Colin McLear
4 | ;; Version: 0.3
5 |
6 | ;; This file is not part of GNU Emacs
7 |
8 | ;; This program is free software: you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 | ;; This is the base init file to load the entire emacs config. For ease of
23 | ;; navigation use outline-mode to cycle headlines open and closed ( and
24 | ;; ) to navigate through sections, and "imenu" to locate individual
25 | ;; use-package definitions.
26 |
27 | ;;; Code:
28 | ;;;; Startup
29 |
30 | ;;;;; Use-Package
31 |
32 | ;; Install use-package to manage package setup. If using Emacs 29 or later
33 | ;; use-package is built-in.
34 | (when (version< emacs-version "29")
35 | (package-refresh-contents)
36 | (package-install 'use-package))
37 |
38 | ;; Use-Package Settings
39 | (use-package use-package
40 | :custom
41 | ;; Don't automatically defer
42 | (use-package-always-defer nil)
43 | ;; Report loading details
44 | (use-package-verbose t)
45 | ;; This is really helpful for profiling
46 | (use-package-minimum-reported-time 0)
47 | ;; Expand normally
48 | (use-package-expand-minimally nil)
49 | ;; Unless otherwise set, manually handle package install -- see early-config.el
50 | (use-package-always-ensure (if lem-package-ensure-packages t nil))
51 | ;; Navigate use-package declarations w/imenu
52 | (use-package-enable-imenu-support t))
53 |
54 | ;;;;; El-Patch
55 | ;; Package for helping advise/modify features of other packages
56 | (use-package el-patch
57 | :ensure t
58 | :hook (emacs-startup . el-patch-use-package-mode)
59 | :custom
60 | (el-patch-enable-use-package-integration t))
61 |
62 | ;;;;; Security
63 | ;; Properly verify outgoing ssl connections.
64 | ;; See https://glyph.twistedmatrix.com/2015/11/editor-malware.html
65 | (use-package gnutls
66 | :ensure nil
67 | :defer 1
68 | :custom
69 | (gnutls-verify-error t)
70 | (gnutls-min-prime-bits 3072))
71 |
72 | ;;;;; Auto-compile
73 | ;; Automatically byte-recompile changed elisp libraries
74 | (use-package auto-compile
75 | :ensure t
76 | :defer 1
77 | :custom
78 | (auto-compile-display-buffer nil)
79 | (auto-compile-mode-line-counter nil)
80 | (auto-compile-use-mode-line nil)
81 | (auto-compile-update-autoloads t)
82 | :config
83 | (auto-compile-on-load-mode)
84 | (auto-compile-on-save-mode))
85 |
86 | ;;;;; Command Line Switches
87 |
88 | ;; Conditionally load parts of config depending on command line switches.
89 | ;; This allows startup with a clean emacs that still recognizes straight.
90 | ;; Helpful for testing packages.
91 | ;; Use (straight-use-package) command to selectively load packages.
92 | ;; See https://emacs.stackexchange.com/a/34909/11934
93 | ;; For function switch see https://stackoverflow.com/a/4065412/6277148
94 |
95 | ;; NOTE: The variable here doesn't really do anything. It is just useful to keep
96 | ;; for a record of switches.
97 | (defvar lem-config-switches
98 | '("basic"
99 | "clean"
100 | "core"
101 | "test")
102 | "Custom switches for conditional loading from command line.
103 | `clean' loads only the `init.el' file w/no personal config; `core'
104 | loads the set of modules set in `lem-core-modules'; `test' loads
105 | only a `lem-setup-test.el' file for easy testing.")
106 |
107 | (defun lem--emacs-switches (switch)
108 | "Depending on command line argument SWITCH, load Emacs with minimal settings & no modules; useful for testing."
109 | (let ((found-switch (member switch command-line-args)))
110 | (setq command-line-args (delete switch command-line-args))
111 | found-switch))
112 |
113 | ;;;;; Emacs Build Version
114 | ;; When built with https://github.com/mclear-tools/build-emacs-macos, Emacs has
115 | ;; git-version patch to include git sha1 in emacs-version string.
116 | (setq site-lisp "/Applications/Emacs.app/Contents/Resources/site-lisp/")
117 | (when (file-exists-p (concat site-lisp "emacs-git-version.el"))
118 | (require 'emacs-git-version))
119 |
120 | (defun lem-emacs-version ()
121 | "A convenience function to print the emacs-version in the echo-area/*messages* buffer and put
122 | emacs-version string on the kill ring."
123 | (interactive)
124 | (let ((emacs (emacs-version)))
125 | (message (emacs-version))
126 | (kill-new emacs)))
127 |
128 | ;;;;; Outline Navigation
129 | ;; Navigate elisp files easily. Outline is a built-in library and we can easily
130 | ;; configure it to treat elisp comments as headings.
131 | (use-package outline
132 | :ensure nil
133 | :hook (prog-mode . outline-minor-mode)
134 | :bind (:map outline-minor-mode-map
135 | ("" . outline-cycle)
136 | ("S-" . outline-cycle-buffer)
137 | ("M-j" . outline-move-subtree-down)
138 | ("M-k" . outline-move-subtree-up)
139 | ("M-h" . outline-promote)
140 | ("M-l" . outline-demote))
141 | :config
142 | (add-hook 'emacs-lisp-mode-hook
143 | (lambda ()
144 | ;; prevent `outline-level' from being overwritten by `lispy'
145 | (setq-local outline-level #'outline-level)
146 | ;; setup heading regexp specific to `emacs-lisp-mode'
147 | (setq-local outline-regexp ";;;\\(;* \\)")
148 | ;; heading alist allows for subtree-like folding
149 | (setq-local outline-heading-alist
150 | '((";;; " . 1)
151 | (";;;; " . 2)
152 | (";;;;; " . 3)
153 | (";;;;;; " . 4)
154 | (";;;;;;; " . 5))))))
155 |
156 | ;;;;; Load Configuration Modules
157 | ;; Lambda-Emacs loads a series of lisp-libraries or 'modules'. Which modules are
158 | ;; loaded is left to the user to set in `config.el', though if there is no
159 | ;; `config.el' file a default set of modules will be loaded.
160 |
161 | (defun lem--default-modules ()
162 | "Load a default configuration for 𝛌-Emacs."
163 | (message "
164 | ;; ======================================================
165 | ;; *Loading default setup of 𝛌-Emacs Modules*
166 | ;; ======================================================")
167 | (measure-time
168 | (cl-dolist (mod (list
169 | ;; Core modules
170 | 'lem-setup-libraries
171 | 'lem-setup-settings
172 | 'lem-setup-functions
173 | 'lem-setup-server
174 | 'lem-setup-scratch
175 |
176 | ;; UI modules
177 | 'lem-setup-frames
178 | 'lem-setup-windows
179 | 'lem-setup-buffers
180 | 'lem-setup-fonts
181 | 'lem-setup-faces
182 | 'lem-setup-colors
183 | 'lem-setup-completion
184 | 'lem-setup-keybindings
185 | 'lem-setup-help
186 | 'lem-setup-modeline
187 | 'lem-setup-theme
188 | 'lem-setup-splash
189 |
190 | ;; Navigation & Search modules
191 | 'lem-setup-navigation
192 | 'lem-setup-dired
193 | 'lem-setup-search
194 |
195 | ;; Project & Tab/Workspace modules
196 | 'lem-setup-vc
197 | 'lem-setup-projects
198 | 'lem-setup-tabs
199 |
200 | ;; Org modules
201 | 'lem-setup-org-base
202 | 'lem-setup-org-settings
203 |
204 | ;; Writing modules
205 | 'lem-setup-writing
206 | 'lem-setup-notes
207 | 'lem-setup-citation
208 |
209 | ;; Shell & Terminal
210 | 'lem-setup-shell
211 | 'lem-setup-eshell
212 |
213 | ;; Programming modules
214 | 'lem-setup-programming
215 |
216 | ;; Productivity
217 | 'lem-setup-pdf))
218 | (require mod))))
219 |
220 | (defun lem--minimal-modules ()
221 | "Load 𝛌-Emacs with a minimal set of modules."
222 | (message "
223 | ;; ======================================================
224 | ;; *Loading 𝛌-Emacs, with minimal modules*
225 | ;; ======================================================")
226 | (measure-time
227 | (cl-dolist (mod (list
228 | ;; Core modules
229 | 'lem-setup-libraries
230 | 'lem-setup-settings
231 | 'lem-setup-functions
232 | 'lem-setup-server
233 | 'lem-setup-scratch
234 |
235 | ;; UI modules
236 | 'lem-setup-frames
237 | 'lem-setup-windows
238 | 'lem-setup-buffers
239 | 'lem-setup-completion
240 | 'lem-setup-keybindings
241 | 'lem-setup-help
242 | 'lem-setup-modeline
243 | 'lem-setup-splash
244 |
245 | ;; Navigation & Search modules
246 | 'lem-setup-navigation
247 | 'lem-setup-dired
248 | 'lem-setup-search))
249 | (require mod))))
250 |
251 | ;; Conditionally load configuration files based on command-line switches,
252 | ;; presence of user-config file, or the default set of modules.
253 | (cond
254 | ;; Load a subset of modules only, ignore other configuration.
255 | ((lem--emacs-switches "-minimal")
256 | (message "*Loading a subset of 𝛌-Emacs modules *only*, ignoring personal user configuration.*")
257 | (lem--minimal-modules))
258 |
259 | ;; Load test module only. This is useful for testing a specific package
260 | ;; against vanilla/default emacs settings.
261 | ((lem--emacs-switches "-test")
262 | (message "*Loading test module only*")
263 | (require 'lem-setup-test))
264 |
265 | ;; Load no libraries other than the built-in icomplete, for better completion.
266 | ((lem--emacs-switches "-vanilla")
267 | (message "*Do not load 𝛌-Emacs setup files. Loading a clean vanilla setup plus icomplete*")
268 | (require 'lem-setup-icomplete))
269 |
270 | ;; Load user's personal config file (if it exists) and hasn't been bypassed
271 | ;; by a command-line switch to load the default libraries.
272 | ((and (not (lem--emacs-switches "-default"))
273 | (file-exists-p lem-config-file))
274 | (message "*Loading 𝛌-Emacs & user config*")
275 | (load lem-config-file 'noerror))
276 |
277 | ;; Load default config
278 | ((lem--emacs-switches "-default")
279 | (message "*Loading 𝛌-Emacs default modules")
280 | (lem--default-modules)
281 | ;; MacOS settings - defer load until after init.
282 | (when sys-mac
283 | (message "*Load MacOS settings...*")
284 | (measure-time
285 | (run-with-idle-timer 1 nil
286 | (function require)
287 | 'lem-setup-macos nil t))))
288 |
289 | ;; Ask if user would like to create a config file.
290 | ((when (not (file-exists-p lem-config-file))
291 | (yes-or-no-p "Would you like to create a user configuration file? ")
292 | (progn
293 | (with-temp-file lem-config-file
294 | (insert-file lem-default-config-file))
295 | (load-file lem-config-file))))
296 | ;; Load default modules
297 | (t
298 | (message "*Loading 𝛌-Emacs default configuration files.*")
299 | (lem--default-modules)
300 | ;; MacOS settings - defer load until after init.
301 | (when sys-mac
302 | (message "*Load MacOS settings...*")
303 | (measure-time
304 | (run-with-idle-timer 1 nil
305 | (function require)
306 | 'lem-setup-macos nil t)))))
307 |
308 |
309 | ;;;; After Startup
310 | ;; reset file-name-handler-alist
311 | (add-hook 'emacs-startup-hook (lambda ()
312 | (setq file-name-handler-alist lem-file-name-handler-alist)
313 | ;; reset garbage collection
314 | (setq gc-cons-threshold 800000)
315 | ;; Startup time
316 | (message (format ";; ======================================================\n;; Emacs ready in %.2f seconds with %d garbage collections.\n;; ======================================================"
317 | (float-time
318 | (time-subtract after-init-time before-init-time)) gcs-done)
319 | (put 'narrow-to-page 'disabled nil))))
320 |
--------------------------------------------------------------------------------
/lambda-library/lambda-logo-black.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lambda-Emacs/lambda-emacs/d401af38014d625bb9eb89bcd777526ae11308fd/lambda-library/lambda-logo-black.png
--------------------------------------------------------------------------------
/lambda-library/lambda-logo-white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lambda-Emacs/lambda-emacs/d401af38014d625bb9eb89bcd777526ae11308fd/lambda-library/lambda-logo-white.png
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-buffers.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-buffers.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 |
20 | ;;; Commentary:
21 |
22 | ;; Setup for buffers
23 |
24 | ;;; Code:
25 |
26 | ;;;; Hooks
27 | ;; See https://github.com/doomemacs/doomemacs/blob/master/lisp/doom-ui.el
28 | (defvar lem-switch-buffer-hook nil
29 | "A list of hooks run after changing the current buffer.")
30 |
31 | (defun lem-run-switch-buffer-hooks-h (&optional _)
32 | (let ((gc-cons-threshold most-positive-fixnum)
33 | (inhibit-redisplay t))
34 | (run-hooks 'lem-switch-buffer-hook)))
35 |
36 | ;; Initialize `lem-switch-buffer-hook'
37 | (add-hook 'window-buffer-change-functions #'lem-run-switch-buffer-hooks-h)
38 | ;; `window-buffer-change-functions' doesn't trigger for files visited via the server.
39 | (add-hook 'server-visit-hook #'lem-run-switch-buffer-hooks-h)
40 |
41 | ;;;; Scrolling
42 | (use-package emacs
43 | :ensure nil
44 | :config
45 | (message "*Loading scrolling settings...*")
46 | ;; Reduce cursor lag by a tiny bit by not auto-adjusting `window-vscroll'
47 | ;; for tall lines.
48 | (setq auto-window-vscroll nil)
49 | ;; For centered cursor scrolling
50 | ;; see https://two-wrongs.com/centered-cursor-mode-in-vanilla-emacs
51 | ;; Smooth Vertical Scroll
52 | (setq scroll-step 1)
53 | (setq scroll-margin 3)
54 | (setq scroll-conservatively 101)
55 | (setq scroll-up-aggressively 0.01)
56 | (setq scroll-down-aggressively 0.01)
57 | (setq auto-window-vscroll nil)
58 | (setq fast-but-imprecise-scrolling nil)
59 | ;; Horizontal Scroll
60 | (setq hscroll-step 1)
61 | (setq hscroll-margin 1))
62 |
63 | (use-package mwheel
64 | :ensure nil
65 | :config
66 | ;; Optimize mouse wheel scrolling for smooth-scrolling trackpad use.
67 | ;; Trackpads send a lot more scroll events than regular mouse wheels,
68 | ;; so the scroll amount and acceleration must be tuned to smooth it out.
69 | (setq
70 | ;; If the frame contains multiple windows, scroll the one under the cursor
71 | ;; instead of the one that currently has keyboard focus.
72 | mouse-wheel-follow-mouse 't
73 | ;; Completely disable mouse wheel acceleration to avoid speeding away.
74 | mouse-wheel-progressive-speed nil
75 | mwheel-coalesce-scroll-events t
76 | ;; The most important setting of all! Make each scroll-event move 1 line at a
77 | ;; time (instead of 5 at default). Simply hold down shift to move twice as
78 | ;; fast. Perfect for trackpads.
79 | mouse-wheel-scroll-amount '(1 ((shift) . 2))))
80 |
81 | ;; Don't use pixel-scroll by default -- it causes janky behavior on MacOS
82 | (use-package pixel-scroll
83 | :ensure nil
84 | :disabled)
85 |
86 |
87 | ;;;; Mouse
88 | ;; Don't be afraid of the mouse!
89 | ;; For ideas see https://ruzkuku.com/texts/emacs-mouse.html
90 | (use-package mouse
91 | :ensure nil
92 | :config
93 | ;; Focus follows mouse
94 | (setq mouse-autoselect-window t
95 | focus-follows-mouse t)
96 | (setq context-menu-functions
97 | '(context-menu-ffap
98 | occur-context-menu
99 | context-menu-region
100 | context-menu-undo
101 | context-menu-dictionary)))
102 |
103 |
104 | ;;;; Switch to Buffer Preserve Window
105 |
106 | ;; switch-to-buffer tries to preserve window-point
107 | (setq switch-to-buffer-preserve-window-point t)
108 |
109 | ;;;; Unique buffers
110 | (use-package uniquify
111 | :ensure nil
112 | :defer 3
113 | :config
114 | (setq uniquify-buffer-name-style 'reverse
115 | uniquify-separator " • "
116 | uniquify-after-kill-buffer-p t
117 | uniquify-ignore-buffers-re "^\\*"))
118 |
119 | ;;;; Buffer Modes
120 | ;; from http://www.jurta.org/en/emacs/dotemacs, set the major mode
121 | ;; of buffers that are not visiting a file
122 | (setq-default major-mode (lambda ()
123 | (if buffer-file-name
124 | (fundamental-mode)
125 | (let ((buffer-file-name (buffer-name)))
126 | (set-auto-mode)))))
127 |
128 | ;;;; Autorevert
129 | (use-package autorevert
130 | :ensure nil
131 | :hook (after-init . global-auto-revert-mode)
132 | :custom
133 | (auto-revert-verbose nil)
134 | (auto-revert-interval .5)
135 | (revert-without-query '(".*")) ;; disable revert query
136 | (global-auto-revert-non-file-buffers t)
137 | :config
138 | (global-auto-revert-mode))
139 |
140 |
141 | ;;;; Revert All Buffers
142 | (use-package revert-buffer-all
143 | :commands (revert-buffer-all))
144 |
145 | ;;;; Popper (Pop-up Buffers)
146 | (use-package popper
147 | :hook (after-init . popper-mode)
148 | :bind (("M-`" . popper-toggle-latest)
149 | ("C-`" . popper-cycle)
150 | ("C-M-`" . popper-toggle-type))
151 | :custom
152 | (popper-window-height 20)
153 | (popper-display-control t)
154 | ;; set display to top -- if user prefers they can set this to `bottom'
155 | (popper-display-function #'popper-select-popup-at-top)
156 | ;; group by project.el project root, with fall back to default-directory
157 | (popper-group-function #'popper-group-by-directory)
158 | ;; Set popper buffers
159 | (popper-reference-buffers
160 | '("\\*Messages\\*"
161 | "Output\\*$"
162 | "\\*Async Shell Command\\*"
163 | help-mode
164 | compilation-mode))
165 | :init
166 | ;; For echo area hints
167 | (popper-echo-mode +1)
168 | :config
169 | ;; Display functions for popup buffers at top, where they are easy to read.
170 | ;; This is just a slight modification of the existing functions.
171 | (defun popper-select-popup-at-top (buffer &optional _alist)
172 | "Display and switch to popup-buffer BUFFER at the top of the screen."
173 | (let ((window (popper-display-popup-at-top buffer)))
174 | (select-window window)))
175 |
176 | (defun popper-display-popup-at-top (buffer &optional _alist)
177 | "Display popup-buffer BUFFER at the top of the screen."
178 | (display-buffer-in-side-window
179 | buffer
180 | `((window-height . ,popper-window-height)
181 | (side . top)
182 | (slot . 1)))))
183 |
184 | ;;;; Xwidget Browser
185 | (use-package xwidget
186 | :ensure nil
187 | :defer 1
188 | :config
189 | ;; No query on kill
190 | (remove-hook 'kill-buffer-query-functions #'xwidget-kill-buffer-query-function)
191 | ;; NOTE: Fix load progress error
192 | (defun xwidget-webkit-estimated-load-progress (session)
193 | 1.0))
194 |
195 | (use-package xwwp-follow-link
196 | :ensure nil
197 | :custom
198 | (xwwp-follow-link-completion-system 'default)
199 | :bind (:map xwidget-webkit-mode-map
200 | ("v" . xwwp-follow-link)))
201 |
202 | ;;;; Fringe
203 | (use-package fringe
204 | :ensure nil
205 | :custom
206 | ;; allow fringe indicators
207 | (fringe-mode '(1 . 0)))
208 |
209 | ;;; Provide
210 | (provide 'lem-setup-buffers)
211 | ;;; lem-setup-buffers.el ends here
212 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-citation.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-citation.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 | ;;; Commentary:
20 |
21 | ;; Packages for academic citation. For discussion of what these various parts
22 | ;; mean see https://kristofferbalintona.me/posts/202206141852/ and
23 | ;; https://blog.tecosaur.com/tmio/2021-07-31-citations.html
24 |
25 | ;;; Code:
26 |
27 | ;;;; Citation Variables
28 | (defcustom lem-bibliography nil "User bibliography for citation."
29 | :group 'lambda-emacs
30 | :tag "Lambda-Emacs User Bibliography")
31 | (defcustom lem-bib-notes nil "User citation notes directory."
32 | :group 'lambda-emacs
33 | :tag "Lambda-Emacs Citation Notes Directory")
34 | (defcustom lem-citar-note nil "Template for use with citar notes."
35 | :group 'lambda-emacs
36 | :tag "Lambda-Emacs Citar Notes Template")
37 |
38 | ;;;; Org-Cite
39 | ;; Eventually this should be a full replacement for org-ref
40 | (use-package oc
41 | :ensure nil
42 | :after org
43 | :config
44 | (setq org-cite-global-bibliography `(,lem-bibliography))
45 | (setq org-cite-export-processors
46 | '((beamer csl)
47 | (latex csl)
48 | (t csl))))
49 |
50 | ;; Use csl
51 | (use-package oc-csl
52 | :ensure nil
53 | :after oc
54 | :init
55 | ;; make sure to download csl
56 | ;; https://citationstyles.org
57 | ;; https://github.com/citation-style-language
58 | ;; repos for styles & locales
59 | (setq org-cite-csl-styles-dir "~/.local/share/csl/styles")
60 | (setq org-cite-csl-locales-dir "~/.local/share/csl/locales"))
61 |
62 | ;;;; Citeproc
63 | (use-package citeproc
64 | :after (oc oc-csl))
65 |
66 | ;;;; Citar
67 | (use-package citar
68 | :commands (citar-open-beref
69 | citar-open-notes
70 | citar-insert-citation)
71 | :bind (:map citar-map
72 | ("b" . #'citar-open-beref))
73 | :custom
74 | ;; Use with org citation
75 | (org-cite-global-bibliography `(,lem-bibliography))
76 | (citar-bibliography `(,lem-bibliography))
77 | (org-cite-insert-processor 'citar)
78 | (org-cite-follow-processor 'citar)
79 | (org-cite-activate-processor 'citar)
80 | :config
81 | ;; use embark with at-point
82 | (setq citar-at-point-function 'embark-act)
83 | ;; add beref entry for bookends
84 | (setq citar-additional-fields '("doi" "url"))
85 | (setq citar-templates
86 | `((main . " ${=key= id:15} ${title:48}")
87 | (suffix . "${author editor:30} ${=type=:12} ${=beref=:12} ${tags keywords:*}")
88 | (preview . "${author editor} (${year issued date}) ${title}, ${journal journaltitle publisher container-title collection-title}.\n")
89 | (note . ,lem-citar-note)))
90 | (when (display-graphic-p)
91 | (setq citar-symbols
92 | `((file ,(all-the-icons-octicon "file-pdf" :face 'error) . " ")
93 | (note ,(all-the-icons-octicon "file-text" :face 'warning) . " ")
94 | (link ,(all-the-icons-octicon "link-external" :face 'org-link) . " "))))
95 | ;; edit notes
96 | (setq citar-notes-paths `(,lem-bib-notes)))
97 |
98 | (provide 'lem-setup-citation)
99 | ;;; lem-setup-citation.el ends here
100 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-colors.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-colors.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 |
20 | ;;; Commentary:
21 |
22 | ;; Setup how emacs handles colors
23 |
24 | ;;; Code:
25 |
26 | ;;;; Color
27 | (setq-default ns-use-srgb-colorspace t)
28 |
29 | ;;;; Show Colors
30 | ;; https://github.com/emacsmirror/rainbow-mode
31 | ;; Colorize color names in buffers
32 | (use-package rainbow-mode
33 | :commands rainbow-mode)
34 |
35 | (provide 'lem-setup-colors)
36 | ;;; lem-setup-colors.el ends here
37 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-dashboard.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-dashboard.el --- Dashboard setup -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 | ;;; Commentary:
20 |
21 | ;; All packages and setup related to the dashboard replacement of the splash screen. Further options or defaults may be overridden in the user's config.
22 |
23 | ;;; Code:
24 |
25 | ;;;; Dependencies
26 | ;; Load dependencies from Lambda-Emacs. Note these packages are usually deferred
27 | ;; but they must be loaded with dashboard since it requires icons.
28 | (require 'all-the-icons)
29 |
30 | ;; dashboard dependency
31 | (use-package page-break-lines
32 | :defer t
33 | :config
34 | (set-fontset-font "fontset-default"
35 | (cons page-break-lines-char page-break-lines-char)
36 | (face-attribute 'default :family)))
37 |
38 | ;;;; Dashboard
39 | (use-package dashboard
40 | ;; Use only with GUI emacs
41 | :if (display-graphic-p)
42 | :if (< (length command-line-args) 2)
43 | :custom
44 | ;; Set info & center
45 | (dashboard-set-init-info t)
46 | (dashboard-center-content t)
47 | ;; Header
48 | (dashboard-startup-banner (concat lem-library-dir (if (eq active-theme 'dark-theme)
49 | "lambda-logo-inv.png"
50 | "lambda-logo.png")))
51 |
52 | (dashboard-banner-logo-title "Welcome to Lambda-Emacs")
53 | (dashboard-image-banner-max-width 200)
54 | (dashboard-image-banner-max-height 200)
55 | ;; Footer
56 | (dashboard-set-footer t)
57 | (dashboard-footer-icon (all-the-icons-fileicon "emacs"
58 | :height 1
59 | :v-adjust -0.15
60 | :face 'font-lock-constant-face))
61 | ;; Set project backend
62 | (dashboard-projects-backend 'project-el)
63 | ;; Add icons
64 | (dashboard-set-heading-icons t)
65 | (dashboard-set-file-icons t)
66 | (dashboard-items '((bookmarks . 5)
67 | (recents . 8)
68 | (projects . 5)))
69 | :config
70 | (dashboard-setup-startup-hook)
71 | (add-hook 'emacs-startup-hook #'lem-dashboard)
72 | (add-hook 'dashboard-mode-hook #'lem-dashboard-hide-modeline))
73 |
74 | ;;;; Dashboard Functions
75 | ;; Hide modeline
76 | (defun lem-dashboard-hide-modeline ()
77 | "Hide modeline in the dashboard buffer."
78 | (let* ((dash-buffer (get-buffer "*dashboard*")))
79 | (with-current-buffer dash-buffer
80 | (setq-local hl-line-mode -1)
81 | (setq-local mode-line-format nil)
82 | (setq-local header-line-format nil))))
83 |
84 | ;; Functions to call dashboard when it kas been killed or not loaded
85 | (defun lem-dashboard ()
86 | "Load dashboard and swith to buffer."
87 | (interactive)
88 | (let ((buffer "*dashboard*"))
89 | (when (not (get-buffer buffer))
90 | (dashboard-insert-startupify-lists))
91 | (switch-to-buffer buffer))
92 | (delete-other-windows))
93 |
94 | (defun lem-goto-dashboard ()
95 | "Goto the dashboard."
96 | (interactive)
97 | (switch-to-buffer "*dashboard*"))
98 |
99 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
100 | (provide 'lem-setup-dashboard)
101 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-debug.el:
--------------------------------------------------------------------------------
1 | ;;; setup-debug.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 |
20 | ;;; Commentary:
21 |
22 | ;; Setup debugging packages
23 |
24 | ;;; Code:
25 |
26 | ;;;; Bug Hunter
27 | (use-package bug-hunter
28 | :defer 2)
29 |
30 | ;;;; Emacs Profiling
31 | ;; might be worth checking this out more closely
32 | ;; https://github.com/raxod502/radian/blob/c4246176155873d3937ff997965279048dabbc01/emacs/radian.el#L4423-L4476
33 | ;; Use fork of esup (original is unmaintained)
34 | (use-package esup
35 | :ensure nil
36 | :init
37 | (unless (package-installed-p 'esup)
38 | (package-vc-install "https://github.com/kiennq/esup.git"))
39 | :commands esup)
40 |
41 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
42 | (provide 'lem-setup-debug)
43 | ;;; setup-debug.el ends here
44 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-dired.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-dired.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 |
20 | ;;; Commentary:
21 | ;; Dired is the perfect filesystem navigator. See
22 | ;; https://www.emacswiki.org/emacs/DiredReuseDirectoryBuffer for discussion of
23 | ;; how to avoid creating lots of dired buffers.
24 |
25 | ;;; Code:
26 |
27 | ;;;; Dired Settings
28 | (use-package dired
29 | :ensure nil
30 | :commands (dired dired-jump dired-jump-other-window)
31 | :bind (:map dired-mode-map
32 | ("l" . dired-find-alternate-file)
33 | ("h" . lem-dired-updirectory))
34 | ;; "q" #'quit-window)
35 | :config
36 | ;; Function to move up a directory like in ranger
37 | (defun lem-dired-updirectory ()
38 | (interactive)
39 | (find-alternate-file ".."))
40 |
41 | (when sys-mac
42 | ;; Suppress the warning: `ls does not support --dired'.
43 | (setq dired-use-ls-dired nil)
44 | (when (executable-find "gls")
45 | ;; Use GNU ls as `gls' from `coreutils' if available.
46 | (setq insert-directory-program "gls")))
47 |
48 | (when (or (and sys-mac (executable-find "gls"))
49 | (and (not sys-mac) (executable-find "ls")))
50 | ;; Using `insert-directory-program'
51 | (setq ls-lisp-use-insert-directory-program t)
52 | ;; list directories first
53 | (setq dired-listing-switches "-laFh1v --group-directories-first"))
54 |
55 | ;; Like with ls, append "@" to file names if they're symlinks
56 | (setq dired-ls-F-marks-symlinks t)
57 | ;; don't ask about killing buffer visiting file
58 | (setq dired-clean-confirm-killing-deleted-buffers nil)
59 | ;; always delete and copy recursively
60 | (setq dired-recursive-copies 'always)
61 | (setq dired-recursive-deletes 'always)
62 | (setq dired-deletion-confirmer 'y-or-n-p)
63 | (setq dired-dwim-target t)
64 | ;; allow editing file permissions
65 | (setq wdired-allow-to-change-permissions t)
66 | ;; open PDF files in external viewer
67 | (setq dired-guess-shell-alist-user '(("\.pdf$" . default)))
68 | ;; Allow dired, gnus, & mu4e to work together
69 | (add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode))
70 |
71 | ;;;; Narrow Dired to Match Filter
72 | (use-package dired-narrow
73 | :bind* (:map dired-mode-map
74 | ("/" . dired-narrow)))
75 |
76 | ;;;; Dired Sort
77 | (use-package dired-quick-sort
78 | :bind* (:map dired-mode-map
79 | ("s" . hydra-dired-quick-sort/body)))
80 |
81 | ;;;; Dired Colors
82 | (use-package diredfl
83 | :hook (dired-mode . diredfl-global-mode))
84 |
85 | ;;;; Peep Dired
86 | (use-package peep-dired
87 | :after dired
88 | :commands (peep-dired)
89 | :bind* (:map dired-mode-map
90 | ("P" . peep-dired)
91 | :map peep-dired-mode-map
92 | ("j" . peep-dired-next-file)
93 | ("k" . peep-dired-prev-file)
94 | ("RET" . lem-peep-dired-open)
95 | ("TAB" . lem-other-window))
96 | :config
97 | ;; helper function for opening files in full window
98 | (defun lem-peep-dired-open ()
99 | "open files from peep-dired & clean-up"
100 | (interactive)
101 | (peep-dired-kill-buffers-without-window)
102 | (dired-find-file)
103 | (delete-other-windows))
104 | (setq peep-dired-ignored-extensions '("mkv" "iso" "mp4" "pdf" "gif"))
105 | (setq peep-dired-cleanup-eagerly nil)
106 | (setq peep-dired-enable-on-directories t)
107 | (setq peep-dired-cleanup-on-disable t))
108 |
109 | ;;;; Dired Ranger
110 | ;; https://github.com/Fuco1/dired-hacks#dired-ranger
111 | ;; Very helpful way of copying/moving files
112 | ;; Note that to move first you need to copy the file and then go to the target directory and move
113 | (use-package dired-ranger
114 | :after dired
115 | :bind (:map dired-mode-map
116 | ("s-c" . dired-ranger-copy)
117 | ("s-m" . dired-ranger-move)
118 | ("s-v" . dired-ranger-paste)))
119 |
120 | ;;;; Cycle Dired Buffer
121 | ;;https://www.reddit.com/r/emacs/comments/qnthhw/comment/hjiv2uc/?utm_source=share&utm_medium=web2x&context=3
122 | ;; Allow for cycling from bottom to top of dired buffer and vice versa
123 | (add-hook 'dired-mode-hook
124 | (defun lem-dired-wrap ()
125 | "Cycle from bottom to top of buffer"
126 | (make-local-variable 'post-command-hook)
127 | (add-hook 'post-command-hook
128 | (defun lem-dired-wrap-1 ()
129 | ""
130 | (if (= 1 (save-excursion
131 | (forward-line)))
132 | (goto-line 3))
133 | (if (= -1 (save-excursion
134 | (forward-line -1)))
135 | (goto-line (count-lines
136 | (point-min)
137 | (point-max))))))))
138 |
139 | (provide 'lem-setup-dired)
140 | ;;; lem-setup-dired.el ends here
141 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-elfeed.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-elfeed.el ---Setup for elfeed -*- lexical-binding: t; -*-
2 | ;; Copyright (C) 2022
3 | ;; SPDX-License-Identifier: MIT
4 | ;; Author: Colin McLear
5 |
6 | ;;; Commentary:
7 | ;; Elfeed is an extensible web feed reader for Emacs, supporting both Atom and RSS. It requires Emacs 24.3 or higher.
8 |
9 | ;; NOTE: feeds must be set by the user in their config.el file. See the
10 | ;; docstring for the `elfeed-feeds` variable for further info.
11 |
12 | ;;; Code:
13 |
14 | ;;;; Elfeed
15 | (use-package elfeed
16 | :commands (elfeed-load-db-and-open)
17 | :bind (:map elfeed-search-mode-map
18 | ("a" . elfeed-show-all)
19 | ("e" . elfeed-show-emacs)
20 | ("d" . elfeed-show-daily)
21 | ("q" . elfeed-save-db-and-bury)
22 | ("R" . elfeed-mark-all-as-read)
23 | ("U" . elfeed-update)
24 | ("p" . elfeed-play-in-external-player))
25 | :custom
26 | (elfeed-db-directory (concat lem-cache-dir ".elfeed"))
27 | :config
28 | ;; Make sure the database is created
29 | (when (not (file-exists-p (concat elfeed-db-directory "/data")))
30 | (elfeed-update))
31 | ;; Useful functions for elfeed
32 | (defun elfeed-show-all ()
33 | "Show all feeds within the last two months."
34 | (interactive)
35 | (elfeed-search-set-filter "@2-months-ago"))
36 |
37 | (defun elfeed-mark-all-as-read ()
38 | "Mark all feeds in buffer as read."
39 | (interactive)
40 | (mark-whole-buffer)
41 | (elfeed-search-untag-all-unread))
42 |
43 | (defun elfeed-play-in-external-player ()
44 | "Play with mpv."
45 | (interactive)
46 | (elfeed-search-yank)
47 | (interactive)
48 | (play-with-mpv (substring-no-properties (car kill-ring))))
49 |
50 | ;; Functions to support syncing .elfeed between machines makes sure elfeed
51 | ;; reads index from disk before launching
52 | (defun elfeed-load-db-and-open ()
53 | "Wrapper to load the elfeed db from disk before opening."
54 | (interactive)
55 | (elfeed-db-load)
56 | (elfeed)
57 | (elfeed-search-update--force))
58 |
59 | ;; Write to disk when quitting
60 | (defun elfeed-save-db-and-bury ()
61 | "Wrapper to save the elfeed db to disk before burying buffer."
62 | (interactive)
63 | (elfeed-db-save)
64 | (quit-window)))
65 |
66 | ;;;; Elfeed Tube
67 | ;; Elfeed Tube is an Emacs package for a richer, interactive, noise-free and
68 | ;; fully text-capable interface to your Youtube subscriptions and playlists
69 | ;; using Elfeed, the RSS feed reader for Emacs.
70 |
71 | (use-package elfeed-tube
72 | ;; :straight (:type git :host github :repo "karthink/elfeed-tube")
73 | :after elfeed
74 | :demand t
75 | :bind (:map elfeed-show-mode-map
76 | ("F" . elfeed-tube-fetch)
77 | ([remap save-buffer] . elfeed-tube-save)
78 | :map elfeed-search-mode-map
79 | ("F" . elfeed-tube-fetch)
80 | ([remap save-buffer] . elfeed-tube-save))
81 | :custom
82 | (elfeed-tube-auto-save-p nil) ; default value
83 | (elfeed-tube-auto-fetch-p t) ; default value
84 | :config
85 | (elfeed-tube-setup))
86 |
87 | (provide 'lem-setup-elfeed)
88 | ;;; lem-setup-elfeed.el ends here
89 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-faces.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-faces.el --- Setup for faces -*- lexical-binding: t; -*-
2 | ;; Copyright (C) 2022
3 | ;; SPDX-License-Identifier: GPL-3.0-or-later
4 | ;; Author: Colin McLear
5 | ;;; Commentary:
6 | ;;
7 | ;;; Code:
8 | ;;;; Outline Faces
9 | ;; Make outline faces look better
10 | (use-package outline-minor-faces
11 | :after outline
12 | :hook ((emacs-lisp-mode lisp-interaction-mode lisp-mode) . outline-minor-faces-mode))
13 |
14 | ;;;; What Face?
15 | ;; https://stackoverflow.com/a/66287459/6277148
16 | (defun what-face (pos)
17 | "State the face at point POS in the minibuffer."
18 | (interactive "d")
19 | (let ((face (or (get-char-property (point) 'read-face-name)
20 | (get-char-property (point) 'face))))
21 | (if face (message "Face: %s" face) (message "No face at %d" pos))))
22 |
23 | ;;;; Underline
24 | (customize-set-variable 'x-underline-at-descent-line t)
25 |
26 | ;;;; Dim inactive windows
27 | (use-package dimmer
28 | :hook (after-init . dimmer-mode)
29 | :custom
30 | (dimmer-prevent-dimming-predicates '(window-minibuffer-p))
31 | (dimmer-fraction 0.5)
32 | (dimmer-adjustment-mode :foreground)
33 | (dimmer-use-colorspace :rgb)
34 | (dimmer-watch-frame-focus-events nil)
35 | :config
36 | (dimmer-configure-which-key)
37 | (dimmer-configure-hydra)
38 | (dimmer-configure-magit)
39 | (dimmer-configure-posframe)
40 | (dimmer-configure-vertico))
41 |
42 | (defun dimmer-configure-vertico ()
43 | "Convenience settings for Dimmer & Vertico users."
44 | (with-no-warnings
45 | (add-to-list
46 | 'dimmer-buffer-exclusion-regexps "^ \\*Vertico\\*$")))
47 |
48 | ;;;; Cursor
49 | ;; don't show cursor in inactive windows
50 | (customize-set-variable 'cursor-in-non-selected-windows nil)
51 |
52 | ;;;; Reveal Mode
53 | ;; Toggle uncloaking of invisible text near point, including folded org headlines (Reveal mode).
54 | (use-package reveal
55 | :ensure nil
56 | :defer 1
57 | :config
58 | (setq reveal-auto-hide nil)
59 | (global-reveal-mode))
60 |
61 | ;;;; SVG Library (For Tags/Labels/etc.)
62 | ;;; SVG Tag Mode
63 | (use-package svg-tag-mode
64 | :when (image-type-available-p 'svg)
65 | :hook (prog-mode . svg-tag-mode)
66 | :config
67 | (setq svg-tag-tags
68 | '(;; Replaces any occurence of :XXX: with a dynamic SVG tag displaying XXX
69 | ("\\(:[A-Z]+:\\)" . ((lambda (tag)
70 | (svg-tag-make tag :face 'success :inverse t :beg 1 :end -1))))
71 | ;; other tags
72 | ("DONE:" . ((lambda (tag) (svg-tag-make "DONE:" :face 'fringe :inverse t ))))
73 | ("FIXME:" . ((lambda (tag) (svg-tag-make "FIXME:" :face 'error :inverse t))))
74 | ("HACK:" . ((lambda (tag) (svg-tag-make "HACK:" :face 'warning :inverse t))))
75 | ("NOTE:" . ((lambda (tag) (svg-tag-make "NOTE:" :face 'warning :inverse t))))
76 | ("TODO:" . ((lambda (tag) (svg-tag-make "TODO:" :face 'warning :inverse t)))))))
77 |
78 | ;;;; Widgets
79 | (use-package wid-edit
80 | :ensure nil
81 | :defer 1
82 | :custom
83 | ;; No ugly button for checkboxes
84 | (widget-image-enable nil))
85 |
86 | ;;;; Highlight
87 |
88 | ;;;;; Highlight Numbers & TODOS
89 | (use-package highlight-numbers
90 | :defer t
91 | :commands highlight-numbers-mode
92 | :init
93 | (add-hook 'prog-mode-hook #'highlight-numbers-mode))
94 |
95 | (use-package hl-todo
96 | :defer t
97 | :commands hl-todo-mode
98 | :init
99 | ;; (add-hook 'org-mode-hook #'hl-todo-mode)
100 | (add-hook 'prog-mode-hook #'hl-todo-mode)
101 | (add-hook 'markdown-mode-hook #'hl-todo-mode))
102 |
103 | ;; hydra for TODOs
104 | (with-eval-after-load 'hydra
105 | (defhydra lem-hydra-todo
106 | (:pre
107 | (hl-todo-mode 1)
108 | :post
109 | (hl-todo-mode -1))
110 | "Todo"
111 | ("n" hl-todo-next "Next")
112 | ("p" hl-todo-previous "Previous")
113 | ("o" hl-todo-occur "Occur")
114 | ("q" nil "Quit" :color blue :exit t)))
115 |
116 | ;; ;;https://github.com/erickgnavar/dotfiles/tree/master/.emacs.d#highlight-todo-fixme-etc
117 | ;; (defun lem-highlight-todo-like-words ()
118 | ;; (font-lock-add-keywords
119 | ;; nil `(("\\<\\(FIXME\\|TODO\\|NOTE\\)"
120 | ;; 1 font-lock-warning-face t))))
121 |
122 |
123 | ;; (add-hook 'prog-mode-hook 'my/highlight-todo-like-words)
124 |
125 |
126 | ;;;;; Highlight Cursor Line with Pulse
127 | ;; From https://karthinks.com/software/batteries-included-with-emacs/
128 | ;; Replace external package with internal command
129 |
130 | (use-package pulse
131 | :bind
132 | ("C-" . pulse-line)
133 | :commands (pulse-line pulse-momentary-highlight-one-line)
134 | :config
135 | (setq pulse-delay 0.08)
136 | (defun pulse-line (&rest _)
137 | "Pulse the current line."
138 | (interactive)
139 | (pulse-momentary-highlight-one-line (point)))
140 | ;; pulse for commands
141 | (dolist (command '(scroll-up-command scroll-down-command
142 | recenter-top-bottom other-window))
143 | (advice-add command :after #'pulse-line))
144 | ;; pulse on window change
145 | (push 'pulse-line window-selection-change-functions))
146 |
147 | ;;;; Goggles (Highlight Changes)
148 | (use-package goggles
149 | :hook ((prog-mode text-mode) . goggles-mode)
150 | :config
151 | (setq-default goggles-pulse t)) ;; set to nil to disable pulsing
152 |
153 | ;;;; Empty Lines
154 | ;; Don't show empty lines.
155 | ;; .. Allows you to tell if there are blank lines at the end of the file.
156 | (setq-default indicate-empty-lines nil)
157 |
158 |
159 | (provide 'lem-setup-faces)
160 | ;;; lem-setup-faces.el ends here
161 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-fonts.el:
--------------------------------------------------------------------------------
1 | ;;;; lem-setup-fonts.el ---Setup for fonts -*- lexical-binding: t; -*-
2 | ;; Copyright (C) 2022
3 | ;; SPDX-License-Identifier: GPL-3.0-or-later
4 | ;; Author: Colin McLear
5 |
6 | ;;; Commentary:
7 | ;;
8 | ;;; Code:
9 |
10 | ;;;; Check Fonts
11 | ;; See https://emacsredux.com/blog/2021/12/22/check-if-a-font-is-available-with-emacs-lisp/
12 | (defun lem-font-available-p (font-name)
13 | "Check if font is available from system installed fonts."
14 | (member font-name (font-family-list)))
15 |
16 | ;;;; Set Default & Variable Pitch Fonts
17 | (defun lem-ui--set-default-font (spec)
18 | "Set the default font based on SPEC.
19 | SPEC is expected to be a plist with the same key names
20 | as accepted by `set-face-attribute'."
21 | (when spec
22 | (apply 'set-face-attribute 'default nil spec)))
23 |
24 | (defun lem-ui--set-variable-width-font (spec)
25 | "Set the default font based on SPEC.
26 | SPEC is expected to be a plist with the same key names
27 | as accepted by `set-face-attribute'."
28 | (when spec
29 | (apply 'set-face-attribute 'variable-pitch nil spec)))
30 |
31 | (defcustom lem-ui-default-font nil
32 | "The configuration of the `default' face.
33 | Use a plist with the same key names as accepted by `set-face-attribute'."
34 | :group 'lambda-emacs
35 | :type '(plist :key-type: symbol)
36 | :tag "Lambda-Emacs Default font"
37 | :set (lambda (sym val)
38 | (let ((prev-val (if (boundp 'lem-ui-default-font)
39 | lem-ui-default-font
40 | nil)))
41 | (set-default sym val)
42 | (when (and val (not (eq val prev-val)))
43 | (lem-ui--set-default-font val)))))
44 |
45 | (defcustom lem-ui-variable-width-font nil
46 | "The configuration of the `default' face.
47 | Use a plist with the same key names as accepted by `set-face-attribute'."
48 | :group 'lambda-emacs
49 | :type '(plist :key-type: symbol)
50 | :tag "Lambda-Emacs Variable width font"
51 | :set (lambda (sym val)
52 | (let ((prev-val (if (boundp 'lem-ui-variable-width-font)
53 | lem-ui-variable-width-font
54 | nil)))
55 | (set-default sym val)
56 | (when (and val (not (eq val prev-val)))
57 | (lem-ui--set-variable-width-font val)))))
58 |
59 | ;;;; Set Symbol & Emoji Fonts
60 | (use-package fontset
61 | :ensure nil
62 | :custom
63 | ;; Set this to nil to set symbols entirely separately
64 | ;; Need it set to `t` in order to display org-modern-indent faces properly
65 | (use-default-font-for-symbols t)
66 | :config
67 | ;; Use symbola for proper symbol glyphs, but have some fallbacks
68 | (cond ((lem-font-available-p "Symbola")
69 | (set-fontset-font
70 | t 'symbol "Symbola" nil))
71 | ((lem-font-available-p "Apple Symbols")
72 | (set-fontset-font
73 | t 'symbol "Apple Symbols" nil))
74 | ((lem-font-available-p "Symbol")
75 | (set-fontset-font
76 | t 'symbol "Symbol" nil))
77 | ((lem-font-available-p "Segoe UI Symbol")
78 | (set-fontset-font
79 | t 'symbol "Segoe UI Symbol" nil)))
80 | ;; Use Apple emoji
81 | ;; NOTE that emoji here may need to be set to unicode to get color emoji
82 | (when (and (>= emacs-major-version 28)
83 | (lem-font-available-p "Apple Color Emoji"))
84 | (set-fontset-font t 'emoji
85 | '("Apple Color Emoji" . "iso10646-1") nil 'prepend))
86 | ;; Fall back font for missing glyph
87 | (defface fallback '((t :family "Fira Code"
88 | :inherit fringe)) "Fallback")
89 | (set-display-table-slot standard-display-table 'truncation
90 | (make-glyph-code ?… 'fallback))
91 | (set-display-table-slot standard-display-table 'wrap
92 | (make-glyph-code ?↩ 'fallback)))
93 |
94 |
95 | ;; Set default line spacing. If the value is an integer, it indicates
96 | ;; the number of pixels below each line. A decimal number is a scaling factor
97 | ;; relative to the current window's default line height. The setq-default
98 | ;; function sets this for all buffers. Otherwise, it only applies to the current
99 | ;; open buffer
100 | (setq-default line-spacing 0.1)
101 |
102 | ;;;; Font Lock
103 | (use-package font-lock
104 | :ensure nil
105 | :defer 1
106 | :custom
107 | ;; Max font lock decoration (set nil for less)
108 | (font-lock-maximum-decoration t)
109 | ;; No limit on font lock
110 | (font-lock-maximum-size nil))
111 |
112 | ;;;; Scale Text
113 | ;; When using `text-scale-increase', this sets each 'step' to about one point size.
114 | (setopt text-scale-mode-step 1.08)
115 | (bind-key* "s-=" #'text-scale-increase)
116 | (bind-key* "s--" #'text-scale-decrease)
117 | (bind-key* "s-0" #'text-scale-adjust)
118 |
119 | ;;;; Icons
120 | ;; Check for icons FIXME: this should be less verbose but haven't been able to
121 | ;; get a `dolist` function working ¯\_(ツ)_/¯
122 | (defun lem-font--icon-check ()
123 | (cond ((and (lem-font-available-p "Weather Icons")
124 | (lem-font-available-p "github-octicons")
125 | (lem-font-available-p "FontAwesome")
126 | (lem-font-available-p "all-the-icons")
127 | (lem-font-available-p "file-icons")
128 | (lem-font-available-p "Material Icons"))
129 | (message "Icon fonts already installed!"))
130 | ((and (not (member unicode-fonts (font-family-list)))
131 | (not sys-win))
132 | (message "Installing necessary fonts")
133 | (all-the-icons-install-fonts 'yes))
134 | (t
135 | (message "Please install fonts."))))
136 |
137 | (defun lem-font--init-all-the-icons-fonts ()
138 | (when (fboundp 'set-fontset-font)
139 | (dolist (font (list "Weather Icons"
140 | "github-octicons"
141 | "FontAwesome"
142 | "all-the-icons"
143 | "file-icons"
144 | "Material Icons"))
145 | (set-fontset-font t 'unicode font nil 'prepend))))
146 |
147 | (use-package all-the-icons
148 | :if (display-graphic-p)
149 | :commands (all-the-icons-octicon
150 | all-the-icons-faicon
151 | all-the-icons-fileicon
152 | all-the-icons-wicon
153 | all-the-icons-material
154 | all-the-icons-alltheicon)
155 | :init
156 | (add-hook 'after-setting-font-hook #'lem-font--icon-check)
157 | :custom
158 | ;; Adjust this as necessary per user font
159 | (all-the-icons-scale-factor 1)
160 | :config
161 | (add-hook 'after-setting-font-hook #'lem-font--init-all-the-icons-fonts))
162 |
163 | ;; icons for dired
164 | (use-package all-the-icons-dired
165 | :if (display-graphic-p)
166 | :defer t
167 | :commands all-the-icons-dired-mode
168 | :init
169 | (add-hook 'dired-mode-hook 'all-the-icons-dired-mode))
170 |
171 | ;; Completion Icons
172 | (use-package all-the-icons-completion
173 | :ensure nil
174 | :if (display-graphic-p)
175 | :init
176 | ;; NOTE: This is a fork -- install original once these changes have been merged
177 | (unless (package-installed-p 'all-the-icons-completion)
178 | (package-vc-install "https://github.com/MintSoup/all-the-icons-completion"))
179 | :hook (emacs-startup . all-the-icons-completion-mode)
180 | :config
181 | (add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup))
182 |
183 |
184 | (provide 'lem-setup-fonts)
185 | ;;; lem-setup-fonts.el ends here
186 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-frames.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-frames.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 |
20 | ;;; Commentary:
21 |
22 | ;; Setup for frames. Note that some basic settings are placed in early-init for
23 | ;; better startup.
24 |
25 | ;;; Code:
26 |
27 | ;;;; Frame defaults
28 | (use-package frame
29 | :ensure nil
30 | :config
31 | ;; Make a clean & minimalist frame
32 | ;; To modify initial frame set `initial-frame-alist`
33 | (setq-default default-frame-alist
34 | (append (list
35 | '(frame-title-format . nil)
36 | '(internal-border-width . 18)
37 | '(tool-bar-lines . 0)
38 | '(vertical-scroll-bars . nil)
39 | '(horizontal-scroll-bars . nil))))
40 | ;; Resize pixel-wise to avoid gaps
41 | (setq-default window-resize-pixelwise t)
42 | (setq-default frame-resize-pixelwise t)
43 |
44 | ;; Don't show icon in frame
45 | (setq-default ns-use-proxy-icon nil))
46 |
47 | ;;;; (Re)Center Frames
48 | (defun lem-frame-recenter (&optional frame)
49 | "Center FRAME on the screen.
50 | FRAME can be a frame name, a terminal name, or a frame.
51 | If FRAME is omitted or nil, use currently selected frame."
52 | (interactive)
53 | (unless (eq 'maximised (frame-parameter nil 'fullscreen))
54 | (modify-frame-parameters
55 | frame '((user-position . t) (top . 0.5) (left . 0.5)))))
56 |
57 | ;; un/comment this hook if you want frames recentered
58 | (add-hook 'after-make-frame-functions #'lem-frame-recenter)
59 |
60 |
61 | ;;;; Fix titlebar titling colors
62 | ;; see also https://github.com/d12frosted/homebrew-emacs-plus/issues/55
63 | (use-package ns-auto-titlebar
64 | :commands ns-auto-titlebar-mode
65 | :if (eq system-type 'darwin)
66 | :init (ns-auto-titlebar-mode))
67 |
68 | (provide 'lem-setup-frames)
69 | ;;; lem-setup-frames.el ends here
70 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-icomplete.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-icomplete.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 |
20 | ;;; Commentary:
21 |
22 | ;; Vertico is a much better overall completion experience, but icomplete is
23 | ;; built-in so use this when running emacs for testing, etc.
24 |
25 | ;;; Code:
26 |
27 | ;;;; Icomplete
28 | (use-package icomplete-vertical
29 | :ensure nil
30 | :hook (after-init . icomplete-vertical-mode)
31 | :bind
32 | (:map icomplete-minibuffer-map
33 | ("C-v" . icomplete-vertical-toggle)
34 | ("RET" . icomplete-force-complete-and-exit)
35 | ("TAB" . icomplete-force-complete-and-exit)
36 | ("C-M-i" . minibuffer-complete)
37 | ("M-RET" . exit-minibuffer)
38 | ("". icomplete-forward-completions)
39 | ("C-j" . icomplete-forward-completions)
40 | ("" . icomplete-backward-completions)
41 | ("C-k" . icomplete-backward-completions))
42 | :custom
43 | (icomplete-show-matches-on-no-input t)
44 | (icomplete-hide-common-prefix nil)
45 | (icomplete-compute-delay 0.0)
46 | (read-file-name-completion-ignore-case t)
47 | (read-buffer-completion-ignore-case t)
48 | (completion-ignore-case t)
49 | (icomplete-scroll t)
50 | :config
51 | (icomplete-mode)
52 | (icomplete-vertical-mode))
53 |
54 |
55 |
56 | (provide 'lem-setup-icomplete)
57 | ;;; lem-setup-icomplete.el ends here
58 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-libraries.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-libraries.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 |
20 | ;;; Commentary:
21 |
22 | ;; https://github.com/jwiegley/emacs-async, https://github.com/magnars/s.el,
23 | ;; https://github.com/magnars/dash.el http://elpa.gnu.org/packages/cl-lib.html
24 | ;; Included are built-in libraries and those for asynchronous processing string
25 | ;; manipulation, list manipulation and backward compatibility respectively.
26 |
27 | ;;; Code:
28 |
29 | ;; Built in libraries; lots of packages depend on these
30 | (use-package subr-x
31 | :ensure nil
32 | :defer 1)
33 | (use-package cl-lib
34 | :ensure nil
35 | :defer t)
36 | ;; Include this only for compatibility purposes
37 | (use-package cl
38 | :ensure nil
39 | :defer t)
40 |
41 | ;; Asynchronous commands. Adds the ability to call asynchronous functions and
42 | ;; process with ease. See the documentation for `async-start' and
43 | ;; `async-start-process'.
44 | (use-package async
45 | :defer
46 | :config
47 | (dired-async-mode 1)
48 | (setq dired-async--modeline-mode nil))
49 |
50 | ;; A modern list API for Emacs. No 'cl required.
51 | (use-package dash
52 | :defer 2)
53 | ;; String manipulation
54 | (use-package s
55 | :defer 2)
56 | ;; APIs for files & directories
57 | (use-package f
58 | :defer 2)
59 |
60 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
61 | (provide 'lem-setup-libraries)
62 | ;;; lem-setup-libraries.el ends here
63 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-macos.el:
--------------------------------------------------------------------------------
1 | ;;; setup-macos.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 |
20 | ;;; Commentary:
21 |
22 | ;; Settings for use with macos
23 |
24 | ;;; Code:
25 |
26 | ;;;; Clipboad
27 |
28 | ;; Integrate with MacOS clipboard
29 | (setq select-enable-clipboard t)
30 |
31 | ;; Saving whatever’s in the current (system) clipboard before
32 | ;; replacing it with the Emacs’ text.
33 | (setq save-interprogram-paste-before-kill t)
34 |
35 | ;; Fix for non-ascii characters
36 | ;; see https://gist.github.com/the-kenny/267162#gistcomment-2883522
37 | (setenv "LANG" "en_US.UTF-8")
38 |
39 | ;;;; General Settings
40 |
41 | (when sys-mac
42 | ;; make fonts look better with anti-aliasing
43 | (setq mac-allow-anti-aliasing t)
44 |
45 | ;;;; Delete to Trash
46 | ;; delete files by moving them to the trash
47 | ;; See https://christiantietze.de/posts/2021/06/emacs-trash-file-macos/
48 | (setq delete-by-moving-to-trash t)
49 | (setq trash-directory "~/.Trash") ;; fallback for `move-file-to-trash'
50 | (defun system-move-file-to-trash (path)
51 | "Moves file at PATH to the macOS Trash according to `move-file-to-trash' convention.
52 |
53 | Relies on the command-line utility 'trash' to be installed.
54 | Get it from: "
55 | (shell-command (concat "trash -vF \"" path "\""
56 | "| sed -e 's/^/Trashed: /'")
57 | nil ;; Name of output buffer
58 | "*Trash Error Buffer*"))
59 |
60 | ;;;; Frames & Fullscreen
61 |
62 | ;; (Do not) make new frames when opening a new file with Emacs unless on scratch buffer
63 | (setq ns-pop-up-frames nil)
64 |
65 | ;; Fullscreen (disable for non-space full screen)
66 | ;; Using fullscreen with "notched" M1 macs requires non-native.
67 | (setq ns-use-native-fullscreen nil)
68 |
69 | ;;;; Keybindings
70 |
71 | ;; Set modifier keys
72 | (setq mac-option-modifier 'meta) ;; Bind meta to ALT
73 | (setq mac-command-modifier 'super) ;; Bind apple/command to super if you want
74 | (setq mac-function-modifier 'hyper) ;; Bind function key to hyper if you want
75 | (setq mac-right-option-modifier 'none) ;; unbind right key for accented input
76 |
77 | ;; Make forward delete work
78 | (global-set-key (kbd "") 'delete-forward-char)
79 |
80 | ;; Keybindings
81 | (global-set-key (kbd "s-q") 'lem-delete-frame-or-quit)
82 | (global-set-key (kbd "H-q") 'lem-kill-all-emacsen)
83 | (global-set-key (kbd "s-v") 'yank)
84 | (with-eval-after-load 'meow
85 | (global-set-key (kbd "s-c") 'meow-clipboard-save))
86 | (global-set-key (kbd "s-a") 'mark-whole-buffer)
87 | (global-set-key (kbd "s-x") 'kill-region)
88 | (global-set-key (kbd "s-w") 'delete-window)
89 | (global-set-key (kbd "s-W") 'delete-frame)
90 | (global-set-key (kbd "s-n") 'eyebrowse-create-window-config)
91 | (global-set-key (kbd "s-N") 'make-frame)
92 | (global-set-key (kbd "s-z") 'undo)
93 | (global-set-key (kbd "s-Z") 'undo-redo)
94 | (global-set-key (kbd "s-s")
95 | (lambda ()
96 | (interactive)
97 | (call-interactively (key-binding "\C-x\C-s"))))
98 | ;; (global-set-key (kbd "s-Z") 'undo-tree-redo)
99 | (global-set-key (kbd "C-s-f") 'ns-toggle-fullscreen)
100 | ;; Emacs sometimes registers C-s-f as this weird keycode
101 | (global-set-key (kbd "") 'ns-toggle-fullscreen))
102 |
103 | ;;;; Reveal in Finder
104 | (use-package reveal-in-osx-finder :defer 2)
105 |
106 | ;;;; Get mac links from safari
107 | (use-package grab-mac-link :defer 1)
108 |
109 | (with-eval-after-load 'org-mac-link
110 | (defun org-mac-message-open (message-id)
111 | "Visit the message with MESSAGE-ID.
112 | This will use the command `open' with the message URL."
113 | (start-process (concat "open message:" message-id) nil
114 | "open" (concat "message://" (substring message-id 2) ""))))
115 |
116 | ;;;; Security Keychain
117 | ;; Seehttps://www.reddit.com/r/emacs/comments/ew75ib/emacs_mu4e_and_mbsync_setup_for_fastmail_on_macos/fg23tcj?utm_source=share&utm_medium=web2x&context=3
118 | (eval-after-load 'auth-source
119 | '(when (member window-system '(mac ns))
120 | (add-to-list 'auth-sources 'macos-keychain-internet)
121 | (add-to-list 'auth-sources 'macos-keychain-generic)))
122 |
123 | ;;;; OSX Lib
124 | ;; useful library of functions
125 | ;; https://melpa.org/#/osx-lib
126 | (use-package osx-lib :defer t)
127 |
128 |
129 | ;;; Provide
130 | (provide 'lem-setup-macos)
131 | ;;; setup-macos.el ends here
132 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-macros.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-macros.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 |
20 | ;;; Commentary:
21 |
22 | ;; Useful macros
23 |
24 | ;;; Code:
25 |
26 | ;;;; Anaphora
27 | ;; Useful macro library: Anaphoric expressions implicitly create one or more
28 | ;; temporary variables which can be referred to during the expression. This
29 | ;; technique can improve clarity in certain cases. It also enables recursion for
30 | ;; anonymous functions.
31 | (use-package anaphora :defer 1)
32 |
33 | ;;;; Toggle macro
34 |
35 | (defun deftoggle-var-doc (name)
36 | (concat "Non-nil if " name " is enabled.\n\n"
37 | "See " name
38 | " command for a description of this toggle."))
39 | (defun deftoggle-fun-doc (name doc)
40 | (concat "Toggle " name " on or off.\n\n" doc))
41 |
42 | (defmacro deftoggle (name doc enabler disabler)
43 | `(progn
44 | (defvar ,name nil ,(deftoggle-var-doc (symbol-name name)))
45 | (defun ,name (&optional enable)
46 | ,(deftoggle-fun-doc (symbol-name name) doc)
47 | (interactive)
48 | (if (called-interactively-p 'interactive)
49 | (progn
50 | (if ,name
51 | ,disabler
52 | ,enabler)
53 | (setq ,name (not ,name)))
54 | (progn
55 | (if enable
56 | ,enabler
57 | ,disabler)
58 | (setq ,name enable))))))
59 | ;; It's very similar to define-minor-mode, but with all the hooks, keymaps, and lighters stripped out, so it's less verbose. Here I use it to toggle my theme for example:
60 | ;; (deftoggle sam-toggle-theme
61 | ;; "Toggle theme between light and dark."
62 | ;; (progn (disable-theme 'dracula)
63 | ;; (load-theme 'spacemacs-light t))
64 | ;; (progn (disable-theme 'spacemacs-light)
65 | ;; (load-theme 'dracula t)))
66 |
67 | ;;;; Set Variables
68 | ;; This is a useful catch-all macro for setting variables.
69 | ;; Originally from https://oremacs.com/2015/01/17/setting-up-ediff/
70 | ;; Revised multi-form version from https://discord.com/channels/767406463265538068/986709779995066428/986726251941212223
71 |
72 | (defmacro csetq (&rest forms)
73 | "Bind each custom variable FORM to the value of its VAL.
74 |
75 | FORMS is a list of pairs of values [FORM VAL].
76 |
77 | If FORM has a custom setter, use it to set FORM to VAL.
78 | Otherwise, use `set-default'.
79 |
80 | \(fn [FORM VAL]...)"
81 | (declare (debug (&rest sexp form))
82 | (indent 1))
83 | ;; Check if we have an even number of arguments
84 | (when (= (mod (length forms) 2) 1)
85 | (signal 'wrong-number-of-arguments (list 'csetq (1+ (length forms)))))
86 | ;; Transform FORMS into a list of pairs (FORM . VALUE)
87 | `(progn ,@(cl-loop for (form value) on forms by 'cddr
88 | collect `(customize-set-variable ',form ,value))))
89 |
90 | (provide 'lem-setup-macros)
91 |
92 | ;;; lem-setup-macros.el ends here
93 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-modeline.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-modeline.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 |
20 | ;;; Commentary:
21 |
22 | ;; Setup for modeline.
23 |
24 | ;;; Code:
25 |
26 | ;;;; Lambda Line
27 | (use-package lambda-line
28 | :ensure nil
29 | :init
30 | (unless (package-installed-p 'lambda-line)
31 | (package-vc-install "https://github.com/Lambda-Emacs/lambda-line.git"))
32 | :custom
33 | (lambda-line-abbrev t)
34 | (lambda-line-position 'top)
35 | (lambda-line-hspace " ")
36 | (lambda-line-prefix t)
37 | (lambda-line-prefix-padding nil)
38 | (lambda-line-status-invert nil)
39 | (lambda-line-gui-ro-symbol " ⨂") ;; ⬤◯⨂
40 | (lambda-line-gui-mod-symbol " ⬤") ;; ⨀⬤
41 | (lambda-line-gui-rw-symbol " ◯") ;; ◉ ◎ ⬤◯
42 | (lambda-line-vc-symbol "")
43 | (lambda-line-space-top +.50)
44 | (lambda-line-space-bottom -.50)
45 | (lambda-line-symbol-position 0.1)
46 | :custom-face
47 | (lambda-line-visual-bell ((t (:background "red3"))))
48 | :config
49 | (lambda-line-mode)
50 | (lambda-line-visual-bell-config)
51 | ;; set divider line in footer
52 | (when (eq lambda-line-position 'top)
53 | (setq-default mode-line-format (list "%_"))
54 | (setq mode-line-format (list "%_"))))
55 |
56 | ;;;; Hide Modeline
57 | (use-package hide-mode-line
58 | :commands hide-mode-line-mode)
59 |
60 | ;;; Provide:
61 | (provide 'lem-setup-modeline)
62 | ;;; lem-setup-modeline.el ends here
63 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-navigation.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-navigation.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 |
20 | ;;; Commentary:
21 |
22 | ;; Setup code for "navigating" Emacs, in the sense of outlines, goto functions,
23 | ;; saving place, recent files, etc.
24 |
25 | ;;; Code:
26 |
27 | ;;;; Imenu list outline
28 | ;; Make a useful outline buffer
29 | ;; Binding set to toggle "o"
30 | (use-package imenu-list
31 | :commands (imenu-list-smart-toggle imenu-list-minor-mode)
32 | :config
33 | (setq imenu-list-focus-after-activation t
34 | imenu-list-auto-resize t
35 | imenu-list-position 'left))
36 |
37 | ;;;; Save place
38 | ;; Everyone remember where we parked.
39 | (use-package saveplace
40 | :ensure nil
41 | :hook (emacs-startup . save-place-mode)
42 | :config
43 | (setq save-place-file (concat lem-cache-dir "saved-places"))
44 | (setq save-place-forget-unreadable-files nil))
45 |
46 | ;;;; Go To Change
47 | ;; Easily go to last change
48 | (use-package goto-last-change
49 | :bind (("C-\"" . #'goto-last-change)))
50 |
51 | ;;;; Recent files
52 | ;; List recent files
53 | (use-package recentf
54 | :ensure nil
55 | :defer 2
56 | :custom
57 | (recentf-save-file (concat lem-cache-dir "recentf"))
58 | (recentf-max-saved-items 500)
59 | (recentf-max-menu-items 10)
60 | :config
61 | (recentf-mode 1))
62 |
63 | ;;;; Goto Address
64 | ;; This package allows you to click or hit a key sequence while on a
65 | ;; URL or e-mail address, and either load the URL into a browser of
66 | ;; your choice using the browse-url package, or if it's an e-mail
67 | ;; address, to send an e-mail to that address.
68 | (use-package goto-addr
69 | :ensure nil
70 | :hook ((compilation-mode . goto-address-mode)
71 | (prog-mode . goto-address-prog-mode)
72 | (eshell-mode . goto-address-mode)
73 | (text-mode . goto-address-mode)
74 | (shell-mode . goto-address-mode))
75 | :bind (:map goto-address-highlight-keymap
76 | ("" . goto-address-at-point)
77 | ("M-" . newline))
78 | :commands (goto-address-prog-mode
79 | goto-address-mode))
80 |
81 | ;;;; Goto Functions
82 | (defun lem-goto-private ()
83 | (interactive)
84 | (find-file (concat lem-user-dir "private.el")))
85 | (defun lem-goto-journal ()
86 | (interactive)
87 | (find-file (concat org-directory "journal.org")))
88 | (defun lem-goto-early-init.el ()
89 | "Open early-init.el file"
90 | (interactive)
91 | (find-file "~/.emacs.d/early-init.el"))
92 | (defun lem-goto-init.el ()
93 | "Open init.el file"
94 | (interactive)
95 | (find-file user-init-file))
96 | (defun lem-goto-custom.el ()
97 | "Open custom.el file"
98 | (interactive)
99 | (find-file custom-file))
100 | (defun lem-goto-config ()
101 | "Open user config file"
102 | (interactive)
103 | (find-file lem-config-file))
104 | (defun lem-load-config ()
105 | "Load config "
106 | (interactive)
107 | (load-file user-init-file)
108 | (load-file lem-config-file))
109 | (defun lem-goto-emacs-dir ()
110 | "Open 𝛌-Emacs directory"
111 | (interactive)
112 | (find-file user-emacs-directory))
113 | (defun lem-goto-org-files ()
114 | "Open directory with org files"
115 | (interactive)
116 | (find-file org-directory))
117 | (defun lem-goto-projects ()
118 | "Open projects dir"
119 | (interactive)
120 | (find-file lem-project-dir))
121 | (defun lem-goto-elisp-library ()
122 | "Open user elisp library."
123 | (interactive)
124 | (find-file lem-user-elisp-dir))
125 |
126 | ;;;; Jump in Buffer
127 | (defun lem-jump-in-buffer ()
128 | "Jump between headlines in buffer using consult"
129 | (interactive)
130 | (cond
131 | ((eq major-mode 'org-mode)
132 | (call-interactively 'consult-org-heading))
133 | (t
134 | (call-interactively 'consult-outline))))
135 |
136 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
137 |
138 | ;;; Provide
139 | (provide 'lem-setup-navigation)
140 |
141 | ;;; lem-setup-navigation.el ends here
142 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-notes.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-notes.el --- packages for notes -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; Maintainer: Colin McLear
5 | ;; Version: .1
6 | ;; Homepage: https://github.com/Lambda-Emacs/lambda-emacs
7 | ;; Keywords: convenience, notes
8 |
9 |
10 | ;; This file is not part of GNU Emacs
11 |
12 | ;; This program is free software: you can redistribute it and/or modify
13 | ;; it under the terms of the GNU General Public License as published by
14 | ;; the Free Software Foundation, either version 3 of the License, or
15 | ;; (at your option) any later version.
16 |
17 | ;; This program is distributed in the hope that it will be useful,
18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 | ;; GNU General Public License for more details.
21 |
22 | ;; You should have received a copy of the GNU General Public License
23 | ;; along with this program. If not, see .
24 |
25 |
26 | ;;; Commentary:
27 |
28 | ;; This library provides settings fora basic notes workflow using the `Denote' package.
29 |
30 | ;;; Code:
31 |
32 | ;;;; Notebook Setup
33 |
34 | (defcustom lem-notes-dir nil
35 | "Set a directory path for notes."
36 | :group 'lambda-emacs
37 | :type 'string)
38 |
39 | ;;;; Denote
40 | ;; Simple and deliberate note-taking with Denote
41 | ;; https://github.com/protesilaos/denote
42 | ;; See also https://systemcrafters.net/live-streams/july-15-2022/
43 |
44 | (use-package denote
45 | :commands (denote denote-create-note denote-link-ol-store)
46 | :custom
47 | ;; Use org-read-date
48 | (denote-date-prompt-use-org-read-date t)
49 | (denote-file-type 'org) ;; use org
50 | (denote-allow-multi-word-keywords nil) ;; single word keywords only
51 | ;; Better backlink display
52 | (denote-link-backlinks-display-buffer-action
53 | (quote ((display-buffer-reuse-window
54 | display-buffer-in-side-window)
55 | (inhibit-same-window . t)
56 | (side . bottom)
57 | (slot . 99)
58 | (window-height . 10))))
59 | ;; Set default prompts for note creation
60 | (denote-prompts '(title keywords subdirectory))
61 | ;; Set multiple keywords as a list of strings
62 | (denote-known-keywords '("workbook" "project" "idea")))
63 |
64 | ;; Org-capture note creation with Denote
65 | (with-eval-after-load 'org-capture
66 | (add-to-list 'org-capture-templates
67 | '("n" "New note (with Denote)" plain
68 | (file denote-last-path)
69 | #'denote-org-capture
70 | :no-save t
71 | :immediate-finish nil
72 | :kill-buffer t
73 | :jump-to-captured t)))
74 |
75 | (defun lem-denote-capture-note ()
76 | "Create a new note with denote."
77 | (interactive)
78 | (org-capture nil "n"))
79 |
80 | ;; Example note creation function
81 | (defun lem-insert-header-and-time-property ()
82 | "Insert an org heading with a created time string property."
83 | (interactive)
84 | (insert "* ")
85 | (org-set-property "CREATED" (format-time-string "[%Y-%m-%d %T]")))
86 |
87 | (defun lem-denote-workbook-create-entry ()
88 | "Create an entry tagged 'workbook' with the date as its title."
89 | (interactive)
90 | (denote
91 | (format-time-string "%Y %A %e %B") ; format like Tuesday 14 June 2022
92 | '("workbook")
93 | nil
94 | (concat denote-directory "workbook")
95 | nil
96 | nil)
97 | (lem-insert-header-and-time-property))
98 |
99 |
100 |
101 | ;;;; Citar-Denote
102 | ;; Integration of denote with citar
103 | (use-package citar-denote
104 | :commands (citar-create-note
105 | citar-open-notes
106 | citar-denote-add-citekey)
107 | :config
108 | (citar-denote-mode))
109 |
110 | ;;;; Consult Notes
111 | ;; Adapted from https://github.com/minad/consult/wiki/hrm-notes
112 | (use-package consult-notes
113 | :commands (consult-notes
114 | consult-notes-search-in-all-notes))
115 |
116 | (defun lem-notebook ()
117 | "Open `consult-notes in buffer window rather than minibuffer."
118 | (interactive)
119 | (let ((vertico-buffer-display-action
120 | '(display-buffer-reuse-window)))
121 | (consult-notes)))
122 |
123 |
124 | ;;; Provide Setup-Notes
125 | (provide 'lem-setup-notes)
126 | ;;; lem-setup-notes.el ends here
127 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-org-base.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-org-base.el --- Org-mode settings -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; Maintainer: Colin McLear
5 | ;; Version: 0.1
6 | ;; Package-Requires: (dependencies)
7 | ;; Homepage: https://github.com/Lambda-Emacs/lambda-emacs
8 | ;; Keywords: org-mode
9 |
10 |
11 | ;; This file is not part of GNU Emacs
12 |
13 | ;; This program is free software: you can redistribute it and/or modify
14 | ;; it under the terms of the GNU General Public License as published by
15 | ;; the Free Software Foundation, either version 3 of the License, or
16 | ;; (at your option) any later version.
17 |
18 | ;; This program is distributed in the hope that it will be useful,
19 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | ;; GNU General Public License for more details.
22 |
23 | ;; You should have received a copy of the GNU General Public License
24 | ;; along with this program. If not, see .
25 |
26 | ;;; Commentary:
27 |
28 | ;; Basic setup for org-mode in 𝛌-Emacs
29 |
30 | ;;; Code:
31 |
32 | ;;;; Org
33 | ;; Use Org from source rather than built in
34 | (use-package org
35 | :ensure nil
36 | :commands (org-mode)
37 | :mode (("\\.org$" . org-mode))
38 | :bind
39 | (:map global-map
40 | ("C-c a" . org-agenda))
41 | (:map org-mode-map
42 | ("C-M-k" . org-metaup)
43 | ("C-M-j" . org-metadown)
44 | ("C-M-l" . org-metaright)
45 | ("C-M-h" . org-metaleft)
46 | ("M-J" . org-shiftdown)
47 | ("M-K" . org-shiftup)
48 | ("M-L" . org-shiftright)
49 | ("M-H" . org-shiftleft)
50 | ;; easily emphasize text
51 | ("s-b" . (lambda () (interactive) (org-emphasize-dwim ?*)))
52 | ("s-i" . (lambda () (interactive) (org-emphasize-dwim ?/)))
53 | ("s-M-`" . org-emphasize-with-verbatim-dwim)
54 | ("s-M-~" . org-emphasize-with-code-dwim)
55 | ;; better pasting behavior in org-mode
56 | ("s-v" . org-yank))
57 |
58 | :init
59 | ;; Org-Emphasis-Regex settings. Set regex boundaries for emphasis.
60 | ;; Load this before org-mode is loaded.
61 | ;; See https://emacs.stackexchange.com/q/54673/11934
62 | ;; https://emacs.stackexchange.com/q/54632/11934
63 |
64 | (setq org-emphasis-regexp-components
65 | '("-—[:space:]('\"{["
66 | "\] - [:space:].,:!?;'\")}\\["
67 | "[:space:]"
68 | "."
69 | 1))
70 |
71 | :custom
72 | ;; Aesthetics & UI
73 | (org-auto-align-tags nil) ;; don't auto-align tags
74 | (org-catch-invisible-edits 'smart) ;; prevent editing invisible area
75 | (org-cycle-separator-lines 0) ;; no empty lines in collapsed view
76 | (org-ellipsis "…") ;; nicer elipses "↷" "↴" "▼"
77 | (org-fontify-quote-and-verse-blocks t) ;; make quotes stand out
78 | (org-hide-emphasis-markers t) ;; hide emph markers
79 | (org-hide-leading-stars t) ;; hide leading stars
80 | (org-image-actual-width 500) ;; show all images at 500px using imagemagik
81 | (org-pretty-entities t) ;; make latex look good, etc.
82 | (org-pretty-entities-include-sub-superscripts t) ;; prettify sub/superscripts
83 | (org-read-date-prefer-future 'time) ;; Incomplete dates refer to future dates & times
84 | (org-startup-folded nil) ;; Don't start org in outline
85 | (org-tags-column 0) ;; place tags directly next to headline text
86 |
87 | ;; Footnotes
88 | (org-footnote-section nil) ;; place footnotes locally
89 | (org-footnote-auto-adjust t) ;; renumber footnotes
90 |
91 | ;; Indentation
92 | (org-adapt-indentation t) ;; adapt indentation
93 | (org-startup-indented t) ;; start with indentation of headlines
94 | (org-src-preserve-indentation t) ;; preserve code indentation
95 |
96 | ;; Insertion/Yanking
97 | (org-insert-heading-respect-content t) ;; insert new headings after subtree
98 | (org-M-RET-may-split-line '((default . t))) ;; don't split line when creating a new headline, list item, or table field
99 | (org-yank-adjusted-subtrees t) ;; adjust subtrees to depth when yanked
100 | (org-yank-folded-subtrees t) ;; fold subtrees on yank
101 |
102 | ;; Lists
103 | (org-list-allow-alphabetical t) ;; allow alphabetical list
104 | ;; Demote sequence for list bullets
105 | (org-list-demote-modify-bullet '(("+" . "-") ("-" . "+") ("*" . "+")))
106 | (org-list-indent-offset 1) ;; increase sub-item indentation
107 |
108 | ;; Logging
109 | (org-log-done 'time)
110 | (org-log-into-drawer t)
111 | (org-log-state-notes-insert-after-drawers nil)
112 | (org-log-redeadline nil) ;; don't log the time a task was rescheduled/redeadlined.
113 | (org-log-reschedule nil)
114 |
115 | ;; Movement
116 | (org-return-follows-link t) ;; make RET follow links
117 | (org-special-ctrl-a/e t) ;; better movement in headers
118 |
119 | ;; Searching
120 | (org-imenu-depth 8) ;; scan to depth 8 w/imenu
121 | (imenu-auto-rescan t) ;; make sure imenu refreshes
122 |
123 | ;; Source block settings
124 | (org-src-fontify-natively t) ;; use lang-specific fontification
125 | (org-src-window-setup 'other-window) ;; edit source in other window
126 | (org-src-tab-acts-natively t) ;; use lang bindings
127 | (org-confirm-babel-evaluate t) ;; confirm evaluation
128 |
129 | ;; TODOS
130 | (org-use-fast-todo-selection 'expert) ;; don't use popup window for todos
131 | ;; don't set to DONE if children aren’t DONE
132 | (org-enforce-todo-dependencies t)
133 | (org-enforce-todo-checkbox-dependencies t)
134 |
135 | :config
136 | (add-hook 'org-mode-hook (lambda () ;; don't pair < symbols
137 | (setq-local electric-pair-inhibit-predicate
138 | `(lambda (c)
139 | (if (char-equal c ?<) t (,electric-pair-inhibit-predicate c))))))
140 | ;; Setup further org config
141 | (require 'lem-setup-org-settings)
142 | (require 'lem-setup-org-extensions))
143 |
144 | ;;; Provide Org-Setup
145 | (provide 'lem-setup-org-base)
146 | ;;; lem-setup-org-base.el ends here
147 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-org-extensions.el:
--------------------------------------------------------------------------------
1 | ;; Additions & modifications to org functionality
2 | ;; NOTE: some org-extensions are set in other setup files:
3 | ;; - org roam setup is in lem-setup-org-roam
4 | ;; - org citations setup is in setup-citation
5 | ;; - some org export functions are in setup-teaching
6 |
7 | ;;; Org Appearance
8 | ;;;; Org-Appear (Show Markup/Pretty Entities)
9 | ;; show markup at point -- this should be part of org!
10 | (use-package org-appear
11 | :commands (org-appear-mode)
12 | :custom
13 | (org-appear-autoemphasis t)
14 | (org-appear-autolinks nil)
15 | (org-appear-autosubmarkers t)
16 | :hook (org-mode . org-appear-mode))
17 |
18 | ;;;; Org Modern (Display properties, bullets, etc)
19 | ;; A nicer set of default display options
20 | (use-package org-modern
21 | :hook ((org-mode . org-modern-mode)
22 | (org-agenda-finalize . org-modern-agenda))
23 | :custom
24 | (org-modern-hide-stars 'leading)
25 | (org-modern-todo nil)
26 | (org-modern-tag t)
27 | ;; Customize this per your font
28 | (org-modern-label-border .25)
29 | ;; Note that these stars allow differentiation of levels
30 | ;; "①" "②" "③" "④" "⑤" "⑥" "⑦"
31 | (org-modern-star ["⦶" "⦷" "⦹" "⊕" "⍟" "⊛" "⏣" "❂"]))
32 |
33 | ;;; Org Autolist (Smart Lists)
34 | ;; Better list behavior
35 | (use-package org-autolist
36 | ;; :straight (:type git :host github :repo "calvinwyoung/org-autolist")
37 | :hook (org-mode . org-autolist-mode))
38 |
39 | ;;; Org Babel
40 | ;; Avoid `org-babel-do-load-languages' since it does an eager require.
41 | (use-package ob-python
42 | :ensure nil
43 | :defer t
44 | :commands (org-babel-execute:python)
45 | :config
46 | (progn
47 | (setq org-babel-python-command "python3"))) ;Default to python 3.x
48 |
49 | (use-package ob-ditaa
50 | :ensure nil
51 | :defer t
52 | :config
53 | (progn
54 | ;; http://pages.sachachua.com/.emacs.d/Sacha.html
55 | (setq org-ditaa-jar-path (expand-file-name
56 | "ditaa.jar"
57 | (concat user-emacs-directory "software/")))))
58 |
59 | (use-package ob-plantuml
60 | :ensure nil
61 | :defer t
62 | :config
63 | (progn
64 | (setq org-plantuml-jar-path (expand-file-name
65 | "plantuml.jar"
66 | (concat user-emacs-directory "software/")))
67 |
68 | (defun lem-advice-org-babel-execute:plantuml (orig-fun &rest args)
69 | "Force `shell-file-name' to be bash as the \">\" operator is used for redirection.
70 |
71 | If this forcing is not done, and if `shell-file-name' is tcsh,
72 | \">\" does not work. When trying to overwrite files, we get a
73 | \"File exists\" error, and \">!\" would need to be used instead.
74 |
75 | Instead it's simpler to use bash."
76 | (let ((shell-file-name (executable-find "bash")))
77 | (apply orig-fun args)))
78 | (advice-add 'org-babel-execute:plantuml :around #'lem-advice-org-babel-execute:plantuml)))
79 |
80 | (use-package ob-shell
81 | :ensure nil
82 | :defer t
83 | :commands
84 | (org-babel-execute:sh
85 | org-babel-expand-body:sh
86 | org-babel-execute:bash
87 | org-babel-expand-body:bash))
88 |
89 | (use-package ob-lisp
90 | :ensure nil
91 | :defer t
92 | :commands (org-babel-execute:lisp))
93 |
94 | (use-package ob-latex
95 | :ensure nil
96 | :defer t
97 | :commands
98 | (org-babel-execute:latex))
99 |
100 | ;;; Org Babel Tangle
101 | (use-package ob-tangle
102 | :ensure nil
103 | :defer t
104 | :config
105 | (progn
106 | ;; Trailing whitespace management
107 | ;; Delete trailing whitespace in tangled buffer and save it.
108 | (add-hook 'org-babel-post-tangle-hook #'delete-trailing-whitespace)
109 | (add-hook 'org-babel-post-tangle-hook #'save-buffer :append)))
110 |
111 | ;;; Org-Download
112 | ;; Drag and drop images to Emacs org-mode. Courtesy of abo-abo.
113 | ;; https://github.com/abo-abo/org-download.
114 |
115 | (use-package org-download
116 | :commands (org-download-yank org-download-screenshot org-download-image)
117 | :custom
118 | (org-download-method 'directory)
119 | (org-download-image-dir (concat org-directory "org-pictures/"))
120 | (org-download-image-latex-width 500)
121 | (org-download-timestamp "%Y-%m-%d"))
122 |
123 | ;;; Org Export Extensions
124 | ;;;; Ox-Pandoc
125 | ;; Export w/pandoc
126 | (use-package ox-pandoc
127 | :if (executable-find "pandoc")
128 | :after ox
129 | :custom
130 | (org-pandoc-command (executable-find "pandoc"))
131 | (org-pandoc-options '((standalone . t)))
132 | (org-pandoc-options-for-docx '((standalone . nil)))
133 | (org-pandoc-options-for-beamer-pdf '((pdf-engine . "xelatex")))
134 | (org-pandoc-options-for-latex-pdf '((pdf-engine . "xelatex")))
135 | (org-pandoc-format-extensions '(org+smart)))
136 |
137 | ;;;; Ox-Pandoc Export Menu Options
138 | ;; Set pandoc export options
139 | (setq org-pandoc-menu-entry
140 | '(
141 | ;;(?0 "to jats." org-pandoc-export-to-jats)
142 | ;;(?0 "to jats and open." org-pandoc-export-to-jats-and-open)
143 | ;;(? "as jats." org-pandoc-export-as-jats)
144 | ;;(?1 "to epub2 and open." org-pandoc-export-to-epub2-and-open)
145 | ;;(?! "to epub2." org-pandoc-export-to-epub2)
146 | ;;(?2 "to tei." org-pandoc-export-to-tei)
147 | ;;(?2 "to tei and open." org-pandoc-export-to-tei-and-open)
148 | ;;(?" "as tei." org-pandoc-export-as-tei)
149 | ;;(?3 "to markdown_mmd." org-pandoc-export-to-markdown_mmd)
150 | ;;(?3 "to markdown_mmd and open." org-pandoc-export-to-markdown_mmd-and-open)
151 | ;;(?# "as markdown_mmd." org-pandoc-export-as-markdown_mmd)
152 | ;;(?4 "to html5." org-pandoc-export-to-html5)
153 | (?4 "to html5 and open." org-pandoc-export-to-html5-and-open)
154 | (?$ "as html5." org-pandoc-export-as-html5)
155 | (?5 "to html5-pdf and open." org-pandoc-export-to-html5-pdf-and-open)
156 | (?% "to html5-pdf." org-pandoc-export-to-html5-pdf)
157 | ;;(?6 "to markdown_phpextra." org-pandoc-export-to-markdown_phpextra)
158 | ;;(?6 "to markdown_phpextra and open." org-pandoc-export-to-markdown_phpextra-and-open)
159 | ;;(?& "as markdown_phpextra." org-pandoc-export-as-markdown_phpextra)
160 | ;;(?7 "to markdown_strict." org-pandoc-export-to-markdown_strict)
161 | ;;(?7 "to markdown_strict and open." org-pandoc-export-to-markdown_strict-and-open)
162 | ;;(?' "as markdown_strict." org-pandoc-export-as-markdown_strict)
163 | ;; (?8 "to opendocument." org-pandoc-export-to-opendocument)
164 | ;; (?8 "to opendocument and open." org-pandoc-export-to-opendocument-and-open)
165 | ;; (?( "as opendocument." org-pandoc-export-as-opendocument)
166 | (?8 "to opml." org-pandoc-export-to-opml)
167 | (?9 "to opml and open." org-pandoc-export-to-opml-and-open)
168 | ;; (?* "as opml." org-pandoc-export-as-opml)
169 | ;;(?: "to rst." org-pandoc-export-to-rst)
170 | ;;(?: "to rst and open." org-pandoc-export-to-rst-and-open)
171 | ;;(?* "as rst." org-pandoc-export-as-rst)
172 | ;;(?< "to slideous." org-pandoc-export-to-slideous)
173 | (?< "to slideous and open." org-pandoc-export-to-slideous-and-open)
174 | (?, "as slideous." org-pandoc-export-as-slideous)
175 | (?= "to ms-pdf and open." org-pandoc-export-to-ms-pdf-and-open)
176 | (?- "to ms-pdf." org-pandoc-export-to-ms-pdf)
177 | ;;(?> "to textile." org-pandoc-export-to-textile)
178 | ;;(?> "to textile and open." org-pandoc-export-to-textile-and-open)
179 | ;;(?. "as textile." org-pandoc-export-as-textile)
180 | ;;(?a "to asciidoc." org-pandoc-export-to-asciidoc)
181 | ;;(?a "to asciidoc and open." org-pandoc-export-to-asciidoc-and-open)
182 | ;;(?A "as asciidoc." org-pandoc-export-as-asciidoc)
183 | (?b "to beamer-pdf and open." org-pandoc-export-to-beamer-pdf-and-open)
184 | (?B "to beamer-pdf." org-pandoc-export-to-beamer-pdf)
185 | (?c "to context-pdf and open." org-pandoc-export-to-context-pdf-and-open)
186 | (?C "to context-pdf." org-pandoc-export-to-context-pdf)
187 | ;;(?d "to docbook5." org-pandoc-export-to-docbook5)
188 | (?d "to docbook5 and open." org-pandoc-export-to-docbook5-and-open)
189 | (?D "as docbook5." org-pandoc-export-as-docbook5)
190 | (?e "to epub3 and open." org-pandoc-export-to-epub3-and-open)
191 | (?E "to epub3." org-pandoc-export-to-epub3)
192 | ;;(?f "to fb2." org-pandoc-export-to-fb2)
193 | ;;(?f "to fb2 and open." org-pandoc-export-to-fb2-and-open)
194 | ;;(?F "as fb2." org-pandoc-export-as-fb2)
195 | ;;(?g "to gfm." org-pandoc-export-to-gfm)
196 | (?g "to gfm and open." org-pandoc-export-to-gfm-and-open)
197 | (?G "as gfm." org-pandoc-export-as-gfm)
198 | ;;(?h "to html4." org-pandoc-export-to-html4)
199 | (?h "to html4 and open." org-pandoc-export-to-html4-and-open)
200 | (?H "as html4." org-pandoc-export-as-html4)
201 | ;;(?i "to icml." org-pandoc-export-to-icml)
202 | (?i "to icml and open." org-pandoc-export-to-icml-and-open)
203 | (?I "as icml." org-pandoc-export-as-icml)
204 | ;;(?j "to json." org-pandoc-export-to-json)
205 | (?j "to json and open." org-pandoc-export-to-json-and-open)
206 | (?J "as json." org-pandoc-export-as-json)
207 | ;; (?k "to markdown." org-pandoc-export-to-markdown)
208 | (?k "to markdown and open." org-pandoc-export-to-markdown-and-open)
209 | (?K "as markdown." org-pandoc-export-as-markdown)
210 | (?l "to latex-pdf and open." org-pandoc-export-to-latex-pdf-and-open)
211 | (?L "to latex-pdf." org-pandoc-export-to-latex-pdf)
212 | ;;(?m "to man." org-pandoc-export-to-man)
213 | (?m "to man and open." org-pandoc-export-to-man-and-open)
214 | (?M "as man." org-pandoc-export-as-man)
215 | ;;(?n "to native." org-pandoc-export-to-native)
216 | (?n "to native and open." org-pandoc-export-to-native-and-open)
217 | (?N "as native." org-pandoc-export-as-native)
218 | (?o "to odt and open." org-pandoc-export-to-odt-and-open)
219 | (?O "to odt." org-pandoc-export-to-odt)
220 | (?p "to pptx and open." org-pandoc-export-to-pptx-and-open)
221 | (?P "to pptx." org-pandoc-export-to-pptx)
222 | ;;(?q "to commonmark." org-pandoc-export-to-commonmark)
223 | ;;(?q "to commonmark and open." org-pandoc-export-to-commonmark-and-open)
224 | ;;(?Q "as commonmark." org-pandoc-export-as-commonmark)
225 | ;;(?r "to rtf." org-pandoc-export-to-rtf)
226 | (?r "to rtf and open." org-pandoc-export-to-rtf-and-open)
227 | (?R "as rtf." org-pandoc-export-as-rtf)
228 | ;;(?s "to s5." org-pandoc-export-to-s5)
229 | ;;(?s "to s5 and open." org-pandoc-export-to-s5-and-open)
230 | ;;(?S "as s5." org-pandoc-export-as-s5)
231 | ;;(?t "to texinfo." org-pandoc-export-to-texinfo)
232 | ;;(?t "to texinfo and open." org-pandoc-export-to-texinfo-and-open)
233 | ;;(?T "as texinfo." org-pandoc-export-as-texinfo)
234 | ;;(?u "to dokuwiki." org-pandoc-export-to-dokuwiki)
235 | (?u "to dokuwiki and open." org-pandoc-export-to-dokuwiki-and-open)
236 | (?U "as dokuwiki." org-pandoc-export-as-dokuwiki)
237 | ;; (?v "to revealjs." org-pandoc-export-to-revealjs)
238 | (?v "to revealjs and open." org-pandoc-export-to-revealjs-and-open)
239 | (?V "as revealjs." org-pandoc-export-as-revealjs)
240 | ;;(?w "to mediawiki." org-pandoc-export-to-mediawiki)
241 | (?w "to mediawiki and open." org-pandoc-export-to-mediawiki-and-open)
242 | (?W "as mediawiki." org-pandoc-export-as-mediawiki)
243 | (?x "to docx and open." org-pandoc-export-to-docx-and-open)
244 | (?X "to docx." org-pandoc-export-to-docx)
245 | ;;(?y "to slidy." org-pandoc-export-to-slidy)
246 | (?y "to slidy and open." org-pandoc-export-to-slidy-and-open)
247 | (?Y "as slidy." org-pandoc-export-as-slidy)
248 | ;;(?z "to dzslides." org-pandoc-export-to-dzslides)
249 | (?z "to dzslides and open." org-pandoc-export-to-dzslides-and-open)
250 | (?Z "as dzslides." org-pandoc-export-as-dzslides)
251 | ;;(?{ "to muse." org-pandoc-export-to-muse)
252 | ;;(?{ "to muse and open." org-pandoc-export-to-muse-and-open)
253 | ;;(?[ "as muse." org-pandoc-export-as-muse)
254 | ;;(?} "to zimwiki." org-pandoc-export-to-zimwiki)
255 | ;;(?} "to zimwiki and open." org-pandoc-export-to-zimwiki-and-open)
256 | ;;(?] "as zimwiki." org-pandoc-export-as-zimwiki)
257 | ;;(?~ "to haddock." org-pandoc-export-to-haddock)
258 | ;;(?~ "to haddock and open." org-pandoc-export-to-haddock-and-open)
259 | ;;(?^ "as haddock." org-pandoc-export-as-haddock)
260 | ))
261 |
262 |
263 | ;;;; Ox-Hugo
264 | ;; Export to Hugo with Org
265 | ;; https://github.com/kaushalmodi/ox-hugo
266 | (use-package ox-hugo
267 | :after ox
268 | :config
269 | ;; https://ox-hugo.scripter.co/doc/org-cite-citations/
270 | ;; Modify this to have a different header for references
271 | (plist-put org-hugo-citations-plist :bibliography-section-heading "References"))
272 |
273 | ;;;;; Batch Export Files with Org-Hugo
274 | ;; mark files and then batch export them with this command
275 | (with-eval-after-load 'dired
276 | (define-key dired-mode-map (kbd "C-+")
277 | (lambda()
278 | (interactive)
279 | (diredp-do-apply/eval 'org-hugo-export-wim-to-md '(4)))))
280 |
281 | ;;;;; Org-Hugo Links
282 | ;; New link type for Org-Hugo internal links
283 | (defun org-hugo-link-complete ()
284 | "Create link with Hugo ref shortcode"
285 | (concat "{{% ref " (file-relative-name (read-file-name "File: ")) " %}}"))
286 |
287 | (defun org-hugo-follow (link)
288 | (find-file (expand-file-name link)))
289 |
290 | (with-eval-after-load 'org
291 | (org-link-set-parameters "hugo"
292 | :complete 'org-hugo-link-complete
293 | :follow 'org-hugo-follow))
294 |
295 | ;;; Org Html Conversion
296 | (use-package htmlize
297 | :commands (htmlize-buffer))
298 |
299 | ;;; Org Pomodoro
300 | ;; Helps with time tracking
301 | (use-package org-pomodoro
302 | :commands org-pomodoro
303 | :init
304 | (progn
305 | (setq org-pomodoro-audio-player "/usr/bin/afplay")))
306 |
307 | ;;; Provide Org Extensions
308 | (provide 'lem-setup-org-extensions)
309 | ;;; lem-setup-org-extensions.el ends here
310 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-pdf.el:
--------------------------------------------------------------------------------
1 | ;; PDF Management
2 |
3 | ;;;; Doc-View Mode
4 | (use-package doc-view
5 | :ensure nil
6 | :disabled
7 | :config
8 | (progn
9 | (defun spacemacs/doc-view-search-new-query ()
10 | "Initiate a new query."
11 | (interactive)
12 | (doc-view-search 'newquery))
13 |
14 | (defun spacemacs/doc-view-search-new-query-backward ()
15 | "Initiate a new query."
16 | (interactive)
17 | (doc-view-search 'newquery t))
18 |
19 | (defcustom doc-view-autofit-timer-start 1.0
20 | "Initial value (seconds) for the timer that delays the fitting when
21 | `doc-view-autofit-fit' is called (Which is when a window
22 | configuration change occurs and a document needs to be fitted)."
23 | :type 'number
24 | :group 'doc-view)
25 |
26 | (defcustom doc-view-autofit-timer-inc 0.02
27 | "Value to increase (seconds) the timer (see `doc-view-autofit-timer-start')
28 | by, if there is another window configuration change occuring, before
29 | it runs out."
30 | :type 'number
31 | :group 'doc-view)
32 |
33 | (defcustom doc-view-autofit-default-fit 'width
34 | "The fitting type initially used when mode is enabled.
35 | Valid values are: width, height, page."
36 | :type 'symbol
37 | :group 'doc-view)
38 |
39 | (defvar doc-view-autofit-mode-map
40 | (let ((map (make-sparse-keymap)))
41 | (define-key map (kbd "C-c W") 'doc-view-autofit-width)
42 | (define-key map (kbd "C-c H") 'doc-view-autofit-height)
43 | (define-key map (kbd "C-c P") 'doc-view-autofit-page)
44 | map)
45 | "Keymap used by `doc-view-autofit-mode'.")
46 |
47 | (defun doc-view-autofit-set (type)
48 | "Set autofitting to TYPE for current buffer."
49 | (when doc-view-autofit-mode
50 | (setq doc-view-autofit-type type)
51 | (doc-view-autofit-fit)))
52 |
53 | (defun doc-view-autofit-width ()
54 | "Set autofitting to width for current buffer."
55 | (interactive) (doc-view-autofit-set 'width))
56 |
57 | (defun doc-view-autofit-height ()
58 | "Set autofitting to height for current buffer."
59 | (interactive) (doc-view-autofit-set 'height))
60 |
61 | (defun doc-view-autofit-page ()
62 | "Set autofitting to page for current buffer."
63 | (interactive) (doc-view-autofit-set 'page))
64 |
65 | (defun doc-view-autofit-fit ()
66 | "Fits the document in the selected window's buffer
67 | delayed with a timer, so multiple calls in succession
68 | don't cause as much overhead."
69 | (lexical-let
70 | ((window (selected-window)))
71 | (if (equal doc-view-autofit-timer nil)
72 | (setq doc-view-autofit-timer
73 | (run-with-timer
74 | doc-view-autofit-timer-start nil
75 | (lambda ()
76 | (if (window-live-p window)
77 | (save-selected-window
78 | (select-window window)
79 | (cancel-timer doc-view-autofit-timer)
80 | (setq doc-view-autofit-timer nil)
81 | (cond
82 | ((equal 'width doc-view-autofit-type)
83 | (doc-view-fit-width-to-window))
84 | ((equal 'height doc-view-autofit-type)
85 | (doc-view-fit-height-to-window))
86 | ((equal 'page doc-view-autofit-type)
87 | (doc-view-fit-page-to-window))))))))
88 | (timer-inc-time doc-view-autofit-timer doc-view-autofit-timer-inc))))
89 |
90 | (define-minor-mode doc-view-autofit-mode
91 | "Minor mode for automatic (timer based) fitting in DocView."
92 | :lighter " AFit" :keymap doc-view-autofit-mode-map :group 'doc-view
93 | (when doc-view-autofit-mode
94 | (set (make-local-variable 'doc-view-autofit-type)
95 | doc-view-autofit-default-fit)
96 | (set (make-local-variable 'doc-view-autofit-timer) nil)
97 | (add-hook 'window-configuration-change-hook
98 | 'doc-view-autofit-fit nil t)
99 | (doc-view-autofit-fit))
100 | (when (not doc-view-autofit-mode)
101 | (remove-hook 'window-configuration-change-hook
102 | 'doc-view-autofit-fit t)
103 | (when doc-view-autofit-timer
104 | (cancel-timer doc-view-autofit-timer)
105 | (setq doc-view-autofit-timer nil))
106 | (setq doc-view-autofit-type nil)))
107 |
108 | (add-hook 'doc-view-mode-hook 'doc-view-autofit-mode)
109 | ;; reload when file changes
110 | (add-hook 'doc-view-mode-hook 'auto-revert-mode)
111 | ;; continuous scroll mode
112 | (setq doc-view-continuous t)))
113 |
114 | ;;;; PDF-Tools
115 | ;; good but often problematic pdf reader and annotator
116 | (use-package pdf-tools
117 | :mode (("\\.pdf$" . pdf-view-mode))
118 | :commands (pdf-view-mode)
119 | ;; :init
120 | ;; (pdf-loader-install :no-query)
121 | :bind (:map pdf-view-mode-map
122 | ;; Navigation
123 | ("j" . pdf-view-next-line-or-next-page)
124 | ("k" . pdf-view-previous-line-or-previous-page)
125 | ("l" . pdf-view-next-page-command)
126 | ("h" . pdf-view-previous-page-command)
127 | ("g" . pdf-view-first-page)
128 | ("G" . pdf-view-last-page)
129 | ("t" . pdf-view-goto-page)
130 | ("l" . pdf-view-goto-label)
131 | ;; Search
132 | ("/" . isearch-forward)
133 | ("?" . isearch-backward)
134 | ;; Actions
135 | ("-" . pdf-view-shrink)
136 | ("+" . pdf-view-enlarge)
137 | ("=" . pdf-view-fit-page-to-window)
138 | ("r" . pdf-view-revert-buffer)
139 | ("o" . pdf-links-action-perform)
140 | ("O" . pdf-outline)
141 | ("!" . lem-pdf-no-filter)
142 | ("#" . lem-pdf-midnight-dark)
143 | ("@" . lem-pdf-midnight-amber)
144 | ("$" . lem-pdf-midnight-green))
145 | :config
146 | ;; initialise
147 | (pdf-tools-install-noverify)
148 | ;; HiDPI
149 | (setq pdf-view-use-imagemagick t
150 | pdf-view-use-scaling t)
151 |
152 | (defun lem-pdf-no-filter ()
153 | "View pdf without colour filter."
154 | (interactive)
155 | (pdf-view-midnight-minor-mode -1))
156 |
157 | (defun lem-pdf-midnight-mode ()
158 | "View pdf with colour filter."
159 | (interactive)
160 | (pdf-view-midnight-minor-mode))
161 |
162 | (defun lem-pdf-color-theme ()
163 | (if (eq active-theme 'light-theme)
164 | (lem-pdf-no-filter)
165 | (lem-pdf-midnight-mode)))
166 |
167 | ;; Set midnight mode colour functions
168 | (defun lem-pdf-midnight-dark ()
169 | "Set pdf-view-midnight-colors to dark & low contrast colours."
170 | (interactive)
171 | (setq pdf-view-midnight-colors '("#ECEFF4" . "#434C5E" ))
172 | (pdf-view-midnight-minor-mode))
173 |
174 | (defun lem-pdf-midnight-amber ()
175 | "Set pdf-view-midnight-colors to amber on dark slate blue."
176 | (interactive)
177 | (setq pdf-view-midnight-colors '("#ff9900" . "dark slate blue")) ; amber
178 | (pdf-view-midnight-minor-mode))
179 |
180 | (defun lem-pdf-midnight-green ()
181 | "Set pdf-view-midnight-colors to green on black."
182 | (interactive)
183 | (setq pdf-view-midnight-colors '("#00B800" . "#000000" )) ; green
184 | (pdf-view-midnight-minor-mode))
185 |
186 | ;; tex hook
187 | ;; see https://github.com/politza/pdf-tools#auto-revert
188 | (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)
189 | ;; other hooks
190 | (add-hook 'pdf-view-mode-hook (lambda ()
191 | (lem-pdf-color-theme)
192 | (blink-cursor-mode -1)
193 | (pulsing-cursor-mode -1)
194 | (display-line-numbers-mode -1)
195 | (column-number-mode -1)
196 | (auto-revert-mode -1))))
197 |
198 | ;;;; PDF Notetaking Tools
199 | (defvar user-pdf-dir
200 | "~/Library/Mobile Documents/iCloud~com~sonnysoftware~bot/Documents/be-library")
201 |
202 | (use-package org-noter
203 | :after org
204 | :commands (org-noter)
205 | :config
206 | (setq org-noter-auto-save-last-location t
207 | org-noter-insert-selected-text-inside-note t
208 | org-noter-insert-note-no-questions t
209 | org-noter-kill-frame-at-session-end t
210 | org-noter-default-notes-file-names '("noter-notes.org")
211 | org-noter-notes-search-path '("~/Dropbox/Work/projects/notebook/content-org")))
212 |
213 | ;; Couldn't get either of these working
214 | (use-package org-pdfview
215 | :disabled
216 | :config
217 | (org-link-set-parameters "pdfview"
218 | :follow #'org-pdfview-open
219 | :export #'org-pdfview-export
220 | :complete #'org-pdfview-complete-link
221 | :store #'org-pdfview-store-link)
222 | (add-to-list 'org-file-apps '("\\.pdf\\'" . (lambda (file link) (org-pdfview-open link))))
223 | (add-to-list 'org-file-apps '("\\.pdf::\\([[:digit:]]+\\)\\'" . (lambda (file link) (org-pdfview-open link)))))
224 |
225 | ;; I can't seem to get this to work...
226 | (use-package org-pdftools
227 | :disabled
228 | :after org
229 | :demand t
230 | :init (setq org-pdftools-search-string-separator "??")
231 | :config
232 | (setq org-pdftools-root-dir user-pdf-dir)
233 | (org-link-set-parameters "pdftools"
234 | :follow #'org-pdftools-open
235 | :complete #'org-pdftools-complete-link
236 | :store #'org-pdftools-store-link
237 | :export #'org-pdftools-export)
238 | (add-hook 'org-store-link-functions 'org-pdftools-store-link))
239 |
240 | (use-package org-noter-pdftools
241 | :disabled
242 | :after (org-noter))
243 |
244 |
245 |
246 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
247 | (provide 'lem-setup-pdf)
248 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-projects.el:
--------------------------------------------------------------------------------
1 | ;; -*- lexical-binding: t -*-
2 | ;; Project Management -- using project.el, bookmarks, and git
3 |
4 | ;;; Project
5 | ;; Use project to switch to, and search in, projects (replaces projectile)
6 | (use-package project
7 | :ensure nil
8 | :commands (project-find-file
9 | project-switch-to-buffer
10 | project-switch-project
11 | project-switch-project-open-file)
12 | :bind (:map project-prefix-map
13 | ("P" . project-switch-project)
14 | ("t" . lem-goto-projects)
15 | ("R" . project-remember-projects-under))
16 | :custom
17 | (project-list-file (concat lem-cache-dir "projects"))
18 | (project-switch-commands '((project-find-file "Find file")
19 | (project-find-regexp "Find regexp")
20 | (project-find-dir "Find directory")
21 | (project-vc-dir "VC-Dir")
22 | (project-magit-dir "Magit status")))
23 | (project-vc-extra-root-markers '(".dir-locals.el" ".project.el" "package.json" "requirements.txt" "autogen.sh"))
24 | :config
25 | ;; Use Ripgrep if installed
26 | (when (shell-command-to-string "command rg --version")
27 | (setq xref-search-program 'ripgrep))
28 | (setq lem-project-dir "~/Dropbox/Work/projects")
29 | ;; remove deleted projects from list
30 | (project-forget-zombie-projects))
31 |
32 | (defun lem--project-name ()
33 | "Return name of project without path"
34 | (file-name-nondirectory (directory-file-name (if (vc-root-dir) (vc-root-dir) "-"))))
35 |
36 | ;; magit function for project
37 | (defun project-magit-dir ()
38 | "Run magit in the current project's root"
39 | (interactive)
40 | (magit-status))
41 | ;; Add to keymap
42 | (define-key (current-global-map) (kbd "C-x p G") #'project-magit-dir)
43 |
44 | ;;;; Open project & file
45 | (with-eval-after-load 'project
46 | (defun project-switch-project-open-file (dir)
47 | "Switch to another project by running an Emacs command.
48 | Open file using project-find-file
49 |
50 | When called in a program, it will use the project corresponding
51 | to directory DIR."
52 | (interactive (list (project-prompt-project-dir)))
53 | (let ((default-directory dir)
54 | (project-current-inhibit-prompt t))
55 | (call-interactively 'project-find-file))))
56 |
57 | ;;; Bookmarks
58 | (use-package bookmark
59 | :ensure nil
60 | :defer 2
61 | :config
62 | (setq bookmark-default-file (concat lem-cache-dir "bookmarks")))
63 |
64 | ;;; New Git Project
65 | (defun lem-git-new-project ()
66 | "Initializes a new git repo and adds it to project.el's known projects."
67 | (interactive)
68 | (let ((project-dir (expand-file-name
69 | (read-directory-name "New project root:"))))
70 | (magit-init project-dir)
71 | (setq default-directory project-dir)
72 | ;; make sure project.el remembers new project
73 | (let ((pr (project--find-in-directory default-directory)))
74 | (project-remember-project pr))))
75 |
76 | ;;; Clone a Git Repo from Clipboard
77 | ;; http://xenodium.com/emacs-clone-git-repo-from-clipboard/
78 | (defun lem-git-clone-clipboard-url ()
79 | "Clone git URL in clipboard asynchronously and open in dired when finishe.
80 | Git repo is cloned to directory set by `lem-user-elisp-dir'."
81 | (interactive)
82 | (cl-assert (string-match-p "^\\(http\\|https\\|ssh\\)://" (current-kill 0)) nil "No URL in clipboard")
83 | (let* ((url (current-kill 0))
84 | (download-dir lem-user-elisp-dir)
85 | (project-dir (concat (file-name-as-directory download-dir)
86 | (file-name-base url)))
87 | (default-directory download-dir)
88 | (command (format "git clone %s" url))
89 | (buffer (generate-new-buffer (format "*%s*" command)))
90 | (proc))
91 | (when (file-exists-p project-dir)
92 | (if (y-or-n-p (format "%s exists. delete?" (file-name-base url)))
93 | (delete-directory project-dir t)
94 | (user-error "Bailed")))
95 | (switch-to-buffer buffer)
96 | (setq proc (start-process-shell-command (nth 0 (split-string command)) buffer command))
97 | (with-current-buffer buffer
98 | (setq default-directory download-dir)
99 | (shell-command-save-pos-or-erase)
100 | (require 'shell)
101 | (shell-mode)
102 | (view-mode +1))
103 | (set-process-sentinel proc (lambda (process state)
104 | (let ((output (with-current-buffer (process-buffer process)
105 | (buffer-string))))
106 | (kill-buffer (process-buffer process))
107 | (if (= (process-exit-status process) 0)
108 | (progn
109 | (message "finished: %s" command)
110 | (dired project-dir))
111 | (user-error (format "%s\n%s" command output))))))
112 | (set-process-filter proc #'comint-output-filter)))
113 |
114 | ;;; End Projects.el
115 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
116 |
117 | (provide 'lem-setup-projects)
118 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-scratch.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-scratch.el --- better scratch settings -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; Maintainer: Colin McLear
5 |
6 | ;; This file is not part of GNU Emacs
7 |
8 | ;; This program is free software: you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 |
22 | ;;; Commentary:
23 |
24 | ;; Better scratch settings
25 | ;; See https://www.reddit.com/r/emacs/comments/4cmfwp/scratch_buffer_hacks_to_increase_its_utility/
26 |
27 | ;; Provide options for persistent scratch buffer
28 | ;; Don't kill scratch, bury it instead
29 | ;; These settings can be enabled/disabled via the relevant variables
30 |
31 | ;;; Code:
32 |
33 | ;;;; Variables
34 |
35 | (defcustom lem-persistent-scratch t
36 | "If t, make scratch buffer persist across sessions.
37 | Default is to persist."
38 | :group 'lambda-emacs
39 | :type 'boolean)
40 |
41 | (defcustom lem-scratch-save-dir lem-cache-dir
42 | "Default directory for saving scratch file."
43 | :group 'lambda-emacs
44 | :type 'string)
45 |
46 | (defcustom lem-scratch-default-dir (concat (getenv "HOME") "/")
47 | "Default directory for scratch buffer.
48 | User may prefer to set this to `lem-scratch-save-dir'."
49 | :group 'lambda-emacs
50 | :type 'string)
51 |
52 | ;;;; Functions
53 |
54 | (defun lem--bury-scratch ()
55 | "Don't kill scratch buffer, bury it."
56 | (if (eq (current-buffer) (get-buffer "*scratch*"))
57 | (progn (bury-buffer)
58 | nil)
59 | t))
60 |
61 | (add-hook 'kill-buffer-query-functions 'lem--bury-scratch)
62 |
63 | (defun lem--save-persistent-scratch ()
64 | "Save the contents of *scratch*."
65 | (with-current-buffer (get-buffer-create "*scratch*")
66 | (write-region (point-min) (point-max)
67 | (concat lem-scratch-save-dir "scratch"))))
68 |
69 | (defun lem--load-persistent-scratch ()
70 | "Reload the scratch buffer."
71 | (let ((scratch-file (concat lem-scratch-save-dir "scratch")))
72 | (if (file-exists-p scratch-file)
73 | (with-current-buffer (get-buffer "*scratch*")
74 | (delete-region (point-min) (point-max))
75 | (insert-file-contents scratch-file))))
76 | ;; set default dir for scratch buffer
77 | (with-current-buffer (get-buffer "*scratch*")
78 | (setq-local default-directory lem-scratch-default-dir)))
79 |
80 | ;; Hooks for loading and saving the scratch buffer
81 | (cond (lem-persistent-scratch
82 | (add-hook 'after-init-hook 'lem--load-persistent-scratch)
83 | (add-hook 'kill-emacs-hook 'lem--save-persistent-scratch)
84 | ;; Save scratch buffer every 5 minutes (300 seconds)
85 | (run-with-idle-timer 300 t 'lem--save-persistent-scratch)))
86 |
87 | ;;; End Setup-Scratch
88 | (provide 'lem-setup-scratch)
89 | ;;; lem-setup-scratch.el ends here
90 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-search.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-search.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 |
20 | ;;; Commentary:
21 |
22 | ;; Settings for effective search of buffers, files, and directories.
23 |
24 | ;;; Code:
25 |
26 | ;;; Search
27 |
28 | ;;;; Deadgrep
29 | ;; Deadgrep uses ripgrep for extremely fast text searches and provides a
30 | ;; separate buffer for results.
31 | (use-package deadgrep
32 | :bind (:map lem+search-keys
33 | ("g" . deadgrep)))
34 |
35 | ;;;; Ripgrep
36 | ;; Ripgrep is a replacement for both grep like (search one file) and ag like
37 | ;; (search many files) tools. It's fast and versatile and written in Rust.
38 | (use-package rg :commands rg)
39 |
40 | ;;;; Xref
41 | ;; Built-in library for cross-referencing
42 | (use-package xref
43 | :ensure nil
44 | :defer 1)
45 |
46 | ;;;; Search and Replace
47 | (use-package visual-regexp
48 | :commands (vr/query-replace)
49 | :config
50 | (use-package visual-regexp-steroids
51 | :commands (vr/select-query-replace)))
52 |
53 |
54 | ;;; Provide
55 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56 |
57 | (provide 'lem-setup-search)
58 | ;;; lem-setup-search.el ends here
59 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-server.el:
--------------------------------------------------------------------------------
1 | ;;; Server
2 | ;; start server for emacsclient
3 | (use-package server
4 | :ensure nil
5 | :if window-system
6 | ;; :hook (after-init . server-mode)
7 | :defer 2
8 | :config
9 | ;; t/nil for instructions
10 | (setq server-client-instructions nil)
11 | ;; avoid warning screen
12 | (or (server-running-p)
13 | (server-start)))
14 |
15 | ;; functions for killing server-related emacsen
16 | (defun lem-kill-all-emacsen ()
17 | (interactive)
18 | (progn
19 | (save-buffers-kill-emacs)
20 | (shell-command-to-string "pkill -i emacs")))
21 |
22 | (defun lem-kill-emacs-capture-daemon ()
23 | (interactive)
24 | (shell-command-to-string "pkill -f /Applications/Emacs.app/Contents/MacOS/emacs"))
25 |
26 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
27 | (provide 'lem-setup-server)
28 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-settings.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-settings.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 | ;;; Commentary:
20 |
21 | ;; Sane settings
22 |
23 | ;;; Code:
24 |
25 | ;;;; General Settings
26 |
27 | ;;;;; Custom File Location
28 | ;; Set custom settings in a separate file in the cache-dir
29 | (use-package cus-edit
30 | :ensure nil
31 | :defer 1
32 | :custom
33 | (custom-file (expand-file-name "custom.el" lem-cache-dir))
34 | :config
35 | (when (not (file-exists-p custom-file))
36 | (write-file custom-file))
37 | (when (file-exists-p custom-file)
38 | (load custom-file)))
39 |
40 | ;; NOTE: If you don't want to use custom settings at all put one of the
41 | ;; following in the `:custom' section above:
42 | ;; (custom-file null-device "Don't store customizations")
43 | ;; (custom-file (make-temp-file "emacs-custom"))
44 |
45 | ;;;;; Private File
46 | ;; Where to store private or "secret" info
47 | (let ((private (expand-file-name "private.el" lem-user-dir)))
48 | (if (file-exists-p private)
49 | (load-file private)))
50 |
51 | ;;;; Text settings
52 | (use-package files
53 | :ensure nil
54 | :defer 1
55 | :custom
56 | ;; Make sure your text files end in a newline
57 | (require-final-newline t)
58 | ;; Allow large(r) files
59 | (large-file-warning-threshold 100000000)
60 | (setq confirm-kill-processes nil) ; don't object when quitting
61 | ;; Follow symlinks
62 | (setq find-file-visit-truename t))
63 |
64 | (use-package emacs
65 | :ensure nil
66 | :custom
67 | ;; Single space between sentences is more widespread than double
68 | (sentence-end-double-space nil))
69 |
70 | (use-package subword
71 | :ensure nil
72 | ;; Iterate through CamelCase words
73 | :hook (after-init . global-subword-mode))
74 |
75 | ;; Allow visual lines
76 | ;; Set Mark ring max
77 | (use-package simple
78 | :ensure nil
79 | :hook (after-init . global-visual-line-mode)
80 | :custom
81 | ;; move via visual lines
82 | (line-move-visual t)
83 | ;; reduce mark ring
84 | (global-mark-ring-max 8)
85 | (mark-ring-max 8))
86 |
87 | ;;;;; Line Numbers
88 | (use-package display-line-numbers
89 | :ensure nil
90 | ;; :hook (markdown-mode prog-mode)
91 | :commands display-line-numbers-mode
92 | :init
93 | (setq-default display-line-numbers-type 'visual)
94 | (setq-default display-line-numbers-width-start t))
95 |
96 | ;;;;; Indentation & Tabs
97 | (use-package emacs
98 | :ensure nil
99 | :defer 1
100 | :config
101 | (setq tab-width 4)
102 | (setq-default fill-column 80)
103 | (setq fill-column 80)
104 | (setq-default indent-tabs-mode nil)
105 | (setq-default tab-width 4)
106 | (setq-default tab-always-indent 'complete)
107 | ;; TAB cycle if there are only few candidates
108 | (setq-default completion-cycle-threshold 3))
109 |
110 | ;;;;; UTF 8
111 | (use-package mule-cmds
112 | :ensure nil
113 | :defer t
114 | :config
115 | ;; UTF-8 for all the things!
116 | (prefer-coding-system 'utf-8))
117 |
118 | ;;;;; Interface settings
119 | (use-package emacs
120 | :ensure nil
121 | :defer 1
122 | :config
123 | ;; Hide mouse cursor while typing. Why?
124 | ;; .. it can overlap characters we want to see.
125 | (setq make-pointer-invisible t)
126 | ;; No audible bell/alert
127 | (setq-default visible-bell t)
128 | ;; (Don't) Blink the cursor
129 | (blink-cursor-mode 0)
130 | ;; Use "y" and "n" to confirm/negate prompt instead of "yes" and "no"
131 | ;; Using `advice' here to make it easy to reverse in custom
132 | ;; configurations with `(advice-remove 'yes-or-no-p #'y-or-n-p)'
133 | ;;
134 | ;; N.B. Emacs 28 has a variable for using short answers, which should
135 | ;; be preferred if using that version or higher.
136 | (if (boundp 'use-short-answers)
137 | (setq use-short-answers t)
138 | (advice-add 'yes-or-no-p :override #'y-or-n-p)))
139 |
140 | (use-package advice
141 | :ensure nil
142 | :defer 1
143 | :custom
144 | ;; Silence warnings generated by a function's being redefined by =defadvice=.
145 | (ad-redefinition-action 'accept))
146 |
147 | ;;;;; Whitespace
148 | ;; Manage whitespace in prog modes
149 | (use-package ws-butler
150 | :init
151 | (unless (package-installed-p 'ws-butler)
152 | (package-vc-install "https://github.com/lewang/ws-butler.git"))
153 | :hook (prog-mode . ws-butler-mode))
154 |
155 | ;; Better than the default 'just-one-space', which was M-SPC before
156 | (global-set-key (kbd "S-s-SPC") #'cycle-spacing)
157 |
158 | ;;;; Backups / Auto-Save
159 | (use-package files
160 | :ensure nil
161 | :defer 1
162 | :init
163 | ;; backups
164 | (let ((backup-dir (concat lem-cache-dir "backup")))
165 | ;; Move backup file to `~/.emacs.d/temp/cache/backup'
166 | (setq backup-directory-alist `(("." . ,backup-dir)))
167 | ;; Makesure backup directory exist
168 | (when (not (file-exists-p backup-dir))
169 | (make-directory backup-dir t)))
170 | ;; auto save
171 | (setq auto-save-list-file-prefix
172 | (concat lem-cache-dir "auto-save-list/.saves-"))
173 | (let ((auto-save-files-dir (concat lem-cache-dir "auto-save-files/")))
174 | (setq auto-save-file-name-transforms
175 | `((".*" ,auto-save-files-dir t)))
176 | (when (not (file-exists-p auto-save-files-dir))
177 | (make-directory auto-save-files-dir t)))
178 | ;; auto-save every file visiting buffer
179 | ;; see https://emacs.stackexchange.com/q/7729/11934
180 | (setq-default auto-save-default t)
181 | (setq-default
182 | auto-save-timeout 30 ; number of seconds idle time before auto-save (default: 30)
183 | auto-save-interval 300 ; number of keystrokes between auto-saves (default: 300)
184 | auto-save-visited-mode t
185 | delete-auto-save-files t
186 | create-lockfiles nil)
187 | :config
188 | (setq make-backup-files t ; backup of a file the first time it is saved.
189 | backup-by-copying t ; don't clobber symlinks
190 | version-control t ; version numbers for backup files
191 | delete-old-versions t ; delete excess backup files silently
192 | kept-old-versions 0 ; oldest versions to keep when a new numbered backup is made
193 | kept-new-versions 10 ; newest versions to keep when a new numbered backup is made
194 | vc-make-backup-files t ; backup versioned files, which Emacs does not do by default
195 | )
196 |
197 | (defun lem-full-auto-save ()
198 | (interactive)
199 | (save-excursion
200 | (dolist (buf (buffer-list))
201 | (set-buffer buf)
202 | (if (and (buffer-file-name) (buffer-modified-p))
203 | (basic-save-buffer)))))
204 |
205 | (add-hook 'auto-save-hook 'lem-full-auto-save)
206 |
207 | ;; Save all buffers after idle time
208 | (run-with-idle-timer 5 t (lambda () (lem-full-auto-save))))
209 |
210 | (use-package backup-walker
211 | :commands backup-walker-start)
212 |
213 |
214 | ;;;; Save History
215 | (use-package savehist
216 | :ensure nil
217 | :hook (after-init . savehist-mode)
218 | :config
219 | (setq-default savehist-file (concat lem-cache-dir "savehist"))
220 | (when (not (file-exists-p savehist-file))
221 | (write-file savehist-file))
222 | (setq savehist-save-minibuffer-history t)
223 | (setq history-length 100)
224 | (put 'minibuffer-history 'history-length 50)
225 | ;; (put 'evil-ex-history 'history-length 50)
226 | (put 'kill-ring 'history-length 25)
227 | (savehist-mode 1))
228 |
229 | ;;;; Desktop
230 | (use-package desktop
231 | :ensure nil
232 | :commands (desktop-save-mode)
233 | :config
234 | (setq desktop-dirname (concat lem-cache-dir "desktops")
235 | desktop-base-file-name "emacs.desktop"
236 | desktop-base-lock-name "lock"
237 | desktop-path (list desktop-dirname)
238 | desktop-save 'ask-if-new
239 | desktop-files-not-to-save (concat "^$" ".*magit$")
240 | desktop-restore-eager 4
241 | desktop-load-locked-desktop t)
242 | (when (not (file-exists-p desktop-dirname))
243 | (make-directory desktop-dirname t))
244 | (setq desktop-buffers-not-to-save
245 | (concat "\\("
246 | "^nn\\.a[0-9]+\\|\\.log\\|(ftp)\\|^tags\\|^TAGS"
247 | "\\|\\.emacs.*\\|\\.diary\\|\\.newsrc-dribble\\|\\.bbdb"
248 | "\\)$")))
249 |
250 | (defun lem-my-desktop ()
251 | "Load the desktop and enable autosaving"
252 | (interactive)
253 | (let ((desktop-load-locked-desktop "ask"))
254 | (desktop-read)
255 | (desktop-save-mode 1)))
256 |
257 | (defun lem-save-desktop-save-buffers-kill-emacs ()
258 | "Save buffers and current desktop every time when quitting emacs."
259 | (interactive)
260 | (desktop-save-in-desktop-dir)
261 | (save-buffers-kill-emacs))
262 |
263 | ;;;; Time Stamps
264 | (use-package time-stamp
265 | :ensure nil
266 | :commands (time-stamp lem-time-stamp)
267 | :config
268 | (setq time-stamp-active t ; do enable time-stamps
269 | time-stamp-line-limit 10 ; check first 10 buffer lines for Time-stamp:
270 | time-stamp-format "Last modified on %Y-%02m%02d-%02H:%02M:%02S") ; date format
271 | (add-hook 'before-save-hook 'time-stamp) ; update when saving
272 |
273 | (defun lem-time-stamp ()
274 | (interactive)
275 | (insert (concat "Time-stamp: <"(format-time-string "%Y-%02m%02d-%02H:%02M:%02S")">"))))
276 |
277 | ;;;; Date & Time
278 | (defun format-date (format)
279 | (let ((system-time-locale "en_US.UTF-8"))
280 | (insert (format-time-string format))))
281 |
282 | (defun lem-insert-date ()
283 | (interactive)
284 | (format-date "%A, %B %d %Y"))
285 |
286 | (defun lem-insert-time ()
287 | (interactive)
288 | (format-date "%H:%M:%S"))
289 |
290 | (defun lem-insert-date-and-time ()
291 | (interactive)
292 | (format-date "%m-%d-%Y %H:%M:%S"))
293 |
294 | ;;;; Long Lines
295 | ;; Emacs has problems with reading files with long lines. This package helps with that
296 | ;; https://www.emacswiki.org/emacs?action=browse;oldid=OverLongLineMode;id=SoLong
297 | ;; Prior to 27.1, not included.
298 | ;; "https://git.savannah.gnu.org/git/so-long.git"
299 | (use-package so-long
300 | :hook (after-init . global-so-long-mode)
301 | :config
302 | (global-so-long-mode))
303 |
304 | ;;;; Read Only
305 | ;;https://karthinks.com/software/batteries-included-with-emacs/
306 | ;; Use pager commands for read-only buffers
307 | (setq view-read-only t)
308 |
309 | ;;;; Expand Region
310 | (use-package expand-region
311 | :defer 1)
312 |
313 | ;;;; Safe Variables
314 | (use-package files
315 | :ensure nil
316 | :defer t
317 | :config
318 | (setq safe-local-variable-values
319 | '((eval require 'org-roam-dev)
320 | (eval when
321 | (fboundp 'rainbow-mode)
322 | (rainbow-mode 1))
323 | (org-download-heading-lvl)
324 | (magit-todos-branch-list nil))))
325 |
326 | ;;;; Restart Emacs
327 |
328 | ;; Versions of Emacs lower than 29 don't have a restart command, so add that.
329 | (use-package restart-emacs
330 | :when (version< emacs-version "29")
331 | :commands restart-emacs)
332 |
333 | ;;;; Undo
334 | (use-package emacs
335 | :ensure nil
336 | :defer 1
337 | :config
338 | ;; Don't group undo steps. Why?
339 | ;; .. without this it groups actions into a fixed number of steps which feels unpredictable.
340 | (fset 'undo-auto-amalgamate 'ignore)
341 | ;; Increase undo limits. Why?
342 | ;; .. ability to go far back in history can be useful, modern systems have sufficient memory.
343 | ;; Limit of 64mb.
344 | (setq undo-limit 6710886400)
345 | ;; Strong limit of 1.5x (96mb)
346 | (setq undo-strong-limit 100663296)
347 | ;; Outer limit of 10x (960mb).
348 | ;; Note that the default is x100), but this seems too high.
349 | (setq undo-outer-limit 1006632960))
350 |
351 | ;;;; Multisession
352 |
353 | (use-package multisession
354 | :ensure nil
355 | :defer t
356 | :config
357 | (setq multisession-directory (concat lem-cache-dir "multisession/")))
358 |
359 | ;;; End Settings
360 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
361 | (provide 'lem-setup-settings)
362 | ;;; lem-setup-settings.el ends here
363 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-shell.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-shell.el --- shell setup -*- lexical-binding: t; -*-
2 |
3 | ;; Copyright (C) 2022 Colin McLear
4 |
5 | ;; Author: Colin McLear
6 | ;; Keywords: tools, lisp, terminals
7 |
8 | ;; Shell & General terminal settings
9 |
10 | ;;; Compilation
11 | (use-package compile
12 | :ensure nil
13 | :defer 2
14 | ;; Add recompile to project map
15 | :bind (:map project-prefix-map
16 | ("C" . recompile))
17 | :config
18 | (setq compilation-always-kill t ;; kill compilation process before starting another
19 | compilation-ask-about-save nil ;; save all buffers on `compile'
20 | compilation-scroll-output 'first-error)
21 | ;; Automatically truncate compilation buffers so they don't accumulate too
22 | ;; much data and bog down the rest of Emacs.
23 | (autoload 'comint-truncate-buffer "comint" nil t)
24 | (add-hook 'compilation-filter-hook #'comint-truncate-buffer))
25 |
26 | ;;; Completion Buffer
27 | ;; Remove completion buffer when done
28 | (add-hook 'minibuffer-exit-hook
29 | #'(lambda ()
30 | (let ((buffer "*Completions*"))
31 | (and (get-buffer buffer)
32 | (kill-buffer buffer)))))
33 |
34 | ;;; Display Buffers for Shell Processes
35 | ;; See https://stackoverflow.com/a/47910509
36 | (defun async-shell-command-no-window (command)
37 | "Don't pop up buffer for async commands"
38 | (interactive)
39 | (let ((display-buffer-alist
40 | (list
41 | (cons
42 | "\\*Async Shell Command\\*.*"
43 | (cons #'display-buffer-no-window nil)))))
44 | (async-shell-command command)))
45 |
46 | ;;; Exec Path
47 | ;; Fix path issues when launching from GUI
48 | (use-package exec-path-from-shell
49 | :custom
50 | ;; Set this to nil only if you have your startup files set correctly.
51 | ;; See https://github.com/purcell/exec-path-from-shell#setting-up-your-shell-startup-files-correctly
52 | (exec-path-from-shell-arguments nil)
53 | :config
54 | (when (memq window-system '(mac ns x))
55 | (exec-path-from-shell-initialize)))
56 |
57 |
58 | ;;; Terminal
59 | ;;;; Settings
60 | ;; Some useful shell settings
61 |
62 | ;; Don't add newline in long lines
63 | (setq-default term-suppress-hard-newline t)
64 | ;; Kill process buffers without query
65 | (setq kill-buffer-query-functions (delq 'process-kill-buffer-query-function kill-buffer-query-functions))
66 | ;; Kill term-buffer on exit
67 | (defadvice term-sentinel (around my-advice-term-sentinel (proc msg))
68 | (if (memq (process-status proc) '(signal exit))
69 | (let ((buffer (process-buffer proc)))
70 | ad-do-it
71 | (kill-buffer buffer))
72 | ad-do-it))
73 | (ad-activate 'term-sentinel)
74 |
75 | ;; clickable links & no highlight of line
76 | (defun lem-term-hook ()
77 | (progn
78 | (goto-address-mode)
79 | (hl-line-mode 0)
80 | (setq comint-buffer-maximum-size most-positive-fixnum)))
81 |
82 | (add-hook 'term-mode-hook 'lem-term-hook)
83 | (add-hook 'eshell-mode-hook 'lem-term-hook)
84 |
85 | ;; paste and navigation
86 | (defun term-send-tab ()
87 | "Send tab in term mode."
88 | (interactive)
89 | (term-send-raw-string "\t"))
90 |
91 | ;; Emacs doesn’t handle less well, so use cat instead for the shell pager
92 | (setenv "PAGER" "cat")
93 |
94 | ;;;;; EAT (Emulate a terminal)
95 | (use-package eat
96 | :config
97 | (setq eat-kill-buffer-on-exit t
98 | eat-enable-yank-to-terminal t
99 | eat-enable-directory-tracking t
100 | eat-enable-shell-command-history t
101 | eat-enable-shell-prompt-annotation t
102 | eat-term-scrollback-size nil)
103 | ;; For `eat-eshell-mode' -- integration with eshell.
104 | (add-hook 'eshell-load-hook #'eat-eshell-mode))
105 |
106 | ;;; Tramp
107 | ;; An easy way to ssh
108 | (use-package tramp
109 | :ensure nil
110 | :defer 1
111 | :config
112 | (setq tramp-persistency-file-name (concat lem-cache-dir "tramp")
113 | ;; the most reliable tramp setup I have found (used at work every day...)
114 | tramp-default-method "ssh"
115 | tramp-copy-size-limit nil
116 | tramp-use-ssh-controlmaster-options nil))
117 |
118 | ;; I recommend the following ~/.ssh/config settings be used with the tramp settings in this cfg:
119 | ;; Host *
120 | ;; ForwardAgent yes
121 | ;; AddKeysToAgent yes
122 | ;; ControlMaster auto
123 | ;; ControlPath ~/.ssh/master-%r@%h:%p
124 | ;; ControlPersist yes
125 | ;; ServerAliveInterval 10
126 | ;; ServerAliveCountMax 10
127 |
128 | ;;; Provide Shell
129 | (provide 'lem-setup-shell)
130 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-skeleton.el:
--------------------------------------------------------------------------------
1 | ;;;; lem-setup-skeleton.el --- Setup file for skeletons -*- lexical-binding: t; -*-
2 | ;; Copyright (C) 2022
3 | ;; SPDX-License-Identifier: MIT
4 | ;; Author: Colin McLear
5 | ;;; Commentary:
6 | ;; Setup file for skeletons & example for setting up lem-setup files.
7 | ;;; Code:
8 |
9 | ;;;; Auto-insert
10 | ;; Skeleton depends on auto-insert, so set that up first.
11 |
12 | (use-package auto-insert
13 | :ensure nil
14 | :hook (after-init . auto-insert-mode))
15 |
16 | ;;;; Package/Library Setup Skeleton
17 | ;; When writing lem-modules, insert header from skeleton
18 | (with-eval-after-load "autoinsert"
19 | (define-auto-insert
20 | (cons (concat (expand-file-name lem-setup-dir) "lem-setup-.*\\.el")
21 | "𝛌-Emacs Lisp Skeleton")
22 | '("𝛌-Emacs Module Description: "
23 | ";;;; " (file-name-nondirectory (buffer-file-name)) " --- " str
24 | (make-string (max 2 (- 80 (current-column) 27)) ?\s)
25 | "-*- lexical-binding: t; -*-" '(setq lexical-binding t)
26 | "
27 | ;; Copyright (C) " (format-time-string "%Y") "
28 | ;; SPDX-License-Identifier: MIT
29 | ;; Author:
30 | ;;; Commentary:
31 | ;; " _ "
32 | ;;; Code:
33 | (provide '"
34 | (file-name-base (buffer-file-name))
35 | ")
36 | ;;; " (file-name-nondirectory (buffer-file-name)) " ends here\n"
37 | )))
38 |
39 | (with-eval-after-load "autoinsert"
40 | (define-auto-insert
41 | (cons (concat (expand-file-name lem-user-dir) "cpm-setup-.*\\.el")
42 | "𝛌-Emacs Lisp Skeleton")
43 | '("𝛌-Emacs Module Description: "
44 | ";;;; " (file-name-nondirectory (buffer-file-name)) " --- " str
45 | (make-string (max 2 (- 80 (current-column) 27)) ?\s)
46 | "-*- lexical-binding: t; -*-" '(setq lexical-binding t)
47 | "
48 | ;; Copyright (C) " (format-time-string "%Y") "
49 | ;; SPDX-License-Identifier: MIT
50 | ;; Author:
51 | ;;; Commentary:
52 | ;; " _ "
53 | ;;; Code:
54 | (provide '"
55 | (file-name-base (buffer-file-name))
56 | ")
57 | ;;; " (file-name-nondirectory (buffer-file-name)) " ends here\n"
58 | )))
59 |
60 |
61 | (provide 'lem-setup-skeleton)
62 | ;;; lem-setup-skeleton.el ends here
63 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-tabs.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-tabs.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 |
20 | ;;; Commentary:
21 |
22 | ;; Tabs -- in some ways tabs are not very Emacsy, but tab-bar is great for
23 | ;; window & buffer management. The setup for tabs here is focused on tabs for
24 | ;; window configurations related to a "workspace" -- i.e. a project or other set
25 | ;; of windows. A workspace or "tabspace" (see the package below) is just a tab
26 | ;; with an isolated set of buffers (see also the consult function). 𝛌-Emacs (and
27 | ;; 𝛌-Themes) sets things up so that these tabs/workspaces are nicely displayed.
28 |
29 | ;;; Code:
30 |
31 | ;;;; Tab Bar
32 | ;; Use tab-bar for window grouping and configuration within a project (replaces eyebrowse)
33 | (use-package tab-bar
34 | :ensure nil
35 | :after (project)
36 | :commands (tab-bar-new-tab
37 | tab-bar-switch-to-tab
38 | tab-bar-switch-to-next-tab
39 | tab-bar-switch-to-prev-tab)
40 | :custom
41 | (tab-bar-show 1)
42 | (tab-bar-tab-hints t) ;; show numbers in tabs
43 | ;; Unless another file/buffer is designated, start from workspace scratch buffer
44 | (tab-bar-new-tab-choice "*scratch*")
45 | (tab-bar-select-tab-modifiers '(super))
46 | (tab-bar-close-tab-select 'recent)
47 | (tab-bar-new-tab-to 'rightmost)
48 | (tab-bar-close-last-tab-choice 'tab-bar-mode-disable)
49 | (tab-bar-tab-name-format-function #'lem--tab-bar-tab-name-format)
50 | (tab-bar-new-button nil)
51 | (tab-bar-close-button nil)
52 | (tab-bar-auto-width nil)
53 | (tab-bar-format '(tab-bar-format-history
54 | tab-bar-format-tabs
55 | lem--tab-bar-suffix
56 | tab-bar-format-add-tab))
57 | :config
58 |
59 | ;; https://christiantietze.de/posts/2022/02/emacs-tab-bar-numbered-tabs/
60 | (defvar lem-tab-bar--circle-numbers-alist
61 | '((0 . "⓪")
62 | (1 . "①")
63 | (2 . "②")
64 | (3 . "③")
65 | (4 . "④")
66 | (5 . "⑤")
67 | (6 . "⑥")
68 | (7 . "⑦")
69 | (8 . "⑧")
70 | (9 . "⑨")
71 | (10 . "⑩")
72 | (11 . "⑪")
73 | (12 . "⑫")
74 | (13 . "⑬")
75 | (14 . "⑭")
76 | (15 . "⑮"))
77 |
78 | "Alist of integers to strings of circled unicode numbers.")
79 | (defun lem--tab-bar-tab-name-format (tab i)
80 | (let ((current-p (eq (car tab) 'current-tab))
81 | (tab-num (if (and tab-bar-tab-hints (< i 16))
82 | (alist-get i lem-tab-bar--circle-numbers-alist) "")))
83 | (propertize
84 | (concat
85 | " "
86 | tab-num
87 | (propertize " " 'display '(space :width (4)))
88 | (alist-get 'name tab)
89 | (or (and tab-bar-close-button-show
90 | (not (eq tab-bar-close-button-show
91 | (if current-p 'non-selected 'selected)))
92 | tab-bar-close-button)
93 | "")
94 | (propertize " " 'display '(space :width (4))))
95 | 'face (funcall tab-bar-tab-face-function tab))))
96 |
97 |
98 | ;; See https://github.com/rougier/nano-modeline/issues/33
99 | (defun lem--tab-bar-suffix ()
100 | "Add empty space.
101 | This ensures that the last tab's face does not extend to the end
102 | of the tab bar."
103 | " ")
104 |
105 |
106 | ;; https://protesilaos.com/codelog/2020-08-03-emacs-custom-functions-galore/
107 | (defun lem-tab-bar-select-tab-dwim ()
108 | "Do-What-I-Mean function for getting to a `tab-bar-mode' tab.
109 | If no other tab exists, create one and switch to it. If there is
110 | one other tab (so two in total) switch to it without further
111 | questions. Otherwise use completion to select the tab."
112 | (interactive)
113 | (let ((tabs (mapcar (lambda (tab)
114 | (alist-get 'name tab))
115 | (tab-bar--tabs-recent))))
116 | (cond ((eq tabs nil)
117 | (tab-new))
118 | ((eq (length tabs) 1)
119 | (tab-next))
120 | (t
121 | (tab-bar-switch-to-tab
122 | (completing-read "Select tab: " tabs nil t)))))))
123 |
124 | ;;;; Tab Workspaces
125 | (use-package tabspaces
126 | ;; Add some functions to the project map
127 | :bind (:map project-prefix-map
128 | ("p" . tabspaces-open-or-create-project-and-workspace))
129 | :hook (emacs-startup . tabspaces-mode)
130 | :custom
131 | (tabspaces-use-filtered-buffers-as-default t)
132 | (tabspaces-default-tab "Home")
133 | :config
134 | (defun lem--consult-tabspaces ()
135 | "Deactivate isolated buffers when not using tabspaces."
136 | (require 'consult)
137 | (cond (tabspaces-mode
138 | ;; hide full buffer list (still available with "b")
139 | (consult-customize consult--source-buffer :hidden t :default nil)
140 | (add-to-list 'consult-buffer-sources 'consult--source-workspace))
141 | (t
142 | (consult-customize consult--source-buffer :hidden nil :default t)
143 | (setq consult-buffer-sources (remove #'consult--source-workspace consult-buffer-sources)))))
144 | (add-hook 'tabspaces-mode-hook #'lem--consult-tabspaces))
145 |
146 | ;;;;; Consult Isolated Workspace Buffers
147 | ;; Filter Buffers for Consult-Buffer
148 | (defun lem-buff-filter (buffer)
149 | (let ((blst (cl-remove (buffer-name) (frame-parameter nil 'buffer-list))))
150 | (memq buffer blst)))
151 |
152 | (with-eval-after-load 'consult
153 | ;; hide full buffer list (still available with "b" prefix)
154 | (consult-customize consult--source-buffer :hidden t :default nil)
155 | ;; set consult-workspace buffer list
156 | (defvar consult--source-workspace
157 | (list :name "Workspace Buffers"
158 | :narrow ?w
159 | :history 'buffer-name-history
160 | :category 'buffer
161 | :state #'consult--buffer-state
162 | :default t
163 | :items (lambda () (consult--buffer-query
164 | :predicate #'tabspaces--local-buffer-p
165 | :sort 'visibility
166 | :as #'buffer-name)))
167 |
168 | "Set workspace buffer list for consult-buffer."))
169 |
170 | ;;; Provide
171 | (provide 'lem-setup-tabs)
172 | ;;; lem-setup-tabs.el ends here
173 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-theme.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-theme.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 |
20 | ;;; Commentary:
21 |
22 | ;; Theme settings & functions 𝛌-Emacs comes with its own set of themes --
23 | ;; 𝛌-Themes. The user can of course configure things to use whatever theme they
24 | ;; like. The Modus themes are especially good and included with Emacs 28+.
25 |
26 | ;;; Code:
27 |
28 | ;;;; No-confirm themes
29 | (setq custom-safe-themes t)
30 |
31 | ;;;; Custom Theme Folder
32 | ;;
33 | (defcustom lem-custom-themes-dir (concat lem-user-dir "custom-themes/")
34 | "Set a custom themes directory path."
35 | :group 'lambda-emacs
36 | :type 'string)
37 |
38 | ;; Make the custom themes dir.
39 | (mkdir lem-custom-themes-dir t)
40 | (setq-default custom-theme-directory lem-custom-themes-dir)
41 |
42 | ;; find all themes recursively in custom-theme-folder
43 | (let ((basedir custom-theme-directory))
44 | (dolist (f (directory-files basedir))
45 | (if (and (not (or (equal f ".") (equal f "..")))
46 | (file-directory-p (concat basedir f)))
47 | (add-to-list 'custom-theme-load-path (concat basedir f)))))
48 |
49 | ;;;; Disable All Custom Themes
50 | (defun lem-disable-all-themes ()
51 | "Disable all active themes & reset mode-line."
52 | (interactive)
53 | (progn
54 | (dolist (i custom-enabled-themes)
55 | (disable-theme i))
56 | ;; disable window-divider mode
57 | (window-divider-mode -1)
58 | ;; revert to mode line
59 | (setq-default header-line-format nil)
60 | (setq-default mode-line-format
61 | '((:eval
62 | (list
63 | "%b "
64 | "%m "
65 | (cond ((and buffer-file-name (buffer-modified-p))
66 | (propertize "(**)" 'face `(:foreground "#f08290")))
67 | (buffer-read-only "(RO)" ))
68 | " %l:%c %0"
69 | " "
70 | ))))
71 | (force-mode-line-update)))
72 |
73 | ;;;; Load Theme Wrapper
74 | (defun lem-load-theme ()
75 | (interactive)
76 | (progn
77 | (lem-disable-all-themes)
78 | (call-interactively 'load-theme)))
79 |
80 | ;;;; Toggle Menubar
81 | ;; toggle menubar to light or dark
82 | (defun lem-osx-toggle-menubar-theme ()
83 | "Toggle menubar to dark or light using shell command."
84 | (interactive)
85 | (shell-command "dark-mode"))
86 | (defun lem-osx-menubar-theme-light ()
87 | "Turn dark mode off."
88 | (interactive)
89 | (shell-command "dark-mode off"))
90 | (defun lem-osx-menubar-theme-dark ()
91 | "Turn dark mode on."
92 | (interactive)
93 | (shell-command "dark-mode on"))
94 |
95 | ;;;; Theme & menubar toggle
96 | (defun toggle-dark-light-theme ()
97 | "Coordinate setting of theme with os theme and toggle."
98 | (interactive)
99 | (if (eq active-theme 'light-theme)
100 | (progn (lem-osx-menubar-theme-dark)
101 | (setq active-theme 'dark-theme))
102 | (progn (lem-osx-menubar-theme-light)
103 | (setq active-theme 'light-theme))))
104 |
105 | ;;;; After Load Theme Hook
106 | (defvar lem-after-load-theme-hook nil
107 | "Hook run after a color theme is loaded using `load-theme'.")
108 | (defadvice load-theme (after run-after-load-theme-hook activate)
109 | "Run `after-load-theme-hook'."
110 | (run-hooks 'lem-after-load-theme-hook))
111 |
112 | ;;;; Lambda Themes
113 | ;; Set a default theme
114 | (use-package lambda-themes
115 | :ensure nil
116 | :init
117 | (unless (package-installed-p 'lambda-themes)
118 | (package-vc-install "https://github.com/Lambda-Emacs/lambda-themes.git"))
119 | :custom
120 | ;; Custom settings. To turn any of these off just set to `nil'.
121 | (lambda-themes-set-variable-pitch t)
122 | (lambda-themes-set-italic-comments t)
123 | (lambda-themes-set-italic-keywords t))
124 |
125 | ;;;;; System Appearance Hook
126 | ;; See https://github.com/d12frosted/homebrew-emacs-plus#system-appearance-change
127 | (defun lem--system-apply-theme (appearance)
128 | "Load theme, taking current system APPEARANCE into consideration."
129 | (mapc #'disable-theme custom-enabled-themes)
130 | (pcase appearance
131 | ('light (progn
132 | (load-theme 'lambda-light)
133 | (setq active-theme 'light-theme)))
134 | ('dark (progn
135 | (load-theme 'lambda-dark)
136 | (setq active-theme 'dark-theme)))))
137 |
138 | (defcustom lem-ui-mac-system-theme t
139 | "When `t' use theme that matches macOS system theme."
140 | :group 'lambda-emacs
141 | :type 'boolean)
142 |
143 | ;; Add the hook on MacOS
144 | (when (and sys-mac
145 | lem-ui-mac-system-theme)
146 | (add-hook 'ns-system-appearance-change-functions #'lem--system-apply-theme))
147 |
148 | ;;;;; Define User Theme
149 | (defcustom lem-ui-theme nil
150 | "Default user theme."
151 | :group 'lambda-emacs
152 | :type 'symbol)
153 |
154 | ;; If set, load user theme, otherwise load lambda-themes
155 | (cond ((bound-and-true-p lem-ui-theme)
156 | (load-theme lem-ui-theme t))
157 | ((eq active-theme 'light-theme)
158 | (load-theme 'lambda-light t))
159 | ((eq active-theme 'dark-theme)
160 | (load-theme 'lambda-dark t))
161 | (t
162 | (load-theme 'lambda-light t)))
163 |
164 | ;; kind-icon needs to have its cache flushed after theme change
165 | (with-eval-after-load 'kind-icon
166 | (add-hook 'lambda-themes-after-load-theme-hook #'kind-icon-reset-cache))
167 |
168 | ;;; Provide
169 | (provide 'lem-setup-theme)
170 | ;;; lem-setup-theme.el ends here
171 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-vc.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-vc.el --- setup for version control -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; Maintainer: Colin McLear
5 |
6 | ;; This file is not part of GNU Emacs
7 |
8 | ;; This program is free software: you can redistribute it and/or modify
9 | ;; it under the terms of the GNU General Public License as published by
10 | ;; the Free Software Foundation, either version 3 of the License, or
11 | ;; (at your option) any later version.
12 |
13 | ;; This program is distributed in the hope that it will be useful,
14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 | ;; GNU General Public License for more details.
17 |
18 | ;; You should have received a copy of the GNU General Public License
19 | ;; along with this program. If not, see .
20 |
21 | ;;; Commentary:
22 |
23 | ;; Version Control -- I use git for version control. Magit is a great interface
24 | ;; for git projects. It's much more pleasant to use than the standard git
25 | ;; interface on the command line. I've set up some easy keybindings to access
26 | ;; magit and related packages.
27 |
28 | ;;; Code:
29 |
30 | ;;;; VC
31 | (use-package vc
32 | :ensure nil
33 | :hook (emacs-startup . vc-mode)
34 | :custom
35 | (vc-follow-symlinks t)
36 | (vc-log-short-style '(file)))
37 |
38 | (use-package vc-git
39 | :ensure nil
40 | :after vc
41 | :config
42 | (setq vc-git-diff-switches "--patch-with-stat")
43 | (setq vc-git-print-log-follow t))
44 |
45 | (use-package vc-annotate
46 | :ensure nil
47 | :after vc
48 | :config
49 | (setq vc-annotate-display-mode 'scale))
50 |
51 | ;;;; Magit
52 | (use-package magit
53 | :commands
54 | (magit-blame-mode
55 | magit-commit
56 | magit-diff
57 | magit-log
58 | magit-status)
59 | :hook (git-commit-mode . turn-on-flyspell)
60 | :bind ((:map magit-log-mode-map
61 | ;; Keybindings for use with updating packages interactively
62 | ("Q" . #'exit-recursive-edit)))
63 | :init
64 | ;; Suppress the message we get about "Turning on
65 | ;; magit-auto-revert-mode" when loading Magit.
66 | (setq magit-no-message '("Turning on magit-auto-revert-mode..."))
67 | :config
68 | (setq magit-log-margin '(t "%Y-%m-%d.%H:%M:%S " magit-log-margin-width nil 18))
69 | (setq magit-refresh-status-buffer t)
70 | ;; Fine grained diffs
71 | (setq magit-diff-refine-hunk t)
72 | ;; control magit initial visibility
73 | (setq magit-section-initial-visibility-alist
74 | '((stashes . hide) (untracked . hide) (unpushed . hide) ([unpulled status] . show)))
75 | (global-git-commit-mode t) ; use emacs as editor for git commits
76 |
77 | ;; refresh status buffer
78 | (add-hook 'after-save-hook 'magit-after-save-refresh-status t)
79 | ;; no magit header line as it conflicts w/bespoke-modeline
80 | (advice-add 'magit-set-header-line-format :override #'ignore)
81 | ;; display magit setting
82 | (setq magit-display-buffer-function #'lem-display-magit-in-other-window)
83 | ;; (setq magit-display-buffer-function #'lem-magit-display-buffer-pop-up-frame)
84 | )
85 |
86 | ;; optional: display magit status in new frame
87 | (defun lem-magit-display-buffer-pop-up-frame (buffer)
88 | (if (with-current-buffer buffer (eq major-mode 'magit-status-mode))
89 | (display-buffer buffer
90 | '((display-buffer-reuse-window
91 | display-buffer-pop-up-frame)
92 | (reusable-frames . t)))
93 | (magit-display-buffer-traditional buffer)))
94 |
95 | ;; optional: display magit in other window & create one if only 1 window
96 | (defun lem-display-magit-in-other-window (buffer)
97 | (if (one-window-p)
98 | (progn
99 | (split-window-right)
100 | (other-window 1)
101 | (display-buffer buffer
102 | '((display-buffer-reuse-window))))
103 | (magit-display-buffer-traditional buffer)))
104 |
105 | ;; settings for committing using magit
106 | (use-package git-commit
107 | :after magit
108 | :hook (git-commit-mode . cpm/git-commit-auto-fill-everywhere)
109 | :custom (git-commit-summary-max-length 50)
110 | :preface
111 | (defun cpm/git-commit-auto-fill-everywhere ()
112 | "Ensures that the commit body does not exceed 80 characters."
113 | (setq fill-column 80)
114 | (setq-local comment-auto-fill-only-comments nil))
115 | :config
116 | (with-eval-after-load 'meow
117 | (add-hook 'git-commit-mode-hook
118 | (lambda ()
119 | (meow-insert-mode)))))
120 |
121 | ;;;; Git Gutter HL (Diff-HL)
122 | ;; Nice vc highlighting in margin/fringe
123 | ;; See https://www.reddit.com/r/emacs/comments/suxc9b/modern_gitgutter_in_emacs/
124 | ;; And https://github.com/jimeh/.emacs.d/blob/master/modules/version-control/siren-diff-hl.el
125 |
126 | (use-package diff-hl
127 | :hook
128 | ((prog-mode . diff-hl-mode)
129 | (text-mode . diff-hl-mode)
130 | (dired-mode . diff-hl-dired-mode)
131 | (magit-pre-refresh . diff-hl-magit-pre-refresh)
132 | (magit-post-refresh . diff-hl-magit-post-refresh))
133 | :custom
134 | (diff-hl-side 'left)
135 | (diff-hl-fringe-bmp-function 'cpm--diff-hl-fringe-bmp-from-type)
136 | (diff-hl-fringe-face-function 'cpm--diff-hl-fringe-face-from-type)
137 | (diff-hl-margin-symbols-alist
138 | '((insert . "┃")
139 | (delete . "┃")
140 | (change . "┃")
141 | (unknown . "?")
142 | (ignored . "i")))
143 | :init
144 | (defun cpm--diff-hl-fringe-face-from-type (type _pos)
145 | (intern (format "cpm--diff-hl-%s" type)))
146 |
147 | (defun cpm--diff-hl-fringe-bmp-from-type(type _pos)
148 | (intern (format "cpm--diff-hl-%s" type)))
149 |
150 | (defun cpm--diff-hl-set-render-mode ()
151 | (diff-hl-margin-mode (if window-system -1 1)))
152 | :config
153 | (diff-hl-margin-mode 1)
154 | (define-fringe-bitmap 'diff-hl-insert
155 | [#b00000011] nil nil '(center repeated))
156 | (define-fringe-bitmap 'diff-hl-change
157 | [#b00000011] nil nil '(center repeated))
158 | (define-fringe-bitmap 'diff-hl-delete
159 | [#b00000011] nil nil '(center repeated)))
160 |
161 | ;;;; Diff Files with Vdiff
162 | (use-package vdiff-magit
163 | :defer t
164 | :init
165 | (with-eval-after-load 'magit
166 | (define-key magit-mode-map "e" #'vdiff-magit-dwim)
167 | (define-key magit-mode-map "E" #'vdiff-magit)
168 | (transient-suffix-put 'magit-dispatch "e" :description "vdiff (dwim)")
169 | (transient-suffix-put 'magit-dispatch "e" :command 'vdiff-magit-dwim)
170 | (transient-suffix-put 'magit-dispatch "E" :description "vdiff")
171 | (transient-suffix-put 'magit-dispatch "E" :command 'vdiff-magit)))
172 |
173 | ;;;; Ediff
174 | ;; Don't open ediff in new frame
175 | (setq ediff-window-setup-function 'ediff-setup-windows-plain)
176 |
177 | ;;;; Quick Commits
178 | ;; Make a quick commit without opening magit. This is a version of a
179 | ;; workflow I used to use in Sublime Text. Perfect for short commit messages.
180 | (defun lem-quick-commit ()
181 | "Quickly commit the current file-visiting buffer from the mini-buffer."
182 | (interactive)
183 | (shell-command (concat "Git add " (buffer-file-name) " && Git commit -m '" (read-string "Enter commit message: ") "'")))
184 |
185 | ;;; End Setup VC
186 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
187 | (provide 'lem-setup-vc)
188 | ;;; lem-setup-vc.el ends here
189 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-windows.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-windows.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 |
20 | ;;; Commentary:
21 |
22 | ;; Setup for windows
23 |
24 | ;;; Code:
25 |
26 | ;;;; Window Setup
27 | (use-package window
28 | :ensure nil
29 | :custom
30 | ;; Emacs often opens buffers in new windows. Make window splitting and
31 | ;; placement more predictable.
32 | ;; TODO: revisit this setting?
33 | (display-buffer-base-action nil)
34 | ;; NOTE: I found the below unhelpful, but not sure what better settings would
35 | ;; be.
36 | ;; '((display-buffer-use-least-recent-window
37 | ;; display-buffer--maybe-pop-up-frame-or-window display-buffer-reuse-window
38 | ;; display-buffer-reuse-mode-window display-buffer-same-window
39 | ;; display-buffer-in-previous-window display-buffer-pop-up-frame)))
40 | )
41 |
42 | ;;;; Window Division
43 | ;; Vertical window divider
44 | (use-package frame
45 | :ensure nil
46 | :custom
47 | (window-divider-default-right-width 1)
48 | (window-divider-default-bottom-width 1)
49 | (window-divider-default-places 'right-only)
50 | (window-divider-mode t))
51 | ;; Make sure new frames use window-divider
52 | (add-hook 'before-make-frame-hook 'window-divider-mode)
53 |
54 | ;;;;; Window Movement
55 | ;;FIXME: Figure out how best to streamline window movement.
56 | ;; Quickly switch windows in Emacs
57 | (use-package ace-window
58 | :commands (ace-window
59 | ace-swap-window
60 | aw-flip-window))
61 |
62 | (defun lem-other-window ()
63 | (interactive)
64 | (other-window 1))
65 | (bind-key* "C-c C-o" 'lem-other-window)
66 |
67 |
68 | ;; Easy window movement by key
69 | (use-package windmove
70 | :ensure nil
71 | :commands (windmove-up
72 | windmove-down
73 | windmove-left
74 | windmove-right)
75 | :bind (("C-c C-h" . #'windmove-left)
76 | ("C-c C-l" . #'windmove-right)
77 | ("C-c C-j" . #'windmove-down)
78 | ("C-c C-k" . #'windmove-up))
79 | :config
80 | (windmove-default-keybindings))
81 |
82 | ;;;;; Window Restore
83 | ;; Winner mode is a built-in package for restoring window configurations
84 | ;; https://www.emacswiki.org/emacs/WinnerMode
85 | (use-package winner
86 | :ensure nil
87 | :hook (after-init . winner-mode))
88 |
89 |
90 | (provide 'lem-setup-windows)
91 | ;;; lem-setup-windows.el ends here
92 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-workspaces.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-workspaces.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 |
20 | ;;; Commentary:
21 | ;; Workspaces leveraging tab-bar and project.el. A "workspace" is just a tab
22 | ;; with an isolated set of buffers (see consult function). 𝛌-Emacs sets things
23 | ;; up so that these workspaces are nicely displayed out of the way in the echo
24 | ;; area rather than as visible tabs in the header tab-line at the top of the
25 | ;; frame.
26 |
27 |
28 | ;;; Code:
29 |
30 | ;;;; Workspace Functions
31 |
32 | ;;;;; Startup Workspaces
33 | (defun lem--workspace-setup ()
34 | "Set up workspace at startup."
35 | ;; Add *Messages* and *splash* to Tab \`Home\'
36 | (progn
37 | (tab-bar-rename-tab "Home")
38 | (when (get-buffer "*Messages*")
39 | (set-frame-parameter nil
40 | 'buffer-list
41 | (cons (get-buffer "*Messages*")
42 | (frame-parameter nil 'buffer-list))))
43 | (when (get-buffer "*splash*")
44 | (set-frame-parameter nil
45 | 'buffer-list
46 | (cons (get-buffer "*splash*")
47 | (frame-parameter nil 'buffer-list))))))
48 |
49 | (add-hook 'after-init-hook #'lem--workspace-setup)
50 | (defun lem-go-home ()
51 | (interactive)
52 | (tab-bar-switch-to-tab "Home"))
53 |
54 | ;;;;; Open Project in New Workspace
55 | (defun lem-open-existing-project-and-workspace ()
56 | "Open a project as its own workspace"
57 | (interactive)
58 | (progn
59 | (tab-bar-new-tab)
60 | (call-interactively 'project-switch-project-open-file)
61 | (tab-bar-rename-tab (tabspaces--name-tab-by-project-or-default))
62 | (project-magit-dir)))
63 |
64 | ;;;;; Open Agenda as Workspace
65 | (defun lem-open-agenda-in-workspace ()
66 | "Open agenda in its own workspace"
67 | (interactive)
68 | (if (member "Agenda" (tabspaces--list-tabspaces))
69 | (progn
70 | (tab-bar-switch-to-tab "Agenda")
71 | (switch-to-buffer "*Org Agenda*")
72 | (org-agenda-redo)
73 | (delete-other-windows))
74 | (progn
75 | (tab-bar-new-tab)
76 | (tab-bar-rename-tab "Agenda")
77 | (require 'org)
78 | (org-agenda-list))))
79 |
80 | ;;;;; Open emacs.d in Workspace
81 | (defun lem-open-emacsd-in-workspace ()
82 | "Open emacs.d in its own workspace"
83 | (interactive)
84 | (require 'tabspaces)
85 | (if (member "emacs.d" (tabspaces--list-tabspaces))
86 | (tab-bar-switch-to-tab "emacs.d")
87 | (progn
88 | (tab-bar-new-tab)
89 | (tab-bar-rename-tab "emacs.d")
90 | (find-file lem-config-file)
91 | (split-window-right)
92 | (other-window 1)
93 | (project-magit-dir))))
94 |
95 | ;;;;; Open Notes in Workspace
96 |
97 | (defun lem-open-notes-in-workspace ()
98 | "Open notes dir in its own workspace"
99 | (interactive)
100 | (require 'tabspaces)
101 | (if (member "Notes" (tabspaces--list-tabspaces))
102 | (tab-bar-switch-to-tab "Notes")
103 | (progn
104 | (tab-bar-new-tab)
105 | (tab-bar-rename-tab "Notes")
106 | (lem-notebook))))
107 |
108 | ;;;;; Eshell Workspace
109 | (defun lem-open-new-eshell-and-workspace ()
110 | "Open an eshell buffer in its own workspace"
111 | (interactive)
112 | (if (member "Eshell" (tabspaces--list-tabspaces))
113 | (tab-bar-switch-to-tab "Eshell")
114 | (progn
115 | (tab-bar-new-tab)
116 | (tab-bar-rename-tab "Eshell")
117 | (lem-eshell-home)
118 | (rename-buffer "eshell-workspace")
119 | (delete-other-windows))))
120 |
121 | ;;;;; Terminal Workspace
122 | (defun lem-vterm-workspace ()
123 | "Open vterm in home dir in its own workspace"
124 | (interactive)
125 | (let ((default-directory "~/"))
126 | (require 'multi-vterm)
127 | (multi-vterm-next)))
128 |
129 | (defun lem-open-new-terminal-and-workspace ()
130 | "Open an empty buffer in its own workspace"
131 | (interactive)
132 | (require 'tabspaces)
133 | (if (member "Terminal" (tabspaces--list-tabspaces))
134 | (tab-bar-switch-to-tab "Terminal")
135 | (progn
136 | (tab-bar-new-tab)
137 | (tab-bar-rename-tab "Terminal")
138 | (lem-vterm-workspace)
139 | (delete-other-windows))))
140 |
141 | ;;;;; Open Mu4e Email in Workspace
142 | (defun lem-open-email-in-workspace ()
143 | "Open mu4e email in its own workspace"
144 | (interactive)
145 | (require 'tabspaces)
146 | (if (member "Email" (tabspaces--list-tabspaces))
147 | (progn
148 | (tab-bar-switch-to-tab "Email")
149 | (cond ((get-buffer "*mu4e-headers*")
150 | (switch-to-buffer "*mu4e-headers*"))
151 | ((get-buffer " *mu4e-main*")
152 | (progn
153 | (switch-to-buffer " *mu4e-main*")
154 | (delete-other-windows)))
155 | (t (mu4e))))
156 | (progn
157 | (tab-bar-new-tab)
158 | (tab-bar-rename-tab "Email")
159 | (require 'org) ; need this for loading?
160 | (find-file (concat org-directory "mail.org"))
161 | (mu4e)
162 | (switch-to-buffer " *mu4e-main*"))))
163 |
164 | ;;;;; Open New Buffer & Workspace
165 | ;; This function is a bit weird; It creates a new buffer in a new workspace with a
166 | ;; dummy git project to give the isolation of buffers typical with a git project
167 | ;; I'm sure there is a more elegant way to do this but I don't know how :)
168 | (defun lem-open-new-buffer-and-workspace ()
169 | "Open an empty buffer in its own workspace"
170 | (interactive)
171 | (tab-bar-new-tab)
172 | (tab-bar-rename-tab-tab "New project")
173 | (let ((lem-project-temp-dir "/tmp/temp-projects/"))
174 | (progn
175 | (when (not (file-exists-p lem-project-temp-dir))
176 | (make-directory lem-project-temp-dir t))
177 | (when (not (file-exists-p (concat lem-project-temp-dir ".git/")))
178 | (magit-init lem-project-temp-dir))
179 | (when (not (file-exists-p (concat lem-project-temp-dir "temp")))
180 | (with-temp-buffer (write-file (concat lem-project-temp-dir "temp")))))
181 | (setq default-directory lem-project-temp-dir)
182 | (find-file (concat lem-project-temp-dir "temp"))))
183 |
184 | ;;;; Workspace Keybindings
185 |
186 | (bind-keys :map lem+leader-map
187 | ("1" . lem-go-home)
188 | ("2" . lem-open-emacsd-in-workspace)
189 | ("3" . lem-open-agenda-in-workspace)
190 | ("4" . lem-open-notes-in-workspace)
191 | ("6" . lem-open-new-terminal-and-workspace)
192 | ("5" . lem-open-email-in-workspace))
193 | (bind-key "N" #'lem-open-new-buffer-and-workspace 'project-prefix-map)
194 |
195 | ;;; Provide
196 | (provide 'lem-setup-workspaces)
197 |
--------------------------------------------------------------------------------
/lambda-library/lambda-setup/lem-setup-writing.el:
--------------------------------------------------------------------------------
1 | ;;; lem-setup-writing.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Author: Colin McLear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 |
20 | ;;; Commentary:
21 |
22 | ;; Writing & related packages
23 |
24 | ;;; Code:
25 | ;;;; Spelling
26 | (use-package ispell
27 | :ensure nil
28 | :commands (ispell-word ispell-region ispell-buffer)
29 | :config
30 | (when (executable-find "aspell")
31 | (setq ispell-program-name "aspell")
32 | ;; Please note ispell-extra-args contains ACTUAL parameters passed to aspell
33 | (setq ispell-extra-args '("--sug-mode=ultra" "--lang=en_US"))))
34 |
35 | (use-package flyspell
36 | :ensure nil
37 | :config
38 | (setq flyspell-abbrev-p t
39 | flyspell-use-global-abbrev-table-p t
40 | flyspell-issue-message-flag nil
41 | flyspell-issue-welcome-flag nil)
42 | :hook ((markdown-mode . flyspell-mode)
43 | (org-mode . flyspell-mode)
44 | (prog-mode . flyspell-prog-mode)))
45 |
46 | ;; completion of spellings
47 | (use-package flyspell-correct
48 | :after flyspell
49 | :bind (:map flyspell-mode-map
50 | ("C-;" . flyspell-correct-previous)
51 | ("C-:" . flyspell-correct-at-point))
52 | :custom
53 | (flyspell-correct-interface #'flyspell-correct-completing-read))
54 |
55 | (with-eval-after-load 'hydra
56 | ;; keybinding is SPC-b S
57 | (defhydra hydra-spelling (:color blue)
58 | "
59 | ^
60 | ^Spelling^ ^Errors^ ^Checker^
61 | ^────────^──────────^──────^────────────^───────^───────
62 | _q_ quit _<_ previous _c_ correction
63 | ^^ _>_ next _d_ dictionary
64 | ^^ _f_ check _m_ mode
65 | ^^ ^^ ^^
66 | "
67 | ("q" nil)
68 | ("<" flyspell-correct-previous :color pink)
69 | (">" flyspell-correct-next :color pink)
70 | ("c" ispell)
71 | ("d" ispell-change-dictionary)
72 | ("f" flyspell-buffer :color pink)
73 | ("m" flyspell-mode)))
74 |
75 | ;; Completion of misspelled words in buffer
76 | (use-package consult-flyspell
77 | :after flyspell
78 | :config
79 | (setq consult-flyspell-set-point-after-word t
80 | consult-flyspell-always-check-buffer nil
81 | ;; Apply flyspell-correct-at-point directly after selecting candidate
82 | ;; and jump back to consult-flyspell.
83 | consult-flyspell-select-function
84 | (lambda () (flyspell-correct-at-point) (consult-flyspell))))
85 |
86 |
87 |
88 | ;;;;; Spelling Goto Next Error
89 | (defun lem-flyspell-ispell-goto-next-error ()
90 | "Custom function to spell check next highlighted word"
91 | (interactive)
92 | (flyspell-goto-next-error)
93 | (ispell-word))
94 |
95 | ;;;; Abbrev
96 | (use-package abbrev
97 | :ensure nil
98 | :defer 2
99 | :config
100 | ;; (add-hook 'text-mode-hook #'abbrev-mode)
101 | (setq abbrev-file-name (concat lem-var-dir "abbrev/.abbrev_defs")
102 | save-abbrevs 'nil)
103 | (if (file-exists-p abbrev-file-name)
104 | (quietly-read-abbrev-file)))
105 |
106 | ;;;; Capitalization
107 | ;; From https://karthinks.com/software/batteries-included-with-emacs/
108 | (global-set-key (kbd "M-u") 'upcase-dwim)
109 | (global-set-key (kbd "M-l") 'downcase-dwim)
110 | (global-set-key (kbd "M-c") 'capitalize-dwim)
111 |
112 | ;;;; Markdown
113 | (use-package markdown-mode
114 | :commands (markdown-mode gfm-mode)
115 | :mode (("\\.markdown\\'" . markdown-mode)
116 | ("\\.md\\'" . markdown-mode)
117 | ("README\\.md\\'" . gfm-mode))
118 | :bind (:map markdown-mode-map
119 | ("s-*" . markdown-insert-list-item)
120 | ("s-b" . markdown-insert-bold)
121 | ("s-i" . markdown-insert-italic))
122 | :config
123 | (setq markdown-enable-math nil
124 | markdown-enable-wiki-links t
125 | markdown-nested-imenu-heading-index t
126 | markdown-open-command "~/bin/mark.sh"
127 | markdown-footnote-location 'immediately
128 | markdown-unordered-list-item-prefix "- "
129 | markdown-header-scaling t
130 | markdown-use-pandoc-style-yaml-metadata t)
131 | (setq markdown-live-preview-window-function 'lem--markdown-live-preview-window-xwidget)
132 |
133 | (defun lem--markdown-live-preview-window-xwidget (file)
134 | "Preview file with xwidget browser"
135 | (xwidget-webkit-browse-url (concat "file://" file))
136 | (let ((buf (xwidget-buffer (xwidget-webkit-current-session))))
137 | (when (buffer-live-p buf)
138 | (and (eq buf (current-buffer)) (quit-window))
139 | (pop-to-buffer buf))))
140 |
141 | (defun lem--markdown-settings ()
142 | "settings for markdown mode"
143 | (progn
144 | (turn-on-flyspell)
145 | ;; (auto-fill-mode)
146 | (hl-todo-mode)))
147 |
148 | ;; markdown hooks
149 | (add-hook 'markdown-mode-hook 'lem--markdown-settings)
150 |
151 | ;; for use with meow point movement
152 | (modify-syntax-entry ?@ "_" markdown-mode-syntax-table))
153 |
154 | ;; macro: delete backslashes in paragraph to cleanup markdown conversion
155 | (fset 'lem-md-delete-backslash
156 | (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ("\361\361f\\x" 0 "%d")) arg)))
157 |
158 |
159 | ;;;; Markdown TOC
160 | (use-package markdown-toc
161 | :after markdown
162 | :hook (markdown-mode . markdown-toc))
163 |
164 | ;;;; Writeroom
165 | (use-package writeroom-mode
166 | :commands (writeroom-mode)
167 | :config
168 | (setq writeroom-fullscreen-effect 'maximized)
169 | (setq writeroom-width 95)
170 | (setq writeroom-mode-line t)
171 | (setq writeroom-bottom-divider-width 0)
172 | ;; better scrolling while writing
173 | (add-hook 'writeroom-mode-hook #'lem-writing-mode-scroll-settings))
174 |
175 | (defun lem-writing-mode-scroll-settings ()
176 | "Center cursor for typewriter-like scrolling during writing."
177 | (progn
178 | (setq-local scroll-preserve-screen-position t
179 | scroll-conservatively 0
180 | maximum-scroll-margin 0.25
181 | scroll-margin 99999)))
182 |
183 | ;;;; Lorem Ipsum
184 | (use-package lorem-ipsum
185 | :commands (Lorem-ipsum-insert-sentences Lorem-ipsum-insert-list Lorem-ipsum-insert-paragraphs)
186 | :config
187 | (lorem-ipsum-use-default-bindings))
188 |
189 | ;;;; Palimpsest (make archive)
190 | (use-package palimpsest
191 | :diminish palimpsest-mode
192 | :hook ((markdown-mode org-mode) . palimpsest-mode)
193 | :custom
194 | (palimpsest-send-bottom "C-c C-z")
195 | (palimpsest-send-top "C-c C-a")
196 | :config
197 | (setq palimpsest-trash-file-suffix ".archive"))
198 |
199 | ;;;; Latex Packages
200 | ;; Basic settings
201 | (use-package auctex
202 | :mode (("\\.tex\\'" . latex-mode)
203 | ("\\.latex\\'" . latex-mode))
204 | :commands (latex-mode LaTeX-mode plain-tex-mode)
205 | :init
206 | (progn
207 | (add-hook 'LaTeX-mode-hook #'LaTeX-preview-setup)
208 | (add-hook 'LaTeX-mode-hook #'flyspell-mode)
209 | (add-hook 'LaTeX-mode-hook #'turn-on-reftex)
210 | (setq-default TeX-engine 'xetex)
211 | (setq TeX-auto-save nil
212 | TeX-parse-self nil
213 | TeX-save-query nil
214 | TeX-PDF-mode t)
215 | (setq-default TeX-master nil)))
216 |
217 | (use-package preview
218 | :ensure nil
219 | :after auctex
220 | :commands LaTeX-preview-setup
221 | :init
222 | (progn
223 | (setq-default preview-scale 1.4
224 | preview-scale-function '(lambda () (* (/ 10.0 (preview-document-pt)) preview-scale)))))
225 |
226 | (use-package reftex
227 | :ensure nil
228 | :commands turn-on-reftex
229 | :init
230 | (setq reftex-plug-into-AUCTeX t))
231 |
232 | (use-package bibtex
233 | :ensure nil
234 | :defer t
235 | :mode ("\\.bib" . bibtex-mode)
236 | :init
237 | (progn
238 | (setq bibtex-align-at-equal-sign t)
239 | (add-hook 'bibtex-mode-hook (lambda () (set-fill-column 120)))))
240 |
241 |
242 | ;; Auto-fill for LaTeX
243 | (defun lem-latex-auto-fill ()
244 | "Turn on auto-fill for LaTeX mode."
245 | (turn-on-auto-fill)
246 | (set-fill-column 80)
247 | (setq default-justification 'left))
248 | (add-hook 'LaTeX-mode-hook #'lem-latex-auto-fill)
249 |
250 | ;; Compilation command
251 | (add-hook 'LaTeX-mode-hook (lambda () (setq compile-command "latexmk -pdflatex=xelatex -f -pdf %f")))
252 |
253 | ;; Prevent ispell from verifying some LaTeX commands
254 | ;; http://stat.genopole.cnrs.fr/dw/~jchiquet/fr/latex/emacslatex
255 | (defvar lem-ispell-tex-skip-alists
256 | '("cite" "nocite"
257 | "includegraphics"
258 | "author" "affil"
259 | "ref" "eqref" "pageref"
260 | "label"))
261 | (setq ispell-tex-skip-alists
262 | (list
263 | (append (car ispell-tex-skip-alists)
264 | (mapcar #'(lambda (cmd) (list (concat "\\\\" cmd) 'ispell-tex-arg-end)) lem-ispell-tex-skip-alists))
265 | (cadr ispell-tex-skip-alists)))
266 |
267 | ;; Indentation with align-current in LaTeX environments
268 | (defvar lem-LaTeX-align-environments '("tabular" "tabular*"))
269 | (add-hook 'LaTeX-mode-hook
270 | (lambda ()
271 | (require 'align)
272 | (setq LaTeX-indent-environment-list
273 | ;; For each item in the list...
274 | (mapcar (lambda (item)
275 | ;; The car is an environment
276 | (let ((env (car item)))
277 | ;; If this environment is in our list...
278 | (if (member env lem-LaTeX-align-environments)
279 | ;; ...then replace this item with a correct one
280 | (list env 'align-current)
281 | ;; else leave it alone
282 | item)))
283 | LaTeX-indent-environment-list))))
284 |
285 | ;; Use dvipdfmx to convert DVI files to PDF in AUCTeX
286 | (eval-after-load 'tex
287 | '(add-to-list 'TeX-command-list
288 | '("DVI to PDF" "dvipdfmx %d" TeX-run-command t t) t))
289 |
290 | ;; SyncTeX (http://www.emacswiki.org/emacs/AUCTeX#toc19)
291 | (defun synctex/un-urlify (fname-or-url)
292 | "A trivial function that replaces a prefix of file:/// with just /."
293 | (if (string= (substring fname-or-url 0 8) "file:///")
294 | (substring fname-or-url 7)
295 | fname-or-url))
296 |
297 | ;;;; Dictionary
298 | (use-package define-word
299 | :commands (define-word define-word-at-point))
300 |
301 | (use-package osx-dictionary
302 | ;; :straight (:type git :host github :repo "xuchunyang/osx-dictionary.el")
303 | :commands (osx-dictionary-search-word-at-point osx-dictionary-search-input))
304 |
305 | ;;;; Narrow/Widen
306 | (defun lem-narrow-or-widen-dwim (p)
307 | "Widen if buffer is narrowed, narrow-dwim otherwise.
308 | Dwim means: region, org-src-block, org-subtree, markdown
309 | subtree, or defun, whichever applies first. Narrowing to
310 | org-src-block actually calls `org-edit-src-code'.
311 |
312 | With prefix P, don't widen, just narrow even if buffer
313 | is already narrowed."
314 | (interactive "P")
315 | (declare (interactive-only))
316 | (cond ((and (buffer-narrowed-p) (not p)) (widen))
317 | ((region-active-p)
318 | (narrow-to-region (region-beginning)
319 | (region-end)))
320 | ((derived-mode-p 'org-mode)
321 | ;; `org-edit-src-code' is not a real narrowing
322 | ;; command. Remove this first conditional if
323 | ;; you don't want it.
324 | (cond ((ignore-errors (org-edit-src-code) t)
325 | (delete-other-windows))
326 | ((ignore-errors (org-narrow-to-block) t))
327 | (t (org-narrow-to-subtree))))
328 | ((derived-mode-p 'markdown-mode)
329 | (markdown-narrow-to-subtree))
330 | ((derived-mode-p 'latex-mode)
331 | (LaTeX-narrow-to-environment))
332 | (t (narrow-to-defun))))
333 |
334 | ;;bind this in the narrow keymap
335 | (bind-key* "C-x n n" #'lem-narrow-or-widen-dwim narrow-map)
336 |
337 | ;;; Provide
338 | (provide 'lem-setup-writing)
339 |
340 | ;;; lem-setup-writing.el ends here
341 |
--------------------------------------------------------------------------------
/lambda-library/lambda-splash.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 | ``
4 | :oyhdmmmmdhs+-
5 | sMMMMMMMMMMMMNdo.
6 | .NMMMMMMMMMMMMMMm+
7 | oMNNNMMMMMMMMMMMMh.
8 | n:sdMMMMMMMMMMMMMMd.
9 | `+NMMMMMMMMm.
10 | -mMMMMMMMMm.
11 | -NMMMMMMMMd`
12 | :NMMMMMMMMy
13 | oMMMMMMMMM+
14 | hMMMMMMMMN-
15 | .mMMMMMMMMm`
16 | :MMMMMMMMMy
17 | sMMMMMMMMM+
18 | `NMMMMMMMMN-
19 | `yMMMMMMMMMMd`
20 | yMMMMMMMMMMMMy
21 | oMMMMMMMMMMMMMM/
22 | oMMMMMMMMMMMMMMMN.
23 | /MMMMMMMMdMMMMMMMMd`
24 | /MMMMMMMMd`dMMMMMMMMs
25 | :NMMMMMMMN. :MMMMMMMMM/
26 | -NMMMMMMMM/ yMMMMMMMMN.
27 | .NMMMMMMMM+ .NMMMMMMMMd
28 | .mMMMMMMMMs /MMMMMMMMMs
29 | `dMMMMMMMMh` yMMMMMMMMM:
30 | `dMMMMMMMMd` `mMMMMMMMMN.
31 | `hMMMMMMMMm. :MMMMMMMMMh
32 | yMMMMMMMMN- oMMMMMMMMMo
33 | sMMMMMMMMN: `dMMMMMMMMN:
34 | oMMMMMMMMM/ -NMMMMMMMMm`
35 | +MMMMMMMMMo +MMMMMMMMMh
36 | /NMMMMMMMMs yMMMMMMMMM+
37 | :NMMMMMMMMy` .mMMMMMMMMN-
38 | -NMMMMMMMMd` :MMMMMMMMMm`
39 | -mMMMMMMMMm. sMMMMMMMMMy
40 | .mMMMMMMMMm- `dMMMMMMMMM+
41 | .dMMMMMMMMN: -NMMMMMMMMN-
42 | `dMMMMMMMMN/ +MMMMMMMMMd`
43 | `hMMMMMMMMM+ hMMMMMMMMMy
44 | yMMMMMMMMMs .NMMMMMMMMM/
45 | `////////// -/////////:
46 |
47 |
--------------------------------------------------------------------------------
/lambda-library/lem-default-config.el:
--------------------------------------------------------------------------------
1 | ;;; config.el --- summary -*- lexical-binding: t -*-
2 |
3 | ;; Maintainer: Colin Mclear
4 | ;; This file is not part of GNU Emacs
5 |
6 | ;; This program is free software: you can redistribute it and/or modify
7 | ;; it under the terms of the GNU General Public License as published by
8 | ;; the Free Software Foundation, either version 3 of the License, or
9 | ;; (at your option) any later version.
10 |
11 | ;; This program is distributed in the hope that it will be useful,
12 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | ;; GNU General Public License for more details.
15 |
16 | ;; You should have received a copy of the GNU General Public License
17 | ;; along with this program. If not, see .
18 |
19 | ;;; Commentary:
20 |
21 | ;; Personal config file
22 | ;; This file contains all user-specific settings
23 |
24 | ;;; Code:
25 | ;;;; Personal Information
26 |
27 | ;; Give Emacs some personal info
28 | (setq user-full-name ""
29 | user-mail-address "")
30 |
31 | ;;;;; Private File
32 | ;; where to store private or "secret" info
33 | (let ((private (expand-file-name "private.el" lem-user-dir)))
34 | (if (file-exists-p private)
35 | (load-file private)))
36 |
37 | ;;;; User Vars
38 |
39 | ;;;;; Set Fonts
40 | ;; Set fonts
41 | ;; Uncomment and set below variables for fonts other than the defaults
42 | ;; (custom-set-variables
43 | ;; '(lem-ui-default-font
44 | ;; '(:font "" :height 120)))
45 |
46 | ;; (custom-set-variables
47 | ;; '(lem-ui-variable-width-font
48 | ;; '(:font "" :height 120)))
49 |
50 |
51 | ;;;;; Org Directories
52 | ;; Set these if you're using org
53 | (setq org-directory ""
54 | org-default-notes-file (concat org-directory "inbox.org")
55 | org-agenda-files (list org-directory))
56 |
57 | ;;;;; Set Splash Footer
58 | ;; Set a footer for the splash screen
59 | (setq lem-splash-footer "")
60 |
61 | ;;;; Load Modules
62 | ;; Load modules in stages for a shorter init time. We load core modules first,
63 | ;; then more expensive modules after init, with the rest loaded after startup
64 | ;; has fully completed.
65 |
66 | ;;;;; Load base modules
67 | (message "
68 | ;; ======================================================
69 | ;; *Loading 𝛌-Emacs Base Modules*
70 | ;; ======================================================")
71 | (measure-time
72 | (cl-dolist (mod (list
73 | ;; Base modules
74 | 'lem-setup-libraries
75 | 'lem-setup-settings
76 | 'lem-setup-functions
77 | 'lem-setup-macros
78 | 'lem-setup-scratch
79 | 'lem-setup-theme
80 |
81 | ;; Basic UI modules
82 | 'lem-setup-windows
83 | 'lem-setup-buffers
84 | 'lem-setup-frames
85 | 'lem-setup-fonts
86 | 'lem-setup-faces))
87 | (require mod nil t)))
88 |
89 | ;;;;; Load After-Init Modules
90 | (defun lem-user-config-after-init ()
91 | "Modules loaded after init."
92 | (message "
93 | ;; ======================================================
94 | ;; *Loading 𝛌-Emacs after-init Modules*
95 | ;; ======================================================")
96 | (measure-time (cl-dolist (mod (list
97 | ;; Splash/Dashboard
98 | 'lem-setup-splash
99 | ;;'lem-setup-dashboard
100 |
101 | ;; Completion & Keybinds
102 | 'lem-setup-completion
103 | 'lem-setup-keybindings
104 |
105 | ;; Navigation & Search modules
106 | 'lem-setup-navigation
107 | 'lem-setup-dired
108 | 'lem-setup-search
109 |
110 | ;; Project & Tab/Workspace modules
111 | 'lem-setup-vc
112 | 'lem-setup-projects
113 | 'lem-setup-tabs
114 | 'lem-setup-workspaces))
115 | (require mod nil t))))
116 | (add-hook 'after-init-hook #'lem-user-config-after-init)
117 |
118 | ;;;;; Load After-Startup Modules
119 | (defun lem-user-config-after-startup ()
120 | "Modules loaded after Emacs startup."
121 | (message "
122 | ;; ======================================================
123 | ;; *Loading 𝛌-Emacs after-startup Modules*
124 | ;; ======================================================")
125 | (measure-time (cl-dolist (mod (list
126 |
127 | ;; Writing modules
128 | 'lem-setup-writing
129 | 'lem-setup-notes
130 | 'lem-setup-citation
131 |
132 | ;; Programming modules
133 | 'lem-setup-programming
134 | 'lem-setup-debug
135 | 'lem-setup-skeleton
136 |
137 | ;; Shell & Terminal
138 | 'lem-setup-shell
139 | 'lem-setup-eshell
140 |
141 | ;; Org modules
142 | 'lem-setup-org-base
143 | 'lem-setup-org-settings
144 | 'lem-setup-org-extensions
145 |
146 | ;; Productivity
147 | 'lem-setup-pdf
148 | 'lem-setup-elfeed
149 |
150 | ;; OS settings
151 | ;; load only if on macos
152 | (when sys-mac
153 | 'lem-setup-macos)
154 |
155 | ;; Other UI/UX
156 | 'lem-setup-help
157 | 'lem-setup-colors
158 | 'lem-setup-modeline
159 |
160 | ;; Server
161 | 'lem-setup-server))
162 | (require mod nil t))))
163 | (add-hook 'emacs-startup-hook #'lem-user-config-after-startup)
164 |
165 | ;;;;; Scratch Directory
166 | (customize-set-variable 'lem-scratch-default-dir lem-scratch-save-dir)
167 |
168 | ;;;; User Keybindings
169 | ;; Set this to whatever you wish. All Lambda-Emacs keybinds will be available through this prefix.
170 | (customize-set-variable 'lem-prefix "C-c C-SPC")
171 |
172 | ;;;; User Functions
173 | ;; Put any custom user functions here.
174 |
175 | ;;; Provide
176 | (provide 'config)
177 | ;;; config.el ends here
178 |
--------------------------------------------------------------------------------
/screenshots/agenda.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lambda-Emacs/lambda-emacs/d401af38014d625bb9eb89bcd777526ae11308fd/screenshots/agenda.png
--------------------------------------------------------------------------------
/screenshots/dark-splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lambda-Emacs/lambda-emacs/d401af38014d625bb9eb89bcd777526ae11308fd/screenshots/dark-splash.png
--------------------------------------------------------------------------------
/screenshots/eshell.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lambda-Emacs/lambda-emacs/d401af38014d625bb9eb89bcd777526ae11308fd/screenshots/eshell.png
--------------------------------------------------------------------------------
/screenshots/light-splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lambda-Emacs/lambda-emacs/d401af38014d625bb9eb89bcd777526ae11308fd/screenshots/light-splash.png
--------------------------------------------------------------------------------
/screenshots/minibuffer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lambda-Emacs/lambda-emacs/d401af38014d625bb9eb89bcd777526ae11308fd/screenshots/minibuffer.png
--------------------------------------------------------------------------------
/screenshots/org.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Lambda-Emacs/lambda-emacs/d401af38014d625bb9eb89bcd777526ae11308fd/screenshots/org.png
--------------------------------------------------------------------------------