From 4566ec69d269ecba8d9386a131b932ee5244aa8e Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 5 May 2024 09:23:58 -0500 Subject: enhancements, functions, tests, and misc enhancements - move accent-company to C-` and ensure it's on for org mode - re-enable narrow-to-region - turn on network repos by default - remove setq in company's use-package custom clause - increase company delay to .7 secs - recipe templates should have visibility show all - move video recordings code to separate module - move geiser-guile to prog-lisp functions - improve cj/reformat-region-or-buffer via restriction - improvements to test-format-region - adding tests for clear-blank-lines - Add prepend-lines and replace-fraction-glyphs functions - add cj/clear-blank-lines function - create cj/load-all-tests utility function tests - add keybinding for ert-run-tests-interactively - ensure ert libraries are available to load-all-tests - remove running the tests when evaluating the buffer - fix clear-blank-lines and adding better tests misc - updated packages - adding the luddite blog to elfeed - more abbrevs --- modules/config-utilities.el | 35 ++++++++++-- modules/custom-functions.el | 118 +++++++++++++++++++++++++++++++++-------- modules/dirvish-config.el | 7 +-- modules/org-config.el | 1 - modules/org-roam-config.el | 2 +- modules/prog-lisp.el | 14 ++++- modules/record-desktop.el | 61 +++++++++++++++++++++ modules/selection-framework.el | 4 +- modules/system-defaults.el | 69 ++++++++++++------------ modules/test-code.el | 63 +++------------------- modules/text-config.el | 4 +- modules/user-constants.el | 7 ++- 12 files changed, 255 insertions(+), 130 deletions(-) create mode 100644 modules/record-desktop.el (limited to 'modules') diff --git a/modules/config-utilities.el b/modules/config-utilities.el index 3aaa006d..90268b7d 100644 --- a/modules/config-utilities.el +++ b/modules/config-utilities.el @@ -6,6 +6,24 @@ ;;; Code: + +;; ------------------------------- Load ERT Tests ------------------------------ + +(defun cj/load-all-tests () + "`load' all ert libraries in test which are not already loaded." + (interactive) + (require 'ert) + (setq ert--tests (make-hash-table :test 'equal)) ;; forget all existing tests + (eval-buffer) + (let ((libraries-loaded (mapcar #'file-name-sans-extension + (delq nil (mapcar #'car load-history)))) + (dir (concat user-emacs-directory "tests/"))) + (dolist (file (directory-files dir t ".+\\.elc?$")) + (let ((library (file-name-sans-extension file))) + (unless (member library libraries-loaded) + (load library nil t) + (push library libraries-loaded)))))) + ;; ------------------------------ Reload Init File ----------------------------- ;; it does what it says it does. @@ -23,13 +41,19 @@ Will recompile natively if supported, or byte-compiled if not." (interactive) (let* ((native-comp-supported (boundp 'native-compile-async)) - (elt-dir (expand-file-name (if native-comp-supported "eln" "elc") user-emacs-directory)) - (message-format (format "Please confirm recursive %s recompilation of %%s: " (if native-comp-supported "native" "byte"))) - (compile-message (format "%scompiling all emacs-lisp files in %%s" (if native-comp-supported "Natively " "Byte-")))) + (elt-dir + (expand-file-name (if native-comp-supported "eln" "elc") + user-emacs-directory)) + (message-format + (format "Please confirm recursive %s recompilation of %%s: " + (if native-comp-supported "native" "byte"))) + (compile-message (format "%scompiling all emacs-lisp files in %%s" + (if native-comp-supported "Natively " "Byte-")))) (if (yes-or-no-p (format message-format user-emacs-directory)) (progn (message "Deleting all compiled files in %s" user-emacs-directory) - (dolist (file (directory-files-recursively user-emacs-directory "\\(\\.elc\\|\\.eln\\)$")) + (dolist (file (directory-files-recursively user-emacs-directory + "\\(\\.elc\\|\\.eln\\)$")) (delete-file file)) (when (file-directory-p elt-dir) (delete-directory elt-dir t t)) @@ -46,7 +70,8 @@ Will recompile natively if supported, or byte-compiled if not." (defun cj/delete-emacs-home-compiled-files () "Delete all compiled files recursively in \='user-emacs-directory\='." (interactive) - (message "Deleting compiled files under %s. This may take a while." user-emacs-directory) + (message "Deleting compiled files under %s. This may take a while." + user-emacs-directory) (require 'find-lisp) ;; make sure the package is required (mapc (lambda (path) (when (or (string-suffix-p ".elc" path) diff --git a/modules/custom-functions.el b/modules/custom-functions.el index 68c2270f..4f9c784b 100644 --- a/modules/custom-functions.el +++ b/modules/custom-functions.el @@ -25,7 +25,7 @@ (t (message "Cursor doesn't follow parenthesis, so there's no match.")))) ;; ---------------------------- Join Line Or Region ---------------------------- -;; joins all selected lines and fixes up the whitespace. +;; joins all selected lines and fixes up the whitespace. (defun cj/join-line-or-region (beg end) "Apply \='join-line\=' over the marked region or join with previous line. @@ -112,22 +112,16 @@ If no region is selected, operate on the whole buffer." ;; reindent, untabify, and delete trailing whitespace across region or buffer (defun cj/format-region-or-buffer () - "Reformat the region or the entire buffer. -If a region is selected, delete trailing whitespace, then indent and untabify -the region. If no region is selected, perform the same actions across the -buffer." + "Reformat the region or the entire buffer." (interactive) - (let (start-pos end-pos) - (if (use-region-p) - (progn - (setq start-pos (region-beginning)) - (setq end-pos (region-end))) - (setq start-pos (point-min)) - (setq end-pos (point-max))) - (save-excursion - (delete-trailing-whitespace start-pos end-pos) - (indent-region start-pos end-pos nil) - (untabify start-pos end-pos)))) + (let ((start-pos (if (use-region-p) (region-beginning) (point-min))) + (end-pos (if (use-region-p) (region-end) (point-max)))) + (save-excursion + (save-restriction + (narrow-to-region start-pos end-pos) + (delete-trailing-whitespace) + (indent-region (point-min) (point-max)) + (untabify (point-min) (point-max)))))) ;; ------------------- Remove Leading And Trailing Whitespace ------------------ ;; removes leading and trailing whitespace on line, region, or buffer. @@ -263,6 +257,7 @@ User is prompted for the optional descriptor." (message "Can't insert around. No word at point and no region selected.")))))) (global-set-key (kbd "C-; i a") 'cj/insert-around-word-or-region) + ;; ------------------------ Insert Around Word Or Region ----------------------- (defun cj/insert-around-word-or-region () @@ -305,6 +300,26 @@ User is prompted for the optional descriptor." (insert str) (forward-line 1))))) +;; -------------------- Prepend To Lines In Region Or Buffer -------------------- +;; prepend characters to the beginning of all lines in the region or the buffer. +;; should probably be collapsed into the append lines function. . + +(defun cj/prepend-to-lines-in-region-or-buffer (str) + "Prompt for STR and prepend it to the start of each line in region or buffer." + (interactive "sEnter string to prepend: ") + (let ((start-pos (if (use-region-p) + (region-beginning) + (point-min))) + (end-pos (if (use-region-p) + (region-end) + (point-max)))) + (save-excursion + (goto-char start-pos) + (while (< (point) end-pos) + (beginning-of-line 1) + (insert str) + (forward-line 1))))) + ;; ------------------------------ Hyphenate Region ----------------------------- ;; hyphenates any empty space in a region; complains if there's no Region @@ -385,7 +400,8 @@ and all articles are considered minor words." ;; Check the beginning of the previous word doesn't reset first. (save-excursion (and - (not (zerop (skip-chars-backward "[:blank:]" prev-word-end))) + (not (zerop + (skip-chars-backward "[:blank:]" prev-word-end))) (memq (char-before (point)) chars-skip-reset)))) (delete-region (point) (1+ (point))) (insert c-up)))))) @@ -397,14 +413,68 @@ and all articles are considered minor words." ;; --------------------------- Buffer Strip Control M -------------------------- ;; remove windows carriage return control characters from the buffer -(defun buffer-strip-ctrl-m () +(defun cj/buffer-strip-ctrl-m () "Remove ^M from the current buffer." (interactive) (save-excursion (goto-char (point-min)) - (while (search-forward "^M" nil t) + (while (search-forward "" nil t) (replace-match "" nil t)))) +;; ----------------------------- Clear Blank Lines ----------------------------- + +(defun cj/clear-blank-lines (beginning end) + "Remove blank lines in the region or the buffer if no region is selected. +BEGINNING and END describe the selected region." + (interactive "r") + (save-excursion + (goto-char beginning) + (while (re-search-forward "^[ \t]*\n" end t) + (replace-match "")))) + +;; ---------------------- Fixup Whitespace Line Or Region ---------------------- + +(defun cj/fixup-whitespace-line-or-region (&optional region) + "Fix up whitespace in the current line, or region if selected. +Ensure there is exactly one space between words, and remove leading and trailing +whitespace. When called with a prefix argument, it operates on the current +REGION." + (interactive "P") + (save-excursion + (let* ((beg (if region (region-beginning) (line-beginning-position))) + (end (if region (region-end) (line-end-position)))) + (save-restriction + (narrow-to-region beg end) + ;; Replace all tabs with space + (goto-char (point-min)) + (replace-string "\t" " " nil beg end) + ;; Remove leading and trailing spaces + (goto-char (point-min)) + (while (re-search-forward "^\\s-+\\|\\s-+$" nil t) + (replace-match "" nil nil)) + ;; Ensure only one space between words/symbols. + (goto-char (point-min)) + (while (re-search-forward "\\s-\\{2,\\}" nil t) + (replace-match " " nil nil)))))) + +;; -------------------------- Replace Fraction Glyphs -------------------------- + +(defun cj/replace-fraction-glyphs (start end) + "Replace common fraction glyphs with their spelled out format. +Operates in the buffer or region (as identified with START and END) if selected. +Replaces the text with the glyphs if called with C-u." + (interactive "r") + (let ((replacements (if current-prefix-arg + '(("1/4" . "¼") ("1/2" . "½") ("3/4" . "¾") + ("1/3" . "⅓") ("2/3" . "⅔")) + '(("¼" . "1/4") ("½" . "1/2") ("¾" . "3/4") + ("⅓" . "1/3") ("⅔" . "2/3"))))) + (save-excursion + (dolist (r replacements) + (goto-char start) + (while (search-forward (car r) end t) + (replace-match (cdr r))))))) + ;; ------------------------------ Insert Date Time ----------------------------- ;; insert a sortable or a readable datestamp or timestamp @@ -557,11 +627,12 @@ Uses `sortable-time-format' for the formatting the date/time." (define-key map "d" 'cj/duplicate-line-or-region) (define-key map "D" 'cj/remove-duplicate-lines-from-region-or-buffer) - (define-key map ")" #'cj/jump-to-matching-paren) + (define-key map ")" #'cj/jump-to-matching-paren) + (define-key map "/" #'cj/replace-fraction-glyphs) + (define-key map "L" #'cj/clear-blank-lines) (define-key map "-" #'cj/hyphenate-region) (define-key map "U" 'upcase-region) - (define-key map "w" 'cj/remove-leading-trailing-whitespace) - (define-key map "W" 'fixup-whitespace) + (define-key map "w" 'cj/fixup-whitespace-line-or-region) (define-key map "#" 'cj/count-words-buffer-or-region) (define-key map "1" 'cj/alphabetize-and-replace-region) (define-key map "C" 'display-fill-column-indicator-mode) @@ -570,6 +641,7 @@ Uses `sortable-time-format' for the formatting the date/time." (define-key map "j" 'cj/join-line-or-region) (define-key map "l" 'downcase-dwim) (define-key map "p" 'cj/append-to-lines-in-region-or-buffer) + (define-key map "P" 'cj/prepend-to-lines-in-region-or-buffer) (define-key map "r" 'align-regexp) (define-key map "u" 'cj/title-case-region) (define-key map "c" 'cj/wrap-region-as-code-span) @@ -583,7 +655,7 @@ Uses `sortable-time-format' for the formatting the date/time." (global-set-key (kbd "C-; i t") 'cj/insert-sortable-time) (global-set-key (kbd "C-; i d") 'cj/insert-sortable-date) ;; buffer and file operations -(global-set-key (kbd "C-; b r") 'cj/rename-buffer-and-file) +(global-set-key (kbd "C-; b r") 'cj/renameq-buffer-and-file) (global-set-key (kbd "C-; b d") 'cj/delete-buffer-and-file) (global-set-key (kbd "C-; b m") 'cj/move-buffer-and-file) ;; copy link to source file diff --git a/modules/dirvish-config.el b/modules/dirvish-config.el index d5dc6c33..c0cf7309 100644 --- a/modules/dirvish-config.el +++ b/modules/dirvish-config.el @@ -99,16 +99,17 @@ automatically displayed." ("cx" ,code-dir "code diredtory") ("ws" ,(concat code-dir "/website") "website staging") ("dr" ,(concat sync-dir "/drill/") "drill files") - ("s" ,sync-dir "sync directory") - ("mp" ,(concat sync-dir "/playlists") "music playlists") + ("s" ,sync-dir "sync directory") + ("vr" ,video-recordings-dir "video recordings directory") ("px" ,projects-dir "projects directory") ("tg" ,(concat sync-dir "/text.games") "text games") ("ps" ,(concat pix-dir "/screenshots/") "pictures screenshots") ("pw" ,(concat pix-dir "/wallpaper/") "pictures wallpaper") ("px" ,pix-dir "pictures directory") ("dl" ,dl-dir "downloads") - ("dt" ,(concat dl-dir "/torrents/complete/") "torrents") + ("dt" ,(concat dl-dir "/torrents/complete/") "torrents") ("vx" ,videos-dir "videos") + ("pl" "~/sync/playlists/" "playlists directory") ("df" "~/.dotfiles/" "dotfiles") ("dx" "~/documents/" "documents") ("mx" "~/music/" "music") diff --git a/modules/org-config.el b/modules/org-config.el index ac206d09..d7230381 100644 --- a/modules/org-config.el +++ b/modules/org-config.el @@ -204,7 +204,6 @@ org-archive-subtree-default are placed.") (org-mode . flyspell-mode) (org-mode . turn-on-visual-line-mode) (org-mode . org-indent-mode) - (org-mode . (lambda () (interactive) (company-mode -1))) ;; no company-mode in org :config (cj/org-general-settings) diff --git a/modules/org-roam-config.el b/modules/org-roam-config.el index ede2025f..e7d7b980 100644 --- a/modules/org-roam-config.el +++ b/modules/org-roam-config.el @@ -30,7 +30,7 @@ ("r" "recipe" plain (function (lambda () (concat roam-dir "templates/recipe.org"))) :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+TITLE: ${title} - #+CATEGORY: ${title}\n#+FILETAGS: Recipe") + #+CATEGORY: ${title}\n#+FILETAGS: Recipe\n#+STARTUP: showall") :unnarrowed t) ("p" "project" plain (function (lambda () (concat roam-dir "templates/project.org"))) diff --git a/modules/prog-lisp.el b/modules/prog-lisp.el index 59eb122b..c68e04cf 100644 --- a/modules/prog-lisp.el +++ b/modules/prog-lisp.el @@ -80,8 +80,11 @@ (ert t)) (keymap-global-unset "C-r" t) + (keymap-global-unset "C-R" t) (define-key emacs-lisp-mode-map (kbd "C-r") 'ert-all-tests) - (define-key lisp-interaction-mode-map (kbd "C-r") 'ert-all-tests)) + (define-key emacs-lisp-mode-map (kbd "C-R") 'ert-run-tests-interactively) + (define-key lisp-interaction-mode-map (kbd "C-r") 'ert-all-tests) + (define-key lisp-interaction-mode-map (kbd "C-R") 'ert-run-tests-interactively)) (use-package el-mock) ;; mock/stub framework @@ -125,6 +128,15 @@ (set-face-foreground 'rainbow-delimiters-depth-8-face "#999") ;; medium gray (set-face-foreground 'rainbow-delimiters-depth-9-face "#666")) ;; dark gray +;; -------------------------------- Geiser Guile ------------------------------- +;; Guile support in Emacs + +(use-package geiser-guile + :defer 1 + :commands (geiser-guile) + :bind ("C-c G" . geiser-guile) + :config + (setq geiser-guile-binary "/usr/bin/guile")) (provide 'prog-lisp) ;;; prog-lisp.el ends here diff --git a/modules/record-desktop.el b/modules/record-desktop.el new file mode 100644 index 00000000..6c5a4fac --- /dev/null +++ b/modules/record-desktop.el @@ -0,0 +1,61 @@ +;;; record-desktop.el --- Video Record desktop -*- lexical-binding: t; -*- + +;;; Commentary: +;; Use ffmpeg to video record your desktop. +;; with audio from mic and audio from default audio sink + +;; Note: video-recordings-dir is defined (and directory created) in +;; user-cosntants.el + +;;; Code: + +(defvar cj/video-recording-ffmpeg-process nil + "Variable to store the process of the ffmpeg recording.") + +(defun cj/video-recording-start (arg) + "Starts the ffmpeg recording. +If called with a prefix arg C-u, choose the location on where to save the +recording, otherwise use the default location in `video-recordings-dir'." + (interactive "P") + (let* ((location (if arg + (read-directory-name "Enter recording location: ") + video-recordings-dir)) + (directory (file-name-directory location))) + (unless (file-directory-p directory) + (make-directory directory t)) + (cj/ffmpeg-record location))) + +(defun cj/ffmpeg-record (directory) + "Start an ffmpeg recording. Save output to DIRECTORY." + (unless cj/video-recording-ffmpeg-process + (let* ((location (expand-file-name directory)) + (name (format-time-string "%Y-%m-%d-%H-%M-%S")) + (filename (concat location "/" name ".mkv")) + (ffmpeg-command + (concat "ffmpeg -framerate 30 -f x11grab -i :0.0+ " + "-f pulse -i " + "alsa_input.pci-0000_00_1b.0.analog-stereo " + "-ac 1 " + "-f pulse -i " + "alsa_output.pci-0000_00_1b.0.analog-stereo.monitor " + "-ac 2 " filename))) + ;; start the recording + (setq cj/video-recording-ffmpeg-process + (start-process-shell-command "ffmpeg-recording" + "*ffmpeg-recording*" + ffmpeg-command)) + (set-process-query-on-exit-flag cj/video-recording-ffmpeg-process nil) + (message "Started recording process.")))) + +(defun cj/video-recording-stop () + "Stop the ffmpeg recording process." + (interactive) + (when cj/video-recording-ffmpeg-process + (delete-process cj/video-recording-ffmpeg-process) + (setq cj/video-recording-ffmpeg-process nil) + (message "Stopped video recording."))) + + + +(provide 'record-desktop) +;;; record-desktop.el ends here. diff --git a/modules/selection-framework.el b/modules/selection-framework.el index 6428a977..1ee83ca2 100644 --- a/modules/selection-framework.el +++ b/modules/selection-framework.el @@ -28,9 +28,9 @@ ;; provide proper casing even if I don't. (company-dabbrev-ignore-case t) ;; company completion wait - (company-idle-delay 0.2) + ( company-idle-delay 0.7) ;; use vscode icons in the margin - (setq company-format-margin-function #'company-vscode-light-icons-margin) + (company-format-margin-function #'company-vscode-light-icons-margin) ;; no company-mode in shell & eshell (company-global-modes '(not eshell-mode shell-mode))) diff --git a/modules/system-defaults.el b/modules/system-defaults.el index 48ac3d50..b7af439b 100644 --- a/modules/system-defaults.el +++ b/modules/system-defaults.el @@ -42,26 +42,27 @@ ;; ------------------------- Re-Enabling Functionality ------------------------- +(put 'narrow-to-region 'disabled nil) ;; narrow-to-region is extremely useful! (put 'upcase-region 'disabled nil) ;; upcase region is useful (put 'erase-buffer 'disabled nil) ;; and so is erase-buffer ;; ------------------------------ Non UI Settings ------------------------------ -(setq ring-bell-function 'ignore) ;; disable the bell ring. -(setq default-directory user-home-dir) ;; consider user home the default directory +(setq ring-bell-function 'ignore) ;; disable the bell ring. +(setq default-directory user-home-dir) ;; consider user home the default directory -(global-auto-revert-mode) ;; update the buffer when the associated file has changed -(setq global-auto-revert-non-file-buffers t) ;; do so for all buffer types (e.g., ibuffer) -(setq bidi-display-reordering nil) ;; don't reorder bidirectional text for display -(setq bidi-paragraph-direction t) ;; forces directionality of text for performance. +(global-auto-revert-mode) ;; update the buffer when the associated file has changed +(setq global-auto-revert-non-file-buffers t) ;; do so for all buffer types (e.g., ibuffer) +(setq bidi-display-reordering nil) ;; don't reorder bidirectional text for display +(setq bidi-paragraph-direction t) ;; forces directionality of text for performance. -(setq system-time-locale "C") ;; use en_US locale to format time. +(setq system-time-locale "C") ;; use en_US locale to format time. ;; --------------------------------- Clipboard --------------------------------- -(setq select-enable-clipboard t) ;; cut and paste using clipboard -(setq yank-pop-change-selection t) ;; update system clipboard when yanking in emacs -(setq save-interprogram-paste-before-kill t) ;; saves existing clipboard to kill ring before replacing +(setq select-enable-clipboard t) ;; cut and paste using clipboard +(setq yank-pop-change-selection t) ;; update system clipboard when yanking in emacs +(setq save-interprogram-paste-before-kill t) ;; saves existing clipboard to kill ring before replacing ;; -------------------------------- Tab Settings ------------------------------- ;; use spaces, not tabs @@ -77,9 +78,9 @@ ;; ----------------------------- Case Insensitivity ---------------------------- ;; make user interfaces case insensitive -(setq case-fold-search t) ;; case-insensitive searches -(setq completion-ignore-case t) ;; case-insensitive completion -(setq read-file-name-completion-ignore-case t) ;; case-insensitive file completion +(setq case-fold-search t) ;; case-insensitive searches +(setq completion-ignore-case t) ;; case-insensitive completion +(setq read-file-name-completion-ignore-case t) ;; case-insensitive file completion ;; ------------------------------- Async Commands ------------------------------ ;; always create new async command buffers silently @@ -94,9 +95,9 @@ ;; ------------------------ Mouse And Trackpad Settings ------------------------ ;; provide smoothest scrolling and avoid accidental gestures -(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse -(setq scroll-margin 5) ;; scroll w/in 10 lines of top/bottom -(setq scroll-step 1) ;; keyboard scroll one line at a time +(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse +(setq scroll-margin 5) ;; scroll w/in 10 lines of top/bottom +(setq scroll-step 1) ;; keyboard scroll one line at a time ;; disable pasting with mouse-wheel click (global-unset-key (kbd "")) @@ -108,19 +109,19 @@ ;; ------------------------------- Be Quiet(er)! ------------------------------- ;; reduces "helpful" instructions that distract Emacs power users. -(setq-default vc-follow-symlinks) ;; don't ask to follow symlinks if target is version controlled -(setq kill-buffer-query-functions ;; don't ask about killing buffers with processes, just kill them +(setq-default vc-follow-symlinks) ;; don't ask to follow symlinks if target is version controlled +(setq kill-buffer-query-functions ;; don't ask about killing buffers with processes, just kill them (remq 'process-kill-buffer-query-function kill-buffer-query-functions)) -(setq confirm-kill-processes nil) ;; automatically kill running processes on exit -(setq confirm-nonexistent-file-or-buffer nil) ;; don't ask if a file I visit with C-x C-f or C-x b doesn't exist -(setq ad-redefinition-action 'accept) ;; silence warnings about advised functions getting redefined. -(setq large-file-warning-threshold nil) ;; open files regardless of size -(fset 'yes-or-no-p 'y-or-n-p) ;; require a single letter for binary answers -(setq use-short-answers t) ;; same as above with Emacs 28+ -(setq auto-revert-verbose nil) ;; turn off auto revert messages -(setq custom-safe-themes t) ;; treat all themes as safe (stop asking) -(setq server-client-instructions nil) ;; I already know what to do when done with the frame +(setq confirm-kill-processes nil) ;; automatically kill running processes on exit +(setq confirm-nonexistent-file-or-buffer nil) ;; don't ask if a file I visit with C-x C-f or C-x b doesn't exist +(setq ad-redefinition-action 'accept) ;; silence warnings about advised functions getting redefined. +(setq large-file-warning-threshold nil) ;; open files regardless of size +(fset 'yes-or-no-p 'y-or-n-p) ;; require a single letter for binary answers +(setq use-short-answers t) ;; same as above with Emacs 28+ +(setq auto-revert-verbose nil) ;; turn off auto revert messages +(setq custom-safe-themes t) ;; treat all themes as safe (stop asking) +(setq server-client-instructions nil) ;; I already know what to do when done with the frame ;; ------------------ Reduce Garbage Collections In Minibuffer ----------------- ;; triggers garbage collection when it won't impact user minibuffer entries @@ -174,13 +175,13 @@ (make-directory cj/backup-directory t)) ;; BACKUP SETTINGS -(setq make-backup-files t) ;; do make backup files -(setq backup-directory-alist `(("." . ,cj/backup-directory))) ;; put all originals in backup directory -(setq backup-by-copying t) ;; don't clobber symlinks -(setq version-control t) ;; make numeric backup versions -(setq delete-old-versions t) ;; delete excess backup files w/o asking -(setq kept-new-versions 25) ;; keep 25 of the newest backups made (default: 2) -(setq vc-make-backup-files t) ;; also backup any files in version control +(setq make-backup-files t) ;; do make backup files +(setq backup-directory-alist `(("." . ,cj/backup-directory))) ;; put all originals in backup directory +(setq backup-by-copying t) ;; don't clobber symlinks +(setq version-control t) ;; make numeric backup versions +(setq delete-old-versions t) ;; delete excess backup files w/o asking +(setq kept-new-versions 25) ;; keep 25 of the newest backups made (default: 2) +(setq vc-make-backup-files t) ;; also backup any files in version control ;; ---------------------------- Exec Path From Shell --------------------------- ;; ensure $PATH is the same between your normal shell and your Emacs shells. diff --git a/modules/test-code.el b/modules/test-code.el index 409f8e07..bde37cb2 100644 --- a/modules/test-code.el +++ b/modules/test-code.el @@ -7,15 +7,14 @@ ;;; Code: -;; -------------------------------- Geiser Guile ------------------------------- -;; Guile support in Emacs +;; ----------------------------------- Mpdel ----------------------------------- -(use-package geiser-guile - :defer 1 - :commands (geiser-guile) - :bind ("C-c G" . geiser-guile) +(use-package mpdel + :defer .5 :config - (setq geiser-guile-binary "/usr/bin/guile")) + (setq mpdel-prefix-key (kbd "M-p")) + (mpdel-mode)) + ;; ---------------------------------- Yeetube ---------------------------------- ;; youtube frontend for emacs @@ -56,56 +55,6 @@ :config (easy-hugo-enable-menu)) - -;; --------------------------------- Recording --------------------------------- - -(defvar cj/ffmpeg-process nil - "Variable to store the process of the ffmpeg recording.") - -(defvar cj/recording-location "~/videos/recordings" - "The location to save the ffmpeg recordings.") - -(defun cj/start-recording (arg) - "Starts the ffmpeg recording. -If called with a prefix arg C-u, choose the location on where to save the recording, -otherwise use the default location in `cj/recording-location'." - (interactive "P") - (let* ((location (if arg - (read-directory-name "Enter recording location: ") - cj/recording-location)) - (directory (file-name-directory location))) - (unless (file-directory-p directory) - (make-directory directory t)) - (cj/ffmpeg-record location))) - -(defun cj/ffmpeg-record (directory) - "Start an ffmpeg recording. Save output to DIRECTORY." - (unless cj/ffmpeg-process - (let* ((location (expand-file-name directory)) - (name (format-time-string "%Y-%m-%d-%H-%M-%S")) - (filename (concat location "/" name ".mkv")) - (ffmpeg-command - (concat "ffmpeg -framerate 30 -f x11grab -i :0.0+ " - "-f pulse -i alsa_input.pci-0000_00_1b.0.analog-stereo " - "-ac 1 -f pulse -i alsa_output.pci-0000_00_1b.0.analog-stereo.monitor " - "-ac 2 " filename))) - ;; start the recording - (setq cj/ffmpeg-process - (start-process-shell-command "ffmpeg-recording" - "*ffmpeg-recording*" - ffmpeg-command)) - (set-process-query-on-exit-flag cj/ffmpeg-process nil) - (message "Started recording process.")))) - -(defun cj/stop-recording () - "Stop the ffmpeg recording process." - (interactive) - (when cj/ffmpeg-process - (delete-process cj/ffmpeg-process) - (setq cj/ffmpeg-process nil) - (message "Stopped recording process."))) - - ;; -------------------------------- Google This -------------------------------- (use-package google-this diff --git a/modules/text-config.el b/modules/text-config.el index 9db626ed..e3713fef 100644 --- a/modules/text-config.el +++ b/modules/text-config.el @@ -94,12 +94,12 @@ :config (setq-default olivetti-body-width 100)) -;; --------------------------- Acccent (Diacriticals) -------------------------- +;; --------------------------- Accent (Diacriticals) --------------------------- ;; an easy way to enter diacritical marks (use-package accent :defer 1 - :bind ("C-c C-a" . accent-company)) + :bind ("C-`" . accent-company)) ;; ----------------------------- Visual Fill Column ---------------------------- ;; text wrapping diff --git a/modules/user-constants.el b/modules/user-constants.el index 56c0f2f9..11872474 100644 --- a/modules/user-constants.el +++ b/modules/user-constants.el @@ -55,6 +55,10 @@ (defconst snippets-dir (concat sync-dir "snippets/") "The location of ya-snippet snippets.") +(defconst video-recordings-dir "~/videos/recordings" + "The location to save the ffmpeg recordings.") + + ;; FILES (defvar schedule-file (concat sync-dir "schedule.org") "The location of the org file containing scheduled events.") @@ -99,7 +103,8 @@ (mapc 'cj/verify-or-create-dir (list sync-dir roam-dir journals-dir - snippets-dir)) + video-recordings-dir + snippets-dir)) (mapc 'cj/verify-or-create-file (list schedule-file inbox-file -- cgit v1.2.3