.emacs file permissions? - dot-emacs

Ok I have been using Aquamacs and want to do a bit of customizing. So I know that I have to create a .emacs file and add my changes in that file. So I created a text file and named it .emacs in my home directory but since it's .emacs it is hidden and permission is denied to the file. In order to edit it and start adding and customizing my set up how do I access the file? Should I change the read/write permissions or something more? Thank you in advance.

Probably the easiest way to get started is to edit your .emacs file directly from Emacs. Thus, start your Aquamacs and type C-x C-f ~/.emacs RET.
Then - just to make that everything works as expected - add e.g. the following line to the file:
(message "works!")
Save the file with C-x C-s, then restart Emacs. You should see "works!" in the status line right after startup.
Open the .emacs file again as described above and start customizing.

Related

IntelliJ not registering file type with correct plugin

Edit: Making title more generic as this situation could apply to any file type.
I am brand new to Puppet and was given the task of adding a new Puppet configuration file. I added a new file, but it either contained a syntax error, had the wrong extension or both (I don't remember), and I believe that caused the file to not register with the plugin. However, even after fixing the syntax error and ensuring the .pp extension, the file is not registering. If I add a new .pp file, it registers right away.
I tried deleting the file and adding it again, but it still won't register, which leads me to believe there is a metadata file somewhere keeping track of which files to register and which to ignore.
I've looked through the the .idea folder for mentions of the file but all I see are entries in the workspace.xml under the ChangeListManager and FileEditorManager.
I also tried cloning the repository again but it still doesn't register. Any ideas?
As it turned out, the entire file name had somehow been associated with a text file.
File -> Settings -> File Types -> Recognized File Types -> Text
Located the file name and removed it. The file registered as a Puppet file.

How to remove custom vim syntax and filetype settings for a specific

I somehow botched the default syntax highlighting and filetype recognition for my apache httpd-vhosts.conf file, such that every time I open it in vim, the syntax and filetype are both set to "conf". All of the other files in the ../conf.d/ directory are recognized properly, i.e. as syntax and filetype both set to "apache". I've tried the following:
manually setting both in vim, i.e.
:set syntax=apache, :set filteype=apache
This works for the session, but they both reset back to "conf" when the file is reopened
Looking for the ~/.vimrc
I don't seem to have one, since I typically edit this file as root
yum remove and reinstall of vim
no change.
I know that there are a lot of posts regarding similar issues with vim syntax and filetype problems, but I cannot figure out how to resolve mine. My guess is that there is a mapping somewhere that says this one particular file should be recognized as a "conf", but that's all I've got. tia.
edit: to clarify, what I would like to know is how this one file got "stuck" on the "conf" syntax and filetype, whereas all of the other .conf files are "apache" syntax and filetype.
I would recommend using a modeline. Put this at the top of your file:
# vim: ft=apache
If you do not have a .vimrc file, you can create one. Keep in mind that each user has a separate .vimrc in their home folder. You can also look for the system default vimrc (without a dot) located in your vim installation folder. To find out where that is, type :echo $VIM in vim.
If you do create a new .vimrc for your user, you can set all .conf files to have apache highlighting as follows:
au BufRead,BufNewFile *.conf set filetype=apache

unable to open text file

I'm trying to get a program to open a file and read from it. However, I can't seem to get it to open the file. I've read several threads about this and I've seen the suggestion to make sure the file is in the same directory as my executable. I don't know how to check if that's true. The text file is saved in the same file as my program files, if that helps. Can anyone give me some input? Relevant code below. Thanks!
std::ifstream myfile;
myfile.open("../ResInput.txt", ios::in);
if(myfile.is_open()){
getline(myfile, stemp1);...
Your open() call is trying to go up one directory to read the file as it's written right now. If you want the file opened in the same directory as your executable, remove the ../ in your open() call.
This is also assuming your OS accepts a forward slash as a directory separator. It would also be useful to know the error you are getting.

Trying to create .htaccess file using ftp doesn't work

I want to create a .htaccess file in a specific directory. I'm using Notepad++ and their plug-in for FTP (NppFTP). I'm able to create any other files and see them in the folder but when I try to create a .htaccess I don't see that file in the directory. I get no errors, it is like nothing happened.
I tried to create this file using an FTP program and it showed the file and right away it disappeared. My guess it is because this is a special file used by the system and prefixed by a (.)
What is a way to edit that file?
This is probably because your ".htaccess" file is a hidden file and your system is set up to no display hidden files.
Have a look in your Notepad++ settings if there's an option to make hidden files visible/unhide.
In addition to that check the windows folder options for that option!
switch on showing hidden files in your ftp client

Mac OS X doesn't allow to name files starting with a dot. How do I name the .htaccess file?

As mentioned in the title, Mac OS X doesn't allow me to name files starting with a dot ( . ).
But, I need an .htaccess file. Or, better, how do I use an htaccess file in Mac OS X without giving it a name starting with a dot?
I am running Mac OS 10.5.8 and XAMPP 1.7.3.
You can't do this with the Finder. Open Terminal.app (Applications -> Utilities -> Terminal), and type:
> cd /path/to/directory/containing/htaccess
> mv current_file_name .htaccess
Example (do not take directory names or initial filename literally, of course):
Finder-only Solution. No Terminal Needed
You need to be able to see invisible files first.
In finder press ⌘+⇧+. –command + shift + dot– to toggle hidden files visibility.
Then just go to the folder where the file is and you'll see it there. You can now rename the file to start with a . if you want.
To create a new file you'll need the terminal. Do touch .htaccess once the terminal is at the right folder.
You can create files that begin with a "." if you can view hidden files.
Enter the following commands to show hidden files:
defaults write com.apple.finder AppleShowAllFiles -bool YES
killall Finder
When you're done enter these commands to hide them again:
defaults write com.apple.finder AppleShowAllFiles -bool NO
killall Finder
Use the terminal instead of Finder to rename it. Try mv.
You can add an alias in your startup script file to make the command shorter. Usually this is .bashrc, .bash_login or .profile file in your home directory.
alias ondot='defaults write com.apple.finder AppleShowAllFiles -bool YES; killall Finder'
alias ofdot='defaults write com.apple.finder AppleShowAllFiles -bool NO; killall Finder'
Now you can just type ondot to show hidden files. and ofdot for hiding hidden files
This works so far as it goes. But TextEdit automatically added .txt to the end of the filename so I ended up with .htaccess.txt
And files with names starting with . don't show up in folders in Finder. You only see it if you go back into Terminal and use ls -a. And if it can't be seen then it can't be uploaded to an online webserver.
Using Fetch as my FTP client, I found it has a function which enables me to create a simple text file directly on the server. This worked to create .htaccess where I really needed it.
Since .htaccess files will not be viewable once you change the name with Terminal (without some annoying searching) it is simpler to just drag an empty text file into the directory of choice using FTP and then rename away. Both filename and extensions can be change/removed once inside FTP.
Use Terminal.
Open Terminal.
Change Directory to source folder where you want to create the file
cd Desktop
Create the file using touch
touch .htaccess
Open the file in any text editor
atom .htaccess