I have GNU Emacs 23.1.1, on Ubuntu 10.10.
I have to following .emacs:
(custom-set-variables
'(cua-mode t nil (cua-base))
'(inhibit-startup-screen t)
)
(show-paren-mode 1)
(setq show-paren-delay 0)
;; perl mode stuff
(fset 'perl-mode 'cperl-mode)
(setq cperl-indent-level 4
cperl-close-paren-offset -4
cperl-continued-statement-offset 0
cperl-indent-parens-as-block t
cperl-tab-always-indent t
cperl-invalid-face nil
)
When I do $ emacs -nw the tab indentation works fine. When I launch the GUI version with $ emacs tab indentation doesn't work. I only get space indentation.
How can I get tab indentation in the GUI as well?
The cperl conf was taken from emacswiki
The emacs packages I have:
$ dpkg -l | grep emacs
ii emacs 23.1+1-4ubuntu7.2+maverick1 The GNU Emacs editor (metapackage)
ii emacs-goodies-el 33.6ubuntu1 Miscellaneous add-ons for Emacs
ii emacs-snapshot 1:20090909-1 The GNU Emacs editor (development snapshot)
ii emacs-snapshot-bin-common 1:20090909-1 The GNU Emacs editor's shared, architecture dependent files
ii emacs-snapshot-common 1:20090909-1 The GNU Emacs editor's common infrastructure
ii emacs23 23.1+1-4ubuntu7.2+maverick1 The GNU Emacs editor (with GTK+ user interface)
ii emacs23-bin-common 23.1+1-4ubuntu7.2+maverick1 The GNU Emacs editor's shared, architecture dependent files
ii emacs23-common 23.1+1-4ubuntu7.2+maverick1 The GNU Emacs editor's shared, architecture independent infrastructure
ii emacsen-common 1.4.19ubuntu1 Common facilities for all emacsen
EDIT: Sorry, but I just noticed that I hadn't studied the behaviour correctly. In both gui and -nw, when I edit a file already indented in tabs, it uses tabs, whereas when I edit a new file, it indents it with spaces.
First, check the *Messages* and *Warnings* buffers on startup. There might be a hint as to what's failing there. In particular, *Messages* should list all the startup files that emacs is loading; on Ubuntu, this will include files in /etc/emacs as well as your .emacs.
If that doesn't help, try running your .emacs interactively in the emacs debugger. Start emacs with emacs -nw -q and load .emacs into a buffer. Run M-x edebug-all-forms then run M-x eval-buffer. Press space repeatedly to step through the file.
Edit: Check the value of indent-tabs-mode in a perl buffer in both of your environment. This is used to control whether to indent with tab characters or spaces. Adding (setq-default indent-tabs-mode t) should force emacs to indent with tab characters.
Related
I want to use the command C-c C-x C-l to preview latex code in org-mode. Since the emacs-nox cannot do this, I tried apt-get install emacs24. However, after I have installed the emacs24 with GUI, I get an error like
can't find \`latex'(needed to convert LaTeX fragments to images)
I have installed texlive2016, and I can latex *.tex in shell command.
I added the /paht/to/latex to .emacs, but it don't work well.
Adding the following to my init.el makes it work:
;; Making emacs find latex (so that C-c C-x C-l works on orgmode)
(setenv "PATH" (concat ":/Library/TeX/texbin/" (getenv "PATH")))
(add-to-list 'exec-path "/Library/TeX/texbin/")
It is not a very pretty solution, but it does the job and is very easy to modify and understand.
This solution worked on a Mac running macOS Sierra and Emacs v25.1.
My crystal ball tells me that the problem is that you're not starting the GUI Emacs from a terminal, so it can't inherit your $PATH settings. See for example https://emacs.stackexchange.com/questions/10722/ (that question is within OSX, but the same problem appears in other systems).
Apparently you can set env-vars globally (so that they affect all applications, including those started directly from the GUI) in ~/.pam_environment (that's for GNU/Linux systems). Note that this is only consulted when you login, so you need to logout+login for changes to take effect.
I have emacs 24.5.1 on windows with slime installed. I am using sbcl for lisp. When I open up slime, it works, but whenever I try to use comma to invoke a command, it just enters a comma. I can't get to the slime command menu. Is there any other way to get to the command menu besides comma?
Found the solution.
When going to the slime git website, they said you should include this in your initialization file
(setq slime-contribs '(slime-fancy))
It works after adding that to init.el (equivalent of .emacs)
I am using Mac OS and emacs -nw (the terminal mode).
I don't know how can I paste things (having been implemented by M-w in emacs -nw) outside the emacs.
I know that the emacs -ns can do it.
Searching the internet and the command C-h b, i find out that method, but it didn't work out.
(setq x-select-enable-clipboard t)
(setq interprogram-cut-function 'x-select-text)
I don't know much about the argument of interprogram-cut-function.
Where does the x-select-text come from and what does it mean?
If you are using Ubuntu 12.04 or Fedora 21, there are a couple of options to make this work.
First you need to install xclip
sudo apt-get install xclip
First Option: For Emacs 24
If you are using emacs24 you can install from the list of packages
M-x package-list-packages
Select
xclip //mine was version 1.3
In your .emacs add:
(xclip-mode 1)
Second Option. For emacs before version 24
Install xclip.el:
Integrating Emacs with the X11 Clipboard in Linux
Third Option. Using #Nicholas Riley code shown in the answer
To use the code in the answer you need
pbcopy / pbpaste in Ubuntu (command line clipboard)
x-select-text is only used if you're running Emacs in a GUI. (Emacs maps the Mac/Windows pasteboard/clipboard APIs to the X11 model, hence the name). You can always use C-h f to find out more about a function like this one and view its definition if it's written in elisp.
On the Mac, there is no concept of CLIPBOARD versus PRIMARY selections, so there is no point in setting x-select-enable-clipboard.
The whole point of running emacs -nw is that it doesn't interact with the windowing system. Why use Emacs in a terminal when there are plenty of graphical Emacsen that work very nicely on the Mac?
That said, if you really wanted to hook up terminal Emacs to the Mac pasteboard, you could do something like this:
(setq interprogram-cut-function
(lambda (text &optional push)
(let* ((process-connection-type nil)
(pbproxy (start-process "pbcopy" "pbcopy" "/usr/bin/pbcopy")))
(process-send-string pbproxy text)
(process-send-eof pbproxy))))
If you want a way to place the contents of the emacs region onto the clipboard only sometimes, as opposed to every time you do an emacs yank (which causes the clipboard contents the be overwitten all the time), you should check this answer to a related question:
https://stackoverflow.com/a/19625063/3363328
I found that it solved my problem much better than setting xclip mode.
I've been using vi quite a while, and with a Mac, I sometimes use TextMate, and finally, I found the greatness of emacs. And, it's very likely that I settle in emacs.
The problem is, I sometimes need the other (vi/TextMate) editor for doing something. It's not that emacs doesn't have the feature, it's just that I need the feature right now, and I know how to do that with the 'other' editor. And the same is true with the other editor.
My question is how can I launch the one editor from the other. It's not just launching an app, but launching an app with the file that I'm editing.
How can I launch vi or TextMate(mate) from emacs?
How can I launch emacs or mate from vi?
How can I launch vi or emacs from TextMate?
ADDED
After Jérôme Radix's answer, I came up with the following command.
(defun runmate ()
(interactive)
(runeditor "/Users/smcho/bin/mate"))
(defun runeditor (editor)
(let (filename (file-truename buffer-file-name))
(setq cmd (format "%s %s" editor (file-truename buffer-file-name)))
(save-window-excursion
(async-shell-command cmd))))
How can I launch vi or TextMate(mate) from emacs?
(async-shell-command "vi") ;; From Emacs 23.2
(shell-command "vi &") ;; Before Emacs 23.2
to launch TextMate, you need to install TextMate's command line tools, and then from emacs, it's (thx Chetan):
(async-shell-command "mate") ;; From Emacs 23.2
(shell-command "mate &") ;; Before Emacs 23.2
But the best thing to do is to open all 3 editors at the same time and switch between them.
How can I match Aquamacs' settings in Mac OS X emacs' AucTeX?
Because of some reason I tried to install AucTeX to emacs for Mac OS X.
For Aquamacs that has pre-installed AucTeX, everything is pretty cool.
It runs SKIM pdf viewer for viewing the result.
It can use pdfsync for reverse/forward link between Aquamacs and SKIM.
I have the following in my .emacs, though there are probably better ways:
(setq LaTeX-command "latex -synctex=1 -shell-escape")
(when (file-exists-p "/Applications/Skim.app/Contents/SharedSupport/displayline")
(add-to-list 'TeX-output-view-style
'("^pdf$" "." "/Applications/Skim.app/Contents/SharedSupport/displayline -b %n %o %b")))
You might try seeing what those variables are set to in Aquamacs. Use C-h v VARIABLE RET to see documentation and the current value.