diff options
| author | Craig Jennings <c@cjennings.net> | 2025-11-03 13:29:56 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-11-03 13:29:56 -0600 |
| commit | 6534147e502f3f1d504b8d2d9757aefa04bfbb07 (patch) | |
| tree | 4c0c1b5a123a06721df7871f146b093ef3e0d660 | |
| parent | 73115112c1f23775e3008b3a359b1d4fd77ae83b (diff) | |
fix: Swap print keybinding and add confirmation prompt
Print operations are now safer and more intuitive:
Keybinding changes:
- C-; b p → copy file path (safe, common action)
- C-; b P → print to PostScript (dramatic, requires shift)
Print function improvements:
- Add y-or-n-p confirmation before printing
- C-u prefix skips confirmation and enables color printing
- Prevents accidental waste of paper/toner
Serves V2MOM Values:
- Intuitive: Dramatic actions require shift key
- Intuitive: Prevents muscle memory mistakes
- Simple: Reliability through confirmation
Also updated docs/NOTES.org with Makefile availability note.
Closes inbox items from emacs-inbox-zero session (2025-11-03).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
| -rw-r--r-- | docs/NOTES.org | 21 | ||||
| -rw-r--r-- | modules/custom-buffer-file.el | 19 | ||||
| -rw-r--r-- | todo.org | 15 |
3 files changed, 44 insertions, 11 deletions
diff --git a/docs/NOTES.org b/docs/NOTES.org index 1b7b644c..a08a25e8 100644 --- a/docs/NOTES.org +++ b/docs/NOTES.org @@ -170,6 +170,27 @@ Deeply nested code: | CI/CD | pre-commit hooks | Prevent bad commits | | Review | byte-compile-file | Comprehensive check | +** Makefile - Comprehensive Testing & Validation Tool + +A comprehensive Makefile is available in the repository root with targets for testing, validation, and utilities. + +#+BEGIN_SRC bash +make # Show all available targets +make test # Run all tests (unit + integration) +make test-file FILE=... # Run specific test file +make test-name TEST=... # Run tests matching pattern +make validate-parens # Check for unbalanced parentheses +make validate-modules # Load all modules to verify compilation +make compile # Byte-compile all modules +make lint # Run checkdoc, package-lint, elisp-lint +make profile # Profile Emacs startup +make clean # Remove test artifacts and compiled files +make reset # Reset to first launch (destructive!) +#+END_SRC + +Created: 2025-11-03 +Adapted from chime.el Makefile with config-specific enhancements + * 📋 AVAILABLE SESSION TYPES ** create-session diff --git a/modules/custom-buffer-file.el b/modules/custom-buffer-file.el index cc4787d9..007fbe1a 100644 --- a/modules/custom-buffer-file.el +++ b/modules/custom-buffer-file.el @@ -64,14 +64,21 @@ auto-detect once per session.") (defun cj/print-buffer-ps (&optional color) "Print the buffer (or active region) as PostScript to the default printer. -With prefix argument COLOR, print in color; otherwise print in monochrome. +With prefix argument COLOR, print in color and skip confirmation; otherwise +print in monochrome with confirmation prompt. Sends directly to the system spooler with no header." (interactive "P") (unless (require 'ps-print nil t) (user-error "Cannot print: ps-print library not found")) (let* ((spooler (cj/print--resolve-spooler)) (want-color (not (null color))) - (have-region (use-region-p))) + (have-region (use-region-p)) + (skip-confirm color)) ; C-u skips confirmation + ;; Confirm unless C-u was used + (when (and (not skip-confirm) + (not (y-or-n-p (format "Send %s to printer? " + (if have-region "region" "buffer"))))) + (user-error "Printing cancelled")) (let ((ps-lpr-command spooler) (ps-printer-name nil) ; default system printer (ps-lpr-switches nil) @@ -277,13 +284,13 @@ TODO: Future integration with difftastic for structural diffs (Method 3)." :doc "Keymap for buffer and file operations." "m" #'cj/move-buffer-and-file "r" #'cj/rename-buffer-and-file - "p" #'cj/print-buffer-ps + "p" #'cj/copy-path-to-buffer-file-as-kill "d" #'cj/delete-buffer-and-file "D" #'cj/diff-buffer-with-file "c" cj/copy-buffer-content-map "n" #'cj/copy-buffer-name "l" #'cj/copy-link-to-buffer-file - "P" #'cj/copy-path-to-buffer-file-as-kill + "P" #'cj/print-buffer-ps "t" #'cj/clear-to-top-of-buffer "b" #'cj/clear-to-bottom-of-buffer "x" #'erase-buffer @@ -297,7 +304,7 @@ TODO: Future integration with difftastic for structural diffs (Method 3)." "C-; b" "buffer and file menu" "C-; b m" "move file" "C-; b r" "rename file" - "C-; b p" "print to PS" + "C-; b p" "copy file path" "C-; b d" "delete file" "C-; b D" "diff buffer with file" "C-; b c" "buffer copy menu" @@ -306,7 +313,7 @@ TODO: Future integration with difftastic for structural diffs (Method 3)." "C-; b c t" "copy to top" "C-; b n" "copy buffer name" "C-; b l" "copy file link" - "C-; b P" "copy file path" + "C-; b P" "print to PS" "C-; b t" "clear to top" "C-; b b" "clear to bottom" "C-; b x" "erase buffer" @@ -184,10 +184,15 @@ Review this inbox, cancel stale items, keep < 20 active. Track in calendar. Can't research next thing until current thing is implemented. * Emacs Config Inbox -** TODO [#A] Irritant: Print should be keybound to capital P -and perhaps print-screen (however Emacs references that key) +** DONE [#A] Irritant: Print should be keybound to capital P +CLOSED: [2025-11-03 Sun] -lowercase p should be about getting path, not doing something dramatic like sending a document to the LPR without confirmation +Swapped keybindings: +- C-; b p → copy file path (safe, common action) +- C-; b P → print to PS (dramatic, requires shift) -** TODO [#A] Irritant: send buffer to printer must have confirmation -it should allow to skip the confirmation with C-u. +** DONE [#A] Irritant: send buffer to printer must have confirmation +CLOSED: [2025-11-03 Sun] + +Added y-or-n-p confirmation to cj/print-buffer-ps. +C-u prefix skips confirmation and prints in color. |
