Mercurial > hg > xemacs-beta
comparison lisp/comint/comint.el @ 149:538048ae2ab8 r20-3b1
Import from CVS: tag r20-3b1
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:36:16 +0200 |
parents | b980b6286996 |
children | 43dd3413c7c7 |
comparison
equal
deleted
inserted
replaced
148:f659db2a1f73 | 149:538048ae2ab8 |
---|---|
643 | 643 |
644 (defun comint-history-menu-filter (menu) | 644 (defun comint-history-menu-filter (menu) |
645 (append menu (comint-make-history-menu))) | 645 (append menu (comint-make-history-menu))) |
646 | 646 |
647 (defun comint-make-history-menu () | 647 (defun comint-make-history-menu () |
648 (if (or (not (ring-p comint-input-ring)) | 648 (if (or (not (ringp comint-input-ring)) |
649 (ring-empty-p comint-input-ring)) | 649 (ring-empty-p comint-input-ring)) |
650 nil | 650 nil |
651 (let ((menu nil) | 651 (let ((menu nil) |
652 hist | 652 hist |
653 (index (1- (ring-length comint-input-ring))) | 653 (index (1- (ring-length comint-input-ring))) |
902 | 902 |
903 | 903 |
904 (defun comint-dynamic-list-input-ring () | 904 (defun comint-dynamic-list-input-ring () |
905 "List in help buffer the buffer's input history." | 905 "List in help buffer the buffer's input history." |
906 (interactive) | 906 (interactive) |
907 (if (or (not (ring-p comint-input-ring)) | 907 (if (or (not (ringp comint-input-ring)) |
908 (ring-empty-p comint-input-ring)) | 908 (ring-empty-p comint-input-ring)) |
909 (message "No history") | 909 (message "No history") |
910 (let ((history nil) | 910 (let ((history nil) |
911 (history-buffer " *Input History*") | 911 (history-buffer " *Input History*") |
912 (index (1- (ring-length comint-input-ring))) | 912 (index (1- (ring-length comint-input-ring))) |
989 (if pos (ring-ref comint-input-ring pos)))) | 989 (if pos (ring-ref comint-input-ring pos)))) |
990 | 990 |
991 (defun comint-previous-matching-input-string-position (regexp arg &optional start) | 991 (defun comint-previous-matching-input-string-position (regexp arg &optional start) |
992 "Return the index matching REGEXP ARG places along the input ring. | 992 "Return the index matching REGEXP ARG places along the input ring. |
993 Moves relative to START, or `comint-input-ring-index'." | 993 Moves relative to START, or `comint-input-ring-index'." |
994 (if (or (not (ring-p comint-input-ring)) | 994 (if (or (not (ringp comint-input-ring)) |
995 (ring-empty-p comint-input-ring)) | 995 (ring-empty-p comint-input-ring)) |
996 (error "No history")) | 996 (error "No history")) |
997 (let* ((len (ring-length comint-input-ring)) | 997 (let* ((len (ring-length comint-input-ring)) |
998 (motion (if (> arg 0) 1 -1)) | 998 (motion (if (> arg 0) 1 -1)) |
999 (n (mod (- (or start (comint-search-start arg)) motion) len)) | 999 (n (mod (- (or start (comint-search-start arg)) motion) len)) |
1256 in `comint-delimiter-argument-list' is a separate argument. | 1256 in `comint-delimiter-argument-list' is a separate argument. |
1257 Argument 0 is the command name." | 1257 Argument 0 is the command name." |
1258 (let ((argpart "[^ \n\t\"'`]+\\|\\(\"[^\"]*\"\\|'[^']*'\\|`[^`]*`\\)") | 1258 (let ((argpart "[^ \n\t\"'`]+\\|\\(\"[^\"]*\"\\|'[^']*'\\|`[^`]*`\\)") |
1259 (args ()) (pos 0) | 1259 (args ()) (pos 0) |
1260 (count 0) | 1260 (count 0) |
1261 beg str value quotes) | 1261 beg str quotes) |
1262 ;; Build a list of all the args until we have as many as we want. | 1262 ;; Build a list of all the args until we have as many as we want. |
1263 (while (and (or (null mth) (<= count mth)) | 1263 (while (and (or (null mth) (<= count mth)) |
1264 (string-match argpart string pos)) | 1264 (string-match argpart string pos)) |
1265 (if (and beg (= pos (match-beginning 0))) | 1265 (if (and beg (= pos (match-beginning 0))) |
1266 ;; It's contiguous, part of the same arg. | 1266 ;; It's contiguous, part of the same arg. |
1383 (if comint-process-echoes | 1383 (if comint-process-echoes |
1384 (delete-region pmark (point)) | 1384 (delete-region pmark (point)) |
1385 (insert ?\n)) | 1385 (insert ?\n)) |
1386 (if (and (funcall comint-input-filter history) | 1386 (if (and (funcall comint-input-filter history) |
1387 (or (null comint-input-ignoredups) | 1387 (or (null comint-input-ignoredups) |
1388 (not (ring-p comint-input-ring)) | 1388 (not (ringp comint-input-ring)) |
1389 (ring-empty-p comint-input-ring) | 1389 (ring-empty-p comint-input-ring) |
1390 (not (string-equal (ring-ref comint-input-ring 0) | 1390 (not (string-equal (ring-ref comint-input-ring 0) |
1391 history)))) | 1391 history)))) |
1392 (ring-insert comint-input-ring history)) | 1392 (ring-insert comint-input-ring history)) |
1393 ;; XEmacs - run the input filters on the history instead | 1393 ;; XEmacs - run the input filters on the history instead |
2147 ;; Set match-data to match the entire string. | 2147 ;; Set match-data to match the entire string. |
2148 (if (< (point) here) | 2148 (if (< (point) here) |
2149 (progn (store-match-data (list (point) here)) | 2149 (progn (store-match-data (list (point) here)) |
2150 (match-string 0)))))) | 2150 (match-string 0)))))) |
2151 | 2151 |
2152 (defun comint-extract-current-pathname () | |
2153 "Return the file name at point. | |
2154 `@' or `.' are not valid characters at the end of the filename." | |
2155 (save-excursion | |
2156 (re-search-forward "@?\\([^-A-Za-z0-9_,/+%.~]\\|$\\)") | |
2157 (goto-char (match-beginning 0)) | |
2158 (re-search-backward | |
2159 "[^-A-Za-z0-9_,/+%.@~][-A-Za-z0-9_,/+%.@~]+[-A-Za-z0-9_+%~]" | |
2160 nil t) | |
2161 (buffer-substring (1+ (match-beginning 0)) (match-end 0)))) | |
2152 | 2162 |
2153 (defun comint-match-partial-filename () | 2163 (defun comint-match-partial-filename () |
2154 "Return the filename at point, or nil if non is found. | 2164 "Return the filename at point, or nil if none is found. |
2155 Environment variables are substituted. See `comint-word'." | 2165 Environment variables are substituted. See `comint-word'." |
2156 (let ((filename (comint-word "~/A-Za-z0-9+@:_.$#%,={}-"))) | 2166 (let ((filename (comint-word "~/A-Za-z0-9+@:_.$#%,={}-"))) |
2157 (and filename (substitute-in-file-name (comint-unquote-filename filename))))) | 2167 (and filename (substitute-in-file-name (comint-unquote-filename filename))))) |
2158 | 2168 |
2159 | 2169 |
2634 (forward-line (min 0 (- comint-find-source-code-max-lines))) | 2644 (forward-line (min 0 (- comint-find-source-code-max-lines))) |
2635 (beginning-of-line)) | 2645 (beginning-of-line)) |
2636 (point))) | 2646 (point))) |
2637 (end (save-excursion (end-of-line) (point))) | 2647 (end (save-excursion (end-of-line) (point))) |
2638 (res (or (comint-extract-source-location beg end) | 2648 (res (or (comint-extract-source-location beg end) |
2639 ;; #### comint-extract-current-pathname doesn't exist | |
2640 (let ((file (comint-extract-current-pathname))) | 2649 (let ((file (comint-extract-current-pathname))) |
2641 (and file | 2650 (and file |
2642 (list file nil nil nil | 2651 (list file nil nil nil |
2643 (match-beginning 0) | 2652 (match-beginning 0) |
2644 (match-end 0)))) | 2653 (match-end 0)))) |