]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/shell.el (shell--parse-pcomplete-arguments): Stop at semi-colon
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 4 Dec 2018 17:39:47 +0000 (12:39 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 4 Dec 2018 17:39:47 +0000 (12:39 -0500)
* test/lisp/shell-tests.el (shell-tests-completion-before-semi):
New corresponding test.

lisp/shell.el
test/lisp/shell-tests.el

index ac6f11aeb401f1506508e488bd363878754b9908..16aeffc1b618bc72ead9cb034baee11bed6a7bb3 100644 (file)
@@ -426,7 +426,7 @@ Thus, this does not include the shell's current directory.")
           (while (looking-at
                   (eval-when-compile
                     (concat
-                     "\\(?:[^\s\t\n\\\"']+"
+                     "\\(?:[^\s\t\n\\\"';]+"
                      "\\|'\\([^']*\\)'?"
                      "\\|\"\\(\\(?:[^\"\\]\\|\\\\.\\)*\\)\"?"
                      "\\|\\\\\\(\\(?:.\\|\n\\)?\\)\\)")))
@@ -490,7 +490,7 @@ Shell buffers.  It implements `shell-completion-execonly' for
   (setq comint-input-autoexpand shell-input-autoexpand)
   ;; Not needed in shell-mode because it's inherited from comint-mode, but
   ;; placed here for read-shell-command.
-  (add-hook 'completion-at-point-functions 'comint-completion-at-point nil t))
+  (add-hook 'completion-at-point-functions #'comint-completion-at-point nil t))
 
 (put 'shell-mode 'mode-class 'special)
 
@@ -606,7 +606,7 @@ buffer."
       ;; Bypass a bug in certain versions of bash.
       (when (string-equal shell "bash")
         (add-hook 'comint-preoutput-filter-functions
-                  'shell-filter-ctrl-a-ctrl-b nil t)))
+                  #'shell-filter-ctrl-a-ctrl-b nil t)))
     (comint-read-input-ring t)))
 
 (defun shell-apply-ansi-color (beg end face)
@@ -751,7 +751,7 @@ Otherwise, one argument `-i' is passed to the shell.
            (xargs-name (intern-soft (concat "explicit-" name "-args"))))
       (unless (file-exists-p startfile)
         (setq startfile (concat user-emacs-directory "init_" name ".sh")))
-      (apply 'make-comint-in-buffer "shell" buffer prog
+      (apply #'make-comint-in-buffer "shell" buffer prog
              (if (file-exists-p startfile) startfile)
              (if (and xargs-name (boundp xargs-name))
                  (symbol-value xargs-name)
@@ -973,10 +973,10 @@ this feature; see the function `dirtrack-mode'."
   nil nil nil
   (setq list-buffers-directory (if shell-dirtrack-mode default-directory))
   (if shell-dirtrack-mode
-      (add-hook 'comint-input-filter-functions 'shell-directory-tracker nil t)
-    (remove-hook 'comint-input-filter-functions 'shell-directory-tracker t)))
+      (add-hook 'comint-input-filter-functions #'shell-directory-tracker nil t)
+    (remove-hook 'comint-input-filter-functions #'shell-directory-tracker t)))
 
-(define-obsolete-function-alias 'shell-dirtrack-toggle 'shell-dirtrack-mode
+(define-obsolete-function-alias 'shell-dirtrack-toggle #'shell-dirtrack-mode
   "23.1")
 
 (defun shell-cd (dir)
index 105701ebbc890564bd8ad536195a74de58e75c0f..9550800f45382b44f9fc235d91d98a0b69839ff8 100644 (file)
   "Test problem found by Filipp Gunbin in emacs-devel."
   (should (equal (car (shell--unquote&requote-argument "te'st" 2)) "test")))
 
+(ert-deftest shell-tests-completion-before-semi ()
+  (with-temp-buffer
+    (shell-mode)
+    (insert "cd ba;")
+    (forward-char -1)
+    (should (equal (shell--parse-pcomplete-arguments)
+                   '(("cd" "ba") 1 4)))))
+
 ;;; shell-tests.el ends here