Mercurial > emacs
comparison lisp/shell.el @ 5335:abf0d4d01681
(shell-backward-command): If comint-bol moves forward,
use real beginning of line instead.
Use skip-syntax-backward properly.
If backward search finds a separator, move forward over it.
(shell-forward-command): Call skip-syntax-backward properly.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 24 Dec 1993 05:42:58 +0000 |
parents | 6c3cfa1f8188 |
children | 239620e1795d |
comparison
equal
deleted
inserted
replaced
5334:37ea8707b175 | 5335:abf0d4d01681 |
---|---|
587 See `shell-command-regexp'." | 587 See `shell-command-regexp'." |
588 (interactive "p") | 588 (interactive "p") |
589 (let ((limit (save-excursion (end-of-line nil) (point)))) | 589 (let ((limit (save-excursion (end-of-line nil) (point)))) |
590 (if (re-search-forward (concat shell-command-regexp "\\([;&|][\\s ]*\\)+") | 590 (if (re-search-forward (concat shell-command-regexp "\\([;&|][\\s ]*\\)+") |
591 limit 'move arg) | 591 limit 'move arg) |
592 (skip-syntax-backward "^\\s ")))) | 592 (skip-syntax-backward " ")))) |
593 | 593 |
594 | 594 |
595 (defun shell-backward-command (&optional arg) | 595 (defun shell-backward-command (&optional arg) |
596 "Move backward across ARG shell command(s). Does not cross lines. | 596 "Move backward across ARG shell command(s). Does not cross lines. |
597 See `shell-command-regexp'." | 597 See `shell-command-regexp'." |
598 (interactive "p") | 598 (interactive "p") |
599 (let ((limit (save-excursion (comint-bol nil) (point)))) | 599 (let ((limit (save-excursion (comint-bol nil) (point)))) |
600 (skip-syntax-backward "\\s " limit) | 600 (if (> limit (point)) |
601 (save-excursion (beginning-of-line) (setq limit (point)))) | |
602 (skip-syntax-backward " " limit) | |
601 (if (re-search-backward | 603 (if (re-search-backward |
602 (format "[;&|]+[\\s ]*\\(%s\\)" shell-command-regexp) limit 'move arg) | 604 (format "[;&|]+[\\s ]*\\(%s\\)" shell-command-regexp) limit 'move arg) |
603 (progn (goto-char (match-beginning 1)) | 605 (progn (goto-char (match-beginning 1)) |
604 (skip-syntax-backward "^\\s "))))) | 606 (skip-chars-forward ";&|"))))) |
605 | 607 |
606 | 608 |
607 (defun shell-get-current-command () | 609 (defun shell-get-current-command () |
608 "Function that returns the current command including arguments." | 610 "Function that returns the current command including arguments." |
609 (save-excursion | 611 (save-excursion |