Function: term-command-hook

term-command-hook is a byte-compiled function defined in term.el.gz.

Signature

(term-command-hook STRING)

Source Code

;; Defined in /usr/src/emacs/lisp/term.el.gz
;; (defun term-switch-to-alternate-sub-buffer (set)
;;   ;; If asked to switch to (from) the alternate sub-buffer, and already (not)
;;   ;; using it, do nothing.  This test is needed for some programs (including
;;   ;; Emacs) that emit the ti termcap string twice, for unknown reason.
;;   (term-handle-deferred-scroll)
;;   (if (eq set (not (term-using-alternate-sub-buffer)))
;;       (let ((row (term-current-row))
;;          (col (term-horizontal-column)))
;;      (cond (set
;;             (goto-char (point-max))
;;             (if (not (eq (preceding-char) ?\n))
;;                 (term-insert-char ?\n 1))
;;             (setq term-scroll-with-delete t)
;;             (setq term-saved-home-marker (copy-marker term-home-marker))
;;             (set-marker term-home-marker (point)))
;;            (t
;;             (setq term-scroll-with-delete
;;                   (not (and (= term-scroll-start 0)
;;                             (= term-scroll-end term-height))))
;;             (set-marker term-home-marker term-saved-home-marker)
;;             (set-marker term-saved-home-marker nil)
;;             (setq term-saved-home-marker nil)
;;             (goto-char term-home-marker)))
;;      (setq term-current-column nil)
;;      (setq term-current-row 0)
;;      (term-goto row col))))

;; Default value for the symbol term-command-function.

(defun term-command-hook (string)
  (cond ((equal string "")
	 t)
	((= (aref string 0) ?\032)
	 ;; gdb (when invoked with -fullname) prints:
	 ;; \032\032FULLFILENAME:LINENUMBER:CHARPOS:BEG_OR_MIDDLE:PC\n
	 (let* ((first-colon (string-search ":" string 1))
		(second-colon
		 (string-search ":" string (1+ first-colon)))
		(filename (substring string 1 first-colon))
		(fileline (string-to-number
			   (substring string (1+ first-colon) second-colon))))
	   (setq term-pending-frame (cons filename fileline))))
	((= (aref string 0) ?/)
	 (cd (substring string 1)))
	;; Allowing the inferior to call functions in Emacs is
	;; probably too big a security hole.
	;; ((= (aref string 0) ?!)
	;; (eval (car (read-from-string string 1))))
	(t)));; Otherwise ignore it