emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/paredit d1b562b 133/224: Fix `paredit-backslash' within a


From: ELPA Syncer
Subject: [nongnu] elpa/paredit d1b562b 133/224: Fix `paredit-backslash' within a character literal.
Date: Sat, 7 Aug 2021 09:22:35 -0400 (EDT)

branch: elpa/paredit
commit d1b562b9c81c5582f943e2a8958fb96f9820f420
Author: Taylor R Campbell <campbell@mumble.net>
Commit: Taylor R Campbell <campbell@mumble.net>

    Fix `paredit-backslash' within a character literal.
    
    Ignore-this: ce30323a4077d83acc1967af18604e40
    
    Put the new escape after the one the point is on; don't split it.
    
    darcs-hash:20110411225316-00fcc-1c65c221a9878047104d5fed02a60f48f0641f7b
---
 paredit.el | 38 ++++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/paredit.el b/paredit.el
index b13ca92..611c9b6 100644
--- a/paredit.el
+++ b/paredit.el
@@ -966,25 +966,27 @@ If not in a string, act as `paredit-doublequote'; if no 
prefix argument
 (defun paredit-backslash ()
   "Insert a backslash followed by a character to escape."
   (interactive)
+  (cond ((paredit-in-string-p) (paredit-backslash-interactive))
+        ((paredit-in-comment-p) (insert ?\\))
+        ((paredit-in-char-p) (forward-char) (paredit-backslash-interactive))
+        (t (paredit-backslash-interactive))))
+
+(defun paredit-backslash-interactive ()
   (insert ?\\ )
-  ;; 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)))
-      ;; 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 "Character to escape: ")))
-              (if (not (eq char ?\^?))
-                  (progn (message "Character to escape: %c" char)
-                         (insert char)
-                         (setq delete-p nil))))
-          (if delete-p
-              (progn (message "Deleting escape.")
-                     (backward-delete-char 1)))))))
+  ;; 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 "Character to escape: ")))
+          (if (not (eq char ?\^?))
+              (progn (message "Character to escape: %c" char)
+                     (insert char)
+                     (setq delete-p nil))))
+      (if delete-p
+          (progn (message "Deleting escape.")
+                 (backward-delete-char 1))))))
 
 (defun paredit-newline ()
   "Insert a newline and indent it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]