Emacs load extra configuration by command - emacs

I am a Emacs user, and have a long configuration file (.emacs) by default. But now I need to add some extra configuration for some specific project. I wonder how I could archive it.
To be more specific:
I have a default .emacs file in the ~/ folder. Now for a specific project under ~/project/, I have a specific Makefile under the project folder, I hope I could press one a default compile key to make it.
I prefer to write another small configuration file in the project folder, and manually load it when I am working in this project. But I don't know how to make it work.
Thanks!

Related

How to export Intellij project as Eclipse archived folder

My professor wants all assignments submitted as an archived folder and wants the program to be able to run on his Eclipse when he grades them. The program is a simple one with one folder that has to contain just one class with the main method.
I am using IntelliJ.
I followed Jetbrains faq on exporting files as Eclipse-compatible using Files --> Export : https://www.jetbrains.com/help/idea/exporting-an-intellij-idea-project-to-eclipse.html
It looks like the files were successfully converted as my folder directory looks similar to what the website. A screenshot of my directory after exporting: https://imgur.com/a/qQY4lUH
I am not sure what to do here as I am not familiar with the Eclipse ".classpath" and ".project" files that were created as well as the .eml and .iml files. I don't know what to do with them.
I was thinking of just copying them into a new folder called "ReviewNW" and archiving them and submitting that folder. I don't know if that would be enough for Eclipse to run my program. Is there something else I have to do from here?
Additional question: I have since changed some things in my program. Now when I try to use File --> Export, IntelliJ gives me an error and says I "cannot export files already exported to eclipse-compatible format". What if I make some changes to my class files in my src folder and need to export those changes again? I think I would need to manually delete each of those Eclipse files and export again or is there a simpler way?
Thank you!

Specify Eclipse CDT Default Launch Config

PAIN POINT:
Using Eclipse CDT - the launch configs I need are rather complex (little settings that are non-default values and other misc things) too many little things to remember, and easy to skip then stuff does not work. I want to be able to semi-automate this process in project makefiles.
Background:
I have multiple projects, not stored in the workspace (my users "import the project"). In some cases projects are some what generated (they are external makefile projects.
Requirement: Specifically depending on what build configuration is required the launch config needs to change/tweak, the external Makefile can do that, or I can create one launch file for each config. Or I can pre-populate them when I create the project
[example is normal development, debug/release but with unit-test variations]
The user might tweak the settings of course and want to save them.
Requirement: So that the launch files "travel with the project" - I want to check the into GIT, thus I want the .launch files kept in the same directory as the .project and .cproject files - as described here (thus they can be checked in and things are "self contained)
Store run configuration with project in Eclipse
PROBLEMS and QUESTIONS
1) Given existing launch configurations files (.launch files) in the ".project" directory, how can I browse/select from the list of existing ones that Eclipse does seem to previously know about.
{Example: Create a launch config called "FOO", copy this to "BAR", edit the BAR config file, replacing internal occurrences of FOO with BAR)
The BROWSE button in the "common" tab lets me select a directory to save but does not allow me to select an existing file
2) How can I tell eclipse File (X) is the default launch configuration for this project, or config(X) uses file(A) and config(Y) uses file (B)
3) Is there a way within the ".project" or ".config" or ".cproject" files to specify where to look for launch configurations, where to offer them?
4) Sure would be nice to have a file (or place in the .project, or .cproject) file that says: Launch configs for this project are in this directory - offer the user a list based on the files present in that directory
bottom line:
I'm sort of stuck - I can create launch files "correctly" with all required settings but I seem to have no means to tell Eclipse to use select/use them.
No amount of automation here seems to work, and I end up having to go back to manually creating and humanly forgetting settings in the project files.
Places I've looked:
Sort of the issue but not exactly
https://superuser.com/questions/521537/remove-launch-from-run-debug-drop-down-in-eclipse
Below - ARM describes the IMPORT process, but in my case all ".launch" files are grayed out and not selectable I don't know why and that is a different problem
I'd like to not make this a multi-step process - also see above about removing stale launch configs - you end up with too many launch configs in the history.
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0446h/CJADBBIA.html
There are numerous other places but all seem to be "click here" or "use this menu item" and not addressing the external file issue.

I cannot access MANIFEST.MF, but the jar file has one. How could I access and edit it?

I try to execute a jar file in the command prompt, but I always get the message 'no main manifest attribute, in 2056751-0.0.1-SNAPSHOT-src.jar'. So, I guess I should edit the manifest file. If I check it in the command prompt with the command 'jar tf 2056751-0.0.1-SNAPSHOT-src.jar' I can see that there is a MANIFEST.MF file, still I cannot see it in Eclipse project view.
To partially answer the question asked, IF on Windows (which you didn't say and isn't the only system with a command prompt), a jar file is really a ZIP file underneath and Explorer in all supported versions (>XP/S03) can treat a ZIP file as a directory subtree, so just rename to have the extension .zip and open in explorer, go to META-INF, select MANIFEST.MF and open with plain-text editor of your choice such as notepad. However this may not allow you to edit; if so copy to somewhere writable like the desktop, edit, then copy or move back. Then rename back to .jar
Although the manifest file in a jar can be loaded from an actual file, usually it is created by the jar tool. If you want a jar containing classes to run from the usual file association on Windows use the jar tool with the e option as described in the man page or Windows version on the web and help message. However if your file name is accurate and this is actually a source jar, it will never be runnable by only changing the manifest and you need to learn how Java works.

How the launcher of eclipse Plugin development project loads\handles the "plugin.xml" file?

I want to figure out how can I put a file in the root folder of the project and use it in run time, there it will be accessible.
The problem that I have by doing that (placing the file in the root folder)-is that by default it means:
It is not in the classpath of the project.
It is not copied to the bin (output) folder.
I can’t see how my modifications of the file will affect the run process.
As I know there is a similar mechanism in eclipse that does the same:
The Plugin development project has a file-"plugin.xml" in the root folder of the project.
When you make a change in the file without building the project or copying it to the bin folder the changes take place when you run it.
example:
add an extension point in ”plugin.xml” and hit “RUN”, it will take place immediately.
Does anybody have an idea how this mechanism works in eclipse?
Edit - for clarification :
I am interested in how the launcher of eclipse Plugin development project loads\handles the "plugin.xml" file.
I assume when you say you want to put a file in a "root folder of the project" you are refering to a plugin that you are developing and then in runtime you want to get access to that file. Please don't vote me down if I did not understand that question correctly but based on my understanding here are some steps to follow:
Open your MANIFEST.MF file /MANIFEST.MF, this will oepn a multipage editor.
Click on the build tab (third from right).
This is where you specify what resources in your plugin you want the builder to include in the plugin at runtime. You will notice that plugin.xml is already checked which is why extensions get updated each time.
Check the resource on this editor page for the resource you want to be able to load and access at runtime. Behind the scenes this is updating your build.xml which the internal builder uses to figure out what sources to build/add when building/exporting the plugin.
One you have done that this is how you can get access to that file, you get the Bundle for your plugin and call the getEntryMethod with the path to your file and then open in inputstream from there you can load it as a File or whatever you want. Code example below: Hope this helps - Duncan
Bundle myBundle = Platform.getBundle("com.mycompany.myplugin.id")
InputStream in = myBundle.getEntry("/myfile.txt").openStream();

Resources check

hey I am frequently uploading my XCode iPhone projects to an svn repository to be build on another machine.
My problem is that when I add resources to my project sometimes I forget to add the resource as relative to the project.
I know one answer is to be more careful (not easy when your tired!) but if there was a way to run a script to check my resource paths are relative when I build and warn me if they are not it would be a great time saver for me.
How would I go about doing this?
Thanks
Chris
You can select all the files in your project and set the Path Type for all of them in one go. While this isn't a script this does save a lot of time over doing the files individually
I think the best approach to script this would be to look in the .xcodeproj file - the file paths are listed in there. If your project is called MyProject you need to open (either by using Show Package Contents in Finder or just the usual cd in Terminal) the MyProject.xcodeproj directory.
In here you'll find a file called project.pbxproj - open this in a editor that won't mess up your formatting and have a peek around the file. If you search for one of your files in the project you should be able to see how Xcode stores references to the project files.
Look for a section named /* Begin PBXFileReference section */. In here all your files are listed, along with where they are relative to the project, e.g.:
... path = Classes/MyClass.h; sourceTree = SOURCE_ROOT
If you can parse this file you should be able to acheive what you want - but remember to back up the file, otherwise you might corrupt your project.
How would it be if you instead write a script that asks the SCM if anything in the project is not committed? For example, think of this scenario
Project Root
Codex
Project.xcodeproj
…
Design
anImage.png
where anImage.png being outside of Codex, where the Xcode project sits (its path starts with a ../). A strong .pbxproj parser would have to support all the variants in which Xcode references files to know exactly if there are stray files.
OTOH, the SCM knows where everything is all the time (you mentioned up-ping to a SVN server), so why not ask it instead.
We have a Ruby script that prints a warning in Xcode’s Build Log if anything in the project is not committed.