Try:
(with-eval-after-load "term"
(defun term-send-M-p ()
"Type M-p in `term-mode'."
(interactive)
(term-send-raw-string "\ep"))
(defun term-send-M-n ()
"Type M-n in `term-mode'."
(interactive)
(term-send-raw-string "\en"))
(define-key term-raw-map (kbd "M-p") #'term-send-M-p)
(define-key term-raw-map (kbd "M-n") #'term-send-M-n))
I think multi-term
binds M-p
and M-n
to term-send-up
and term-send-down
by default, which tries to do the same as pressing the arrows in a terminal. IIRC, multi-term
has an elaborate binding override mechanism, which you may have to use instead of plain define-key
.