[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/paredit 73c481a 061/224: Simplify and clarify implementati
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/paredit 73c481a 061/224: Simplify and clarify implementation of `paredit-backslash'. |
Date: |
Sat, 7 Aug 2021 09:22:19 -0400 (EDT) |
branch: elpa/paredit
commit 73c481aad0af84f01649d8f1616c0d022aca9c42
Author: Taylor R Campbell <campbell@mumble.net>
Commit: Taylor R Campbell <campbell@mumble.net>
Simplify and clarify implementation of `paredit-backslash'.
Ignore-this: a59b556bdad0266cec90303f6864738e
darcs-hash:20110320171404-00fcc-87038309e85fdc70dbbb48714769decf4317e3bb
---
paredit.el | 41 ++++++++++++++---------------------------
1 file changed, 14 insertions(+), 27 deletions(-)
diff --git a/paredit.el b/paredit.el
index 35265bc..2f6a0f1 100644
--- a/paredit.el
+++ b/paredit.el
@@ -932,35 +932,22 @@ If not in a string, act as `paredit-doublequote'; if no
prefix argument
"Insert a backslash followed by a character to escape."
(interactive)
(insert ?\\ )
- ;; This funny conditional is necessary because PAREDIT-IN-COMMENT-P
- ;; assumes that PAREDIT-IN-STRING-P already returned false; otherwise
- ;; it may give erroneous answers.
+ ;; Can't call `paredit-in-comment-p' unless `paredit-in-string-p'
+ ;; gives false. Read this as simply (not (paredit-in-comment-p)).
(if (or (paredit-in-string-p)
(not (paredit-in-comment-p)))
- (let ((delp t))
- (unwind-protect (setq delp
- (call-interactively 'paredit-escape))
- ;; We need this in an UNWIND-PROTECT so that the backlash is
- ;; left in there *only* if PAREDIT-ESCAPE return NIL normally
- ;; -- in any other case, such as the user hitting C-g or an
- ;; error occurring, we must delete the backslash to avoid
- ;; leaving a dangling escape. (This control structure is a
- ;; crock.)
- (if delp (backward-delete-char 1))))))
-
-;;; This auxiliary interactive function returns true if the backslash
-;;; should be deleted and false if not.
-
-(defun paredit-escape (char)
- ;; I'm too lazy to figure out how to do this without a separate
- ;; interactive function.
- (interactive "cEscaping character...")
- (if (eq char 127) ; The backslash was a typo, so
- t ; the luser wants to delete it.
- (insert char) ; (Is there a better way to
- nil)) ; express the rubout char?
- ; ?\^? works, but ugh...)
-
+ ;; Read a character to insert after the backslash. If anything
+ ;; goes wrong -- the user hits delete (entering the rubout
+ ;; `character'), aborts with C-g, or enters non-character input
+ ;; -- then delete the backslash to avoid a dangling escape.
+ (let ((delete-p t))
+ (unwind-protect
+ (let ((char (read-char "Escaping character...")))
+ (if (not (eq char ?\^?))
+ (progn (insert char) (setq delete-p nil))))
+ (if delete-p
+ (backward-delete-char 1))))))
+
(defun paredit-newline ()
"Insert a newline and indent it.
This is like `newline-and-indent', but it not only indents the line
- [nongnu] elpa/paredit 190797e 030/224: Add warning to documentation of prefix arguments to `paredit-mode'., (continued)
- [nongnu] elpa/paredit 190797e 030/224: Add warning to documentation of prefix arguments to `paredit-mode'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 41a0a34 033/224: Omit unused variable `orig' in `paredit-move-past-close-and-reindent'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 04e6f50 035/224: Put space between closing delimiters and opening double quotes., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 70d40b5 040/224: Refine scope of reindentation after raise, splice, and insert-comment., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 896c165 039/224: Implement variable `paredit-space-for-delimiter-predicates'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit e23adec 036/224: Omit vestigial debug message in `paredit-backward-slurp-into-string'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit c0a9160 041/224: Make `paredit-newline' keep invalid structure inside comments., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 05b2cad 043/224: Generalize `paredit-kill' to work inside any string-like object., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit e380e42 048/224: Implement `paredit-{for, back}ward-{up, down}'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 3ce96a4 050/224: Fix format arguments in `paredit-check-region-state-comment'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 73c481a 061/224: Simplify and clarify implementation of `paredit-backslash'.,
ELPA Syncer <=
- [nongnu] elpa/paredit b51f220 055/224: In `paredit-newline', ignore parse errors during `indent-sexp'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 0011090 066/224: Fix bounds checking in `paredit-find-next-string-start'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit bd0e5ba 072/224: Don't mask errors during `buffer-string' in `paredit-unescape-string'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit b7f234a 067/224: Preserve column in `paredit-reindent-defun'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 2a94a48 103/224: Set `indent-tabs-mode' and `current-column' in `paredit-test'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit e06ab40 063/224: Spell `paredit-recenter-on-sexp' to match convention in Emacs., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 0a7619c 089/224: Fix `imbalanced' -> `unbalanced' in `paredit-kill-ring-save' docstring., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 9faf474 073/224: Use `scan-sexps' for noninteractive `check-parens'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit a79aa2c 082/224: Fix end-of-line and end-of-buffer corner cases of `paredit-semicolon'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/paredit 8a85899 098/224: Omit vestigial debugging message from `paredit-test' in test.el., ELPA Syncer, 2021/08/07