Friday, 23 December 2016

Absolute Beginner's Guide to Emacs 3

Opening, saving, and closing buffers

To open a file and load it into a buffer, use C-x C-f, which will open a prompt in the mini-buffer that says “Find file: ~/path/to/current/directory/”. Just as with switching buffers, you can press the tab key to list the files in the directory you have specified if you need to.

Find file: ~/learn/shell/

You can then type in the name (and/or change the path) of the file you want:

Find file: ~/learn/shell/zip.sh

Press enter, and a new buffer will be created with the file you specified:

File Edit Options Buffers Tools Sh-Script Help
#!/bin/bash

# Zip all the arguments with for loop
for i in $@; do
  zip archive "$i"
done


-UU-:----F1  zip.sh         All L1     (Shell-script[bash]) -------------------------------------------
Indentation setup for shell type bash

If you make changes to the buffer and you want to save it back to the file on disk, use C-x C-s:
Wrote /home/jtony/learn/shell/zip.sh

No comments:

Post a Comment