[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/bash-completion 8b02aafc67 046/313: separators
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/bash-completion 8b02aafc67 046/313: separators |
Date: |
Sat, 3 Dec 2022 10:59:15 -0500 (EST) |
branch: elpa/bash-completion
commit 8b02aafc6784de7889a0e67b15e7f997c9a089da
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>
separators
---
bash-completion.el | 20 ++++++++++----------
bash-completion_test.el | 30 +++++++++++++++++++++++++++++-
2 files changed, 39 insertions(+), 11 deletions(-)
diff --git a/bash-completion.el b/bash-completion.el
index 371938ee04..74ec8792d5 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -107,9 +107,12 @@ at POS, the current word: ( (word1 word2 ...) . wordnum )"
(bash-completion-split-postprocess
(bash-completion-split-raw start end) start pos))
+(defun bash-completion-split-strings (accum)
+ (mapcar 'bash-completion-split-raw-get-str accum))
+
(defun bash-completion-split-postprocess (accum start pos)
(if (null pos)
- (cons nil (mapcar 'bash-completion-split-raw-get-str accum))
+ (cons nil (bash-completion-split-strings accum))
;; find position
(let ((index 0) (strings nil) (current nil) (accum-rest accum) (cword nil))
(while accum-rest
@@ -134,11 +137,6 @@ at POS, the current word: ( (word1 word2 ...) . wordnum )"
(defsubst bash-completion-split-raw-get-range (current)
(cons (cdr (assq 'start current)) (cdr (assq 'end current))))
-(defsubst bash-completion-split-raw-set-start (current)
- (let ((start-cons (assq 'start current)))
- (when (null (cdr start-cons))
- (setcdr start-cons (point)))))
-
(defsubst bash-completion-split-raw-set-end (current)
(setcdr (assq 'end current) (point)))
@@ -157,11 +155,12 @@ at POS, the current word: ( (word1 word2 ...) . wordnum )"
(defun bash-completion-split-raw-new-element (end accum)
(skip-chars-forward " \t\n\r" end)
(if (< (point) end)
- (bash-completion-split-raw-0 end accum (copy-alist '((str . "") (start .
nil) (end . nil))))
+ (bash-completion-split-raw-0 end accum (list (cons 'str "")
+ (cons 'start (point))
+ (cons 'end nil)))
accum))
(defun bash-completion-split-raw-0 (end accum current)
- (bash-completion-split-raw-set-start current)
(let ( (char-start (char-after))
(quote nil) )
(when (and char-start (or (= char-start ?') (= char-start ?\")))
@@ -171,7 +170,8 @@ at POS, the current word: ( (word1 word2 ...) . wordnum )"
(defun bash-completion-split-raw-1 (end quote accum current)
(let ((local-start (point)))
- (skip-chars-forward (bash-completion-nonsep quote) end)
+ (when (= (skip-chars-forward "[;&|]" end) 0)
+ (skip-chars-forward (bash-completion-nonsep quote) end))
(bash-completion-split-raw-append-str
current
(buffer-substring-no-properties local-start (point))))
@@ -201,7 +201,7 @@ at POS, the current word: ( (word1 word2 ...) . wordnum )"
(bash-completion-split-raw-new-element end accum))))
(defconst bash-completion-nonsep-alist
- '((nil . "^ \t\n\r'\"")
+ '((nil . "^ \t\n\r;&|'\"")
(?' . "^ \t\n\r'")
(?\" . "^ \t\n\r\"")))
diff --git a/bash-completion_test.el b/bash-completion_test.el
index fa869c55a3..bfa6dea1ab 100644
--- a/bash-completion_test.el
+++ b/bash-completion_test.el
@@ -108,6 +108,34 @@ cases. That's why they need to be enabled manually.")
(bash-completion-split 1 (line-end-position) (point)))
'(2 . ("a" "hello" "world" "b" "c")))
+ ("bash-completion-split-raw unescaped semicolon"
+ (sz-testutils-with-buffer
+ "to infinity;and\\ beyond"
+ (bash-completion-split-strings
+ (bash-completion-split-raw 1 (line-end-position))))
+ '("to" "infinity" ";" "and beyond"))
+
+ ("bash-completion-split-raw unescaped &&"
+ (sz-testutils-with-buffer
+ "to infinity&&and\\ beyond"
+ (bash-completion-split-strings
+ (bash-completion-split-raw 1 (line-end-position))))
+ '("to" "infinity" "&&" "and beyond"))
+
+ ("bash-completion-split-raw unescaped ||"
+ (sz-testutils-with-buffer
+ "to infinity||and\\ beyond"
+ (bash-completion-split-strings
+ (bash-completion-split-raw 1 (line-end-position))))
+ '("to" "infinity" "||" "and beyond"))
+
+ ("bash-completion-split-raw quoted ;&|"
+ (sz-testutils-with-buffer
+ "to \"infinity;&|and\" beyond"
+ (bash-completion-split-strings
+ (bash-completion-split-raw 1 (line-end-position))))
+ '("to" "infinity;&|and" "beyond"))
+
;; ("bash-completion-split cursor at the beginning"
;; (sz-testutils-with-buffer
;; '(" " cursor " a hello world b c")
@@ -415,7 +443,7 @@ garbage
(bash-completion-nonsep nil)
(bash-completion-nonsep ?')
(bash-completion-nonsep ?\"))
- '("^ \t\n\r'\"" "^ \t\n\r'" "^ \t\n\r\""))
+ '("^ \t\n\r;&|'\"" "^ \t\n\r'" "^ \t\n\r\""))
("bash-completion-escape"
- [nongnu] elpa/bash-completion ad8d72c626 162/313: README nit pick ; ), (continued)
- [nongnu] elpa/bash-completion ad8d72c626 162/313: README nit pick ; ), ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion c494a89070 168/313: Run tests under Emacs 24.1: alias letf to cl-letf., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f523a290a6 169/313: Make the integration tests run on Emacs 24.1., ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion bbff4fa527 172/313: Merge branch 'master' of github.com:szermatt/emacs-bash-completion, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion b307dc24c3 005/313: keep cword, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion a79137cc86 004/313: escaped quotes, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 581864111e 039/313: integration test harness, process buffer cleanup, hidden buffer, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 3e1481741c 031/313: remove messages, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 0d360a45cd 017/313: fixed test case, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion c28492a749 036/313: wordbreak before and after, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 8b02aafc67 046/313: separators,
ELPA Syncer <=
- [nongnu] elpa/bash-completion 2390d5cdf3 061/313: more commends and documentation; still need a commentary section, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion c0f7c20a6b 094/313: added license and missing test dependency, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion a2d322fb79 054/313: Added customization group, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 983f5c28e9 106/313: Merge pull request #2 from frankpzh/patch-1, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 9f02a62609 049/313: re-enabled parse-line cursor at the beginning/in the middle tests, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 3ec615a4ef 077/313: added id, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion f1d8d73b42 072/313: changed comment, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 2d6ad3980a 062/313: fixes for emacs 22, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 9583153e0b 068/313: Fixed issue with wordbreak character being the first character, ELPA Syncer, 2022/12/03
- [nongnu] elpa/bash-completion 7dec35f302 087/313: Set MAIL to the empty string in case shopt -u mailwarn is not, ELPA Syncer, 2022/12/03