• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/

Lines Matching +defs:ring +defs:insert

81 ;; C-c C-l comint-dynamic-list-input-ring  List input history
108 (require 'ring)
118 ;; comint-input-ring-size integer For the input history
119 ;; comint-input-ring ring mechanism
120 ;; comint-input-ring-index number ...
121 ;; comint-save-input-ring-index number ...
218 into the buffer's input ring. See also `comint-magic-space' and
240 "*If non-nil, don't add input matching the last on the input ring.
247 (defcustom comint-input-ring-file-name nil
249 See also `comint-read-input-ring' and `comint-write-input-ring'.
316 (defvar comint-input-ring-size 150
317 "Size of input history ring.")
319 (defvar comint-input-ring-separator "\n"
467 (define-key map "\C-c\C-l" 'comint-dynamic-list-input-ring)
472 (define-key map "\C-c." 'comint-insert-previous-argument)
474 (define-key map [mouse-2] 'comint-insert-input)
525 '("List Input History" . comint-dynamic-list-input-ring))
547 (defvar comint-input-ring nil)
551 (defvar comint-input-ring-index nil
555 (defvar comint-save-input-ring-index
556 "Last input ring index which you copied.
567 (put 'comint-input-ring 'permanent-local t)
568 (put 'comint-input-ring-index 'permanent-local t)
569 (put 'comint-save-input-ring-index 'permanent-local t)
595 An input history is maintained of size `comint-input-ring-size', and
596 can be accessed with the commands \\[comint-next-input], \\[comint-previous-input], and \\[comint-dynamic-list-input-ring].
597 Input ring history expansion can be achieved with the commands
599 Input ring expansion is controlled by the variable `comint-input-autoexpand',
623 (make-local-variable 'comint-input-ring-size) ; ...to global val.
624 (make-local-variable 'comint-input-ring)
625 (make-local-variable 'comint-input-ring-file-name)
626 (or (and (boundp 'comint-input-ring) comint-input-ring)
627 (setq comint-input-ring (make-ring comint-input-ring-size)))
628 (make-local-variable 'comint-input-ring-index)
629 (make-local-variable 'comint-save-input-ring-index)
630 (or (and (boundp 'comint-input-ring-index) comint-input-ring-index)
631 (setq comint-input-ring-index nil))
632 (or (and (boundp 'comint-save-input-ring-index) comint-save-input-ring-index)
633 (setq comint-save-input-ring-index nil))
747 (insert-file-contents startfile)
807 (defun comint-insert-input (event)
826 (and fun (not (eq fun 'comint-insert-input))
828 ;; Otherwise, insert the previous input.
836 (insert input))))
844 ;; comint-dynamic-list-input-ring List history in help buffer.
855 ;; comint-magic-space Expand history and insert space.
858 ;; comint-read-input-ring Read into comint-input-ring...
859 ;; comint-write-input-ring Write to comint-input-ring-file-name.
862 (defun comint-read-input-ring (&optional silent)
863 "Set the buffer's `comint-input-ring' from a history file.
864 The name of the file is given by the variable `comint-input-ring-file-name'.
865 The history ring is of size `comint-input-ring-size', regardless of file size.
866 If `comint-input-ring-file-name' is nil this function does nothing.
874 `comint-input-ring-separator', and entries that match
878 See also `comint-input-ignoredups' and `comint-write-input-ring'."
879 (cond ((or (null comint-input-ring-file-name)
880 (equal comint-input-ring-file-name ""))
882 ((not (file-readable-p comint-input-ring-file-name))
885 comint-input-ring-file-name)))
888 (file comint-input-ring-file-name)
890 (size comint-input-ring-size)
891 (ring (make-ring size)))
897 (insert-file-contents file)
903 (re-search-backward comint-input-ring-separator nil t)
905 (if (re-search-backward comint-input-ring-separator nil t)
912 (ring-empty-p ring)
913 (not (string-equal (ring-ref ring 0) history))))
915 (ring-insert-at-beginning ring history)
918 (setq comint-input-ring ring
919 comint-input-ring-index nil)))))
921 (defun comint-write-input-ring ()
922 "Writes the buffer's `comint-input-ring' to a history file.
923 The name of the file is given by the variable `comint-input-ring-file-name'.
924 The original contents of the file are lost if `comint-input-ring' is not empty.
925 If `comint-input-ring-file-name' is nil this function does nothing.
929 See also `comint-read-input-ring'."
930 (cond ((or (null comint-input-ring-file-name)
931 (equal comint-input-ring-file-name "")
932 (null comint-input-ring) (ring-empty-p comint-input-ring))
934 ((not (file-writable-p comint-input-ring-file-name))
935 (message "Cannot write history file %s" comint-input-ring-file-name))
938 (ring comint-input-ring)
939 (file comint-input-ring-file-name)
940 (index (ring-length ring)))
948 (insert (ring-ref ring index) comint-input-ring-separator))
953 (defvar comint-dynamic-list-input-ring-window-conf)
955 (defun comint-dynamic-list-input-ring-select ()
969 (set-window-configuration comint-dynamic-list-input-ring-window-conf)
972 (defun comint-dynamic-list-input-ring ()
975 (if (or (not (ring-p comint-input-ring))
976 (ring-empty-p comint-input-ring))
980 (index (1- (ring-length comint-input-ring)))
982 ;; We have to build up a list ourselves from the ring vector.
984 (setq history (cons (ring-ref comint-input-ring index) history)
993 (define-key keymap "\C-m" 'comint-dynamic-list-input-ring-select)
1000 (setq comint-dynamic-list-input-ring-window-conf conf)
1020 ;; First make sure there is a ring and that we are after the process mark
1023 ((or (null comint-input-ring)
1024 (ring-empty-p comint-input-ring))
1025 (error "Empty input ring"))
1028 (setq comint-input-ring-index nil)
1036 (when comint-input-ring-index
1039 (insert comint-stored-incomplete-input)
1041 (setq comint-input-ring-index nil)))
1044 "Index to start a directional search, starting at `comint-input-ring-index'."
1045 (if comint-input-ring-index
1047 (mod (+ comint-input-ring-index (if (> arg 0) 1 -1))
1048 (ring-length comint-input-ring))
1052 (1- (ring-length comint-input-ring))))) ; Last elt for backward search
1055 "Return the string ARG places along the input ring.
1056 Moves relative to `comint-input-ring-index'."
1057 (ring-ref comint-input-ring (if comint-input-ring-index
1058 (mod (+ arg comint-input-ring-index)
1059 (ring-length comint-input-ring))
1065 (if (and comint-input-ring-index
1066 (or ;; leaving the "end" of the ring
1068 (eq comint-input-ring-index 0))
1070 (eq comint-input-ring-index
1071 (1- (ring-length comint-input-ring)))))
1082 "Return the string matching REGEXP ARG places along the input ring.
1083 Moves relative to `comint-input-ring-index'."
1085 (if pos (ring-ref comint-input-ring pos))))
1088 "Return the index matching REGEXP ARG places along the input ring.
1089 Moves relative to START, or `comint-input-ring-index'."
1090 (if (or (not (ring-p comint-input-ring))
1091 (ring-empty-p comint-input-ring))
1093 (let* ((len (ring-length comint-input-ring))
1096 (tried-each-ring-item nil)
1099 (while (and (/= arg 0) (not tried-each-ring-item))
1104 (while (and (< n len) (not tried-each-ring-item)
1105 (not (string-match regexp (ring-ref comint-input-ring n))))
1108 tried-each-ring-item (= n prev)))
1110 ;; Now that we know which ring element to use, if we found it, return that.
1111 (if (string-match regexp (ring-ref comint-input-ring n))
1134 (if (null comint-input-ring-index) ;not yet on ring
1137 (setq comint-input-ring-index pos)
1140 (insert (ring-ref comint-input-ring pos)))))
1164 comint-input-ring-index nil))
1236 (setq comint-input-ring-index nil)
1250 (if (<= number (ring-length comint-input-ring))
1256 (setq comint-input-ring-index number)
1284 (setq comint-input-ring-index pos)
1286 (comint-args (ring-ref comint-input-ring pos)
1308 "Expand input history references before point and insert ARG spaces.
1312 (self-insert-command arg))
1451 (not (ring-p comint-input-ring))
1452 (ring-empty-p comint-input-ring)
1453 (not (string-equal (ring-ref comint-input-ring 0)
1455 (ring-insert comint-input-ring cmd)))
1470 The input is entered into the input history ring, if the value of variable
1517 (insert copy)
1529 ;; strings. We have to expand, then insert back.
1533 (insert input)
1538 (insert ?\n))
1562 help-echo "mouse-2: insert after prompt as new input"
1573 (setq comint-save-input-ring-index comint-input-ring-index)
1574 (setq comint-input-ring-index nil)
1627 from the subprocess. It should return the string to insert, perhaps
1728 ;; insert-before-markers is a bad thing. XXX
1739 ;; using `insert', and making the insertion-type of
1743 (insert-before-markers string)
1745 ;; used `insert-before-markers'.
1757 ;; insert-before-markers. First fixup overlays that might
1827 are `self-insert-command', `comint-magic-space', `yank', and `hilit-yank'.
1832 (memq this-command '(self-insert-command comint-magic-space yank
1943 (insert input))))
2199 (insert " " (key-description (this-command-keys)))
2314 ;; State used by `comint-insert-previous-argument' when cycling.
2315 (defvar comint-insert-previous-argument-last-start-pos nil)
2316 (make-variable-buffer-local 'comint-insert-previous-argument-last-start-pos)
2317 (defvar comint-insert-previous-argument-last-index nil)
2318 (make-variable-buffer-local 'comint-insert-previous-argument-last-index)
2322 (defun comint-insert-previous-argument (index)
2336 (delete-region comint-insert-previous-argument-last-start-pos (point))
2337 (setq index comint-insert-previous-argument-last-index))
2340 (setq comint-input-ring-index nil)
2341 (setq comint-insert-previous-argument-last-index index)
2342 (when (null comint-insert-previous-argument-last-start-pos)
2344 (setq comint-insert-previous-argument-last-start-pos
2350 ;; Remember the beginning of what we insert, so we can delete it if
2352 (set-marker comint-insert-previous-argument-last-start-pos (point))
2358 (insert (comint-arguments input-string index index)))
2360 (setq comint-input-ring-index (1+ (or comint-input-ring-index 0)))
2848 (insert filesuffix)
2855 (insert (comint-quote-filename
2860 (insert (if (file-directory-p file) dirsuffix filesuffix))
2867 (insert (if (file-directory-p file) dirsuffix filesuffix))
2920 (insert (substring completion (length stub)))
2922 (insert suffix)
2927 (insert (substring completion (length stub)))
2932 (insert suffix)
3034 (if comint-save-input-ring-index
3036 (setq comint-input-ring-index (1+ comint-save-input-ring-index))
3048 (insert "\n")
3050 (if comint-input-ring-index
3051 (setq comint-save-input-ring-index
3052 (- comint-input-ring-index 1))))
3144 from the subprocess. It should return the string to insert, perhaps
3165 (defvar comint-redirect-insert-matching-regexp nil
3195 "Non-nil means `comint-redirect' can insert into read-only buffers.
3306 (or comint-redirect-insert-matching-regexp
3320 (insert filtered-input-string))))
3457 "^Empty input ring$"
3503 ;; for this; the input history ring often does the job better.