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

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

[nongnu] elpa/xah-fly-keys 5347be6e31: xah-delete-backward-char-or-brack


From: ELPA Syncer
Subject: [nongnu] elpa/xah-fly-keys 5347be6e31: xah-delete-backward-char-or-bracket-text major fix, for lang with comment syntax such as (* comment *). still not totally correct.
Date: Fri, 24 Jun 2022 03:59:12 -0400 (EDT)

branch: elpa/xah-fly-keys
commit 5347be6e3165c74d9edc2a84010c2099f0620388
Author: Xah Lee <xah@xahlee.org>
Commit: Xah Lee <xah@xahlee.org>

    xah-delete-backward-char-or-bracket-text major fix, for lang with comment 
syntax such as (* comment *). still not totally correct.
---
 xah-fly-keys.el | 47 ++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 36 insertions(+), 11 deletions(-)

diff --git a/xah-fly-keys.el b/xah-fly-keys.el
index ce10afc6fa..a93f85cb6b 100644
--- a/xah-fly-keys.el
+++ b/xah-fly-keys.el
@@ -4,7 +4,7 @@
 
 ;; Author: Xah Lee ( http://xahlee.info/ )
 ;; Maintainer: Xah Lee <xah@xahlee.org>
-;; Version: 17.14.20220618162127
+;; Version: 17.14.20220624001507
 ;; Created: 10 Sep 2013
 ;; Package-Requires: ((emacs "24.1"))
 ;; Keywords: convenience, emulations, vim, ergoemacs
@@ -627,22 +627,47 @@ What char is considered bracket or quote is determined by 
current syntax table.
 If `universal-argument' is called first, do not delete inner text.
 
 URL 
`http://xahlee.info/emacs/emacs/emacs_delete_backward_char_or_bracket_text.html'
-Version: 2017-07-02"
+Version: 2017-07-02 2022-06-23"
   (interactive)
   (if (and delete-selection-mode (region-active-p))
       (delete-region (region-beginning) (region-end))
     (cond
      ((looking-back "\\s)" 1)
-      (if current-prefix-arg
-          (xah-delete-backward-bracket-pair)
-        (xah-delete-backward-bracket-text)))
+      (let ($isComment ($p0 (point)))
+        (backward-char)
+        (setq $isComment (nth 4 (syntax-ppss)))
+        (goto-char $p0)
+        (if $isComment
+            (if (forward-comment -1)
+                (kill-region (point) $p0)
+              (message "error GSNN2:parsing comment failed."))
+          (if current-prefix-arg
+              (xah-delete-backward-bracket-pair)
+            (xah-delete-backward-bracket-text)))))
      ((looking-back "\\s(" 1)
-      (progn
+      (message "left of cursor is opening bracket")
+      (let ($pOpenBracketLeft
+            ($pOpenBracketRight (point)) $p1 $isComment)
         (backward-char)
-        (forward-sexp)
-        (if current-prefix-arg
-            (xah-delete-backward-bracket-pair)
-          (xah-delete-backward-bracket-text))))
+        (setq $pOpenBracketLeft (point))
+        (goto-char $pOpenBracketRight)
+        (forward-char)
+        (setq $p1 (point))
+        (setq $isComment (nth 4 (syntax-ppss)))
+        (if $isComment
+            (progn
+              (message "cursor is in comment")
+              (goto-char $pOpenBracketLeft)
+              (if (forward-comment 1)
+                  (kill-region (point) $pOpenBracketLeft)
+                (message "error hSnRp: parsing comment failed.")))
+          (progn
+            (message "right 1 char of cursor is not in comment")
+            (goto-char $pOpenBracketLeft)
+            (forward-sexp)
+            (if current-prefix-arg
+                (xah-delete-backward-bracket-pair)
+              (xah-delete-backward-bracket-text))))))
      ((looking-back "\\s\"" 1)
       (if (nth 3 (syntax-ppss))
           (progn
@@ -1698,7 +1723,7 @@ If `universal-argument' is called first, prompt for a 
format to use.
 If there is selection, delete it first.
 
 URL `http://xahlee.info/emacs/emacs/elisp_insert-date-time.html'
-version 2020-09-07 2021-11-07 2022-04-07"
+Version 2013-05-10 2021-11-07 2022-04-07"
   (interactive)
   (let (($style
          (if current-prefix-arg



reply via email to

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