Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (set-background-color "black")
- (set-foreground-color "white")
- (setq line-number-mode t)
- (setq column-number-mode t)
- ;; ===== Function to delete a line =====
- ;; First define a variable which will store the previous column position
- (defvar previous-column nil "Save the column position")
- ;; Define the nuke-line function. The line is killed, then the newline
- ;; character is deleted. The column which the cursor was positioned at is then
- ;; restored. Because the kill-line function is used, the contents deleted can
- ;; be later restored by usibackward-delete-char-untabifyng the yank commands.
- (defun nuke-line()
- "Kill an entire line, including the trailing newline character"
- (interactive)
- ;; Store the current column position, so it can later be restored for a more
- ;; natural feel to the deletion
- (setq previous-column (current-column))
- ;; Now move to the end of the current line
- (end-of-line)
- ;; Test the length of the line. If it is 0, there is no need for a
- ;; kill-line. All that happens in this case is that the new-line character
- ;; is deleted.
- (if (= (current-column) 0)
- (delete-char 1)
- ;; This is the 'else' clause. The current line being deleted is not zero
- ;; in length. First remove the line by moving to its start and then
- ;; killing, followed by deletion of the newline character, and then
- ;; finally restoration of the column position.
- (progn
- (beginning-of-line)
- (kill-line)
- (delete-char 1)
- (move-to-column previous-column))))
- ;; Now bind the delete line function to the F8 key
- (global-set-key [f8] 'nuke-line)
- ;; ===== Turn off tab character =====
- ;;
- ;; Emacs normally uses both tabs and spaces to indent lines. If you
- ;; prefer, all indentation can be made from spaces only. To request this,
- ;; set `indent-tabs-mode' to `nil'. This is a per-buffer variable;
- ;; altering the variable affects only the current buffer, but it can be
- ;; disabled for all buffers.
- ;;
- ;; Use (setq ...) to set value locally to a buffer
- ;; Use (setq-default ...) to set value globally
- ;;
- (setq-default indent-tabs-mode nil)
- ;; ===== Set standard indent to 2 rather that 4 ====
- (setq standard-indent 4)
- ;; ========== Support Wheel Mouse Scrolling ==========
- (mouse-wheel-mode t)
- ;; ===== Set the highlight current line minor mode =====
- ;; In every buffer, the line which contains the cursor will be fully
- ;; highlighted
- (global-hl-line-mode 1)
- ;; To customize the background color of highlighted line
- (set-face-background 'hl-line "#191970") ;; Emacs 22 Only
- ;; (set-face-background 'highlight "#0000DD") ;; Emacs 21 Only
- (add-hook 'c-mode-common-hook
- '(lambda () (c-toggle-auto-hungry-state 1)))
- ;; Switch RET and LF. Makes <return> indent
- (defvar tmp (global-key-binding "\C-m"))
- (global-set-key "\C-m" (global-key-binding "\C-j"))
- (global-set-key "\C-j" tmp)
- ;; Put autosave files (ie #foo#) in one place, *not*
- ;; scattered all over the file system!
- (defvar autosave-dir
- (concat "/home/" (user-login-name) "/.emacs-bak/"))
- (make-directory autosave-dir t)
- (defun auto-save-file-name-p (filename)
- (string-match "^#.*#$" (file-name-nondirectory filename)))
- (defun make-auto-save-file-name ()
- (concat autosave-dir
- (if buffer-file-name
- (concat "#" (file-name-nondirectory buffer-file-name) "#")
- (expand-file-name
- (concat "#%" (buffer-name) "#")))))
- ;; Put backup files (ie foo~) in one place too. (The backup-directory-alist
- ;; list contains regexp=>directory mappings; filenames matching a regexp are
- ;; backed up in the corresponding directory. Emacs will mkdir it if necessary.)
- (defvar backup-dir (concat "/home/" (user-login-name) "/.emacs-bak"))
- (setq backup-directory-alist (list (cons "." backup-dir)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement