mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
Make 'eshell-bol' obsolete
Now that Eshell uses fields for its output, 'eshell-bol' is no longer
needed, and we can just use 'beginning-of-line'.
* lisp/eshell/esh-mode.el (eshell-bol): Mark obsolete.
(eshell-mode-map): Remove 'C-a' mapping.
(eshell-command-map): Use 'move-beginning-of-line'.
(eshell-move-argument, eshell-kill-input): Use 'beginning-of-line'.
(eshell-get-old-input): Remove unnecessary call to
'eshell-skip-prompt-function'.
* lisp/eshell/em-rebind.el (eshell-rebind-keys-alist): Remove 'C-a'
and '<home>' mappings; the global mapping for these
('move-beginning-of-line') does the same thing now.
* lisp/eshell/em-cmpl.el (eshell-complete-parse-arguments):
* lisp/eshell/em-elecslash.el (eshell-electric-forward-slash):
* lisp/eshell/em-hist.el (eshell-hist-word-reference)
(eshell-previous-matching-input-from-input, eshell-test-imatch):
* lisp/eshell/em-prompt.el (eshell-backward-matching-input):
* lisp/eshell/em-rebind.el (eshell-point-within-input-p):
* test/lisp/eshell/eshell-tests.el (eshell-test/forward-arg): Use
'beginning-of-line'.
* test/lisp/eshell/eshell-tests.el (eshell-test/run-old-command):
Rename to...
(eshell-test/get-old-input): ... this, and expand the test.
This commit is contained in:
parent
558f04c39e
commit
54051c97f2
7 changed files with 31 additions and 33 deletions
|
|
@ -312,7 +312,7 @@ to writing a completion function."
|
|||
(eshell-interactive-process-p))
|
||||
(eshell--pcomplete-insert-tab))
|
||||
(let ((end (point-marker))
|
||||
(begin (save-excursion (eshell-bol) (point)))
|
||||
(begin (save-excursion (beginning-of-line) (point)))
|
||||
(posns (list t))
|
||||
args delim)
|
||||
(when (and pcomplete-allow-modifications
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ insertion."
|
|||
(delete-char -1)
|
||||
(let ((tilde-before (eq ?~ (char-before)))
|
||||
(command (save-excursion
|
||||
(eshell-bol)
|
||||
(beginning-of-line)
|
||||
(skip-syntax-forward " ")
|
||||
(thing-at-point 'sexp)))
|
||||
(prefix (file-remote-p default-directory)))
|
||||
|
|
|
|||
|
|
@ -555,7 +555,7 @@ See also `eshell-read-history'."
|
|||
(defun eshell-hist-parse-arguments (&optional b e)
|
||||
"Parse current command arguments in a history-code-friendly way."
|
||||
(let ((end (or e (point)))
|
||||
(begin (or b (save-excursion (eshell-bol) (point))))
|
||||
(begin (or b (save-excursion (beginning-of-line) (point))))
|
||||
(posb (list t))
|
||||
(pose (list t))
|
||||
(textargs (list t))
|
||||
|
|
@ -913,7 +913,7 @@ If N is negative, search forwards for the -Nth following match."
|
|||
eshell-next-matching-input-from-input)))
|
||||
;; Starting a new search
|
||||
(setq eshell-matching-input-from-input-string
|
||||
(buffer-substring (save-excursion (eshell-bol) (point))
|
||||
(buffer-substring (save-excursion (beginning-of-line) (point))
|
||||
(point))
|
||||
eshell-history-index nil))
|
||||
(eshell-previous-matching-input
|
||||
|
|
@ -933,7 +933,7 @@ If N is negative, search backwards for the -Nth previous match."
|
|||
(if (get-text-property (point) 'history)
|
||||
(progn (beginning-of-line) t)
|
||||
(let ((before (point)))
|
||||
(eshell-bol)
|
||||
(beginning-of-line)
|
||||
(if (and (not (bolp))
|
||||
(<= (point) before))
|
||||
t
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ If N is negative, find the next or Nth next match."
|
|||
(progn (message "Not found")
|
||||
(ding))
|
||||
(goto-char pos)
|
||||
(eshell-bol))))
|
||||
(beginning-of-line))))
|
||||
|
||||
(defun eshell-forward-matching-input (regexp arg)
|
||||
"Search forward through buffer for match for REGEXP.
|
||||
|
|
|
|||
|
|
@ -50,9 +50,7 @@ the behavior of normal shells while the user editing new input text."
|
|||
:group 'eshell-rebind)
|
||||
|
||||
(defcustom eshell-rebind-keys-alist
|
||||
'(([(control ?a)] . eshell-bol)
|
||||
([home] . eshell-bol)
|
||||
([(control ?d)] . eshell-delchar-or-maybe-eof)
|
||||
'(([(control ?d)] . eshell-delchar-or-maybe-eof)
|
||||
([backspace] . eshell-delete-backward-char)
|
||||
([delete] . eshell-delete-backward-char)
|
||||
([(control ?w)] . backward-kill-word)
|
||||
|
|
@ -190,7 +188,7 @@ lock it at that."
|
|||
(and eshell-remap-previous-input
|
||||
(setq begin
|
||||
(save-excursion
|
||||
(eshell-bol)
|
||||
(beginning-of-line)
|
||||
(and (not (bolp)) (point))))
|
||||
(>= pos begin)
|
||||
(<= pos (line-end-position))
|
||||
|
|
|
|||
|
|
@ -262,14 +262,13 @@ This is used by `eshell-watch-for-password-prompt'."
|
|||
"C-c" 'eshell-command-map
|
||||
"RET" #'eshell-send-input
|
||||
"M-RET" #'eshell-queue-input
|
||||
"C-M-l" #'eshell-show-output
|
||||
"C-a" #'eshell-bol)
|
||||
"C-M-l" #'eshell-show-output)
|
||||
|
||||
(defvar-keymap eshell-command-map
|
||||
:prefix 'eshell-command-map
|
||||
"M-o" #'eshell-mark-output
|
||||
"M-d" #'eshell-toggle-direct-send
|
||||
"C-a" #'eshell-bol
|
||||
"C-a" #'move-beginning-of-line
|
||||
"C-b" #'eshell-backward-argument
|
||||
"C-e" #'eshell-show-maximum-output
|
||||
"C-f" #'eshell-forward-argument
|
||||
|
|
@ -472,7 +471,7 @@ and the hook `eshell-exit-hook'."
|
|||
(defun eshell-move-argument (limit func property arg)
|
||||
"Move forward ARG arguments."
|
||||
(catch 'eshell-incomplete
|
||||
(eshell-parse-arguments (save-excursion (eshell-bol) (point))
|
||||
(eshell-parse-arguments (save-excursion (beginning-of-line) (point))
|
||||
(line-end-position)))
|
||||
(let ((pos (save-excursion
|
||||
(funcall func 1)
|
||||
|
|
@ -505,12 +504,7 @@ and the hook `eshell-exit-hook'."
|
|||
(kill-ring-save begin (point))
|
||||
(yank)))
|
||||
|
||||
(defun eshell-bol ()
|
||||
"Go to the beginning of line, then skip past the prompt, if any."
|
||||
(interactive)
|
||||
(beginning-of-line)
|
||||
(and eshell-skip-prompt-function
|
||||
(funcall eshell-skip-prompt-function)))
|
||||
(define-obsolete-function-alias 'eshell-bol #'beginning-of-line "30.1")
|
||||
|
||||
(defsubst eshell-push-command-mark ()
|
||||
"Push a mark at the end of the last input text."
|
||||
|
|
@ -856,7 +850,7 @@ With a prefix argument, narrows region to last command output."
|
|||
(if (> (point) eshell-last-output-end)
|
||||
(kill-region eshell-last-output-end (point))
|
||||
(let ((here (point)))
|
||||
(eshell-bol)
|
||||
(beginning-of-line)
|
||||
(kill-region (point) here))))
|
||||
|
||||
(defun eshell-show-maximum-output (&optional interactive)
|
||||
|
|
@ -884,17 +878,18 @@ If SCROLLBACK is non-nil, clear the scrollback contents."
|
|||
(erase-buffer)))
|
||||
|
||||
(defun eshell-get-old-input (&optional use-current-region)
|
||||
"Return the command input on the current line."
|
||||
"Return the command input on the current line.
|
||||
If USE-CURRENT-REGION is non-nil, return the current region."
|
||||
(if use-current-region
|
||||
(buffer-substring (min (point) (mark))
|
||||
(max (point) (mark)))
|
||||
(save-excursion
|
||||
(beginning-of-line)
|
||||
(and eshell-skip-prompt-function
|
||||
(funcall eshell-skip-prompt-function))
|
||||
(let ((beg (point)))
|
||||
(end-of-line)
|
||||
(buffer-substring beg (point))))))
|
||||
(let ((inhibit-field-text-motion t))
|
||||
(end-of-line))
|
||||
(let ((inhibit-field-text-motion)
|
||||
(end (point)))
|
||||
(beginning-of-line)
|
||||
(buffer-substring (point) end)))))
|
||||
|
||||
(defun eshell-copy-old-input ()
|
||||
"Insert after prompt old input at point as new input to be edited."
|
||||
|
|
|
|||
|
|
@ -117,14 +117,14 @@
|
|||
(with-temp-eshell
|
||||
(eshell-insert-command "echo $(+ 1 (- 4 3)) \"alpha beta\" file" 'ignore)
|
||||
(let ((here (point)) begin valid)
|
||||
(eshell-bol)
|
||||
(beginning-of-line)
|
||||
(setq begin (point))
|
||||
(eshell-forward-argument 4)
|
||||
(setq valid (= here (point)))
|
||||
(eshell-backward-argument 4)
|
||||
(prog1
|
||||
(and valid (= begin (point)))
|
||||
(eshell-bol)
|
||||
(beginning-of-line)
|
||||
(delete-region (point) (point-max))))))
|
||||
|
||||
(ert-deftest eshell-test/queue-input ()
|
||||
|
|
@ -148,12 +148,17 @@ insert the queued one at the next prompt, and finally run it."
|
|||
(should (eshell-match-output
|
||||
(concat "^" (regexp-quote "*** output flushed ***\n") "$")))))
|
||||
|
||||
(ert-deftest eshell-test/run-old-command ()
|
||||
"Re-run an old command"
|
||||
(ert-deftest eshell-test/get-old-input ()
|
||||
"Test that we can get the input of a previous command."
|
||||
(with-temp-eshell
|
||||
(eshell-insert-command "echo alpha")
|
||||
(goto-char eshell-last-input-start)
|
||||
(string= (eshell-get-old-input) "echo alpha")))
|
||||
(should (string= (eshell-get-old-input) "echo alpha"))
|
||||
;; Make sure that `eshell-get-old-input' works even if the point is
|
||||
;; inside the prompt.
|
||||
(let ((inhibit-field-text-motion t))
|
||||
(beginning-of-line))
|
||||
(should (string= (eshell-get-old-input) "echo alpha"))))
|
||||
|
||||
(provide 'eshell-tests)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue