How to navigate perl code with cscope in emacs? - perl

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/

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.

Changing the initialization location of Emacs

I used to take the Programming languages course on Coursera and for the sake of the course i installed SML-Mode.
Now, I'd want to set up a Clojure environment in Emacs but instead of initializing Emacs from ~/.emacs.d, it initializes from the Users/karthik/Documents/sml-mode/sml-mode-startup
I deleted the sml-mode folder and on Emacs startup it shows me a warning about the files not being present. How I do point Emacs to load Emacs Live from the home folder.
I'm an Emacs newbie.
One easy way to do it, is
save you closure settings in /some/dir/my-closure-settings.el and call emacs as the following (to learn about -q -l , try emacs --help )
$ emacs -q -l /some/dir/my-closure-settings.el
or even placing an alias in bashrc,
$ alias closure-emacs='emacs -q -l /some/dir/my-closure-settings.el'
$ closure-emacs # will start emacs with your closure settings.
As you progress in learning some elisp, you will want to do it in one folder.
Assuming you installed Emacs yourself, and this SML-mode was an independent package, then I would speculated that it may have modified your site-start.el.
See if running emacs --no-site-file makes a difference.
If that's the issue, you can visit the file with:
M-: (find-library site-run-file) RET
You might also check:
C-hv user-emacs-directory RET
when running emacs in various ways:
emacs
emacs --no-site-file
emacs -q
emacs -Q
Unless it's a custom binary, at some point it should tell you "~/.emacs.d/"
Installing SML-mode does not change the place of the main initialization file, which is one of ~/.emacs or ~/.emacs.d/init.el. So look at those files (which ever of the two is present), and if none is present, then just create it and add what you need in it.
BTW, it looks like you're using an old sml-mode package (the newer one doesn't have an sml-mode-startup.el file). So please try and make sure the documentation that pointed you to that mode is updated: nowaday sml-mode should be installed from GNU ELPA, i.e. via M-x package-list or M-x package-install.

absolutely pure emacs initialization

I'd like to run emacs without any installed plugins. Emacs manual says that you may use -q option to skip init file. I've tried emacs -q and discovered that plugins from /usr/share/emacs/site-lisp (ubuntu installs plugins here) are still loaded.
I've searched google about emacs's initialization routine and found nothing usefull. I'm curios what emacs do step by step while initializing and what variables, options, evironment, etc. may change default behaviour.
Try emacs -Q
From the manpage:
-Q, --quick
Similar to "-q --no-site-file --no-splash". Also, avoid processing X resources.
If you only want to avoid loading site lisp code, you might want to run
emacs -q --no-site-file
Emacs == self-documenting.
C-hig (emacs) Emacs Invocation RET
If you really want to get into the details, you can peruse startup.el with
M-x find-library RET startup RET

Coding in Emacs shell?

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