#!/bin/bash # # .---. . . # | | | # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-' # ' ' --' --' -' - -' ' ' -' -' -' ' - --' # # Freedom in the Cloud # # Emacs application # # License # ======= # # Copyright (C) 2014-2016 Bob Mottram # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . function backup_local_emacs { echo '' } function backup_remote_emacs { echo '' } function remove_emacs { if ! grep -Fxq "install_emacs" $COMPLETION_FILE; then return fi apt-get -y remove --purge emacs24 update-alternatives --set editor /usr/bin/nano sed -i '/install_emacs/d' $COMPLETION_FILE } function install_emacs { if grep -Fxq "install_emacs" $COMPLETION_FILE; then return fi update-alternatives --set editor /usr/bin/emacs24 # A minimal emacs configuration #echo -n "(add-to-list 'load-path " > /home/$MY_USERNAME/.emacs #echo '"~/.emacs.d/")' >> /home/$MY_USERNAME/.emacs #echo '' >> /home/$MY_USERNAME/.emacs echo $';; ===== Remove trailing whitepace ======================================' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo ";;(add-hook 'before-save-hook 'delete-trailing-whitespace)" >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo ';; Goto a line number with CTRL-l' >> /home/$MY_USERNAME/.emacs echo -n '(global-set-key "\C-l" ' >> /home/$MY_USERNAME/.emacs echo "'goto-line)" >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo $';; ===== Show line numbers ==============================================' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo "(add-hook 'find-file-hook (lambda () (linum-mode 1)))" >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo $';; ===== Enable line wrapping in org-mode ===============================' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo " (add-hook 'org-mode-hook" >> /home/$MY_USERNAME/.emacs echo " '(lambda ()" >> /home/$MY_USERNAME/.emacs echo " (visual-line-mode 1)))" >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo $';; ===== Enable shift select in org mode ================================' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo '(setq org-support-shift-select t)' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo $';; ===== Set standard indent to 4 rather that 4 =========================' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo '(setq standard-indent 4)' >> /home/$MY_USERNAME/.emacs echo '(setq-default tab-width 4)' >> /home/$MY_USERNAME/.emacs echo '(setq c-basic-offset 4)' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo $';; ===== Support Wheel Mouse Scrolling ==================================' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo '(mouse-wheel-mode t)' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo $';; ===== Place Backup Files in Specific Directory =======================' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo '(setq make-backup-files t)' >> /home/$MY_USERNAME/.emacs echo '(setq version-control t)' >> /home/$MY_USERNAME/.emacs echo '(setq backup-directory-alist (quote ((".*" . "~/.emacs_backups/"))))' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo $';; ===== Make Text mode the default mode for new buffers ================' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo "(setq default-major-mode 'text-mode)" >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo $';; ===== Line length ====================================================' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo '(setq-default fill-column 72)' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo $';; ===== Enable Line and Column Numbering ===============================' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo '(line-number-mode 1)' >> /home/$MY_USERNAME/.emacs echo '(column-number-mode 1)' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo $';; ===== Turn on Auto Fill mode automatically in all modes ==============' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo ';; Auto-fill-mode the the automatic wrapping of lines and insertion of' >> /home/$MY_USERNAME/.emacs echo ';; newlines when the cursor goes over the column limit.' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo ';; This should actually turn on auto-fill-mode by default in all major' >> /home/$MY_USERNAME/.emacs echo ';; modes. The other way to do this is to turn on the fill for specific modes' >> /home/$MY_USERNAME/.emacs echo ';; via hooks.' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo '(setq auto-fill-mode 1)' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo $';; ===== Enable GPG encryption =========================================' >> /home/$MY_USERNAME/.emacs echo '' >> /home/$MY_USERNAME/.emacs echo "(require 'epa)" >> /home/$MY_USERNAME/.emacs echo '(epa-file-enable)' >> /home/$MY_USERNAME/.emacs cp /home/$MY_USERNAME/.emacs /root/.emacs chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.emacs echo 'install_emacs' >> $COMPLETION_FILE } # NOTE: deliberately no exit 0