how to open emacs via OSX terminal [duplicate] - emacs

This question already has answers here:
How to launch GUI Emacs from command line in OSX?
(15 answers)
How to start "emacsformacosx" in terminal
(5 answers)
Closed 9 years ago.
how do you open emacs for OSX?
I have it downloaded in my Applications, but I don't know how to open it via my terminal (calling it "emacs test.cpp")..
I checked out some sites, but their solution didn't work for me.

I have this in my .bashrc (or .zshrc) file.
alias emacs="open -a Emacs.app"

ysakamoto's answer is correct.
I've taken it a step further, I'm using a shellscript using emacsclient to open a file in a running instance of Emacs, or launch a new one if there's none running. Alternatively, it just focuses Emacs/opens an empty session when I don't give it a file. Take a look.

Related

Problems with terminal [duplicate]

This question already has answers here:
Enable or disable VS Code Integrated Terminal Tabs?
(5 answers)
Closed 1 year ago.
My terminal now looks like this:
Today's terminal
But yesterday my terminal was ok and it looked like this:
old terminal
So I would like to have the old terminal.
Thanks.
Open settings.json
and then
"terminal.integrated.tabs.enabled": true
You just have to turn it false

Why emacs doesn't load my .emacs at the begining [duplicate]

This question already has answers here:
home directory and .emacs file in Windows 7
(8 answers)
Closed 2 years ago.
On a computer I have emacs installed. I wanted to install emacs on another computer without administrator rights.
So I copied all the directory from the computer on which emacs is already installed to the other computer. I add the .emacs with C-x f ~/.emacs
When I open emacs again the file .emacs is not read and there is an error message :
mapc: Opening directory: No such file or directory, C:/Program Files/GNU Emacs 26.1/share/emacs/site-lisp/site-start.d
I know emacs is not installed there. (this is the path where emacs was installed on the computer from where I copied the directory)
How can I say to emacs the right path when it opens?
It looks like your .emacs file does in fact get loaded but that something in there causes the error you see. After that error, the rest of the file does not get evaluated.
I suggest bisecting your .emacs file until you're identified the culprit: delete half of your .emacs file and see if the error persists. If so, delete half of that, and so on, until you get to a point where everything works. Then add in half of the last half you deleted, and so on, until you get to the part that causes the error.

Go to current path in Console or PowerShell Terminal in VS Code [duplicate]

This question already has answers here:
VS Code - Shortcut to change the current directory in the PowerShell console to the currently opened file? [duplicate]
(1 answer)
How to quickly change shell folder to match the currently open file
(5 answers)
Closed 3 years ago.
Quick Question: Is there a shortcut key or an add-on for VS Code that updates the path in the integrated terminal to the path of the file that is currently open??
For example: Powershell in the integrated terminal always opens in my C:\Users\andy folder, but if I have a script in say c:\scripts\powershell\superdooperhacks\andysscript\ I need to cd through a lot of folders to get there (or prepend the command with the entire path).
The only quick way I found so far is to right click on the file and Reveal in Explorer and then open another Powershell session by right-clicking and... you get the idea. That means, I now have three windows open and it defeats the purpose of having an integrated shell.
Try Terminal Here add-on. Exposes the command terminalHere.create that creates a terminal at the current file's directory. This can be accessed through the command palette (ctrl/cmd+shift+p) or by attaching a custom keybinding to it.

run matlab script from command line or shell [duplicate]

This question already has answers here:
How do I hide "MATLAB Command Window" when I run an m-file from command line?
(4 answers)
Closed 7 years ago.
Is there a way to run matlab code from command line or linux shell? If yes, please also let me know what OS you are using. I searched online and found several 'answer' but does not work under my desktop (win 7).
I tried following code in cmd matlab -nodesktop -nosplash -nodisplay -nojvm -r "a=[3,4,5,6,6]; dlmwrite('test', a);". Although the code worked and write out the file under current folder, but there is this white backgrounded window open up. Can it just run quietly and when finished, do not show this window?
Yes, you can call matlab from command prompt. In a windows machine it will look like this depending on your matlab installation path:
"C:\Path\to\matlab\matlab.exe" -r matfile.m
But it does open up Matlab gui. I do not know how to run it silently, but including
exit
at the end of your routine will close it automatically.

Change The Character Encoding [duplicate]

This question already has answers here:
How to use Special Chars in Java/Eclipse
(7 answers)
Closed 3 years ago.
I'm having some problems when i try to save my project in Eclipse. The error is because of the character encoding that is Cp1252 that is because i copyed the file from another that i have created in my Linux computer, then i cant save my file in Eclipse, but how i can solve this problem? But if is needed here is an screenshot of the error:
Encoding Error http://www.uploadimagens.com/upload/2dfccb154f30a1ccd39f2e3a9697e5cf.jpg
Thanks!
from this mail thread-->
dev.eclipse.org/mhonarc/lists/cdt-dev/msg16205.html
So I can reliably make the problem come and go using Preferences > C/C++ > Environment.
There I set LANG to en_US.UTF-8 (what it was from cmd line environment) then the problem comes back when i launch from Finder.
So launching from the command line, I can UNset it there (hit "Undefine" button for that env. variable which shows its value as !! )
to fix it.