Issue With Desktop Save Mode Not Saving - emacs

Recently I have been having an issue with desktop save mode where it will not actually save my desktop. In the echo bar it says "Error while saving the desktop..." After typing no it says "Opening output file: no such file or directory, then gives the location to the path of the file". After saving a .emacs.desktop file then restarting emacs I noticed that it is saving the buffer locations in that file but is not loading that file. Thanks. Also I am not sure what has caused this to happen as it was working a couple weeks backs and nothing has changed that should make a difference.
The only thing i have in my .emacs for the desktop mode is
(desktop-save-mode 1)

Looking at the code for desktop.el here, it looks like the error is bubbling up from desktop-kill, which runs when you exit Emacs. The first thing I'd try is to check that the directory where it tries to save the desktop is sane.
Looking at the code in desktop-kill, it only tries to do anything if the variable desktop-dirname is non-nil. But that only gets set when you run M-x desktop-save for the first time: are you sure that it's set to something sensible? To check its value quickly, you can type M-: desktop-dirname RET and it should appear as a string in the message area.
If the directory is something sensible (the directory exists and you can write to it...), then I'm not sure. You'll probably have to give more information to get a solution, and it's not really clear that it's an ideal question for StackOverflow.

i should hazard that you get this error by creating a shortcut in the windows start manual via clicking addpm.exe in the ...\emacs-version\bin\ folder.
you can further modify the shortcut. go to its property->shortcut tab, you will find that the Target has value like ...\emacs-version\bin\runemacs.exe, while Start in is void. try to fill Start in with the corresponding folder ...\emacs-version\bin (actually most directories would be fine, just don't leave it blank), then everything is fine. still, the machanism behind this remains unclear to me.
or you could always creat your own shortcut manually, only make sure that the target is runemacs.exe, not any other exe file.

Related

VScode: Show a prompt when loaded files are modified externally on disk

Which is the final outcome of the VScode [issue] #14298 (https://github.com/microsoft/vscode/issues/14298) ?
Is it: "No, we will NOT issue a warning, if an external app modifies a VScode opened file, like ALL other editors do ? (except Notepad)"
Up to now, I cannot find such a setting...
I have never seen a prompt when an open file is changed elsewhere. What I have seen is a warning when I try to save a file that has been changed elsewhere. I have seen this: preventing dirty writes
VS Code will show you an error message when you try to save a file
that cannot be saved because it has changed on disk. VS Code blocks
saving the file to prevent overwriting changes that have been made
outside of the editor.
In order to resolve the save conflict, click the Compare action in the
error message to open a diff editor that will show you the contents of
the file on disk (to the left) compared to the contents in VS Code (on
the right):
Until those issues have been resolved I believe that is as close as you are going to get.

Silence emacs warning

Whenever I try to save my emacs file, it prompts me "file has changed since visited or saved. Save anyway? (yes/no)". I tried "diff buffer-with-file" but it says there's no difference. I'm suspecting this is happening because I'm using a virtual machine with shared file. Anyway, I want to silence this error, and save without prompt. Any solutions?
If this is only happening for a particular file in a particular Emacs instance, you can try M-x revert-buffer to replace the buffer with the contents of the file. That should reset the timer to what's on disk. Of course you will lose any unsaved changes, but you say you have none.
If this doesn't work, or you are getting this error for every file every time you run Emacs, you are in bigger trouble than I know how to diagnose.

How do I load a theme that I have downloaded onto emacs?

I have the .el file downloaded on my drive but I can't figure out how to load it into emacs. I am a very big noob at emacs, just started today and am just trying to change the theme. How do I do it? A step by step process would be appreciated. I have looked on the internet on how to do it but the documentation people give is a bit confusing.
The simplest method is to load the file when you start emacs: from the command line, type emacs -l /path/to/theme.el where you will have to provide the path (absolute or relative) to the file that you downloaded.
If you want to make this change permanent, then you can modify your initialization file (the .emacs file in your home directory usually, although that depends on what OS you are running; or equivalently $HOME/.emacs.d/init.el). Add the following line at the end:
(load-file "/path/to/theme.el")
again replacing the path with whatever is appropriate in your case (but make sure it's an absolute path, so it can be found no matter where you start your emacs from).
There are other ways, but these two are enough for now: you can learn about the rest later.

Keep the emacs BROWSE file up to date while editing

I'm trying to use a source browser for a c++ project without using a big IDE.
My current favorite text editor is emacs.
I found a solution that fit well to my needs which is the ebrowse (not intrusive, can very easily add sources of third part dependancy...).
My problem is that it does not stay up to date while I edit a file already ebrowsed.
eg if I add a method, it will not appear in the tree, and I didn't find a command to update it.
I tried to do a script that execute the ebrowse command line with an (global-auto-revert-mode t) t try to automatically keep the open BROWSE file updated, but it complain about editing externally modificated file.
There is a solution or should I quit to redo the BROWSE file each time then reload it ?
Thanks a lot
PS: I already saw ecb, it is a bit heavy from my point of view, and there is an annoying known bug that force me to trick by an ugly way ecb permission denied bug http://blog.gmane.org/gmane.emacs.code-browser/page=2

Eclipse pydev: automatically save file when running program

It used to be that when I made changes to my .py file in Eclipse, then the changes would be automatically saved when I then ran the program in debug mode. I liked this since it meant that what it was debugging was the same as what I was looking at. Now it no longer does that, which means that's it's actually running an old version, unless I manually save the file first. The first time I ran the program, Eclipse asked me whether I always wanted any changes to be saved when the program was run, and I answered yes. I don't know why it doesn't do it anymore or how to get it back.
This seems to have happened after I started using Mercurial TortoiseHg with BitBucket. As part of that, I did move some files around, but everything is back and named the same as before.
Of course, I can just do change, save, run, but I'd rather not have to remember the extra save step.
Edit: Actually it's a bigger problem. It also shifts my breakpoints. In regular edit mode, I 1) set a break point and Save. 2) Add a new line above the breakpoint. Everything looks fine. 3) Save. Now the first breakpoint shifts position.
From your description, it seems that you're always opening the file as an external file and not a file within your workspace (the fact that breakpoints don't get updated is the major clue here).
You can check if this is what happening from the title that's shown in Eclipse (if it's a full filesystem path and not relative path considering your workspace location, this is what's probably happening).
How are you opening the file you're running? Are you opening it from the PyDev package explorer or dragging from the filesystem? (also, it'd be interesting knowing which eclipse/pydev/tortoise versions are you using)
Look at your Preferences -> Run/Debug -> Launching, you probably have "Never" set for Save Required Dirty Editors before launching.