comparison lisp/eshell/esh-mode.el @ 88155:d7ddb3e565de

sync with trunk
author Henrik Enberg <henrik.enberg@telia.com>
date Mon, 16 Jan 2006 00:03:54 +0000
parents 642c25258945
children
comparison
equal deleted inserted replaced
88154:8ce476d3ba36 88155:d7ddb3e565de
1 ;;; esh-mode.el --- user interface 1 ;;; esh-mode.el --- user interface
2 2
3 ;; Copyright (C) 1999, 2000, 2001 Free Software Foundation 3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005 Free Software Foundation, Inc.
4 5
5 ;; Author: John Wiegley <johnw@gnu.org> 6 ;; Author: John Wiegley <johnw@gnu.org>
6 7
7 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
8 9
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details. 18 ;; GNU General Public License for more details.
18 19
19 ;; You should have received a copy of the GNU General Public License 20 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 ;; Boston, MA 02111-1307, USA. 23 ;; Boston, MA 02110-1301, USA.
23 24
24 (provide 'esh-mode) 25 (provide 'esh-mode)
25 26
26 (eval-when-compile (require 'esh-maint)) 27 (eval-when-compile (require 'esh-maint))
27 28
433 (lambda () 434 (lambda ()
434 (run-hooks 'eshell-exit-hook))) t t) 435 (run-hooks 'eshell-exit-hook))) t t)
435 436
436 (if eshell-first-time-p 437 (if eshell-first-time-p
437 (run-hooks 'eshell-first-time-mode-hook)) 438 (run-hooks 'eshell-first-time-mode-hook))
438 (run-hooks 'eshell-mode-hook) 439 (run-mode-hooks 'eshell-mode-hook)
439 (run-hooks 'eshell-post-command-hook)) 440 (run-hooks 'eshell-post-command-hook))
440 441
441 (put 'eshell-mode 'mode-class 'special) 442 (put 'eshell-mode 'mode-class 'special)
442 443
443 (eshell-deftest mode major-mode 444 (eshell-deftest mode major-mode
515 (interactive) 516 (interactive)
516 (require 'etags) 517 (require 'etags)
517 (let ((inhibit-read-only t) 518 (let ((inhibit-read-only t)
518 (no-default (eobp)) 519 (no-default (eobp))
519 (find-tag-default-function 'ignore)) 520 (find-tag-default-function 'ignore))
520 (setq tagname (car (find-tag-interactive "Find tag: "))) 521 (with-no-warnings
522 (setq tagname (car (find-tag-interactive "Find tag: "))))
521 (find-tag tagname next-p regexp-p))) 523 (find-tag tagname next-p regexp-p)))
522 524
523 (defun eshell-move-argument (limit func property arg) 525 (defun eshell-move-argument (limit func property arg)
524 "Move forward ARG arguments." 526 "Move forward ARG arguments."
525 (catch 'eshell-incomplete 527 (catch 'eshell-incomplete
661 (sit-for 1 0) 663 (sit-for 1 0)
662 (setq count (1- count)))) 664 (setq count (1- count))))
663 (eshell-match-result "alpha\n")) 665 (eshell-match-result "alpha\n"))
664 666
665 (defun eshell-send-input (&optional use-region queue-p no-newline) 667 (defun eshell-send-input (&optional use-region queue-p no-newline)
666 "Send the input received to Eshell for parsing and processing.. 668 "Send the input received to Eshell for parsing and processing.
667 After `eshell-last-output-end', sends all text from that marker to 669 After `eshell-last-output-end', sends all text from that marker to
668 point as input. Before that marker, calls `eshell-get-old-input' to 670 point as input. Before that marker, calls `eshell-get-old-input' to
669 retrieve old input, copies it to the end of the buffer, and sends it. 671 retrieve old input, copies it to the end of the buffer, and sends it.
670 672
671 If USE-REGION is non-nil, the current region (between point and mark) 673 If USE-REGION is non-nil, the current region (between point and mark)
815 ;;; jww (1999-10-23): this needs testing 817 ;;; jww (1999-10-23): this needs testing
816 (defun eshell-preinput-scroll-to-bottom () 818 (defun eshell-preinput-scroll-to-bottom ()
817 "Go to the end of buffer in all windows showing it. 819 "Go to the end of buffer in all windows showing it.
818 Movement occurs if point in the selected window is not after the 820 Movement occurs if point in the selected window is not after the
819 process mark, and `this-command' is an insertion command. Insertion 821 process mark, and `this-command' is an insertion command. Insertion
820 commands recognised are `self-insert-command', `yank', and 822 commands recognized are `self-insert-command', `yank', and
821 `hilit-yank'. Depends on the value of 823 `hilit-yank'. Depends on the value of
822 `eshell-scroll-to-bottom-on-input'. 824 `eshell-scroll-to-bottom-on-input'.
823 825
824 This function should be a pre-command hook." 826 This function should be a pre-command hook."
825 (if (memq this-command '(self-insert-command yank hilit-yank)) 827 (if (memq this-command '(self-insert-command yank hilit-yank))
941 (kill-region eshell-last-output-end (point)) 943 (kill-region eshell-last-output-end (point))
942 (let ((here (point))) 944 (let ((here (point)))
943 (eshell-bol) 945 (eshell-bol)
944 (kill-region (point) here)))) 946 (kill-region (point) here))))
945 947
946 (defun eshell-show-maximum-output () 948 (defun eshell-show-maximum-output (&optional interactive)
947 "Put the end of the buffer at the bottom of the window." 949 "Put the end of the buffer at the bottom of the window.
948 (interactive) 950 When run interactively, widen the buffer first."
949 (if (interactive-p) 951 (interactive "p")
952 (if interactive
950 (widen)) 953 (widen))
951 (goto-char (point-max)) 954 (goto-char (point-max))
952 (recenter -1)) 955 (recenter -1))
953 956
954 (defun eshell-get-old-input (&optional use-current-region) 957 (defun eshell-get-old-input (&optional use-current-region)
1000 (forward-line (- eshell-buffer-maximum-lines)) 1003 (forward-line (- eshell-buffer-maximum-lines))
1001 (beginning-of-line) 1004 (beginning-of-line)
1002 (let ((pos (point))) 1005 (let ((pos (point)))
1003 (if (bobp) 1006 (if (bobp)
1004 (if (interactive-p) 1007 (if (interactive-p)
1005 (error "Buffer too short to truncate")) 1008 (message "Buffer too short to truncate"))
1006 (delete-region (point-min) (point)) 1009 (delete-region (point-min) (point))
1007 (if (interactive-p) 1010 (if (interactive-p)
1008 (message "Truncated buffer from %d to %d lines (%.1fk freed)" 1011 (message "Truncated buffer from %d to %d lines (%.1fk freed)"
1009 lines eshell-buffer-maximum-lines 1012 lines eshell-buffer-maximum-lines
1010 (/ pos 1024.0)))))))) 1013 (/ pos 1024.0))))))))
1015 (defun eshell-send-invisible (str) 1018 (defun eshell-send-invisible (str)
1016 "Read a string without echoing. 1019 "Read a string without echoing.
1017 Then send it to the process running in the current buffer." 1020 Then send it to the process running in the current buffer."
1018 (interactive "P") ; Defeat snooping via C-x ESC ESC 1021 (interactive "P") ; Defeat snooping via C-x ESC ESC
1019 (let ((str (read-passwd 1022 (let ((str (read-passwd
1020 (format "Password: " 1023 (format "%s Password: "
1021 (process-name (eshell-interactive-process)))))) 1024 (process-name (eshell-interactive-process))))))
1022 (if (stringp str) 1025 (if (stringp str)
1023 (process-send-string (eshell-interactive-process) 1026 (process-send-string (eshell-interactive-process)
1024 (concat str "\n")) 1027 (concat str "\n"))
1025 (message "Warning: text will be echoed")))) 1028 (message "Warning: text will be echoed"))))
1075 (custom-add-option 'eshell-output-filter-functions 1078 (custom-add-option 'eshell-output-filter-functions
1076 'eshell-handle-control-codes) 1079 'eshell-handle-control-codes)
1077 1080
1078 ;;; Code: 1081 ;;; Code:
1079 1082
1083 ;;; arch-tag: ec65bc2b-da14-4547-81d3-a32af3a4dc57
1080 ;;; esh-mode.el ends here 1084 ;;; esh-mode.el ends here