Cannot copy text in Emacs and paste into another application - emacs

I'm running GNU Linux and GNU Emacs 23.4.2
When I copy text in Emacs (with M-w, or in CUA mode C-c) and then type C-v in some other application to try to paste the copied text, it doesn't work -- the text from Emacs is not pasted.
However, when I instead copy the text using the Emacs menus (Edit->Copy), this works -- I can successfully paste the copied text into another application with C-v.
How can I fix this, so that copying via the keybindings works the same as copying via the menus?

Read the manual, section 25.1.5 Using the Clipboard:
You can customize the variable x-select-enable-clipboard to make the Emacs yank functions consult the clipboard before the primary selection, and to make the kill functions to store in the clipboard as well as the primary selection. Otherwise, these commands do not access the clipboard at all.
You should probably also read section 25.1.3 Cut and Paste with Other Window Applications.

Put this in your .emacs (setq x-select-enable-clipboard t)

Related

How do I activate "lisp mode" for cljs files in emacs?

Currently emacs isn't turning on paredit and isn't using any syntax highlighting when I edit .cljs files. It does when I edit .clj files and I want it to treat .cljs similar.
What do I have to do?
If you already have everything working for clojure you can just turn clojure-mode on for the current buffer using
M-x clojure-mode
If you want it turned on automatically you need to add an entry to the Auto Mode AList. In my case, adding the following to init.el did the trick:
(add-to-list 'auto-mode-alist '("\.cljs$" . clojure-mode))
After that you need to reload your init.el (M-x load-file) and re-open the file.

unable to toggle read-only mode in emacs

I am using emacs-live as my emacs starter config. I have .jade files which when opened in emacs say Buffer is read only.
However these same files I am able to edit in Sublime Text.
I tried toggling the read only by C-xC-q to no effect.
How do I resolve it ?
File permissions shouldn't prevent Emacs from allowing you to toggle the read-only state of an associated buffer.
Can you try M-x toggle-read-only RET instead, to check whether it's the function or just the key binding that isn't working?
I'm assuming that C-xC-q is working in general for other buffers?

"Open Recent" in Emacs

Does Emacs have the capability to open recent files (e.g. a menu like File > Open Recent...)?
I know that Aquamacs, for OS X, has this feature. But is it common to all Emacs versions?
The most idiomatic method of providing this functionality that I know of is through the use of recentf-mode (more here). I enable it in my initialization file with:
(require 'recentf)
(recentf-mode 1)
It then provides an interactive function, recentf-open-files, which I bind to C-x f, which provides a numbered menu of recently opened files that spans sessions, i.e. even if you shut down emacs and restart it, it will retain your recently opened files. You can bind the function to an accelerator with another line in your initialization file, like:
(global-set-key "\C-xf" 'recentf-open-files)
(Optional)
If you make extensive use of Tramp, recentf will track those files too, and do it's periodic cleanup thing which can be a real mess since the files are remote. Prevent this by putting this in your startup file:
(setq recentf-auto-cleanup 'never)
Ordinary GNU Emacs doesn't have a menu showing recently open files. However, all Emacs commands have history, including find-file (C-x C-f). Selecting “File | Open” in the menu or opening a file with emacsclient also adds to this history. After you press C-x C-f, press up and down to navigate the history of opened files.
The history is saved between sessions if you enable session saving with the desktop package.
If you just want to save the minibuffer history between emacs invocations you can put the following in your .emacs:
(savehist-mode 1)
Unlike the desktop package that can save all your open buffers across invocations, this does just the minibuffer history (e.g. when opening a file you can use the up arrow to navigate the list of files you opened in a previous session).
GNU Emacs does include library recentf.el, since Emacs 22. Just do as indicated by R.P. Dillon.

how to disable copy file on drag-and-drop

According to a doc
Emacs supports “drag and drop”: dropping a file into an ordinary Emacs window visits the file using that window. As an exception, dropping a file into a window displaying a Dired buffer moves or copies the file into the displayed directory.
How can I disable move or copy of a file in a dired mode so that emacs would visit the file in any mode?
Set dired-dnd-protocol-alist to nil.
(setq dired-dnd-protocol-alist nil)
...or use M-x customize to do it.

Ido mode is too smart, can I get it to NOT complete a filename?

My problem: I have Ido-mode enabled and I want to edit (for example) a file .emacs in my home directory. I have no .emacs file there, but I do have a .emacs.d, and so ido assumes that I want to enter the directory when I do C-x C-f .emacs RET.
I've been trying to solve this for at least weeks, and I've got a couple work-arounds but I would really rather not have to do anything crazy.
You can either press C-j to accept what you have typed so far, or C-f which will drop you into regular find-file