2

I thinkk that finally, I managed to get a "nice" multi-term working with emacs on MAC-OSX: this is my configuration:

On Emacs:

;;; my-multi-term.el --- multi-term configuration -*- lexical-binding: t; -*-
;;; Commentary:
;;; this is the multi-term configuration based on
;;; http://rawsyntax.com/blog/learn-emacs-zsh-and-multi-term/
;;; and
;;; https://www.emacswiki.org/emacs/MultiTerm
;;; Code:

(require 'multi-term)

(setq multi-term-program "/usr/local/bin/zsh")

(add-hook 'term-mode-hook
          (lambda ()
            (setq term-buffer-maximum-size 10000)))

(add-hook 'term-mode-hook
          (lambda ()
            (setq show-trailing-whitespace nil)))

(defcustom term-unbind-key-list
  '("C-z" "C-x" "C-c" "C-h" "C-y" "<ESC>")
  "The key list that will need to be unbind."
  :type 'list
  :group 'multi-term)

(defcustom term-bind-key-alist
  '(
    ("C-c C-c" . term-interrupt-subjob)
    ("C-p" . previous-line)
    ("C-n" . next-line)
    ("C-s" . isearch-forward)
    ("C-r" . isearch-backward)
    ("C-m" . term-send-raw)
    ("M-f" . term-send-forward-word)
    ("M-b" . term-send-backward-word)
    ("M-o" . term-send-backspace)
    ("M-p" . term-send-up)
    ("M-n" . term-send-down)
    ("M-M" . term-send-forward-kill-word)
    ("M-N" . term-send-backward-kill-word)
    ("M-r" . term-send-reverse-search-history)
    ("M-," . term-send-input)
    ("M-." . comint-dynamic-complete))
  "The key alist that will need to be bind.
If you do not like default setup, modify it, with (KEY . COMMAND) format."
  :type 'alist
  :group 'multi-term)

(add-hook 'term-mode-hook
          (lambda ()
            (add-to-list 'term-bind-key-alist '("M-[" . multi-term-prev))
            (add-to-list 'term-bind-key-alist '("M-]" . multi-term-next))))

(add-hook 'term-mode-hook
          (lambda ()
            (define-key term-raw-map (kbd "C-y") 'term-paste)))


(provide 'my-multi-term)
;;; my-multi-term.el ends here

On .zshrenv

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

export TERM="xterm-256color"

# Path to your oh-my-zsh installation.
export ZSH=/Users/toni/.oh-my-zsh

# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
if [ -n "$INSIDE_EMACS" ]; then
    export ZSH_THEME="simple"
else
ZSH_THEME="powerlevel9k/powerlevel9k"
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir rvm custom_lisp vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time root_indicator background_jobs history time)
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_RPROMPT_ON_NEWLINE=true
POWERLEVEL9K_CUSTOM_LISP="ros config show default.lisp"
fi

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
if [ -n "$INSIDE_EMACS" ]; then
    plugins=(git)
else
plugins=(git
         rails
         rvm
         cask
         ssh-agent
         mvn
         tmuxinator
         zsh-editing-workbench
         zsh-cmd-architect)
fi

source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
   export EDITOR='vim'
 else
   export EDITOR='emacsclient --server-file=server -nw'
 fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
alias emc="emacsclient --server-file=server -nw"
alias mux="tmuxinator"
alias tethering="sudo kextload /Library/Extensions/HoRNDIS.kext"

### ZNT's installer added snippet ###
fpath=( "$fpath[@]" "$HOME/.config/znt/zsh-navigation-tools" )
autoload n-aliases n-cd n-env n-functions n-history n-kill n-list n-list-draw n-list-input n-options n-panelize n-help
autoload znt-usetty-wrapper znt-history-widget znt-cd-widget znt-kill-widget
alias naliases=n-aliases ncd=n-cd nenv=n-env nfunctions=n-functions nhistory=n-history
alias nkill=n-kill noptions=n-options npanelize=n-panelize nhelp=n-help
zle -N znt-history-widget
bindkey '^R' znt-history-widget
setopt AUTO_PUSHD HIST_IGNORE_DUPS PUSHD_IGNORE_DUPS
zstyle ':completion::complete:n-kill::bits' matcher 'r:|=** l:|=*'
### END ###

## For My Proxy Tunnel
alias proxy-on='ssh -fN blog-proxy'  
alias proxy-check='ssh -O check blog-proxy'  
alias proxy-off='ssh -O exit blog-proxy'

## unencryptpdf
alias unencrypt='gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=unencrypted.pdf -c .setpdfwrite -f'

export LANG="es_ES.UTF-8"
export LC_ALL="es_ES.UTF-8"
export PATH=/usr/local/bin:$PATH
export PATH="$HOME/.roswell/bin:$PATH"
export M2_HOME=/Users/toni/bin/apache-maven-3.3.9
export PATH=$PATH:$M2_HOME/bin
if which jenv > /dev/null; then eval "$(jenv init -)"; fi

. /Users/toni/.kerl/versions/20.2/activate

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

[[ -s "$HOME/.kiex/scripts/kiex" ]] && source "$HOME/.kiex/scripts/kiex"

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.

# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"

But I have still problems with characters not displaying. I'm also using

(prefer-coding-system 'utf-8)
(set-face-attribute 'default nil :foreground "turquoise" :font "Source Code Pro for Powerline" :height 150)

but I get this:

%                                                                                                                                         
~ =ls>
Applications        Movies              VirtualBox VMs      exercism            pharo-local
Desktop             Music               bin                 learn               quicklisp
Documents           Pictures            bug_fix             logs                rethinkdb_data
Downloads           Polyspace_Workspace ci                  migrate             src
Library             Public              common-lisp         node_modules        tmp
%                                                                                                                                         
~ =>
%                                                                                                                                         
~ =  

the problem is the extra % and character

As pointed in a comment by @npostavs I updated emacs to This is GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin16.7.0, NS appkit-1504.83 Version 10.12.6 (Build 16G1408)) of 2018-06-21 and now I have this:

=ls>

~ =ls>
Applications        Movies              VirtualBox VMs      exercism            pharo-local
Desktop             Music               bin                 learn               quicklisp
Documents           Pictures            bug_fix             logs                rethinkdb_data
Downloads           Polyspace_Workspace ci                  migrate             src
Library             Public              common-lisp         node_modules        tmp
~ =

I added a capture because cannot seed the problematic symbol in copy paste:

emacs capture

anquegi
  • 739
  • 5
  • 21
  • This sounds similar to [Bug#30544](https://debbugs.gnu.org/cgi/bugreport.cgi?bug=30544), what Emacs version are you using? (that bug is fixed in 26.1) – npostavs Jun 20 '18 at 13:19
  • Hi thanks for the comment, That emacs is This is GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin16.7.0, NS appkit-1504.83 Version 10.12.6 (Build 16G1114)) of 2018-01-24 – anquegi Jun 20 '18 at 16:09
  • I think `27.0.50 [...] of 2018-01-24` is older than the bug (which was in April). So I suggest updating Emacs first. – npostavs Jun 20 '18 at 22:54
  • Thanks you, I updated emacs and the % dissapeared, now I only have the problem with the symbol in the promt, I will actualize the question – anquegi Jun 21 '18 at 06:53

0 Answers0