Coding in Emacs shell? - emacs

I am using shell in my emacs version 22.2.1 (debian stable repos) and it has some kind of broken coding. For example, if I run `ls' command, output is
[0m[01;34margouml-0.30.2[0m
not "argouml-0.30.2" as normal. I have tried commands C-x RET p utf-8 and so others but without any effect. I have properly generated utf-8 locales and everywhere else in emacs coding works perfect. Does anybody knows what may be wrong with it?

Your terminal type in the shell is set incorrectly; those escapes are for colors, but the emacs shell doesn't support them. Try M-x term instead for better support.

You can also try M-x ansi-term, or even download Multi term and try that too.
Links:
Ansi Term
Multi Term

Related

How to use rlwrap in Gauche running on emacs in MinGW?

I am new to Scheme, and using gosh running on emacs buffer, in MinGW on Windows. It seems that people use readline or rlwrap to use history and more, but I still cannot figure out to accomplish the setting. Though it may be easy to run one on Linux using virtual machine, I would stick to Windows for now. Any idea or alternative suggestion?
An Emacs buffer is not a real terminal, and rlwrap will not run in it. However, this is no tragedy: almost all of rlwraps goodness can be had directly from Emacs (you could use one of the existing scheme modes, or even Emacs-gosh-mode)
If you insist, Emacs can provide a terminal emulator for you (M-x term) in which rlwrap will feel right at home.

Emacs shell behavior

I am using cygwin on windows 7. I have a question regarding the Emacs shell.
Whenever I use the shell inside of the Emacs(M-x shell)
It echo pwd directory after prints out the result.
I found it very annoying since it distracts me.
e.g.
$ ls
workspace
^[]0;~/cs61bl^G
myname#pc ~/cs61bl
Is there any way to remove these lines?
^[]0;~/cs61bl^G
myname#pc ~/cs61bl
When using Emacs, try using the eshell: M-x eshell. The eshell does not suffer from this problem.
You might be looking for "shell-dirtrack-mode". You can either do an M-x shell-dirtrack-toggle or (shell-dirtrack-mode 1) in your init file. Recent emacs versions seem to disable it by default.
There is this file http://www.emacswiki.org/emacs/setup-cygwin.el that simplifies setup of various packages in Emacs (including shell) to use cygwin. Also try not to use ANSI sequences in your PS1 prompt because Emacs shell mode wouldn't interpret them, something like
export PS1="\h \W\$ "
should do.

Associate ` to <S-dead-grave> in Emacs

What do I have to write in my .emacs file in order to associate the <S-dead-grave> command with inserting the character ` (backtick).
I run GNU Emacs 23.1.1 on Unix.
Background: I run Unix via a shell that runs in Java (Oracle SGD) on a Windows terminal server. I do not have admin access on either system. My keyboard is set to Norwegian. There is apparently some bug in Java causing this to act weird with "dead" characters (like ` is on the Norwegian keyboard) and I have not succeeded in getting my administrator to fix this.
When I click ` followed by a space (as is the way to insert that character with my keyboard layout) in Emacs, I get the error message <S-dead-grave> is undefined. Hence, I believe that if I could define this, I would be able to work around this error.
Within this setup, I am also happy with alternative workarounds.
It's not completely clear to me whether you run Emacs in GUI mode or in text mode (in a terminal emulator), but based on your description of Emacs's behavior I guess it runs in GUI mode (maybe via some X server on your Windows machine?).
It's strange that you'd get S-dead-grave events, so it might be a bug in your GUI environment (your X server's config?).
But in any case
(global-set-key [S-dead-grave] "`")
might let you work around the problem.
I had the same problem and this bug report discussion reports a solution :
XMODIFIERS= emacs
I did put it into my .bashrc after testing that it works (with XMODIFIERS= emacs && emacs)
This is apparently not needed with emacs 24.4, but I use emacs 24.3.1 and still need it.
If XMODIFIERS= emacs works for you (don't forget space after equal sign), check ~/.xinputrc and /etc/X11/xinit/xinputrc or run im-config and select none. For more info consult debian reference chapter I18N and L10N

Using clipboard/ copy paste results in chinese looking characters (debian sid)

Using Emacs on my linux box (wheezy, awesome,gnome and kde) I run into big trouble using clipboard even from one emacs instance to another.
Everything I put into the clipboard is converted into chinese looking characters in emacs. Only solution is to copy paste into some other editor (e.g. nano, vi) save it and open it in emacs.
I use the same .emacs on my other (ubuntu) computer and on windows 7 with out any trouble. I erased all my previous encoding settings I had without any success.
http://stackoverflow.com/questions/ask
after copy paste gets
栊瑴㩰⼯瑳捡潫敶晲潬⹷潣⽭畱獥楴湯⽳獡k
I run into the same problem today, with a little different environment tho. I've been using Emacs 24.3.1 on Windows 7, then switched to the same version running under Cygwin+XWin with the same .emacs.d config. While clipboard under Windows worked fine, with the config I had under Cygwin/XWin I had the same problem as in the question.
Under terminal it worked fine, with XWin the -Q worked too, so after a little digging, it turned out to be:
;; MS Windows clipboard is UTF-16LE
(set-clipboard-coding-system 'utf-16le-dos)
I don't remember why I added this. I must have copied it from some Emacs Wiki in early days. When I googled it now, it seems like a popular setting in people configs. It turns out, under Windows I don't need this line for clipboard to work properly with Emacs (quick check with some polish diacritical characters), and under Cygwin/XWin it finally started to work.
(sorry, I haven't the reputation to comment, so I leave a clarification request here)
Are you using emacs in a terminal ? if so, which one (konsole, lxterm, xterm...) ?
Are you cut'n'pasting with mouse (middle click) or keyboard ?
Have you any clipboard manager running (eg glipper) ?
Do you get the same behavior if you start without an init file (~/.emacs), that is, using emacs -Q?
If you can come up with a reproducible recipe starting from emacs -Q then, unless you get some solution proposed here, consider filing an Emacs bug report: M-x report-emacs-bug.

How to navigate perl code with cscope in emacs?

I have been a VIM user for 4 years, but have been trying to learn emacs. My project is fully written in perl and I am trying to get the cscope working in emacs for perl.
I don't have any problem navigating perl from VIM.“cs add cscope.out” from vim command mode does the job for me. In emacs though, with the same cscope database (which has both C++ and perl symbols) emacs perfectly recognizes my C symbols (M-x M-x cscope-find-global-definition). But for perl symbols, I am getting the below error .
Error:
Finding global definition: somePerlFunction Search complete.
Search time = 0.92 seconds.
No matches were found.
Does emacs supports perl code navigation? If not, isn't it a major drawback? Can someone please help?
Yes, Emacs supports cscope, there are several options:
http://www.emacswiki.org/emacs/CScopeAndEmacs
I've just tested xcscope.el on GNU Emacs 24 and it seems to be working fine.
If you already have a cscope database, I suggest you run cscope from the command line, using the -d flag:
cscope -d
Use the 'Find this global definition' option to search for your symbol, if you don't get any results then the issue is with cscope, not Emacs. If you do find results, please provide more detail, e.g. which method of integrating cscope with Emacs you are using, which version of Emacs, and provide sample perl code which can be used to reproduce the problem.
You may also want to investigate cedet:
http://cedet.sourceforge.net/