unable to toggle read-only mode in emacs - 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?

Related

Emacs does not create new windows for new buffers

I am very new to emacs. I just started using it. After a fresh install of spacemacs on my macbook when I opened a file from neo tree or command line it used to appear in a new window. Now it's opening in the same window and the file that was already open gets hidden. I don't know what I did wrong. I even reinstalled spacemacs from scratch but it is of no use.
Also, I can't find a way to open a file in a new frame and close it in the frame that it's already in.
it used to appear in a new window. Now it's opening in the same
window and the file that was already open gets hidden.
I don't know about spacemacs, but for Emacs generally it's completely
normal when visiting a file for the current window to be re-used.
The pop-up-windows user option would affect this some of the time,
but that's non-nil by default, so you probably have that enabled
already?
M-x customize-option RET pop-up-windows RET
Naturally there are other rules and settings around this behaviour
(which is very flexible), so I would also recommend reading about it
in the manual:
C-hig (emacs)Window Choice
You can use the command find-file-other-window to make Emacs display
the buffer in the 'other' window (creating a new window if necessary).
This is usually bound to C-x4f but
spacemacs may be different?
Refer to: C-hig (emacs)Pop Up Window
Also, I can't find a way to open a file in a new frame and close it
in the frame that it's already in.
Similarly to the above, by default:
C-x5f calls find-file-other-frame
C-x50 calls delete-frame
Refer to: C-hig (emacs)Creating Frames

Emacs changes buffer when autosaving other window using tramp

I have two windows open in my Emacs session. Both are remote files opened using tramp. I make a change in window A and switch to window B without saving file in window A. When Emacs decides to autosave, the buffer displayed in window B is switched to the buffer from window A that was autosaved. This only happens when using tramp, not local files.
Another thing I have noticed is, that if I have the same file opened in two windows, because I need to reference something at another position in the file and save the file, the buffer I'm in sometimes jumps to the position that the point is in the other window, so I have to move around to get back to the place where I was editing.
Is this a bug or is there some setting that I have(n't) set? I suspect it is something related to refreshing the windows when saving.
i'm using Emacs 24.3 on OSX, but I have seen this using Linux too.
Sounds very much like a bug, to me. Can you reproduce this starting from emacs -Q (i.e., with no init file)?
If so, use M-x report-emacs-bug to give Emacs Dev the recipe. If not, bisect your init file recursively until you locate the culprit code. Then ask for more help here, if it's not clear how to fix the problem.

Cannot copy text in Emacs and paste into another application

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)

How do you disable mlinks-mode in emacs nxhtml mode

I am using emacs with nxhtml mode. I find mlinks-mode to be a pain because I use PHP constants for my paths which trips up mlinks-mode - so when I inadvertently click on a link, I get a debug stack trace.
Whenever I enter into an HTML block, the mlinks-mode gets enabled. I have tried setting my init file or mlinks-mode options to disable it, but it seems to be getting loaded dynamically regardless of these settings. Is there a way to prevent nxhtml from loading this mode unless I want it to?
Try M-x customize-variable RET mlinks-mode-functions RET and remove the nxhtml-mode entry.

"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.