emacs opening 2 windows in ubuntu - why? - emacs

I installed emacs ver 24 in ubuntu and when i launch it > emacs "file" - emacs opens with 2 windows split vertically. One window has my "file" and the other window has the "Welcome to GNU Emacs .... " screen in it.
How do I stop it from opening the window with the "Welcome to GNU Emacs"? Do i need to add something to my .emacs file?
Right now I have tried :
(setq inhibit-splash-screen-t)
(setq inhibit-startup-message-t)
(setq initial-scratch-message nil)
(setq delete-other-windows t)
None of which prevent the second window from opening with the emacs welcome.

;; No emacs start-up message
(setq inhibit-startup-message t)
;; Consider also to start a server
(server-start)
Such that your emacs instance is reused when opening multiple files

Related

C-c C-c does not work anymore to compile a tex under Emacs

I just upgraded my Ubuntu from 12.04 to 14.04.
When I edited .tex file under 12.04, I have set up my Emacs in such a way that C-c C-c launched automatically Latex, View or BibTex according to the circumstance. Consequently, I just needed to keep pressing C-c C-c to compile and view a simple .tex file. A part of the ~/.emacs file is as follows:
(require 'server)
(or (server-running-p)
(server-start))
(add-hook 'LaTeX-mode-hook 'TeX-PDF-mode)
(defun pdf-with-okular ()
(add-to-list 'TeX-output-view-style
(quote ("^pdf$" "." "okular %o %(outpage)"))))
(add-hook 'LaTeX-mode-hook 'pdf-with-okular t)
(setq TeX-view-program-list '(("Okular" "okular %o")))
(setq TeX-view-program-selection '((output-pdf "Okular") (output-dvi "Okular")))
(eval-after-load "tex"
'(setcdr (assoc "LaTeX" TeX-command-list)
'("%`%l%(mode) -shell-escape%' %t"
TeX-run-TeX nil (latex-mode doctex-mode) :help "Run LaTeX")))
(custom-set-variables
'(LaTeX-command "latex -synctex=1")
'(cua-mode t nil (cua-base))
'(show-paren-mode t)
'(tool-bar-mode nil))
After upgrading, this mechanism does not work anymore: C-c C-c launches Command [pdflatex], and if I just press Enter, it could not find the .tex file.
Does anyone know what is wrong?
It sounds like the command you expect to be bound to C-c C-c is not -- some other command is.
C-h m tells you what mode you are in, and some things about it. C-h k C-c C-c tells you what command is bound to C-c C-c, and it gives you a link to the library where that command is defined.
This info, together with your init file and the Lisp source code, will help you find out why C-c C-c is not bound to the command you expect.
And you might want to start your search by bisecting your init file, to narrow it down to the code that causes the problem.
In sum, the answer is to ask Emacs first.
The command that you describe comes from the AUCTeX extension, which replaces the built-in LaTeX mode of Emacs. It appears that AUCTeX was not properly upgraded or removed from your system, so you are back to the built-in mode, which is pretty primitive compared to AUCTeX.
Check whether AUCTeX is still available in your Emacs session (e.g. M-x locate-library RET auctex). Also, check whether the AUCTeX package is still installed, and reinstall it if necessary.
Alternatively, you can obtain AUCTeX from GNU ELPA with Emacs' built-in package manager, which makes your Emacs setup independent from your system.

How do I open a shell by default in my emacs' init file?

When I start up emacs, I'd like to have a shell loaded up right away. Is there a way to do this by changing my .emacs file?
I just put (shell) to the end of my .emacs file and it opens right after emacs start up.
On a fresh install of Emacs 27.1, I had to do the following:
(custom-set-variables
'(inhibit-startup-screen t))
(switch-to-buffer (shell))
(delete-other-windows)

Symbol's function definition is void: x-cut-buffer-or-selection-value

Just installed Emacs 24 under Windows 7
Getting the following error when trying to cut & paste (kill & yank) within emacs, e.g.
C-k, C-y
to kill a line and copy it somewhere else:
Symbol's function definition is void: x-cut-buffer-or-selection-value
I have commented out the following from my .emacs and restarted emacs but error remains:
;; get copy and paste to work between emacs and other windows
;; (setq x-select-enable-clipboard t)
;; (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
I have no similar problems using emacs 24 with the same .emacs file under linux
I have done an initial googel trawl but all the information I found suggest the bug has been fixed already which isn't much help
Unfortunately, this is making emacs unusable under windows for me
UPDATE
this line doesn't seem to be causing the problem:
;; get copy and paste to work between emacs and other windows
(setq x-select-enable-clipboard t)
however these lines do:
;; this line causes cut/paste errors under windows (emacs 24)
;; (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
;; this alternative fixes windows problems but causes errors under linux (emacs 24)
(setq interprogram-paste-function 'x-selection-value)
I have had a go at making my .emacs platform conditional, e.g.:
;; this line causes cut/paste errors under windows (emacs 24)
(if (eq system-type 'gnu-linux) (setq interprogram-paste-function 'x-cut-buffer-or-selection-value) )
;; (setq interprogram-paste-function 'x-cut-buffer-or-selection-value)
;; this alternative causes errors under linux (emacs 24)
(if (eq system-type 'windows-nt) (setq interprogram-paste-function 'x-selection-value) )
;;(setq interprogram-paste-function 'x-selection-value)
this fixes the problem but this seems like a bit of a kludge...
The variable name changed in EMACS 24:
current-kill: Symbol's function definition is void: x-cut-buffer-or-selection-value
Open your .emacs and change:
'x-cut-buffer-or-selection-value)
to:
(setq interprogram-paste-function 'x-selection-value)
I found the answer in this posting:
http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg00638.html
How does Emacs behave if you didn't customize at all? i.e. start with
emacs -Q
?
I don't have Windows machine in front of me, but there nothing in my config that's Windows specific for cut/paste, and I never had any problems with 24, although I haven't tried the stable release yet.

emacs identation works only in terminal (-nw)

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.

Calling vim or TextMate from emacs

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.