Eclipse pydev: automatically save file when running program - eclipse

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.

Related

How can I remove deleted files from emacs-projectile's cache if `projectile-invalidate-cache` doesn't do the trick?

Pretty much what the title says. For whatever reason projectile-invalidate-cache does not remove dead files from projectile's cache, or at least not from the results it presents me. I am using Spacemacs, an extension of Emacs, but I believe this issue is specific to projectile.
Restarting the editor does not fix the issue.
One thing to try would be to make sure you are running projectile-invalidate-cache from the project you want to clear out files for (i.e., from a buffer that is visiting a file in that project. From the docs for projectile-invalidate-cache:
Remove the current project's files from `projectile-projects-cache'.
Note it is supposed to work only for the "current project".
However, I have also not had much luck with this command (potentially this is me not using the command correctly). What I often end up doing is deleting the actual cache file (in my case this is ~/.emacs.d/projectile.cache. I have not noticed any negative effects of this, and your cache will be rebuilt without the deleted files next time you use projectile.
If your project is a git project, try to commit your change. It works for me.
Actually the correct path of projectile.cache file to be removed is: ~/.emacs.d/.cache/projectile.cache
I installed through MELPA, and deleting ~/.emacs.d/projectile-bookmarks.eld did the trick for me.

How to run the changed code without saving in Eclipse?

If I don't save the code, I can't run the changed code.It only output the previous result. Sometimes,The changed code could be worse or better,I'm not sure. So before run it,I don't want save it.
You do have to save the code to run it.
However, you can always see the state of your file before your changes. In fact you can see the state of your file many changes back.
Please use Right Click => Team => Show Local History to access previous versions of the file. You can also revert to previous versions and compare current version to previous versions using "Replace With" and "Compare With" context menu items.
Also, consider using version control software such as subversion or git.
As far as I know, this is not possible. In any case, you (or eclipse) needs to save the changes in some file, so that it can be processed by the compiler.
You can go here and check the box Save automatically before build...
Windows > Preferences > General -> Workspace
you wrote "So before run it,I don't want save it" - actually what you want?

Rescuing eclipse from bad workspace/project data

I would like to take a step backwards opening eclipse without it automatically opening the source files which were last open, nor the projects which were last loaded, I have reason to believe this might clear it all up.
Motivation being that as of a forced quit of eclipse, after it had gone stuck after some project changes, my eclipse Luna is no longer able to start without getting hung up again.
How may I accomplish that?
It's important to me not to lose my settings such as syntax highlighting and stuff, while performing the salvation... and whereas I am pretty certain I could locate my workspace directory on disk, would be nice finding where does eclipse keep the pointer to it, just to make sure I'll be tinkering with the right workspace, if needed..
I guess I could call it "starting eclipse in safe mode" :)

Issue With Desktop Save Mode Not Saving

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.

How to know if a Scala file modified with IntelliJ Idea is saved and if it is checked into CVS?

I'm a long-time Eclipse user and I just now decided to try IntelliJ IDEA 9 (free edition) for Scala.
A couple of dumb questions:
How can I tell if a file I've modified has been saved?
How can I tell if I file I've saved has been checked into CVS?
I feel incredibly "exposed" to some sort of imminent danger when I don't see the familiar visual cues from Eclipse that indicate a file has been saved and/or checked in.
Thanks
In IDEA 11:
Settings->Editor->Editor Tabs->Mark modified tabs with asterisk
UPDATE
In IDEA 15:
Settings->Editor->General->Editor Tabs->Mark modified tabs with asterisk
Under Settings -> IDE Settings -> General -> Synchronization you can control when files are saved. I save files on Frame Deactivation (that is, switching to another program), and after 60 seconds of idle time.
You should also look at the Local History feature, which is a local VCS for your project, capturing all the individual edits between commits. This allows you to roll back changes that were made by the auto-save feature, which some people find unnerving at first.
If a file is modified but not saved, there's an asterisk, *, in its tab.
If a file is newer than its VCS counterpart, its name is displayed in dark blue instead of black. If it is not under VCS at all, it is shown in dark red. This goes for the editor tab as well as other places such as the Project window.